libidav/davqlexec.c

changeset 150
37fb12574acd
parent 148
f21ee22170bf
child 157
8dccc3063e28
--- a/libidav/davqlexec.c	Sat Oct 03 20:10:54 2015 +0200
+++ b/libidav/davqlexec.c	Sun Oct 04 15:57:40 2015 +0200
@@ -240,18 +240,24 @@
         ucx_map_put(new_properties, rt_key, value);
     }
     
-    UcxKey cn_key = dav_property_key("DAV:", "crypto-name");
+    UcxKey cn_key = dav_property_key(DAV_NS, "crypto-name");
     value = ucx_map_get(data->properties, cn_key);
     if(value) {
         ucx_map_put(new_properties, cn_key, value);
     }
     
-    UcxKey ck_key = dav_property_key("DAV:", "crypto-key");
+    UcxKey ck_key = dav_property_key(DAV_NS, "crypto-key");
     value = ucx_map_get(data->properties, ck_key);
     if(value) {
         ucx_map_put(new_properties, ck_key, value);
     }
     
+    UcxKey ch_key = dav_property_key(DAV_NS, "crypto-hash");
+    value = ucx_map_get(data->properties, ch_key);
+    if(value) {
+        ucx_map_put(new_properties, ch_key, value);
+    }
+    
     // add properties from field list
     UCX_FOREACH(elm, fields) {
         DavCompiledField *field = elm->data;
@@ -291,6 +297,7 @@
     ucx_map_remove(data->properties, rt_key);
     ucx_map_remove(data->properties, cn_key);
     ucx_map_remove(data->properties, ck_key);
+    ucx_map_remove(data->properties, ch_key);
     
     resource_free_properties(sn, data->properties);
     data->properties = new_properties;
@@ -302,6 +309,7 @@
     free(rt_key.data);
     free(cn_key.data);
     free(ck_key.data);
+    free(ch_key.data);
     
     return 0;
 }
@@ -378,7 +386,9 @@
         ucx_mempool_destroy(mp);
         return result;
     }
-    ucx_mempool_reg_destr(mp, where, (ucx_destructor)ucx_buffer_free);
+    if(where) {
+        ucx_mempool_reg_destr(mp, where, (ucx_destructor)ucx_buffer_free);
+    }
     
     // compile order criterion
     UcxList *ordercr = NULL;
@@ -495,15 +505,15 @@
                     add_properties(root, &response);
                     cleanup_response(&response);
                     
-                    if(root == selroot) {
+                    if(root == selroot) {                     
                         // The current root is the root of the select query.
                         // In this case we have to check the where clause.
                         // If root is not selroot, the where clause was
                         // already checked for the resource before it was
                         // added to the stack.
                         DavQLStackObj where_result;
-                        if(!dav_exec_expr(where, root, &where_result)) {
-                            if(where_result.data.integer != 0) {
+                        if(!dav_exec_expr(where, root, &where_result)) {                           
+                            if(where_result.data.integer != 0) { 
                                 if(!reset_properties(sn, &result, root, cfieldlist)) {
                                     continue;
                                 }

mercurial