]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - modules/m_pass.c
Update comments for parv[0] removal.
[irc/rqf/shadowircd.git] / modules / m_pass.c
index 1f4255e26eb379b9d4a2c0e63dd49720231fed6a..5f59f95f325fcd3b07dde35d9cf016868af61f3f 100644 (file)
@@ -52,7 +52,6 @@ DECLARE_MODULE_AV1(pass, NULL, NULL, pass_clist, NULL, NULL, "$Revision: 3550 $"
  *
  *
  * 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
@@ -60,6 +59,9 @@ DECLARE_MODULE_AV1(pass, NULL, NULL, pass_clist, NULL, NULL, "$Revision: 3550 $"
 static int
 mr_pass(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
 {
+       char *auth_user, *pass, *buf;
+       buf = LOCAL_COPY(parv[1]);
+       
        if(client_p->localClient->passwd)
        {
                memset(client_p->localClient->passwd, 0,
@@ -68,6 +70,22 @@ mr_pass(struct Client *client_p, struct Client *source_p, int parc, const char *
        }
 
        client_p->localClient->passwd = rb_strndup(parv[1], PASSWDLEN);
+       
+       if ((pass = strchr(buf, ':')) != NULL)
+       {
+               *pass++ = '\0'; 
+               auth_user = buf; 
+       }
+       else
+       {
+               pass = buf;
+               auth_user = NULL;
+       }
+       
+       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)