]> jfr.im git - irc/quakenet/newserv.git/blobdiff - glines/glines_formats.c
Merge branch 'master' into chanserv-live
[irc/quakenet/newserv.git] / glines / glines_formats.c
index c47063ecfdb8aa3db89656ee4d7667d4323d415a..6a1649fc7dcc962cdd80f29df842926b764cb6a7 100644 (file)
@@ -81,19 +81,16 @@ gline *makegline(const char *mask) {
     }
 
     gl->flags |= GLINE_REALNAME;
-    gl->user = getsstring(mask + 2, REALLEN);
+
+    if (strcmp(mask + 2, "*") != 0)
+      gl->user = getsstring(mask + 2, REALLEN);
+
     return gl;
   }
 
   strncpy(dupmask, mask, sizeof(dupmask));
   canon_userhost(dupmask, &nick, &user, &host, "*");
 
-  /* Make sure it's not too long */
-  if (strlen(nick) + strlen(user) + strlen(host) > NICKLEN + USERLEN + HOSTLEN) {
-    freegline(gl);
-    return NULL;
-  }
-
   if (ipmask_parse(host, &gl->ip, &gl->bits))
     gl->flags |= GLINE_IPMASK;
   else
@@ -107,7 +104,7 @@ gline *makegline(const char *mask) {
       count++;
 
   if (count >= 8) {
-    controlwall(NO_OPER, NL_GLINES, "Warning: Parsed invalid IPv6 G-Line: %s", mask);
+    controlwall(NO_OPER, NL_GLINES_AUTO, "Warning: Parsed invalid IPv6 G-Line: %s", mask);
     freegline(gl);
     return NULL;
   }
@@ -128,11 +125,7 @@ char *glinetostring(gline *gl) {
   static char mask[512]; /* check */
 
   if (gl->flags & GLINE_REALNAME) {
-   if (gl->user)
-     snprintf(mask, sizeof(mask), "$R%s", gl->user->content);
-   else
-     strncpy(mask, "$R*", sizeof(mask));
-
+   snprintf(mask, sizeof(mask), "$R%s", (gl->user) ? gl->user->content : "*");
    return mask;
   }