]> jfr.im git - solanum.git/blobdiff - modules/m_pass.c
msg: remove last vestiges of the fakelag system. charybdis has never supported fakelag.
[solanum.git] / modules / m_pass.c
index 1cfe2844a34ec610072e7cde47025968c788da50..440433010941a582fde4098e212948a6527b7b40 100644 (file)
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  *  USA
  *
- *  $Id: m_pass.c 1291 2006-05-05 19:00:19Z jilles $
+ *  $Id: m_pass.c 3550 2007-08-09 06:47:26Z nenolod $
  */
 
 #include "stdinc.h"
 #include "client.h"            /* client struct */
-#include "irc_string.h"
+#include "match.h"
 #include "send.h"              /* sendto_one */
 #include "numeric.h"           /* ERR_xxx */
 #include "ircd.h"              /* me */
 #include "hash.h"
 #include "s_conf.h"
 
-static int mr_pass(struct Client *, struct Client *, int, const char **);
+static int mr_pass(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
 
 struct Message pass_msgtab = {
-       "PASS", 0, 0, 0, MFLG_SLOW | MFLG_UNREG,
+       "PASS", 0, 0, 0, 0,
        {{mr_pass, 2}, mg_reg, mg_ignore, mg_ignore, mg_ignore, mg_reg}
 };
 
 mapi_clist_av1 pass_clist[] = { &pass_msgtab, NULL };
-DECLARE_MODULE_AV1(pass, NULL, NULL, pass_clist, NULL, NULL, "$Revision: 1291 $");
+DECLARE_MODULE_AV1(pass, NULL, NULL, pass_clist, NULL, NULL, "$Revision: 3550 $");
 
 /*
  * m_pass() - Added Sat, 4 March 1989
  *
  *
  * mr_pass - PASS message handler
- *      parv[0] = sender prefix
  *      parv[1] = password
  *      parv[2] = "TS" if this server supports TS.
  *      parv[3] = optional TS version field -- needed for TS6
  */
 static int
-mr_pass(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
+mr_pass(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
 {
-       if(client_p->localClient->passwd)
+       char *auth_user, *pass, *buf;
+       buf = LOCAL_COPY(parv[1]);
+
+       if(client_p->localClient->passwd || client_p->localClient->auth_user)
+               return 0;
+
+       if ((pass = strchr(buf, ':')) != NULL)
+       {
+               *pass++ = '\0';
+               auth_user = buf;
+       }
+       else
        {
-               memset(client_p->localClient->passwd, 0,
-                       strlen(client_p->localClient->passwd));
-               MyFree(client_p->localClient->passwd);
+               pass = buf;
+               auth_user = NULL;
        }
 
-       DupNString(client_p->localClient->passwd, parv[1], PASSWDLEN);
+       client_p->localClient->passwd = *pass ? rb_strndup(pass, PASSWDLEN) : NULL;
+
+       if(auth_user && *auth_user)
+               client_p->localClient->auth_user = rb_strndup(auth_user, PASSWDLEN);
 
        /* These are for servers only */
        if(parc > 2 && client_p->user == NULL)
        {
-               /* 
+               /*
                 * It looks to me as if orabidoo wanted to have more
                 * than one set of option strings possible here...
                 * i.e. ":AABBTS" as long as TS was the last two chars
@@ -83,10 +95,7 @@ mr_pass(struct Client *client_p, struct Client *source_p, int parc, const char *
                if(irccmp(parv[2], "TS") == 0 && client_p->tsinfo == 0)
                        client_p->tsinfo = TS_DOESTS;
 
-               /* kludge, if we're not using ts6, dont ever mark a server
-                * as TS6 capable, that way we'll never send them TS6 data.
-                */
-               if(ServerInfo.use_ts6 && parc == 5 && atoi(parv[3]) >= 6)
+               if(parc == 5 && atoi(parv[3]) >= 6)
                {
                        /* only mark as TS6 if the SID is valid.. */
                        if(IsDigit(parv[4][0]) && IsIdChar(parv[4][1]) &&