X-Git-Url: https://jfr.im/git/irc/quakenet/newserv.git/blobdiff_plain/93680998264c0a8b8185dfd4517adf586c72c4bb..0b48bbd5dc5821a01029214c5ccd39116468c09f:/chanserv/authcmds/auth.c diff --git a/chanserv/authcmds/auth.c b/chanserv/authcmds/auth.c index e5949b96..ab9ce227 100644 --- a/chanserv/authcmds/auth.c +++ b/chanserv/authcmds/auth.c @@ -2,7 +2,7 @@ * * * CMDNAME: auth - * CMDALIASES: login + * CMDALIASES: login ircdauth * CMDLEVEL: QCMD_SECURE | QCMD_NOTAUTHED * CMDARGS: 2 * CMDDESC: Authenticates you on the bot. @@ -46,10 +46,13 @@ int csa_auth(void *source, int cargc, char **cargv, CRAlgorithm alg) { aup->authattempts++; if (aup->authattempts > MAXAUTHATTEMPT) { +/* if ((aup->authattempts % 100) == 0) chanservwallmessage("Warning: User %s!%s@%s attempted to auth %d times. Last attempt: %s %s %s", sender->nick, sender->ident, sender->host->name->content, aup->authattempts, authtype, cargv[0], cargv[1]); - chanservstdmessage(sender, QM_AUTHFAIL); +*/ + + chanservstdmessage(sender, QM_TOOMANYAUTHATTEMPTS); cs_log(sender,"%s FAIL too many auth attempts (last attempt: %s %s %s)", authtype, authtype, cargv[0], cargv[1]); return CMD_ERROR; } @@ -79,9 +82,10 @@ int csa_auth(void *source, int cargc, char **cargv, CRAlgorithm alg) { int csa_completeauth(nick *sender, reguser *rup, char *authtype) { int toomanyauths=0; - time_t now; + time_t now, oldlastauth; char userhost[USERLEN+HOSTLEN+2]; nick *onp; + void *args[2]; authname *anp; /* This should never fail but do something other than crashing if it does. */ @@ -131,8 +135,14 @@ int csa_completeauth(nick *sender, reguser *rup, char *authtype) { chanservstdmessage(sender, QM_EXPIRES, rup->suspendexp); return CMD_ERROR; } + if (UIsInactive(rup)) { + chanservstdmessage(sender, QM_INACTIVEACCOUNT); + return CMD_ERROR; + } /* Guarantee a unique auth timestamp for each account */ + oldlastauth=rup->lastauth; + if (rup->lastauth < now) rup->lastauth=now; else @@ -151,6 +161,10 @@ int csa_completeauth(nick *sender, reguser *rup, char *authtype) { chanservstdmessage(sender, QM_AUTHOK, rup->username); + args[0]=sender; + args[1]=(void *)oldlastauth; + triggerhook(HOOK_CHANSERV_AUTH, args); + return CMD_OK; }