From 0fa385835eeba6215b449339d01efa68f9e29008 Mon Sep 17 00:00:00 2001 From: wessels <> Date: Tue, 4 May 1999 23:40:09 +0000 Subject: [PATCH] bad domain matching diagnostic --- src/acl.cc | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/src/acl.cc b/src/acl.cc index 2d578c3d13..1f3e5dec35 100644 --- a/src/acl.cc +++ b/src/acl.cc @@ -1,6 +1,6 @@ /* - * $Id: acl.cc,v 1.202 1999/04/26 21:04:39 wessels Exp $ + * $Id: acl.cc,v 1.203 1999/05/04 17:40:09 wessels Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -1889,21 +1889,33 @@ aclDomainCompare(const void *data, splayNode * n) { const char *d1 = data; const char *d2 = n->data; - int l1 = strlen(d1); - int l2 = strlen(d2); + int l1; + int l2; + while ('.' == *d1) + d1++; + while ('.' == *d2) + d2++; + l1 = strlen(d1); + l2 = strlen(d2); while (d1[l1] == d2[l2]) { if ((l1 == 0) && (l2 == 0)) return 0; /* d1 == d2 */ - if (l1-- == 0) { - debug(28, 0) ("WARNING: %s is a subdomain of %s\n", d1, d2); - debug(28, 0) ("WARNING: This may break Splay tree searching\n"); - debug(28, 0) ("WARNING: You should remove '%s' from the ACL named '%s'\n", d2, AclMatchedName); + l1--; + l2--; + if (0 == l1) { + if ('.' == d2[l2 - 1]) { + debug(28, 0) ("WARNING: %s is a subdomain of %s\n", d1, d2); + debug(28, 0) ("WARNING: This may break Splay tree searching\n"); + debug(28, 0) ("WARNING: You should remove '%s' from the ACL named '%s'\n", d2, AclMatchedName); + } return -1; /* d1 < d2 */ } - if (l2-- == 0) { - debug(28, 0) ("WARNING: %s is a subdomain of %s\n", d2, d1); - debug(28, 0) ("WARNING: This may break Splay tree searching\n"); - debug(28, 0) ("WARNING: You should remove '%s' from the ACL named '%s'\n", d1, AclMatchedName); + if (0 == l2) { + if ('.' == d1[l1 - 1]) { + debug(28, 0) ("WARNING: %s is a subdomain of %s\n", d2, d1); + debug(28, 0) ("WARNING: This may break Splay tree searching\n"); + debug(28, 0) ("WARNING: You should remove '%s' from the ACL named '%s'\n", d1, AclMatchedName); + } return 1; /* d1 > d2 */ } } -- 2.47.3