diff -r 29d544c3c2b8 -r 05647e862a17 dav/sync.c --- a/dav/sync.c Sun Sep 17 13:51:01 2023 +0200 +++ b/dav/sync.c Sat Sep 30 16:33:47 2023 +0200 @@ -598,13 +598,13 @@ return -strcmp(a->path, b->path); } -static DavSession* create_session(CmdArgs *a, DavContext *ctx, Repository *repo, char *collection) { - int flags = get_repository_flags(repo); +static DavSession* create_session(CmdArgs *a, DavContext *ctx, DavCfgRepository *repo, char *collection) { + int flags = dav_repository_get_flags(repo); DavBool find_collection = TRUE; if((flags & DAV_SESSION_DECRYPT_NAME) != DAV_SESSION_DECRYPT_NAME) { - char *url = util_concat_path(repo->url, collection); - free(repo->url); - repo->url = url; + char *url = util_concat_path(repo->url.value.ptr, collection); + dav_repository_set_url(get_config(), repo, cx_str(url)); + free(url); collection = NULL; find_collection = FALSE; } @@ -618,13 +618,13 @@ DavSession *sn = connect_to_repo(ctx, repo, collection, request_auth, a); sn->flags = flags; - sn->key = dav_context_get_key(ctx, repo->default_key); + sn->key = dav_context_get_key(ctx, repo->default_key.value.ptr); curl_easy_setopt(sn->handle, CURLOPT_HTTPAUTH, repo->authmethods); curl_easy_setopt(sn->handle, CURLOPT_SSLVERSION, repo->ssl_version); - if(repo->cert) { - curl_easy_setopt(sn->handle, CURLOPT_CAPATH, repo->cert); - } - if(!repo->verification) { + if(repo->cert.value.ptr) { + curl_easy_setopt(sn->handle, CURLOPT_CAPATH, repo->cert.value.ptr); + } + if(!repo->verification.value) { curl_easy_setopt(sn->handle, CURLOPT_SSL_VERIFYPEER, 0); curl_easy_setopt(sn->handle, CURLOPT_SSL_VERIFYHOST, 0); } @@ -635,7 +635,7 @@ // we actually don't care what the result is // if it doesn't exists, an error will occur later // and we can't handle it here - char *newurl = util_concat_path(repo->url, util_resource_name(col->href)); + char *newurl = util_concat_path(repo->url.value.ptr, util_resource_name(col->href)); dav_session_set_baseurl(sn, newurl); free(newurl); } @@ -731,7 +731,7 @@ return -1; } - Repository *repo = get_repository(cx_str(dir->repository)); + DavCfgRepository *repo = dav_config_get_repository(get_config(), cx_str(dir->repository)); if(!repo) { fprintf(stderr, "Unknown repository %s\n", dir->repository); return -1; @@ -2076,7 +2076,7 @@ return -1; } - Repository *repo = get_repository(cx_str(dir->repository)); + DavCfgRepository *repo = dav_config_get_repository(get_config(), cx_str(dir->repository)); if(!repo) { fprintf(stderr, "Unkown repository %s\n", dir->name); return -1; @@ -2754,7 +2754,7 @@ int ret = 0; // create DavSession - Repository *repo = get_repository(cx_str(dir->repository)); + DavCfgRepository *repo = dav_config_get_repository(get_config(), cx_str(dir->repository)); if(!repo) { log_error("Unkown repository %s\n", dir->name); return -1; @@ -5134,7 +5134,7 @@ fprintf(stderr, "No versioning configured for syncdir %s\n", dir->name); } - Repository *repo = get_repository(cx_str(dir->repository)); + DavCfgRepository *repo = dav_config_get_repository(get_config(), cx_str(dir->repository)); if(!repo) { fprintf(stderr, "Unknown repository %s\n", dir->repository); return -1; @@ -5729,12 +5729,12 @@ CxIterator iter = cxListIterator(reponames); cx_foreach(char *, reponame, iter) { log_printf("Checking %s... ", reponame); - Repository* repo = get_repository(cx_str(reponame)); + DavCfgRepository *repo = dav_config_get_repository(get_config(), cx_str(reponame)); if (!repo) { log_printf(" not found in config.xml!\n"); ret = EXIT_FAILURE; } else { - DavSession *sn = create_session(a, ctx, repo, repo->url); + DavSession *sn = create_session(a, ctx, repo, repo->url.value.ptr); if (sn) { DavResource *res = dav_query(sn, "select - from / with depth = 0");