More title host checking
authorZoot <zoot@gamesurge.net>
Thu, 12 Aug 2004 16:06:55 +0000 (16:06 +0000)
committerZoot <zoot@gamesurge.net>
Thu, 12 Aug 2004 16:06:55 +0000 (16:06 +0000)
 * src/nickserv.c: Make oset title verify that the final combined fakehost
   will not be truncated before storing the title. Also, supply a missing
   format string argument.
git-archimport-id: srvx@srvx.net--2004-srvx/srvx--devo--1.3--patch-77

ChangeLog
src/nickserv.c

index 42183876285d9393b0c064bc0ff21bcd6477275e..d48ffe0db21fd12ea78c2d09e7068bcff5fc9fc1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,21 @@
 # arch-tag: automatic-ChangeLog--srvx@srvx.net--2004-srvx/srvx--devo--1.3
 #
 
+2004-08-12 16:06:55 GMT        Zoot <zoot@gamesurge.net>       patch-77
+
+    Summary:
+      More title host checking
+    Revision:
+      srvx--devo--1.3--patch-77
+
+     * src/nickserv.c: Make oset title verify that the final combined fakehost
+       will not be truncated before storing the title. Also, supply a missing
+       format string argument.
+
+    modified files:
+     ChangeLog src/nickserv.c
+
+
 2004-08-08 17:42:01 GMT        Zoot <zoot@gamesurge.net>       patch-76
 
     Summary:
index 2288d115f4e3af4bdf0e32e720f6e6696b3f9a21..d48ecab68393043229808f5bc0c5dc8c9bcbb6ac 100644 (file)
@@ -179,6 +179,7 @@ static const struct message_entry msgtab[] = {
     { "NSMSG_STAMPED_RESETPASS", "You have already authenticated to an account once this session; you may not reset your password to authenticate again." },
     { "NSMSG_STAMPED_AUTHCOOKIE",  "You have already authenticated to an account once this session; you may not use a cookie to authenticate to another account." },
     { "NSMSG_TITLE_INVALID", "Titles cannot contain any dots; please choose another." },
+    { "NSMSG_TITLE_TRUNCATED", "That title combined with the user's account name would result in a truncated host; please choose a shorter title." },
     { "NSMSG_FAKEHOST_INVALID", "Fake hosts must be shorter than %d characters and cannot start with a dot." },
     { "NSMSG_HANDLEINFO_ON", "Account information for $b%s$b:" },
     { "NSMSG_HANDLEINFO_ID", "  Account ID: %lu" },
@@ -2443,6 +2444,12 @@ static OPTION_FUNC(opt_title)
             send_message(user, nickserv, "NSMSG_TITLE_INVALID");
             return 0;
         }
+        if ((strlen(user->handle_info->handle) + strlen(title) +
+             strlen(nickserv_conf.titlehost_suffix) + 2) > HOSTLEN) {
+            send_message(user, nickserv, "NSMSG_TITLE_TRUNCATED");
+            return 0;
+        }
+
         free(hi->fakehost);
         if (!strcmp(title, "*")) {
             hi->fakehost = NULL;
@@ -2474,7 +2481,7 @@ static OPTION_FUNC(opt_fakehost)
     if ((argc > 1) && oper_has_access(user, nickserv, nickserv_conf.set_fakehost_level, 0)) {
         fake = argv[1];
         if ((strlen(fake) > HOSTLEN) || (fake[0] == '.')) {
-            send_message(user, nickserv, "NSMSG_FAKEHOST_INVALID");
+            send_message(user, nickserv, "NSMSG_FAKEHOST_INVALID", HOSTLEN);
             return 0;
         }
         free(hi->fakehost);