From 837dcbb91472a4d4da413de841a733c1b52dfddf Mon Sep 17 00:00:00 2001 From: wessels <> Date: Thu, 11 Apr 1996 23:27:17 +0000 Subject: [PATCH] debugging and bugfixes --- src/acl.cc | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/acl.cc b/src/acl.cc index 2eb5d88cc2..51b8bb80c7 100644 --- a/src/acl.cc +++ b/src/acl.cc @@ -1,4 +1,4 @@ -#ident "$Id: acl.cc,v 1.4 1996/04/11 04:46:49 wessels Exp $" +#ident "$Id: acl.cc,v 1.5 1996/04/11 17:27:17 wessels Exp $" /* * DEBUG: Section 28 acl @@ -268,7 +268,7 @@ void aclParseAccessLine(line_in) t); a = aclFindByName(t); if (a == NULL) { - debug(28, 1, "aclParseAccessLine: ACL name '%s' not found.\n", t); + debug(28, 0, "aclParseAccessLine: ACL name '%s' not found.\n", t); xfree(L); continue; } @@ -276,6 +276,12 @@ void aclParseAccessLine(line_in) *Tail = L; Tail = &L->next; } + if (A->acl_list == NULL) { + debug(28,0,"aclParseAccessLine: Access line contains no ACL's, skipping\n"); + debug(28,0,"aclParseAccessLine: '%s'\n", line_in); + xfree(A); + return; + } A->cfgline = xstrdup(line_in); *AccessListTail = A; AccessListTail = &A->next; @@ -288,10 +294,15 @@ int aclMatchIp(data, c) struct in_addr h; while (data) { h.s_addr = c.s_addr & data->mask1.s_addr; - if (h.s_addr == data->addr1.s_addr) + debug(28,1,"aclMatchIp: h = %s\n", inet_ntoa(h)); + debug(28,1,"aclMatchIp: addr1 = %s\n", inet_ntoa(data->addr1)); + if (h.s_addr == data->addr1.s_addr) { + debug(28,1,"aclMatchIp: returning 1\n"); return 1; + } data = data->next; } + debug(28,1,"aclMatchIp: returning 0\n"); return 0; } @@ -312,7 +323,9 @@ int aclMatchRegex(data, word) relist *data; char *word; { + debug(28, 1, "aclMatchRegex: looking for '%s'\n", word); while (data) { + debug(28, 1, "aclMatchRegex: checking '%s'\n", data->pattern); if (regexec(&data->regex, word, 0, 0, 0) == 0) return 1; data = data->next; @@ -384,12 +397,15 @@ int aclMatchAclList(list, c, pr, h, po, r) int po; char *r; { - debug(28, 1, "aclMatchAclList: list=%p\n", list); + debug(28, 1, "aclMatchAclList: list=%p op=%d\n", list, list->op); while (list) { - if (aclMatchAcl(list->acl, c, pr, h, po, r) != list->op) + if (aclMatchAcl(list->acl, c, pr, h, po, r) != list->op) { + debug(28,1,"aclMatchAclList: returning 0\n"); return 0; + } list = list->next; } + debug(28,1,"aclMatchAclList: returning 1\n"); return 1; } -- 2.47.3