dav/scfg.c

changeset 522
46f96dcd6eab
parent 521
c5bbae4b3cca
child 523
923a4528a2ae
equal deleted inserted replaced
521:c5bbae4b3cca 522:46f96dcd6eab
34 #include <ucx/map.h> 34 #include <ucx/map.h>
35 #include <ucx/utils.h> 35 #include <ucx/utils.h>
36 36
37 #include "scfg.h" 37 #include "scfg.h"
38 #include "config.h" 38 #include "config.h"
39 #include "finfo.h"
39 40
40 #define xstreq(a,b) xmlStrEqual(BAD_CAST a, BAD_CAST b) 41 #define xstreq(a,b) xmlStrEqual(BAD_CAST a, BAD_CAST b)
41 42
42 43
43 #define print_error(lineno, ...) \ 44 #define print_error(lineno, ...) \
304 | SYNC_CMD_ARCHIVE | SYNC_CMD_RESTORE; 305 | SYNC_CMD_ARCHIVE | SYNC_CMD_RESTORE;
305 bool backuppull = false; 306 bool backuppull = false;
306 bool lockpull = false; 307 bool lockpull = false;
307 bool lockpush = false; 308 bool lockpush = false;
308 time_t lock_timeout = 0; 309 time_t lock_timeout = 0;
310 uint32_t metadata = 0;
309 311
310 unsigned short parentlineno = node->line; 312 unsigned short parentlineno = node->line;
311 node = node->children; 313 node = node->children;
312 while(node) { 314 while(node) {
313 if(node->type == XML_ELEMENT_NODE) { 315 if(node->type == XML_ELEMENT_NODE) {
338 } 340 }
339 } else if(xstreq(node->name, "database")) { 341 } else if(xstreq(node->name, "database")) {
340 database = value; 342 database = value;
341 } else if(xstreq(node->name, "tagconfig")) { 343 } else if(xstreq(node->name, "tagconfig")) {
342 tagconfig = parse_tagconfig(node); 344 tagconfig = parse_tagconfig(node);
345 } else if(xstreq(node->name, "metadata")) {
346 char *error = NULL;
347 metadata = parse_finfo(value, &error);
348 if(error) {
349 print_error(node->line, "unknown metadata: %s\n", error);
350 free(error);
351 }
343 } else if(xstreq(node->name, "versioning")) { 352 } else if(xstreq(node->name, "versioning")) {
344 versioning = parse_versioning_config(node); 353 versioning = parse_versioning_config(node);
345 } else if(xstreq(node->name, "max-retry")) { 354 } else if(xstreq(node->name, "max-retry")) {
346 int64_t i; 355 int64_t i;
347 if(util_strtoint(value, &i) && i >= 0) { 356 if(util_strtoint(value, &i) && i >= 0) {
425 dir->allow_cmd = allow_cmd; 434 dir->allow_cmd = allow_cmd;
426 dir->backuppull = backuppull; 435 dir->backuppull = backuppull;
427 dir->lockpull = lockpull; 436 dir->lockpull = lockpull;
428 dir->lockpush = lockpush; 437 dir->lockpush = lockpush;
429 dir->lock_timeout = lock_timeout; 438 dir->lock_timeout = lock_timeout;
439 dir->metadata = metadata;
440 if(metadata & FINFO_MODE == FINFO_MODE) {
441 dir->db_settings = DB_STORE_MODE;
442 }
443 if(metadata & FINFO_OWNER == FINFO_OWNER) {
444 dir->db_settings |= DB_STORE_OWNER;
445 }
446
430 if (include) { 447 if (include) {
431 dir->include = include; 448 dir->include = include;
432 } else { 449 } else {
433 regex_t *matchall = malloc(sizeof(regex_t)); 450 regex_t *matchall = malloc(sizeof(regex_t));
434 regcomp(matchall, ".*", REG_NOSUB); 451 regcomp(matchall, ".*", REG_NOSUB);

mercurial