129 CxIterator i = cxMapIteratorValues(properties); |
129 CxIterator i = cxMapIteratorValues(properties); |
130 cx_foreach(DavProperty*, property, i) { |
130 cx_foreach(DavProperty*, property, i) { |
131 // TODO: free everything |
131 // TODO: free everything |
132 dav_session_free(sn, property); |
132 dav_session_free(sn, property); |
133 } |
133 } |
134 cxMapDestroy(properties); |
134 cxMapFree(properties); |
135 } |
135 } |
136 |
136 |
137 void dav_resource_free(DavResource *res) { |
137 void dav_resource_free(DavResource *res) { |
138 DavSession *sn = res->session; |
138 DavSession *sn = res->session; |
139 |
139 |
805 } |
805 } |
806 |
806 |
807 CxBuffer *rqbuf = create_propfind_request(res->session, proplist, "propfind", 0); |
807 CxBuffer *rqbuf = create_propfind_request(res->session, proplist, "propfind", 0); |
808 int ret = dav_propfind(res->session, res, rqbuf); |
808 int ret = dav_propfind(res->session, res, rqbuf); |
809 cxBufferFree(rqbuf); |
809 cxBufferFree(rqbuf); |
810 cxMempoolDestroy(mp); |
810 cxMempoolFree(mp); |
811 return ret; |
811 return ret; |
812 } |
812 } |
813 |
813 |
814 |
814 |
815 static void init_hash_stream(HashStream *hstr, void *stream, dav_read_func readfn, dav_seek_func seekfn) { |
815 static void init_hash_stream(HashStream *hstr, void *stream, dav_read_func readfn, dav_seek_func seekfn) { |
1014 if(data->crypto_set) { |
1014 if(data->crypto_set) { |
1015 CxIterator i = cxListIterator(data->crypto_set); |
1015 CxIterator i = cxListIterator(data->crypto_set); |
1016 cx_foreach(DavProperty *, property, i) { |
1016 cx_foreach(DavProperty *, property, i) { |
1017 cxmutstr keystr = dav_property_key(property->ns->name, property->name); |
1017 cxmutstr keystr = dav_property_key(property->ns->name, property->name); |
1018 CxHashKey key = cx_hash_key(keystr.ptr, keystr.length); |
1018 CxHashKey key = cx_hash_key(keystr.ptr, keystr.length); |
1019 DavProperty *existing_prop = cxMapRemoveAndGet(crypto_props, key); |
1019 DavProperty *existing_prop = NULL; |
|
1020 cxMapRemoveAndGet(crypto_props, key, &existing_prop); |
1020 cxMapPut(crypto_props, key, property); |
1021 cxMapPut(crypto_props, key, property); |
1021 if(existing_prop) { |
1022 if(existing_prop) { |
1022 // TODO: free existing_prop |
1023 // TODO: free existing_prop |
1023 } |
1024 } |
1024 free(keystr.ptr); |
1025 free(keystr.ptr); |
1532 cxBufferPut(content, '\n'); |
1533 cxBufferPut(content, '\n'); |
1533 } |
1534 } |
1534 |
1535 |
1535 cxBufferPutString(content, "</D:prop>"); |
1536 cxBufferPutString(content, "</D:prop>"); |
1536 |
1537 |
1537 cxMapDestroy(nsmap); |
1538 cxMapFree(nsmap); |
1538 |
1539 |
1539 // encrypt xml document |
1540 // encrypt xml document |
1540 char *crypto_prop_content = aes_encrypt(content->space, content->size, sn->key); |
1541 char *crypto_prop_content = aes_encrypt(content->space, content->size, sn->key); |
1541 cxBufferDestroy(content); |
1542 cxBufferDestroy(content); |
1542 |
1543 |