From c5ff590650307a4259da459e78b34aa1eb72dd7c Mon Sep 17 00:00:00 2001 From: Karl Ramm Date: Sun, 27 Oct 2013 12:38:47 -0400 Subject: The logging is too chatty and the control flow is too incomprehensible --- server/acl_files.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/server/acl_files.c b/server/acl_files.c index 346abb7..9f67fd7 100644 --- a/server/acl_files.c +++ b/server/acl_files.c @@ -351,32 +351,25 @@ acl_check(char *acl, char *princ, struct sockaddr_in *who) { char *realm; char *name; - int result = -1; + int result = 0; if (princ) { name = strdup(princ); realm = split_name(name); if (acl_match(acl, name, realm, 1)) - result = 0; - else if (acl_match(acl, name, realm, 0)) + return 0; + if (acl_match(acl, name, realm, 0)) result = 1; free(name); } - if (who && result != 0) { + if (who) { if (acl_host_match(acl, who->sin_addr.s_addr, 1)) - result = 0; - else if (acl_host_match(acl, who->sin_addr.s_addr, 0)) + return 0; + if (acl_host_match(acl, who->sin_addr.s_addr, 0)) result = 1; } - if (result == -1) - result = 0; - - syslog(LOG_DEBUG, "acl_check(%s, %s, %s) = %d", acl, - princ ? princ : "NONE", who ? inet_ntoa(who->sin_addr) : "NONE", - result); - return result; } -- cgit v1.2.3