63 static UcxMap *repos; |
63 static UcxMap *repos; |
64 static UcxMap *keys; |
64 static UcxMap *keys; |
65 |
65 |
66 static PwdStore *pstore; |
66 static PwdStore *pstore; |
67 |
67 |
68 |
68 static char *secretstore_unlock_cmd; |
|
69 static char *secretstore_lock_cmd; |
69 |
70 |
70 int check_config_dir(void) { |
71 int check_config_dir(void) { |
71 char *file = util_concat_path(ENV_HOME, ".dav"); |
72 char *file = util_concat_path(ENV_HOME, ".dav"); |
72 int ret = 0; |
73 int ret = 0; |
73 if(util_mkdir(file, S_IRWXU)) { |
74 if(util_mkdir(file, S_IRWXU)) { |
144 ret = load_proxy(ctx->http_proxy, node, HTTP_PROXY); |
145 ret = load_proxy(ctx->http_proxy, node, HTTP_PROXY); |
145 } else if (xstreq(node->name, "https-proxy")) { |
146 } else if (xstreq(node->name, "https-proxy")) { |
146 ret = load_proxy(ctx->https_proxy, node, HTTPS_PROXY); |
147 ret = load_proxy(ctx->https_proxy, node, HTTPS_PROXY); |
147 } else if (xstreq(node->name, "namespace")) { |
148 } else if (xstreq(node->name, "namespace")) { |
148 ret = load_namespace(node); |
149 ret = load_namespace(node); |
149 } /* else { |
150 } else if (xstreq(node->name, "secretstore")) { |
|
151 ret = load_secretstore(node); |
|
152 } |
|
153 /* else { |
150 fprintf(stderr, "Unknown config element: %s\n", node->name); |
154 fprintf(stderr, "Unknown config element: %s\n", node->name); |
151 ret = 1; |
155 ret = 1; |
152 } */ |
156 } */ |
153 } |
157 } |
154 node = node->next; |
158 node = node->next; |
565 } |
569 } |
566 |
570 |
567 return dav_add_namespace(context, prefix, uri); |
571 return dav_add_namespace(context, prefix, uri); |
568 } |
572 } |
569 |
573 |
|
574 int load_secretstore(const xmlNode *node) { |
|
575 // currently only one secretstore is supported |
|
576 |
|
577 node = node->children; |
|
578 int error = 0; |
|
579 while(node) { |
|
580 if(node->type == XML_ELEMENT_NODE) { |
|
581 char *value = util_xml_get_text(node); |
|
582 if(value) { |
|
583 if(xstreq(node->name, "unlock-command")) { |
|
584 secretstore_unlock_cmd = strdup(value); |
|
585 } else if(xstreq(node->name, "lock-command")) { |
|
586 secretstore_lock_cmd = strdup(value); |
|
587 } |
|
588 } |
|
589 } |
|
590 node = node->next; |
|
591 } |
|
592 |
|
593 return error; |
|
594 } |
|
595 |
570 Repository* get_repository(sstr_t name) { |
596 Repository* get_repository(sstr_t name) { |
571 if(!name.ptr) { |
597 if(!name.ptr) { |
572 return NULL; |
598 return NULL; |
573 } |
599 } |
574 return ucx_map_sstr_get(repos, name); |
600 return ucx_map_sstr_get(repos, name); |