]> jfr.im git - irc/quakenet/snircd-patchqueue.git/commitdiff
welcome: check the length of the message and throw warning to user when too long
authorwiebe <redacted>
Tue, 6 Apr 2010 12:17:22 +0000 (14:17 +0200)
committerwiebe <redacted>
Tue, 6 Apr 2010 12:17:22 +0000 (14:17 +0200)
welcome.patch

index 5a9c097c5e5bcf3916ce53389dd552be09fcc461..d2931823e8fdec0561f568070815be1da0da5881 100644 (file)
@@ -771,7 +771,7 @@ diff -r a9b437e961ec ircd/s_user.c
 diff -r a9b437e961ec ircd/welcome.c
 --- /dev/null
 +++ b/ircd/welcome.c
-@@ -0,0 +1,581 @@
+@@ -0,0 +1,592 @@
 +/*
 + * IRC - Internet Relay Chat, ircd/welcome.c
 + * Copyright (C) 1990 Jarkko Oikarinen and
@@ -1137,6 +1137,17 @@ diff -r a9b437e961ec ircd/welcome.c
 +    return 0;
 +  }
 +
++  /* source is user, and is myuser or welcome is local, check length of the message */
++  if ((IsUser(sptr)) && ((MyUser(sptr)) || (flags & WELCOME_LOCAL)) && (strlen(text) > WELCOMELEN)) {
++    sendcmdto_one(&me, CMD_NOTICE, sptr,
++      "%C :WELCOME: The message is too long with %d chars - max is %d chars",
++      sptr, strlen(text), WELCOMELEN);
++    ircd_strncpy(text, text, WELCOMELEN);
++    sendcmdto_one(&me, CMD_NOTICE, sptr,
++      "%C :WELCOME: Change or trunacte the message to: \"%s\"", sptr, text);
++    return 0;
++  }
++
 +  /* correct namearray for local offset */
 +  if (flags & WELCOME_LOCAL)
 +    namearray += WELCOME_MAX_ENTRIES;