]> jfr.im git - irc/rqf/shadowircd.git/blobdiff - modules/m_pass.c
ShadowIRCd 6.2.0-beta1
[irc/rqf/shadowircd.git] / modules / m_pass.c
index 0cc0747baeddcc2e86ec5a43047fbce767664b0d..73b3c13abac57a9281193932dedfb29bcd40b59e 100644 (file)
@@ -21,7 +21,6 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  *  USA
  *
- *  $Id: m_pass.c 3550 2007-08-09 06:47:26Z nenolod $
  */
 
 #include "stdinc.h"
@@ -52,7 +51,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
@@ -68,10 +66,17 @@ mr_pass(struct Client *client_p, struct Client *source_p, int parc, const char *
                memset(client_p->localClient->passwd, 0,
                        strlen(client_p->localClient->passwd));
                rb_free(client_p->localClient->passwd);
+               client_p->localClient->passwd = NULL;
+       }
+
+       if (client_p->localClient->auth_user)
+       {
+               memset(client_p->localClient->auth_user, 0,
+                      strlen(client_p->localClient->auth_user));
+               rb_free(client_p->localClient->auth_user);
+               client_p->localClient->auth_user = NULL;
        }
 
-       client_p->localClient->passwd = rb_strndup(parv[1], PASSWDLEN);
-       
        if ((pass = strchr(buf, ':')) != NULL)
        {
                *pass++ = '\0'; 
@@ -83,9 +88,9 @@ mr_pass(struct Client *client_p, struct Client *source_p, int parc, const char *
                auth_user = NULL;
        }
        
-       client_p->localClient->passwd = rb_strndup(pass, PASSWDLEN);
+       client_p->localClient->passwd = *pass ? rb_strndup(pass, PASSWDLEN) : NULL;
        
-       if(auth_user)
+       if(auth_user && *auth_user)
                client_p->localClient->auth_user = rb_strndup(auth_user, PASSWDLEN);
 
        /* These are for servers only */
@@ -102,9 +107,6 @@ 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(parc == 5 && atoi(parv[3]) >= 6)
                {
                        /* only mark as TS6 if the SID is valid.. */