#ifndef SQUID_ACLDENYINFOLIST_H_
#define SQUID_ACLDENYINFOLIST_H_
-#include "acl/AclNameList.h"
+#include "acl/forward.h"
#include "err_type.h"
#include "errorpage.h"
#include "mem/forward.h"
}
~AclDenyInfoList() {
xfree(err_page_name);
- delete acl_list;
while (next) {
auto *a = next;
next = a->next;
}
err_type err_page_id = ERR_NONE;
char *err_page_name = nullptr;
- AclNameList *acl_list = nullptr;
+ SBufList acl_list; ///< ACL names in configured order
AclDenyInfoList *next = nullptr;
};
+++ /dev/null
-/*
- * Copyright (C) 1996-2018 The Squid Software Foundation and contributors
- *
- * Squid software is distributed under GPLv2+ license and includes
- * contributions from numerous individuals and organizations.
- * Please see the COPYING and CONTRIBUTORS files for details.
- */
-
-#ifndef SQUID_ACL_ACLNAMELIST_H_
-#define SQUID_ACL_ACLNAMELIST_H_
-
-#include "acl/forward.h"
-#include "mem/forward.h"
-
-/// list of name-based ACLs
-class AclNameList
-{
- MEMPROXY_CLASS(AclNameList);
-
-public:
- AclNameList(const char *t) {
- xstrncpy(name, t, ACL_NAME_SZ-1);
- }
- ~AclNameList() {
- // recursion is okay, these lists are short
- delete next;
- }
-
- char name[ACL_NAME_SZ];
- AclNameList *next = nullptr;
-};
-// TODO: convert to a std::list<string>
-
-#endif /* SQUID_ACLNAMELIST_H_ */
-
debugs(28, 8, HERE << "got called for " << name);
for (A = *head; A; A = A->next) {
- AclNameList *L = NULL;
-
if (!redirect_allowed && strchr(A->err_page_name, ':') ) {
debugs(28, 8, HERE << "Skip '" << A->err_page_name << "' 30x redirects not allowed as response here.");
continue;
}
- for (L = A->acl_list; L; L = L->next) {
- if (!strcmp(name, L->name)) {
- debugs(28, 8, HERE << "match on " << name);
+ for (const auto &aclName: A->acl_list) {
+ if (aclName.cmp(name) == 0) {
+ debugs(28, 8, "match on " << name);
return A->err_page_id;
}
-
}
}
char *t = NULL;
AclDenyInfoList *B;
AclDenyInfoList **T;
- AclNameList *L = NULL;
- AclNameList **Tail = NULL;
/* first expect a page name */
AclDenyInfoList *A = new AclDenyInfoList(t);
/* next expect a list of ACL names */
- Tail = &A->acl_list;
-
while ((t = ConfigParser::NextToken())) {
- L = new AclNameList(t);
- *Tail = L;
- Tail = &L->next;
+ A->acl_list.emplace_back(t);
}
- if (A->acl_list == NULL) {
+ if (A->acl_list.empty()) {
debugs(28, DBG_CRITICAL, "aclParseDenyInfoLine: " << cfg_filename << " line " << config_lineno << ": " << config_input_line);
debugs(28, DBG_CRITICAL, "aclParseDenyInfoLine: deny_info line contains no ACL's, skipping");
delete A;
{
AclDenyInfoList *a = NULL;
AclDenyInfoList *a_next = NULL;
- AclNameList *l = NULL;
- AclNameList *l_next = NULL;
debugs(28, 8, "aclDestroyDenyInfoList: invoked");
for (a = *list; a; a = a_next) {
- for (l = a->acl_list; l; l = l_next) {
- l_next = l->next;
- safe_free(l);
- }
-
a_next = a->next;
delete a;
}
while (var != NULL) {
storeAppendPrintf(entry, "%s %s", name, var->err_page_name);
- for (auto *a = var->acl_list; a != NULL; a = a->next)
- storeAppendPrintf(entry, " %s", a->name);
+ for (const auto &aclName: var->acl_list)
+ storeAppendPrintf(entry, " " SQUIDSBUFPH, SQUIDSBUFPRINT(aclName));
storeAppendPrintf(entry, "\n");