Fri, 05 May 2023 18:02:11 +0200
update ucx
479
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1 | /* |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
3 | * |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
4 | * Copyright 2023 Olaf Wintermann. All rights reserved. |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
5 | * |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
6 | * Redistribution and use in source and binary forms, with or without |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
7 | * modification, are permitted provided that the following conditions are met: |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
8 | * |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
9 | * 1. Redistributions of source code must retain the above copyright |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
10 | * notice, this list of conditions and the following disclaimer. |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
11 | * |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
12 | * 2. Redistributions in binary form must reproduce the above copyright |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
13 | * notice, this list of conditions and the following disclaimer in the |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
14 | * documentation and/or other materials provided with the distribution. |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
15 | * |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
26 | * POSSIBILITY OF SUCH DAMAGE. |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
27 | */ |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
28 | |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
29 | |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
30 | #ifndef WS_WEBDAV_XATTRBACKEND_H |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
31 | #define WS_WEBDAV_XATTRBACKEND_H |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
32 | |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
33 | #include "../public/webdav.h" |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
34 | |
481
31affbf33911
implement proppatch of the xattr webdav backend
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
480
diff
changeset
|
35 | #include <cx/map.h> |
31affbf33911
implement proppatch of the xattr webdav backend
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
480
diff
changeset
|
36 | #include <cx/string.h> |
31affbf33911
implement proppatch of the xattr webdav backend
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
480
diff
changeset
|
37 | |
479
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
38 | #ifdef __cplusplus |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
39 | extern "C" { |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
40 | #endif |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
41 | |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
42 | typedef struct WebdavXAttrRepository { |
480 | 43 | char *xattr_name; |
479
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
44 | } WebdavXAttrRepository; |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
45 | |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
46 | typedef struct WebdavXAttrBackend { |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
47 | WebdavXAttrRepository *repo; |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
48 | } WebdavXAttrBackend; |
480 | 49 | |
50 | typedef struct XAttrPropfind { | |
51 | const char *base_href; | |
52 | const char *base_path; | |
53 | } XAttrPropfind; | |
481
31affbf33911
implement proppatch of the xattr webdav backend
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
480
diff
changeset
|
54 | |
31affbf33911
implement proppatch of the xattr webdav backend
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
480
diff
changeset
|
55 | typedef struct XAttrProppatch { |
31affbf33911
implement proppatch of the xattr webdav backend
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
480
diff
changeset
|
56 | CxMap *properties; |
31affbf33911
implement proppatch of the xattr webdav backend
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
480
diff
changeset
|
57 | } XAttrProppatch; |
31affbf33911
implement proppatch of the xattr webdav backend
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
480
diff
changeset
|
58 | |
31affbf33911
implement proppatch of the xattr webdav backend
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
480
diff
changeset
|
59 | |
479
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
60 | int webdav_init_xattr_backend(void); |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
61 | |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
62 | |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
63 | void* webdav_xattr_init(ServerConfiguration *cfg, pool_handle_t *pool, WSConfigNode *config); |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
64 | |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
65 | WebdavBackend* webdav_xattr_create(Session *sn, Request *rq, pblock *pb, void *initData); |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
66 | |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
67 | |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
68 | |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
69 | /* webdav backend implementation */ |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
70 | int webdav_xattr_propfind_init( |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
71 | WebdavPropfindRequest *rq, |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
72 | const char *path, |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
73 | const char *href, |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
74 | WebdavPList **outplist); |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
75 | int webdav_xattr_propfind_do( |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
76 | WebdavPropfindRequest *request, |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
77 | WebdavResponse *response, |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
78 | VFS_DIR parent, |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
79 | WebdavResource *resource, |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
80 | struct stat *s); |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
81 | int webdav_xattr_propfind_finish(WebdavPropfindRequest *rq); |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
82 | int webdav_xattr_proppatch_do( |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
83 | WebdavProppatchRequest *request, |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
84 | WebdavResource *response, |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
85 | VFSFile *file, |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
86 | WebdavPList **setInOut, |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
87 | WebdavPList **removeInOut); |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
88 | int webdav_xattr_proppatch_finish( |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
89 | WebdavProppatchRequest *request, |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
90 | WebdavResource *response, |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
91 | VFSFile *file, |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
92 | WSBool commit); |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
93 | |
482
b02da778362e
implement propfind for webdav xattr backend
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
481
diff
changeset
|
94 | int webdav_xattr_propfind_get_requested_properties( |
b02da778362e
implement propfind for webdav xattr backend
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
481
diff
changeset
|
95 | WebdavPropfindRequest *request, |
b02da778362e
implement propfind for webdav xattr backend
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
481
diff
changeset
|
96 | WebdavResource *resource, |
b02da778362e
implement propfind for webdav xattr backend
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
481
diff
changeset
|
97 | CxAllocator *a, |
b02da778362e
implement propfind for webdav xattr backend
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
481
diff
changeset
|
98 | CxMap *pmap); |
b02da778362e
implement propfind for webdav xattr backend
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
481
diff
changeset
|
99 | |
b02da778362e
implement propfind for webdav xattr backend
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
481
diff
changeset
|
100 | int webdav_xattr_propfind_allprop( |
b02da778362e
implement propfind for webdav xattr backend
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
481
diff
changeset
|
101 | WebdavPropfindRequest *request, |
b02da778362e
implement propfind for webdav xattr backend
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
481
diff
changeset
|
102 | WebdavResource *resource, |
b02da778362e
implement propfind for webdav xattr backend
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
481
diff
changeset
|
103 | CxAllocator *a, |
b02da778362e
implement propfind for webdav xattr backend
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
481
diff
changeset
|
104 | CxMap *pmap); |
479
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
105 | |
481
31affbf33911
implement proppatch of the xattr webdav backend
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
480
diff
changeset
|
106 | /* properties xattr data */ |
31affbf33911
implement proppatch of the xattr webdav backend
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
480
diff
changeset
|
107 | |
31affbf33911
implement proppatch of the xattr webdav backend
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
480
diff
changeset
|
108 | int webdav_xattr_put_prop(CxMap *pmap, WebdavProperty *prop); |
31affbf33911
implement proppatch of the xattr webdav backend
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
480
diff
changeset
|
109 | |
31affbf33911
implement proppatch of the xattr webdav backend
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
480
diff
changeset
|
110 | CxMap* webdav_xattr_parse_data(CxAllocator *a, const char *data, size_t len, const char *path); |
31affbf33911
implement proppatch of the xattr webdav backend
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
480
diff
changeset
|
111 | |
31affbf33911
implement proppatch of the xattr webdav backend
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
480
diff
changeset
|
112 | cxmutstr webdav_xattr_serialze_map(CxAllocator *a, CxMap *pmap); |
31affbf33911
implement proppatch of the xattr webdav backend
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
480
diff
changeset
|
113 | |
31affbf33911
implement proppatch of the xattr webdav backend
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
480
diff
changeset
|
114 | |
479
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
115 | #ifdef __cplusplus |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
116 | } |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
117 | #endif |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
118 | |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
119 | #endif /* WS_WEBDAV_XATTRBACKEND_H */ |
2a42ba73ecdd
add new xattr based webdav backend (unimplemented)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
120 |