Wed, 27 Nov 2024 23:00:07 +0100
add TODO to use a future ucx feature
366
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1 | /* |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
3 | * |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
4 | * Copyright 2022 Olaf Wintermann. All rights reserved. |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
5 | * |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
6 | * Redistribution and use in source and binary forms, with or without |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
7 | * modification, are permitted provided that the following conditions are met: |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
8 | * |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
9 | * 1. Redistributions of source code must retain the above copyright |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
10 | * notice, this list of conditions and the following disclaimer. |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
11 | * |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
12 | * 2. Redistributions in binary form must reproduce the above copyright |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
13 | * notice, this list of conditions and the following disclaimer in the |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
14 | * documentation and/or other materials provided with the distribution. |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
15 | * |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
47bc686fafe4
add new dav config element
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 |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
26 | * POSSIBILITY OF SUCH DAMAGE. |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
27 | */ |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
28 | |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
29 | #include "config.h" |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
30 | |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
31 | #include "../../util/util.h" |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
32 | |
373
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
33 | #include <libxml/tree.h> |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
34 | |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
35 | #define xstreq(a,b) xmlStrEqual(BAD_CAST a, BAD_CAST b) |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
36 | |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
37 | static int pg_load_ext_dav_config( |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
38 | ServerConfiguration *cfg, |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
39 | pool_handle_t *pool, |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
40 | PgRepository *repo, |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
41 | const char *file); |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
42 | |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
43 | |
372
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
44 | static const char *sql_get_repository_root = "select resource_id from Resource where parent_id is NULL and nodename = $1 ;"; |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
45 | |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
46 | |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
47 | // Uses a PGconn to lookup the resource id of the specified root node |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
48 | // if the lookup succeeds, the resource id is written to rootid |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
49 | // in case of an error, an error message will be logged |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
50 | // returns: 0 success, 1 error |
374
77506ec632a4
use configured root node from PgRepository in pg vfs/webdav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
373
diff
changeset
|
51 | int pg_lookup_root(ResourceData *res, const char *rootnode, int64_t *rootid) { |
372
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
52 | PGconn *connection = res->data; |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
53 | |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
54 | PGresult *result = PQexecParams( |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
55 | connection, |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
56 | sql_get_repository_root, |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
57 | 1, // number of parameters |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
58 | NULL, |
374
77506ec632a4
use configured root node from PgRepository in pg vfs/webdav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
373
diff
changeset
|
59 | &rootnode, // parameter value |
372
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
60 | NULL, |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
61 | NULL, |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
62 | 0); // 0: result in text format |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
63 | |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
64 | if(!result) { |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
65 | log_ereport(LOG_FAILURE, "pg: root lookup failed: %s", PQerrorMessage(connection)); |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
66 | return 1; |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
67 | } |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
68 | |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
69 | int ret = 0; |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
70 | |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
71 | int nrows = PQntuples(result); |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
72 | if(nrows == 1) { |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
73 | char *resource_id_str = PQgetvalue(result, 0, 0); |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
74 | if(resource_id_str) { |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
75 | if(!util_strtoint(resource_id_str, rootid)) { |
374
77506ec632a4
use configured root node from PgRepository in pg vfs/webdav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
373
diff
changeset
|
76 | log_ereport(LOG_FAILURE, "pg: unexpected result for column resource_id", rootnode); |
372
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
77 | ret = 1; |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
78 | } |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
79 | } |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
80 | } else { |
374
77506ec632a4
use configured root node from PgRepository in pg vfs/webdav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
373
diff
changeset
|
81 | log_ereport(LOG_FAILURE, "pg: cannot find root resource '%s'", rootnode); |
372
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
82 | ret = 1; |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
83 | } |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
84 | PQclear(result); |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
85 | |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
86 | return ret; |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
87 | } |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
88 | |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
89 | PgRepository* pg_init_repo(ServerConfiguration *cfg, pool_handle_t *pool, WSConfigNode *config) { |
415
d938228c382e
switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
376
diff
changeset
|
90 | CxAllocator *a = pool_allocator(pool); |
366
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
91 | |
415
d938228c382e
switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
376
diff
changeset
|
92 | ConfigNode *pg = serverconfig_get_node(config, CONFIG_NODE_OBJECT, cx_str("Postgresql")); |
366
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
93 | if(!pg) { |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
94 | log_ereport(LOG_MISCONFIG, "pg_init_repo: missing postgresql config object"); |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
95 | return NULL; |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
96 | } |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
97 | |
418
b7dcc9c4f270
use server.conf parser for init.conf as well
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
415
diff
changeset
|
98 | cxstring cfg_respool = serverconfig_object_directive_value(pg, cx_str("ResourcePool")); |
b7dcc9c4f270
use server.conf parser for init.conf as well
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
415
diff
changeset
|
99 | cxstring cfg_rootid = serverconfig_object_directive_value(pg, cx_str("RootId")); |
b7dcc9c4f270
use server.conf parser for init.conf as well
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
415
diff
changeset
|
100 | cxstring cfg_rootnode = serverconfig_object_directive_value(pg, cx_str("RootNode")); |
b7dcc9c4f270
use server.conf parser for init.conf as well
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
415
diff
changeset
|
101 | cxstring cfg_dav = serverconfig_object_directive_value(pg, cx_str("PGDavConfig")); |
366
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
102 | |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
103 | // minimum requirement is a resource pool |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
104 | if(cfg_respool.length == 0) { |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
105 | return NULL; |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
106 | } |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
107 | |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
108 | // check rootid |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
109 | int64_t root_id = 1; |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
110 | if(cfg_rootid.length > 0) { |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
111 | if(!util_strtoint(cfg_rootid.ptr, &root_id)) { |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
112 | log_ereport(LOG_MISCONFIG, "pg_init_repo: RootId parameter is not an integer: %s", cfg_rootid.ptr); |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
113 | return NULL; |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
114 | } |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
115 | } |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
116 | |
372
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
117 | // warn if RootId and RootNode are specified |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
118 | if(cfg_rootid.length > 0 && cfg_rootnode.length > 0) { |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
119 | log_ereport(LOG_WARN, "log_init_repo: RootId and RootNode specified, RootNode ignored"); |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
120 | } else if(cfg_rootnode.length > 0) { |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
121 | // check root node |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
122 | |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
123 | // resolve rootnode |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
124 | // therefore we first need to get a connection from the resourcepool |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
125 | ResourceData *res = resourcepool_cfg_lookup(cfg, cfg_respool.ptr, 0); |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
126 | if(!res) { |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
127 | log_ereport(LOG_MISCONFIG, "pg_init_repo: resource lookup failed"); |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
128 | return NULL; |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
129 | } |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
130 | // do lookup, if successful, root_id will be set |
374
77506ec632a4
use configured root node from PgRepository in pg vfs/webdav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
373
diff
changeset
|
131 | int lookup_err = pg_lookup_root(res, cfg_rootnode.ptr, &root_id); |
372
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
132 | // we don't need the connection anymore |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
133 | resourcepool_free(NULL, NULL, res); |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
134 | if(lookup_err) { |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
135 | // no logging required, pg_lookup_root will log the error |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
136 | return NULL; |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
137 | } |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
138 | } |
1d2538a1ba8f
add config option for pg root node lookup
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
366
diff
changeset
|
139 | |
366
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
140 | PgRepository *repo = pool_malloc(pool, sizeof(PgRepository)); |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
141 | ZERO(repo, sizeof(PgRepository)); |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
142 | |
415
d938228c382e
switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
376
diff
changeset
|
143 | repo->resourcepool = cx_strdup_a(a, cfg_respool); |
373
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
144 | repo->root_resource_id = root_id; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
145 | |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
146 | // check for extended pg dav config |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
147 | if(cfg_dav.length > 0) { |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
148 | // load extended config from config file |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
149 | char *cfg_file_path = cfg_config_file_path(cfg_dav.ptr); |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
150 | if(pg_load_ext_dav_config(cfg, pool, repo, cfg_file_path)) { |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
151 | // error |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
152 | repo = NULL; // no need to cleanup because everything is from the pool |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
153 | } |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
154 | free(cfg_file_path); |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
155 | } |
366
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
156 | |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
157 | return repo; |
47bc686fafe4
add new dav config element
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
158 | } |
373
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
159 | |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
160 | static int pg_ext_get_config( |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
161 | ServerConfiguration *cfg, |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
162 | pool_handle_t *pool, |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
163 | PgRepository *repo, |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
164 | const char *file_path, |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
165 | xmlNode *root); |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
166 | static int pg_ext_get_extension( |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
167 | PgExtParser *ext, |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
168 | pool_handle_t *pool, |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
169 | PgRepository *repo, |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
170 | const char *file_path, |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
171 | xmlNode *ext_node); |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
172 | |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
173 | static const char* pg_util_xml_get_text(const xmlNode *elm) { |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
174 | xmlNode *node = elm->children; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
175 | while(node) { |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
176 | if(node->type == XML_TEXT_NODE) { |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
177 | return (const char*)node->content; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
178 | } |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
179 | node = node->next; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
180 | } |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
181 | return NULL; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
182 | } |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
183 | |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
184 | // load additional postgresql webdav config from the specified xml file |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
185 | static int pg_load_ext_dav_config( |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
186 | ServerConfiguration *cfg, |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
187 | pool_handle_t *pool, |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
188 | PgRepository *repo, |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
189 | const char *file_path) |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
190 | { |
415
d938228c382e
switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
376
diff
changeset
|
191 | CxAllocator *a = pool_allocator(pool); |
373
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
192 | |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
193 | // check if the file exists and can be accessed |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
194 | struct stat s; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
195 | if(stat(file_path, &s)) { |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
196 | if(errno == ENOENT) { |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
197 | log_ereport(LOG_FAILURE, "pg: config file %s not found", file_path); |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
198 | } else { |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
199 | log_ereport(LOG_FAILURE, "pg: cannot access config file %s", file_path); |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
200 | } |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
201 | |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
202 | return 1; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
203 | } |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
204 | |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
205 | // prepare PgRepository |
490 | 206 | repo->prop_ext = cxHashMapCreate(a, CX_STORE_POINTERS, 8); |
373
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
207 | if(!repo->prop_ext) { |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
208 | log_ereport(LOG_FAILURE, "pg: cannot load config file: OOM"); |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
209 | return 1; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
210 | } |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
211 | |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
212 | // load xml document |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
213 | xmlDoc *doc = xmlReadFile(file_path, NULL, 0); |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
214 | if(!doc) { |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
215 | log_ereport(LOG_FAILURE, "pg: cannot load config file %s", file_path); |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
216 | return 1; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
217 | } |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
218 | |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
219 | // the root element must be <repository> |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
220 | int ret = 0; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
221 | xmlNode *xml_root = xmlDocGetRootElement(doc); |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
222 | if(xstreq(xml_root->name, "repository")) { |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
223 | // parse config |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
224 | ret = pg_ext_get_config(cfg, pool, repo, file_path, xml_root); |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
225 | } else { |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
226 | log_ereport(LOG_MISCONFIG, "pg: config %s: root element <repository> expected", file_path); |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
227 | ret = 1; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
228 | } |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
229 | xmlFreeDoc(doc); |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
230 | |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
231 | return ret; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
232 | } |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
233 | |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
234 | |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
235 | |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
236 | |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
237 | static int pg_ext_get_config( |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
238 | ServerConfiguration *cfg, |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
239 | pool_handle_t *pool, |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
240 | PgRepository *repo, |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
241 | const char *file_path, |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
242 | xmlNode *root) |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
243 | { |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
244 | xmlNode *node = root->children; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
245 | int ret = 0; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
246 | |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
247 | PgExtParser parserData; |
490 | 248 | parserData.table_lookup = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 8); |
249 | parserData.tables = cxLinkedListCreate(cxDefaultAllocator, NULL, sizeof(PgExtTable)); | |
373
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
250 | |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
251 | while(node && !ret) { |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
252 | // currently, the only possible config element is <extension> |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
253 | if(node->type == XML_ELEMENT_NODE) { |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
254 | if(xstreq(node->name, "extension")) { |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
255 | ret = pg_ext_get_extension(&parserData, pool, repo, file_path, node); |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
256 | } |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
257 | } |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
258 | node = node->next; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
259 | } |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
260 | |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
261 | // convert parserData |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
262 | if(!ret) { |
415
d938228c382e
switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
376
diff
changeset
|
263 | size_t ntables = parserData.tables->size; |
373
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
264 | repo->ntables = ntables; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
265 | repo->tables = pool_calloc(pool, ntables, sizeof(PgExtTable)); |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
266 | if(repo->tables) { |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
267 | int i = 0; |
490 | 268 | CxIterator iter = cxListIterator(parserData.tables); |
415
d938228c382e
switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
376
diff
changeset
|
269 | cx_foreach(PgExtTable *, tab, iter) { |
373
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
270 | repo->tables[i++] = *tab; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
271 | } |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
272 | } else { |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
273 | ret = 1; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
274 | } |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
275 | |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
276 | } |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
277 | |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
278 | // cleanup parser |
415
d938228c382e
switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
376
diff
changeset
|
279 | cxListDestroy(parserData.tables); |
d938228c382e
switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
376
diff
changeset
|
280 | cxMapDestroy(parserData.table_lookup); |
373
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
281 | |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
282 | return ret; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
283 | } |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
284 | |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
285 | static int pg_ext_get_extension( |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
286 | PgExtParser *ext, |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
287 | pool_handle_t *pool, |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
288 | PgRepository *repo, |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
289 | const char *file_path, |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
290 | xmlNode *ext_node) |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
291 | { |
415
d938228c382e
switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
376
diff
changeset
|
292 | CxAllocator *a = pool_allocator(pool); |
373
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
293 | |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
294 | xmlNode *node = ext_node->children; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
295 | |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
296 | const char *table = NULL; |
490 | 297 | CxList *properties = cxLinkedListCreate(a, NULL, CX_STORE_POINTERS); |
373
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
298 | |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
299 | while(node) { |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
300 | if(node->type == XML_ELEMENT_NODE) { |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
301 | if(xstreq(node->name, "table")) { |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
302 | const char *value = pg_util_xml_get_text(node); |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
303 | if(!value) { |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
304 | log_ereport(LOG_MISCONFIG, "pg: config %s: table: missing value", file_path, table); |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
305 | return 1; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
306 | } else if(table) { |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
307 | log_ereport(LOG_MISCONFIG, "pg: config %s: table %s already set", file_path, table); |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
308 | return 1; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
309 | } |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
310 | table = value; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
311 | } else if(xstreq(node->name, "properties")) { |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
312 | // add all child elements to the properties list |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
313 | xmlNode *ps = node->children; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
314 | while(ps) { |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
315 | if(ps->type == XML_ELEMENT_NODE) { |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
316 | // validate |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
317 | // required: namespace, value |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
318 | if(!ps->ns || !ps->ns->href) { |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
319 | log_ereport(LOG_MISCONFIG, "pg: config %s: property %s: missing namespace", file_path, ps->name); |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
320 | return 1; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
321 | } |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
322 | const char *value = pg_util_xml_get_text(ps); |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
323 | if(!value) { |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
324 | log_ereport(LOG_MISCONFIG, "pg: config %s: no column specified for property %s", file_path, ps->name); |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
325 | return 1; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
326 | } |
415
d938228c382e
switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
376
diff
changeset
|
327 | cxListAdd(properties, ps); |
373
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
328 | } |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
329 | ps = ps->next; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
330 | } |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
331 | } |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
332 | } |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
333 | node = node->next; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
334 | } |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
335 | |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
336 | // check if anything is missing |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
337 | if(!table) { |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
338 | log_ereport(LOG_MISCONFIG, "pg: config %s: missing table value for extension", file_path); |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
339 | return 1; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
340 | } |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
341 | if(!properties) { |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
342 | log_ereport(LOG_MISCONFIG, "pg: config %s: no properties configured for extension", file_path); |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
343 | return 1; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
344 | } |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
345 | |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
346 | // check if the table was already specified |
415
d938228c382e
switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
376
diff
changeset
|
347 | if(cxMapGet(ext->table_lookup, cx_hash_key_str(table))) { |
373
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
348 | log_ereport(LOG_MISCONFIG, "pg: config %s: extension table %s not unique", file_path, table); |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
349 | return 1; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
350 | } |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
351 | // mark table as used |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
352 | // tabname will be used later, so ist must be allocated in the pool |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
353 | char *tabname = pool_strdup(pool, table); |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
354 | if(!tabname) return 1; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
355 | |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
356 | // exttable is only used temporarily |
415
d938228c382e
switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
376
diff
changeset
|
357 | PgExtTable exttable; |
d938228c382e
switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
376
diff
changeset
|
358 | exttable.table = tabname; |
d938228c382e
switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
376
diff
changeset
|
359 | exttable.isused = 0; // not relevant in config |
d938228c382e
switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
376
diff
changeset
|
360 | int tableindex = (int)ext->tables->size; |
d938228c382e
switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
376
diff
changeset
|
361 | cxListAdd(ext->tables, &exttable); |
373
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
362 | |
415
d938228c382e
switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
376
diff
changeset
|
363 | if(cxMapPut(ext->table_lookup, cx_hash_key_str(table), (void*)table)) { |
373
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
364 | return 1; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
365 | } |
376
61d481d3c2e4
Add support for extended properties in pg propfind
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
374
diff
changeset
|
366 | |
490 | 367 | CxIterator iter = cxListIterator(properties); |
415
d938228c382e
switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
376
diff
changeset
|
368 | cx_foreach(xmlNode *, ps, iter) { |
373
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
369 | const char *value = pg_util_xml_get_text(ps); |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
370 | |
376
61d481d3c2e4
Add support for extended properties in pg propfind
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
374
diff
changeset
|
371 | PgPropertyStoreExt *ext_col = pool_malloc(pool, sizeof(PgPropertyStoreExt)); |
61d481d3c2e4
Add support for extended properties in pg propfind
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
374
diff
changeset
|
372 | if(!ext_col) { |
373
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
373 | return 1; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
374 | } |
376
61d481d3c2e4
Add support for extended properties in pg propfind
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
374
diff
changeset
|
375 | ext_col->tableindex = tableindex; |
61d481d3c2e4
Add support for extended properties in pg propfind
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
374
diff
changeset
|
376 | ext_col->ns = pool_strdup(pool, (const char*)ps->ns->href); |
61d481d3c2e4
Add support for extended properties in pg propfind
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
374
diff
changeset
|
377 | ext_col->name = pool_strdup(pool, (const char*)ps->name); |
61d481d3c2e4
Add support for extended properties in pg propfind
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
374
diff
changeset
|
378 | ext_col->column = pool_strdup(pool, (const char*)value); |
61d481d3c2e4
Add support for extended properties in pg propfind
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
374
diff
changeset
|
379 | if(!ext_col->ns || !ext_col->name || !ext_col->column) { |
373
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
380 | return 1; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
381 | } |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
382 | |
415
d938228c382e
switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
376
diff
changeset
|
383 | CxHashKey key = webdav_property_key(ext_col->ns, ext_col->name); |
d938228c382e
switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
376
diff
changeset
|
384 | int err = cxMapPut(repo->prop_ext, key, ext_col); |
490 | 385 | free((void*)key.data); |
373
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
386 | if(err) { |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
387 | return 1; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
388 | } |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
389 | } |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
390 | |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
391 | return 0; |
f78a585e1a2f
add parser for extended postgresql webdav config
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
372
diff
changeset
|
392 | } |