Sun, 23 Nov 2025 14:59:52 +0100
implement Location AddACL directive
| src/server/daemon/location.c | file | annotate | diff | comparison | revisions |
--- a/src/server/daemon/location.c Sun Nov 23 13:48:29 2025 +0100 +++ b/src/server/daemon/location.c Sun Nov 23 14:59:52 2025 +0100 @@ -33,6 +33,7 @@ #include "../util/pblock.h" #include "vserver.h" #include <cx/linked_list.h> +#include <cx/array_list.h> #define DIR_CHECK_ARGC(n) if(argc != n) { \ log_ereport(LOG_FAILURE, "%s directive argc != %d", name.ptr, n); \ @@ -57,6 +58,19 @@ } else if(!cx_strcasecmp(name, "DocumentRoot")) { DIR_CHECK_ARGC(1); location->config.docroot = cx_strdup_a(a, dir->args->value); + } else if(!cx_strcasecmp(name, "AddACL")) { + DIR_CHECK_ARGC(1); + if(!location->config.acls) { + CxList *aclList = cxLinkedListCreate(cfg->a, NULL, CX_STORE_POINTERS); + if(!aclList) { + return 1; + } + location->config.acls = aclList; + cxmutstr aclName = dir->args->value; + if(cxListAdd(aclList, aclName.ptr)) { + return 1; + } + } } else if(!cx_strcasecmp(name, "Location")) { WSLocation *sub_location = cfg_location_get(cfg, dir); if(!sub_location) {