X-Git-Url: https://jfr.im/git/irc/evilnet/x3.git/blobdiff_plain/f16ad9e7befcbd008c053c992cc05ed925a1ec49..7b0150f8ee4d699706369f3f1d1304bcd20e7f06:/src/nickserv.c diff --git a/src/nickserv.c b/src/nickserv.c index 550d8b1..e189e77 100644 --- a/src/nickserv.c +++ b/src/nickserv.c @@ -984,10 +984,8 @@ set_user_handle_info(struct userNode *user, struct handle_info *hi, int stamp) if (hi && !hi->users && !hi->opserv_level) HANDLE_CLEAR_FLAG(hi, HELPING); - if (GetUserH(user->nick)) { - for (n=0; nnick)) user->loc = 1; if (hi) { @@ -1000,12 +998,15 @@ set_user_handle_info(struct userNode *user, struct handle_info *hi, int stamp) send_message(other, nickserv, "NSMSG_CLONE_AUTH", user->nick, user->ident, user->hostname); } + /* Add this auth to users list of current auths */ user->next_authed = hi->users; hi->users = user; hi->lastseen = now; + /* Add to helpers list */ if (IsHelper(user)) userList_append(&curr_helpers, user); + /* Set the fakehost */ if (hi->fakehost || old_info) apply_fakehost(hi); @@ -1016,6 +1017,9 @@ set_user_handle_info(struct userNode *user, struct handle_info *hi, int stamp) #else const char *id = "???"; #endif + /* Mark all the nicks registered to this + * account as registered nicks + * - Why not just this one? -rubin */ if (!nickserv_conf.disable_nicks) { struct nick_info *ni; for (ni = hi->nicks; ni; ni = ni->next) { @@ -1025,15 +1029,23 @@ set_user_handle_info(struct userNode *user, struct handle_info *hi, int stamp) } } } + /* send the account to the ircd */ StampUser(user, id, hi->registered); } + /* Stop trying to kick this user off their nick */ if ((ni = get_nick_info(user->nick)) && (ni->owner == hi)) timeq_del(0, nickserv_reclaim_p, user, TIMEQ_IGNORE_WHEN); } else { /* We cannot clear the user's account ID, unfortunately. */ user->next_authed = NULL; } + + /* Call auth handlers */ + if (GetUserH(user->nick)) { + for (n=0; ncookie->type) { + case ACTIVATION: + safestrncpy(hi->passwd, hi->cookie->data, sizeof(hi->passwd)); + if (nickserv_conf.sync_log) + SyncLog("ACCOUNTACC %s", hi->handle); + break; + case PASSWORD_CHANGE: + safestrncpy(hi->passwd, hi->cookie->data, sizeof(hi->passwd)); + if (nickserv_conf.sync_log) + SyncLog("PASSCHANGE %s %s", hi->handle, hi->passwd); + break; + case EMAIL_CHANGE: + if (!hi->email_addr && nickserv_conf.sync_log) { + if (nickserv_conf.sync_log) + SyncLog("REGISTER %s %s %s %s", hi->handle, hi->passwd, hi->cookie->data, user->info); + } + nickserv_set_email_addr(hi, hi->cookie->data); + if (nickserv_conf.sync_log) + SyncLog("EMAILCHANGE %s %s", hi->handle, hi->cookie->data); + break; + default: + reply("NSMSG_BAD_COOKIE_TYPE", hi->cookie->type); + log_module(NS_LOG, LOG_ERROR, "Bad cookie type %d for account %s.", hi->cookie->type, hi->handle); + break; + } + nickserv_eat_cookie(hi->cookie); reply("NSMSG_ATE_FOREIGN_COOKIE", hi->handle); @@ -2972,20 +3010,27 @@ static OPTION_FUNC(opt_title) title = hi->fakehost + 1; else { /* If theres no title set then the default title will therefore - be the first part of hidden_host in x3.conf.example, so for - consistency with opt_fakehost we will print this here */ + be the first part of hidden_host in x3.conf, so for + consistency with opt_fakehost we will print this here. + This isnt actually used in P10, its just handled to keep from crashing... */ char *hs, *hidden_suffix, *rest; hs = conf_get_data("server/hidden_host", RECDB_QSTRING); hidden_suffix = strdup(hs); /* Yes we do this twice */ - rest = strrchr(hidden_suffix, '.'); - *rest++ = '\0'; - rest = strrchr(hidden_suffix, '.'); - *rest++ = '\0'; + if((rest = strchr(hidden_suffix, '.'))) + { + *rest = '\0'; + title = hidden_suffix; + } + else + { + /* A lame default if someone configured hidden_host to something lame */ + title = strdup("users"); + free(hidden_suffix); + } - title = hidden_suffix; } if (!title)