]> jfr.im git - irc/quakenet/newserv.git/commitdiff
Allow nested CIDRs with different masks.
authorGunnar Beutner <redacted>
Wed, 9 Oct 2013 07:55:01 +0000 (09:55 +0200)
committerGunnar Beutner <redacted>
Wed, 9 Oct 2013 07:55:01 +0000 (09:55 +0200)
trusts/trusts_management.c

index 4520fb5af633f09ff8db9a03bc1d3d0d6e2c89ca..8d8311b3719fdb220c3657934e37cee60296c11c 100644 (file)
@@ -69,14 +69,14 @@ static int trusts_cmdtrustadd(void *source, int cargc, char **cargv) {
   /* OKAY! Lots of checking here!
    *
    * Need to check:
-   *   - host isn't already covered by given group (reject if it is)
+   *   - exact same host isn't already covered by given group (reject if it is)
    *   - host doesn't already exist exactly already (reject if it does)
    *   - host is more specific than an existing one (warn if it is, fix up later)
    *   - host is less specific than an existing one (warn if it is, don't need to do anything special)
    */
 
   for(th=tg->hosts;th;th=th->next) {
-    if(ipmask_check(&ip, &th->ip, th->bits)) {
+    if(ipmask_check(&ip, &th->ip, th->bits) && th->bits == bits) {
       controlreply(sender, "This host (or part of it) is already covered in the given group.");
       return CMD_ERROR;
     }