src/server/daemon/config.c

changeset 115
51d9a15eac98
parent 106
b122f34ddc80
child 129
fd324464f56f
equal deleted inserted replaced
114:c3a0f1275d71 115:51d9a15eac98
59 59
60 // TODO: Funktion für ConfigDirective -> directive 60 // TODO: Funktion für ConfigDirective -> directive
61 // TODO: Funktion für UcxList parameter list -> pblock 61 // TODO: Funktion für UcxList parameter list -> pblock
62 62
63 int load_init_conf(char *file) { 63 int load_init_conf(char *file) {
64 printf("load_init_conf\n"); 64 log_ereport(LOG_VERBOSE, "load_init_conf");
65 65
66 InitConfig *cfg = load_init_config(file); 66 InitConfig *cfg = load_init_config(file);
67 if(cfg == NULL) { 67 if(cfg == NULL) {
68 fprintf(stderr, "Cannot load init.conf\n"); 68 log_ereport(LOG_FAILURE, "Cannot load init.conf");
69 return 1; 69 return 1;
70 } 70 }
71 UcxAllocator *mp = cfg->parser.mp; 71 UcxAllocator *mp = cfg->parser.mp;
72 72
73 cfg_pool = pool_create(); // one pool for one Configuration 73 cfg_pool = pool_create(); // one pool for one Configuration
126 126
127 return 0; 127 return 0;
128 } 128 }
129 129
130 ServerConfiguration* load_server_conf(ServerConfiguration *old, char *file) { 130 ServerConfiguration* load_server_conf(ServerConfiguration *old, char *file) {
131 printf("load_server_conf\n"); 131 log_ereport(LOG_VERBOSE, "load_server_conf");
132 132
133 ServerConfig *serverconf = load_server_config(file); 133 ServerConfig *serverconf = load_server_config(file);
134 if(serverconf == NULL) { 134 if(serverconf == NULL) {
135 fprintf(stderr, "Cannot load server.conf\n"); 135 log_ereport(LOG_FAILURE, "Cannot load server.conf");
136 } 136 }
137 ServerConfiguration *serverconfig = calloc(1, sizeof(ServerConfiguration)); 137 ServerConfiguration *serverconfig = calloc(1, sizeof(ServerConfiguration));
138 serverconfig->ref = 1; 138 serverconfig->ref = 1;
139 serverconfig->pool = pool_create(); 139 serverconfig->pool = pool_create();
140 serverconfig->listeners = NULL; 140 serverconfig->listeners = NULL;
502 conf.bindpw = basepw.ptr; 502 conf.bindpw = basepw.ptr;
503 503
504 name = sstrdup(name); 504 name = sstrdup(name);
505 505
506 AuthDB *authdb = create_ldap_authdb(name.ptr, &conf); 506 AuthDB *authdb = create_ldap_authdb(name.ptr, &conf);
507 printf("authdb: %"PRIxPTR"\n", (intptr_t)authdb);
508 ucx_map_sstr_put(cfg->authdbs, name, authdb); 507 ucx_map_sstr_put(cfg->authdbs, name, authdb);
509 508
510 // TODO: create_ldap_authdb should copy the strings 509 // TODO: create_ldap_authdb should copy the strings
511 /* 510 /*
512 free(host.ptr); 511 free(host.ptr);
547 } 546 }
548 547
549 // add keyfile authdb 548 // add keyfile authdb
550 Keyfile *keyfile = f->data; 549 Keyfile *keyfile = f->data;
551 keyfile->authdb.name = sstrdup(name).ptr; 550 keyfile->authdb.name = sstrdup(name).ptr;
552 printf("authdb: %"PRIxPTR"\n", (intptr_t)keyfile);
553 ucx_map_sstr_put(cfg->authdbs, name, keyfile); 551 ucx_map_sstr_put(cfg->authdbs, name, keyfile);
554 } 552 }
555 553
556 return 0; 554 return 0;
557 } 555 }
714 pool_destroy(conf->pool); 712 pool_destroy(conf->pool);
715 } 713 }
716 } 714 }
717 715
718 HTTPObjectConfig* load_obj_conf(char *file) { 716 HTTPObjectConfig* load_obj_conf(char *file) {
719 printf("load_obj_conf\n"); 717 log_ereport(LOG_VERBOSE, "load_obj_conf");
720 718
721 // new conf function test 719 // new conf function test
722 ObjectConfig *cfg = load_object_config(file); 720 ObjectConfig *cfg = load_object_config(file);
723 UcxAllocator *mp = cfg->parser.mp; 721 UcxAllocator *mp = cfg->parser.mp;
724 if(cfg == NULL) { 722 if(cfg == NULL) {
861 859
862 ACLData *acldata = acl_data_new(); 860 ACLData *acldata = acl_data_new();
863 UCX_FOREACH(elm, aclfile->namedACLs) { 861 UCX_FOREACH(elm, aclfile->namedACLs) {
864 ACLConfig *ac = elm->data; 862 ACLConfig *ac = elm->data;
865 ACLList *acl = acl_config_convert(cfg, ac); 863 ACLList *acl = acl_config_convert(cfg, ac);
866 printf("put acl: %s\n", ac->id.ptr); 864 log_ereport(LOG_VERBOSE, "add acl: %.*s", (int)ac->id.length, ac->id.ptr);
867 ucx_map_sstr_put(acldata->namedACLs, ac->id, acl); 865 ucx_map_sstr_put(acldata->namedACLs, ac->id, acl);
868 } 866 }
869 free_acl_file(aclfile); 867 free_acl_file(aclfile);
870 868
871 ACLData *old_data = file->data; 869 ACLData *old_data = file->data;
885 acllist->acl.isextern = 0; 883 acllist->acl.isextern = 0;
886 acllist->ace = NULL; 884 acllist->ace = NULL;
887 acllist->ece = NULL; 885 acllist->ece = NULL;
888 886
889 if(acl->type.ptr && !sstrcmp(acl->type, sstr("fs"))) { 887 if(acl->type.ptr && !sstrcmp(acl->type, sstr("fs"))) {
890 printf("set acl to extern\n");
891 acllist->acl.isextern = 1; 888 acllist->acl.isextern = 1;
892 } 889 }
893 890
894 size_t s = ucx_list_size(acl->entries); 891 size_t s = ucx_list_size(acl->entries);
895 WSAce **aces = calloc(s, sizeof(WSAce*)); 892 WSAce **aces = calloc(s, sizeof(WSAce*));

mercurial