dav/config.c

changeset 730
83f832e345e0
parent 729
5433f0f3dd48
child 731
e0358fa1a3b1
--- a/dav/config.c	Sun Aug 08 11:38:55 2021 +0200
+++ b/dav/config.c	Sun Aug 08 11:45:36 2021 +0200
@@ -65,7 +65,8 @@
 
 static PwdStore *pstore;
 
-
+static char *secretstore_unlock_cmd;
+static char *secretstore_lock_cmd;
 
 int check_config_dir(void) {
     char *file = util_concat_path(ENV_HOME, ".dav");
@@ -146,7 +147,10 @@
                 ret = load_proxy(ctx->https_proxy, node, HTTPS_PROXY);
             } else if (xstreq(node->name, "namespace")) {
                 ret = load_namespace(node);
-            } /* else {
+            } else if (xstreq(node->name, "secretstore")) {
+                ret = load_secretstore(node);
+            } 
+            /* else {
                 fprintf(stderr, "Unknown config element: %s\n", node->name);
                 ret = 1;
             } */
@@ -567,6 +571,28 @@
     return dav_add_namespace(context, prefix, uri);
 }
 
+int load_secretstore(const xmlNode *node) {
+    // currently only one secretstore is supported
+    
+    node = node->children;
+    int error = 0;
+    while(node) {
+        if(node->type == XML_ELEMENT_NODE) {
+            char *value = util_xml_get_text(node);
+            if(value) {
+                if(xstreq(node->name, "unlock-command")) {
+                    secretstore_unlock_cmd = strdup(value);
+                } else if(xstreq(node->name, "lock-command")) {
+                    secretstore_lock_cmd = strdup(value);
+                }
+            }
+        }
+        node = node->next;
+    }
+    
+    return error;
+}
+
 Repository* get_repository(sstr_t name) {
     if(!name.ptr) {
         return NULL;

mercurial