X-Git-Url: https://jfr.im/git/irc/evilnet/x3.git/blobdiff_plain/1117fc5a8fda9e591ea33b418fadbd4f220fb834..9b2d838a3f6c15287a36caed1c8e10ff8d74613d:/src/nickserv.c diff --git a/src/nickserv.c b/src/nickserv.c index 3b446c0..593e112 100644 --- a/src/nickserv.c +++ b/src/nickserv.c @@ -931,7 +931,7 @@ set_user_handle_info(struct userNode *user, struct handle_info *hi, int stamp) } } } - StampUser(user, id); + StampUser(user, id, hi->registered); } if ((ni = get_nick_info(user->nick)) && (ni->owner == hi)) @@ -1528,6 +1528,57 @@ reg_failpw_func(failpw_func_t func) failpw_func_list[failpw_func_used++] = func; } +/* + * Return hi if the handle/pass pair matches, NULL if it doesnt. + * + * called by nefariouses enhanced AC login-on-connect code + * + */ +struct handle_info *loc_auth(char *handle, char *password) +{ + int pw_arg, used, maxlogins; + unsigned int ii; + int wildmask = 0; + struct handle_info *hi; + struct userNode *other; + + hi = dict_find(nickserv_handle_dict, handle, NULL); + pw_arg = 2; + if (!hi) { + return NULL; + } + + /* We don't know the users hostname, or anything because they + * havn't registered yet. So we can only allow LOC if your + * account has *@* as a hostmask. + */ + for (ii=0; iimasks->used; ii++) + { + if (!strcmp(hi->masks->list[ii], "*@*")) + { + wildmask++; + break; + } + } + if(wildmask < 1) + return NULL; + + /* Responses from here on look up the language used by the handle they asked about. */ + if (!checkpass(password, hi->passwd)) { + return NULL; + } + if (HANDLE_FLAGGED(hi, SUSPENDED)) { + return NULL; + } + maxlogins = hi->maxlogins ? hi->maxlogins : nickserv_conf.default_maxlogins; + for (used = 0, other = hi->users; other; other = other->next_authed) { + if (++used >= maxlogins) { + return NULL; + } + } + return hi; +} + static NICKSERV_FUNC(cmd_auth) { int pw_arg, used, maxlogins; @@ -3648,11 +3699,26 @@ void handle_account(struct userNode *user, const char *stamp) { struct handle_info *hi; + char *colon; #ifdef WITH_PROTOCOL_P10 + time_t timestamp = 0; + + colon = strchr(stamp, ':'); + if(colon && colon[1]) + { + *colon = 0; + timestamp = atoi(colon+1); + } hi = dict_find(nickserv_handle_dict, stamp, NULL); + if(hi && timestamp && hi->registered != timestamp) + { + log_module(MAIN_LOG, LOG_WARNING, "%s using account %s but timestamp does not match %lu is not %lu.", user->nick, stamp, timestamp, hi->registered); + return; + } #else hi = dict_find(nickserv_id_dict, stamp, NULL); + log_module(MAIN_LOG, LOG_WARNING, "Using non-P10 code in accounts, not tested at all!"); #endif if (hi) {