Thu, 28 Nov 2024 17:20:19 +0100
fix crash in printxmldoc, fixes #514
795
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1 | /* |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
3 | * |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
4 | * Copyright 2023 Olaf Wintermann. All rights reserved. |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
5 | * |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
6 | * Redistribution and use in source and binary forms, with or without |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
7 | * modification, are permitted provided that the following conditions are met: |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
8 | * |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
9 | * 1. Redistributions of source code must retain the above copyright |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
10 | * notice, this list of conditions and the following disclaimer. |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
11 | * |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
12 | * 2. Redistributions in binary form must reproduce the above copyright |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
13 | * notice, this list of conditions and the following disclaimer in the |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
14 | * documentation and/or other materials provided with the distribution. |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
15 | * |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
05647e862a17
add new config parser
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 |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
26 | * POSSIBILITY OF SUCH DAMAGE. |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
27 | */ |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
28 | |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
29 | #ifndef LIBIDAV_CONFIG_H |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
30 | #define LIBIDAV_CONFIG_H |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
31 | |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
32 | #include "webdav.h" |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
33 | |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
34 | #ifdef __cplusplus |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
35 | extern "C" { |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
36 | #endif |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
37 | |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
38 | typedef struct DavConfig DavConfig; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
39 | typedef struct DavCfgRepository DavCfgRepository; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
40 | typedef struct DavCfgProxy DavCfgProxy; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
41 | typedef struct DavCfgKey DavCfgKey; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
42 | typedef struct DavCfgNamespace DavCfgNamespace; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
43 | typedef struct DavCfgSecretStore DavCfgSecretStore; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
44 | |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
45 | typedef struct CfgString CfgString; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
46 | typedef struct CfgInt CfgInt; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
47 | typedef struct CfgUInt CfgUInt; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
48 | typedef struct CfgBool CfgBool; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
49 | |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
50 | typedef enum dav_cfg_key_type DavCfgKeyType; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
51 | |
796
81e0f67386a6
remove old config loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
795
diff
changeset
|
52 | typedef cxmutstr (*dav_loadkeyfile_func)(const char *filename); |
81e0f67386a6
remove old config loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
795
diff
changeset
|
53 | |
795
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
54 | #define DAV_HTTP_PROXY 1 |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
55 | #define DAV_HTTPS_PROXY 2 |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
56 | |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
57 | enum dav_cfg_key_type { |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
58 | DAV_KEY_TYPE_AES256 = 0, |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
59 | DAV_KEY_TYPE_AES128, |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
60 | DAV_KEY_TYPE_UNKNOWN |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
61 | }; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
62 | |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
63 | struct DavConfig { |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
64 | CxMempool *mp; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
65 | |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
66 | DavCfgRepository *repositories; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
67 | DavCfgKey *keys; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
68 | DavCfgNamespace *namespaces; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
69 | DavCfgProxy *http_proxy; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
70 | DavCfgProxy *https_proxy; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
71 | DavCfgSecretStore *secretstore; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
72 | |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
73 | xmlDoc *doc; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
74 | }; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
75 | |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
76 | struct CfgString { |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
77 | cxmutstr value; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
78 | xmlNode *node; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
79 | }; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
80 | |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
81 | struct CfgInt { |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
82 | int64_t value; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
83 | xmlNode *node; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
84 | }; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
85 | |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
86 | struct CfgUInt { |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
87 | uint64_t value; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
88 | xmlNode *node; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
89 | }; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
90 | |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
91 | struct CfgBool { |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
92 | bool value; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
93 | xmlNode *node; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
94 | }; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
95 | |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
96 | |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
97 | struct DavCfgRepository { |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
98 | xmlNode *node; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
99 | |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
100 | CfgString name; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
101 | CfgString url; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
102 | CfgString user; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
103 | CfgString password; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
104 | CfgString stored_user; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
105 | CfgString default_key; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
106 | CfgString cert; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
107 | CfgBool verification; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
108 | |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
109 | CfgBool full_encryption; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
110 | CfgBool content_encryption; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
111 | CfgBool decrypt_content; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
112 | CfgBool decrypt_name; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
113 | CfgBool decrypt_properties; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
114 | |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
115 | CfgInt ssl_version; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
116 | CfgUInt authmethods; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
117 | |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
118 | int unknown_elements; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
119 | |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
120 | DavCfgRepository *prev; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
121 | DavCfgRepository *next; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
122 | }; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
123 | |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
124 | struct DavCfgProxy { |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
125 | CfgString url; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
126 | CfgString user; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
127 | CfgString password; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
128 | CfgString noproxy; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
129 | |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
130 | int unknown_elements; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
131 | }; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
132 | |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
133 | struct DavCfgKey { |
845
8ac8bf29e2ee
add cfg functions for modifying keys
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
838
diff
changeset
|
134 | xmlNode *node; |
8ac8bf29e2ee
add cfg functions for modifying keys
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
838
diff
changeset
|
135 | |
795
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
136 | CfgString name; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
137 | CfgString file; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
138 | DavCfgKeyType type; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
139 | xmlNode *type_node; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
140 | |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
141 | DavCfgKey *prev; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
142 | DavCfgKey *next; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
143 | |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
144 | int unknown_elements; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
145 | }; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
146 | |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
147 | struct DavCfgNamespace { |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
148 | xmlNode *node; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
149 | cxmutstr prefix; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
150 | cxmutstr uri; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
151 | |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
152 | DavCfgNamespace *prev; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
153 | DavCfgNamespace *next; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
154 | }; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
155 | |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
156 | struct DavCfgSecretStore { |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
157 | CfgString unlock_cmd; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
158 | CfgString lock_cmd; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
159 | }; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
160 | |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
161 | enum DavConfigError { |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
162 | DAV_CONFIG_ERROR_XML = 0 |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
163 | }; |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
164 | |
827
d9928f11970f
fix load_config stores wrong xml doc pointer in the config object
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
826
diff
changeset
|
165 | DavConfig* dav_config_new(xmlDoc *doc); |
826
b6e9fd3f1951
fix dav add-repo crash in case .dav/config.xml doesn't exist
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
823
diff
changeset
|
166 | |
795
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
167 | DavConfig* dav_config_load(cxmutstr xmlfilecontent, int *error); |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
168 | |
796
81e0f67386a6
remove old config loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
795
diff
changeset
|
169 | void dav_config_free(DavConfig *config); |
81e0f67386a6
remove old config loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
795
diff
changeset
|
170 | |
795
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
171 | CxBuffer* dav_config2buf(DavConfig *config); |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
172 | |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
173 | void dav_config_add_repository(DavConfig *config, DavCfgRepository *repo); |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
174 | |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
175 | DavCfgRepository* dav_repository_new(DavConfig *config); |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
176 | void dav_repository_free(DavConfig *config, DavCfgRepository *repo); |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
177 | void dav_repository_remove_and_free(DavConfig *config, DavCfgRepository *repo); |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
178 | int dav_repository_get_flags(DavCfgRepository *repo); |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
179 | void dav_repository_set_url(DavConfig *config, DavCfgRepository *repo, cxstring newurl); |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
180 | void dav_repository_set_auth(DavConfig *config, DavCfgRepository *repo, cxstring user, cxstring password); |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
181 | cxmutstr dav_repository_get_decodedpassword(DavCfgRepository *repo); |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
182 | |
845
8ac8bf29e2ee
add cfg functions for modifying keys
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
838
diff
changeset
|
183 | void dav_config_add_key(DavConfig *config, DavCfgKey *key); |
8ac8bf29e2ee
add cfg functions for modifying keys
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
838
diff
changeset
|
184 | |
8ac8bf29e2ee
add cfg functions for modifying keys
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
838
diff
changeset
|
185 | DavCfgKey* dav_key_new(DavConfig *config); |
8ac8bf29e2ee
add cfg functions for modifying keys
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
838
diff
changeset
|
186 | void dav_key_remove_and_free(DavConfig *config, DavCfgKey *key); |
8ac8bf29e2ee
add cfg functions for modifying keys
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
838
diff
changeset
|
187 | |
838
d262210f8454
move ssl version parser to new function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
837
diff
changeset
|
188 | int dav_str2ssl_version(const char *str); |
d262210f8454
move ssl version parser to new function
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
837
diff
changeset
|
189 | |
836
7842c7665cd0
add utility functions for setting CfgString/CfgBool values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
827
diff
changeset
|
190 | int dav_cfg_string_set_node_value(DavConfig *config, CfgString *str, xmlNode *node); |
7842c7665cd0
add utility functions for setting CfgString/CfgBool values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
827
diff
changeset
|
191 | void dav_cfg_bool_set_node_value(DavConfig *config, CfgBool *cbool, xmlNode *node); |
7842c7665cd0
add utility functions for setting CfgString/CfgBool values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
827
diff
changeset
|
192 | |
7842c7665cd0
add utility functions for setting CfgString/CfgBool values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
827
diff
changeset
|
193 | void dav_cfg_string_set_value(DavConfig *config, CfgString *str, xmlNode *parent, cxstring new_value, const char *nodename); |
7842c7665cd0
add utility functions for setting CfgString/CfgBool values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
827
diff
changeset
|
194 | void dav_cfg_bool_set_value(DavConfig *config, CfgBool *cbool, xmlNode *parent, DavBool new_value, const char *nodename); |
837
b5984d5cc40c
add utility functions for setting CfgInt/CfgUInt values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
836
diff
changeset
|
195 | void dav_cfg_int_set_value(DavConfig *config, CfgInt *cint, xmlNode *parent, int64_t new_value, const char *nodename); |
b5984d5cc40c
add utility functions for setting CfgInt/CfgUInt values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
836
diff
changeset
|
196 | void dav_cfg_uint_set_value(DavConfig *config, CfgUInt *cint, xmlNode *parent, uint64_t new_value, const char *nodename); |
836
7842c7665cd0
add utility functions for setting CfgString/CfgBool values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
827
diff
changeset
|
197 | |
7842c7665cd0
add utility functions for setting CfgString/CfgBool values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
827
diff
changeset
|
198 | void dav_cfg_string_remove(CfgString *str); |
7842c7665cd0
add utility functions for setting CfgString/CfgBool values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
827
diff
changeset
|
199 | void dav_cfg_bool_remove(CfgBool *cbool); |
837
b5984d5cc40c
add utility functions for setting CfgInt/CfgUInt values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
836
diff
changeset
|
200 | void dav_cfg_int_remove(CfgInt *cint); |
b5984d5cc40c
add utility functions for setting CfgInt/CfgUInt values
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
836
diff
changeset
|
201 | void dav_cfg_uint_remove(CfgUInt *cint); |
795
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
202 | |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
203 | DavCfgRepository* dav_config_get_repository(DavConfig *config, cxstring name); |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
204 | DavCfgRepository* dav_config_url2repo(DavConfig *config, const char *url, char **path); |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
205 | DavCfgRepository* dav_config_url2repo_s(DavConfig *config, cxstring url, cxmutstr *path); |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
206 | |
796
81e0f67386a6
remove old config loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
795
diff
changeset
|
207 | int dav_config_keytype(DavCfgKeyType type); |
845
8ac8bf29e2ee
add cfg functions for modifying keys
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
838
diff
changeset
|
208 | const char* dav_config_keytype_str(DavCfgKeyType type); |
796
81e0f67386a6
remove old config loader
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
795
diff
changeset
|
209 | int dav_config_register_keys(DavConfig *config, DavContext *ctx, dav_loadkeyfile_func loadkey); |
795
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
210 | |
823
04c60a353331
add configured namespaces to the dav context
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
796
diff
changeset
|
211 | int dav_config_register_namespaces(DavConfig *config, DavContext *ctx); |
04c60a353331
add configured namespaces to the dav context
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
796
diff
changeset
|
212 | |
795
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
213 | #ifdef __cplusplus |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
214 | } |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
215 | #endif |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
216 | |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
217 | #endif /* LIBIDAV_CONFIG_H */ |
05647e862a17
add new config parser
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
218 |