]> jfr.im git - irc/evilnet/x3.git/blobdiff - src/hosthiding.c
Couple of srvx updates.
[irc/evilnet/x3.git] / src / hosthiding.c
index 46c0f350377304207fd8321fb5714c47bb39f151..850cdaa8be401b2aab99c323882b9639af0f1883 100644 (file)
@@ -5,7 +5,7 @@
  *
  * x3 is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
@@ -227,10 +227,16 @@ make_virthost (char *curr, char *host, char *virt)
       snprintf(mask, HOSTLEN, "%x.%x.%s.%s.%s",
               hash[0], hash[1], parv2[parc2 - 3], parv2[parc2 - 2],
               parv2[parc2 - 1]);
-    } else {
+    } else if (parc2 >= 3) {
        snprintf(mask, HOSTLEN, "%x.%x.%s.%s",
                hash[0], hash[1], parv2[parc2 - 2],
                parv2[parc2 - 1]);
+    } else if (parc2 >= 2) {
+       snprintf(mask, HOSTLEN, "%x.%x.%s",
+               hash[0], hash[1], parv2[parc2 - 1]);
+    } else {
+       snprintf(mask, HOSTLEN, "%x.%x",
+               hash[0], hash[1]);
     }
   }
   safestrncpy (virt, mask, HOSTLEN);