diff -r 279f343bbf6c -r fac51f87def0 src/server/config/acl.c --- a/src/server/config/acl.c Wed Jul 31 13:02:06 2013 +0200 +++ b/src/server/config/acl.c Sun Sep 08 23:27:07 2013 +0200 @@ -28,6 +28,7 @@ #include #include +#include #include "acl.h" @@ -44,10 +45,6 @@ conf->pathACLs = NULL; int r = cfg_parse_basic_file((ConfigParser*)conf, in); - UcxMempool *mp = conf->parser.mp; - cfg_list_destr(mp, conf->namedACLs); - cfg_list_destr(mp, conf->uriACLs); - cfg_list_destr(mp, conf->pathACLs); if(r != 0) { free_acl_file(conf); return NULL; @@ -59,15 +56,15 @@ } void free_acl_file(ACLFile *conf) { - ucx_mempool_destroy(conf->parser.mp); + ucx_mempool_destroy(conf->parser.mp->pool); free(conf); } int acl_parse(void *p, ConfigLine *begin, ConfigLine *end, sstr_t line) { ACLFile *aclf = p; - UcxMempool *mp = aclf->parser.mp; + UcxAllocator *mp = aclf->parser.mp; - if(sstr_startswith(line, sstr("ACL "))) { + if(sstrsuffix(line, sstr("ACL "))) { sstr_t param = sstrsubs(line, 4); UcxList *plist = cfg_param_list(param, mp); ACLConfig *acl = OBJ_NEW(mp, ACLConfig); @@ -83,19 +80,19 @@ if(name.ptr) { acl->id = name; - aclf->namedACLs = ucx_list_append(aclf->namedACLs, acl); + aclf->namedACLs = ucx_list_append_a(mp, aclf->namedACLs, acl); } else if(path.ptr) { acl->id = path; - aclf->pathACLs = ucx_list_append(aclf->pathACLs, acl); + aclf->pathACLs = ucx_list_append_a(mp, aclf->pathACLs, acl); } else if(uri.ptr) { acl->id = uri; - aclf->uriACLs = ucx_list_append(aclf->uriACLs, acl); + aclf->uriACLs = ucx_list_append_a(mp, aclf->uriACLs, acl); } if(type.ptr) { acl->type = type; } - } else if(sstr_startswith(line, sstr("Authenticate "))) { + } else if(sstrsuffix(line, sstr("Authenticate "))) { sstr_t param = sstrsubs(line, 13); UcxList *plist = cfg_param_list(param, mp); aclf->cur->authparam = plist; @@ -111,7 +108,7 @@ int parse_ace(ACLFile *f, sstr_t line) { ACLConfig *cur = f->cur; - UcxMempool *mp = f->parser.mp; + UcxAllocator *mp = f->parser.mp; size_t tkn = 0; sstr_t *tk = sstrsplit(line, sstr(":"), &tkn); @@ -133,12 +130,12 @@ // next token is the user name s = tk[1]; n++; - ace->who = sstrdup_mp(mp, s); + ace->who = sstrdup_a(mp, s); } else if(!sstrcmp(s, sstr("group"))) { // next token is the group name s = tk[1]; n++; - ace->who = sstrdup_mp(mp, s); + ace->who = sstrdup_a(mp, s); ace->flags = ACLCFG_IDENTIFIER_GROUP; } else if(!sstrcmp(s, sstr("owner@"))) { ace->flags = ACLCFG_OWNER; @@ -148,7 +145,7 @@ ace->flags = ACLCFG_EVERYONE; } else { // you can specify only the user name in the ace - ace->who = sstrdup_mp(mp, s); + ace->who = sstrdup_a(mp, s); } n++; //next token @@ -219,7 +216,7 @@ return 1; } - cur->entries = ucx_list_append(cur->entries, ace); + cur->entries = ucx_list_append_a(mp, cur->entries, ace); return 0; }