[srvx-commits] commit: Fix glob matching against IPs
Brought to you by:
entrope
From: Michael P. <md...@tr...> - 2004-10-16 21:14:41
|
Revision: srvx--devo--1.3--patch-82 Archive: sr...@sr...--2004-srvx Creator: Michael Poole <md...@tr...> Date: Sat Oct 16 17:14:11 EDT 2004 Standard-date: 2004-10-16 21:14:11 GMT Modified-files: ChangeLog src/tools.c New-patches: sr...@sr...--2004-srvx/srvx--devo--1.3--patch-82 Summary: Fix glob matching against IPs Keywords: Do not require the first character in an IP glob to be a digit. If an IP-looking glob does not match, fall through to the other host matching rules, in case the IP-looking glob really matches their hostname. * added files {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2004-srvx/patch-log/patch-82 * modified files --- orig/ChangeLog +++ mod/ChangeLog @@ -2,6 +2,21 @@ # arch-tag: aut...@sr...--2004-srvx/srvx--devo--1.3 # +2004-10-16 21:14:11 GMT Michael Poole <md...@tr...> patch-82 + + Summary: + Fix glob matching against IPs + Revision: + srvx--devo--1.3--patch-82 + + Do not require the first character in an IP glob to be a digit. If an + IP-looking glob does not match, fall through to the other host matching + rules, in case the IP-looking glob really matches their hostname. + + modified files: + ChangeLog src/tools.c + + 2004-09-15 04:14:14 GMT adam <ad...@ga...> patch-81 Summary: --- orig/src/tools.c +++ mod/src/tools.c @@ -334,22 +334,22 @@ if (!match_ircglob(user->ident, glob)) return 0; glob = marker + 1; - /* Now check the host part */ - if (isdigit(*glob) && !glob[strspn(glob, "0123456789./*?")]) { - /* Looks like an IP-based mask */ - return match_ircglob(inet_ntoa(user->ip), glob); - } else { - /* The host part of the mask isn't IP-based */ - if (IsFakeHost(user) && match_ircglob(user->fakehost, glob)) + /* If it might be an IP glob, test that. */ + if (!glob[strspn(glob, "0123456789./*?")] + && match_ircglob(inet_ntoa(user->ip), glob)) + return 1; + /* Check for a fakehost match. */ + if (IsFakeHost(user) && match_ircglob(user->fakehost, glob)) + return 1; + /* Check for an account match. */ + if (hidden_host_suffix && user->handle_info) { + char hidden_host[HOSTLEN+1]; + snprintf(hidden_host, sizeof(hidden_host), "%s.%s", user->handle_info->handle, hidden_host_suffix); + if (match_ircglob(hidden_host, glob)) return 1; - if (hidden_host_suffix && user->handle_info) { - char hidden_host[HOSTLEN+1]; - snprintf(hidden_host, sizeof(hidden_host), "%s.%s", user->handle_info->handle, hidden_host_suffix); - if (match_ircglob(hidden_host, glob)) - return 1; - } - return match_ircglob(user->hostname, glob); } + /* None of the above; could only be a hostname match. */ + return match_ircglob(user->hostname, glob); } int |