]> jfr.im git - irc/quakenet/newserv.git/commitdiff
Make patrol_isip() use ipmask_parse().
authorGunnar Beutner <redacted>
Sat, 8 Feb 2014 07:44:51 +0000 (08:44 +0100)
committerGunnar Beutner <redacted>
Sat, 8 Feb 2014 07:44:51 +0000 (08:44 +0100)
patrol/patrol.c

index b40c37e2300011e89a1167b95b6ab51234419915..a69961981c61157649ccd923e69fb0c389451c6a 100644 (file)
@@ -44,19 +44,10 @@ host *patrol_selecthost(void) {
 }
 
 int patrol_isip(char *host) {
-  char *p = host, components = 0, length = 0;
+  struct irc_in_addr ip;
+  unsigned char bits;
 
-  for (; *p; p++) {
-    if (*p == '.') {
-      if (((!length) || (length = 0)) || (++components > 3))
-        return 0;
-    } else {
-      if ((++length > 3) || !isdigit(*p))
-        return 0;
-    }
-  }
-
-  return components == 3;
+  return (ipmask_parse(host, &ip, &bits));
 }
 
 static int specialuseronhost(host *hp) {