X-Git-Url: https://jfr.im/git/irc/evilnet/x3.git/blobdiff_plain/d0cb2fb607f90029d877b558437f647c9fa38a77..b3076f1675cc9f0761035f5a36e22327ca8904d9:/src/nickserv.c diff --git a/src/nickserv.c b/src/nickserv.c index 630ef2e..e776634 100644 --- a/src/nickserv.c +++ b/src/nickserv.c @@ -180,6 +180,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" }, @@ -2455,6 +2456,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; @@ -2486,7 +2493,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); @@ -2607,7 +2614,7 @@ static NICKSERV_FUNC(cmd_ounregister) if (!(hi = get_victim_oper(user, argv[1]))) return 0; nickserv_unregister_handle(hi, user); - return 0; + return 1; } static NICKSERV_FUNC(cmd_status) @@ -3842,7 +3849,8 @@ init_nickserv(const char *nick) userList_init(&curr_helpers); if (nick) { - nickserv = AddService(nick, "Nick Services", NULL); + const char *modes = conf_get_data("services/nickserv/modes", RECDB_QSTRING); + nickserv = AddService(nick, modes ? modes : NULL, "Nick Services", NULL); nickserv_service = service_register(nickserv); } saxdb_register("NickServ", nickserv_saxdb_read, nickserv_saxdb_write);