249 |
249 |
250 void cfg_unref(ServerConfiguration *cfg) { |
250 void cfg_unref(ServerConfiguration *cfg) { |
251 uint32_t ref = ws_atomic_dec32(&cfg->ref); |
251 uint32_t ref = ws_atomic_dec32(&cfg->ref); |
252 if(ref == 0) { |
252 if(ref == 0) { |
253 // TODO: free configuration |
253 // TODO: free configuration |
254 printf("free ServerConfiguration %d\n", cfg); |
254 printf("free ServerConfiguration %"PRIxPTR"\n", (intptr_t)cfg); |
255 } |
255 } |
256 } |
256 } |
257 |
257 |
258 |
258 |
259 void init_server_config_parser() { |
259 void init_server_config_parser() { |
460 conf.bindpw = basepw.ptr; |
460 conf.bindpw = basepw.ptr; |
461 |
461 |
462 name = sstrdup(name); |
462 name = sstrdup(name); |
463 |
463 |
464 AuthDB *authdb = create_ldap_authdb(name.ptr, &conf); |
464 AuthDB *authdb = create_ldap_authdb(name.ptr, &conf); |
465 printf("authdb: %d\n", authdb); |
465 printf("authdb: %"PRIxPTR"\n", (intptr_t)authdb); |
466 ucx_map_sstr_put(cfg->authdbs, name, authdb); |
466 ucx_map_sstr_put(cfg->authdbs, name, authdb); |
467 |
467 |
468 // TODO: create_ldap_authdb should copy the strings |
468 // TODO: create_ldap_authdb should copy the strings |
469 /* |
469 /* |
470 free(host.ptr); |
470 free(host.ptr); |
504 } |
504 } |
505 |
505 |
506 // add keyfile authdb |
506 // add keyfile authdb |
507 Keyfile *keyfile = f->data; |
507 Keyfile *keyfile = f->data; |
508 keyfile->authdb.name = sstrdup(name).ptr; |
508 keyfile->authdb.name = sstrdup(name).ptr; |
509 printf("authdb: %d\n", keyfile); |
509 printf("authdb: %"PRIxPTR"\n", (intptr_t)keyfile); |
510 ucx_map_sstr_put(cfg->authdbs, name, keyfile); |
510 ucx_map_sstr_put(cfg->authdbs, name, keyfile); |
511 } |
511 } |
512 |
512 |
513 return 0; |
513 return 0; |
514 } |
514 } |
639 } |
639 } |
640 |
640 |
641 void object_conf_unref(HTTPObjectConfig *conf) { |
641 void object_conf_unref(HTTPObjectConfig *conf) { |
642 uint32_t ref = ws_atomic_dec32(&conf->ref); |
642 uint32_t ref = ws_atomic_dec32(&conf->ref); |
643 if(ref == 0) { |
643 if(ref == 0) { |
644 printf("free HTTPObjectConfig %x\n", conf); |
644 printf("free HTTPObjectConfig %"PRIxPTR"\n", (intptr_t)conf); |
645 pool_destroy(conf->pool); |
645 pool_destroy(conf->pool); |
646 } |
646 } |
647 } |
647 } |
648 |
648 |
649 HTTPObjectConfig* load_obj_conf(char *file) { |
649 HTTPObjectConfig* load_obj_conf(char *file) { |
768 } |
768 } |
769 |
769 |
770 void mime_conf_unref(MimeMap *conf) { |
770 void mime_conf_unref(MimeMap *conf) { |
771 uint32_t ref = ws_atomic_dec32(&conf->ref); |
771 uint32_t ref = ws_atomic_dec32(&conf->ref); |
772 if(ref == 0) { |
772 if(ref == 0) { |
773 printf("free MimeConfig %x\n", conf); |
773 printf("free MimeConfig %"PRIxPTR"\n", (intptr_t)conf); |
774 UcxMapIterator i = ucx_map_iterator(conf->map); |
774 UcxMapIterator i = ucx_map_iterator(conf->map); |
775 char *str; |
775 char *str; |
776 UCX_MAP_FOREACH(str, i) { |
776 UCX_MAP_FOREACH(str, i) { |
777 free(str); |
777 free(str); |
778 } |
778 } |