]> jfr.im git - irc/quakenet/newserv.git/blobdiff - chanserv/authcmds/auth.c
CHANSERV: tell user when they can't attempts to auth any more, and drop max attempts...
[irc/quakenet/newserv.git] / chanserv / authcmds / auth.c
index e55beb5c1d924afd6ad82bbbb36feae06352fe25..ab9ce2271ab963cf1d4b0df7c62cc4ab08366877 100644 (file)
@@ -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. */
@@ -92,7 +96,7 @@ int csa_completeauth(nick *sender, reguser *rup, char *authtype) {
 
   /* Check for too many auths.  Don't return immediately, since we will still warn
    * other users on the acct in this case. */
-  if (!UHasHelperPriv(rup) && !UIsNoAuthLimit(rup)) {
+  if (!UHasStaffPriv(rup) && !UIsNoAuthLimit(rup)) {
     if (anp->usercount >= MAXAUTHCOUNT) {
       chanservstdmessage(sender, QM_TOOMANYAUTHS);
       toomanyauths=1;
@@ -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;
 }