dav/main.c

changeset 40
a95ee94b9204
parent 38
b855f76e965b
child 43
03076907b58a
--- a/dav/main.c	Sat Sep 07 14:08:43 2013 +0200
+++ b/dav/main.c	Mon Mar 17 18:42:01 2014 +0100
@@ -39,8 +39,8 @@
 
 
 #include <libidav/utils.h>
+#include <libidav/crypto.h>
 #include "config.h"
-#include "crypto.h"
 #include "main.h"
 
 static DavContext *ctx;
@@ -52,8 +52,8 @@
 int main(int argc, char **argv) {
     xmlGenericErrorFunc fnc = xmlerrorfnc;
     initGenericErrorDefaultFunc(&fnc);
-    load_config();
     ctx = dav_context_new();
+    load_config(ctx);
     dav_add_namespace(ctx, "U", "http://www.uap-core.de/");
     
     memcpy(ctx->http_proxy, get_http_proxy(), sizeof(Proxy));
@@ -251,11 +251,11 @@
     
     char *url = a->argv[0];
     char *path = NULL;
-    char *base = NULL;
+    //char *base = NULL;
     DavSession *sn = NULL;
     Repository *repo = url2repo(url, &path);
-    base = util_concat_path(repo->url, path);
-    sn = dav_session_new_auth(ctx, base, repo->user, repo->password);
+    //base = util_concat_path(repo->url, path);
+    sn = dav_session_new_auth(ctx, repo->url, repo->user, repo->password);
     
     char *update = cmd_getoption(a, "update");
     time_t t = 0;
@@ -267,22 +267,25 @@
     DavResource *ls;
     while(ret != 0) {
         if(cmd_getoption(a, "recursive")) {
-            printf("base: %s\n", base);
+            //printf("base: %s\n", base);
             if(update) {
                 ls = dav_query(
                         sn,
-                        "get U:crypto-key from /* where lastmodified > %t",
+                        "get U:crypto-key from %s* where lastmodified > %t",
+                        path,
                         t);
             } else {
-                ls = dav_query(sn, "get U:crypto-key from /*");
+                ls = dav_query(sn, "get U:crypto-key from %s*", path);
             }
         } else {
             if(update) {
                 ls = dav_query(
                         sn,
-                        "get U:crypto-key from / where lastmodified > %t", t);
+                        "get U:crypto-key from %s where lastmodified > %t",
+                        path,
+                        t);
             } else {
-                ls = dav_query(sn, "get U:crypto-key from /");
+                ls = dav_query(sn, "get U:crypto-key from %s", path);
             }
         }
         
@@ -317,7 +320,7 @@
     }
     
     free(path);
-    free(base);
+    //free(base);
     
     return ret;
 }

mercurial