diff -r cd74667f6c85 -r 4adad7faf452 src/server/webdav/webdav.c --- a/src/server/webdav/webdav.c Sat Jan 25 15:34:30 2020 +0100 +++ b/src/server/webdav/webdav.c Sat Jan 25 21:37:38 2020 +0100 @@ -64,6 +64,9 @@ default_backend.propfind_init = default_propfind_init; default_backend.propfind_do = default_propfind_do; default_backend.propfind_finish = default_propfind_finish; + default_backend.proppatch_do = NULL; + default_backend.proppatch_finish = NULL; + default_backend.settings = WS_WEBDAV_PROPFIND_USE_VFS; } int webdav_init(pblock *pb, Session *sn, Request *rq) { @@ -242,6 +245,9 @@ VFSContext *vfs = NULL; if(usevfs) { vfs = vfs_request_context(sn, rq); + if(!vfs) { + return REQ_ABORTED; + } if(vfs_stat(vfs, path, &s)) { protocol_status(sn, rq, util_errno2status(vfs->vfs_errno), NULL); @@ -491,14 +497,25 @@ } WebdavPList* webdav_plist_clone(pool_handle_t *pool, WebdavPList *list) { + return webdav_plist_clone_s(pool, list, NULL); +} + +WebdavPList* webdav_plist_clone_s( + pool_handle_t *pool, + WebdavPList *list, + size_t *newlen) +{ WebdavPList *new_list = NULL; // start of the new list WebdavPList *new_list_end = NULL; // end of the new list + size_t len = 0; + WebdavPList *elm = list; while(elm) { // copy list item WebdavPList *new_elm = pool_malloc(pool, sizeof(WebdavPList)); if(!new_elm) { + if(newlen) *newlen = 0; return NULL; } new_elm->property = elm->property; // new list contains original ptr @@ -512,9 +529,11 @@ } new_list_end = new_elm; + len++; elm = elm->next; } + if(newlen) *newlen = len; return new_list; }