# HG changeset patch # User Olaf Wintermann # Date 1628415936 -7200 # Node ID 83f832e345e07493765eeffd208646be3fd9bee4 # Parent 5433f0f3dd4833f07fced805c989d942274c7df2 implement secretstore config diff -r 5433f0f3dd48 -r 83f832e345e0 dav/config.c --- 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; diff -r 5433f0f3dd48 -r 83f832e345e0 dav/config.h --- a/dav/config.h Sun Aug 08 11:38:55 2021 +0200 +++ b/dav/config.h Sun Aug 08 11:45:36 2021 +0200 @@ -82,6 +82,7 @@ int load_proxy(DavProxy*, const xmlNode *proxynode, int type); sstr_t load_key_file(char *filename); int load_namespace(const xmlNode *node); +int load_secretstore(const xmlNode *node); Repository* repository_new(void);