]> jfr.im git - solanum.git/blobdiff - modules/m_pass.c
um_callerid: Use newer common channel iteration
[solanum.git] / modules / m_pass.c
index ad25522b6eae3be9c40a50e846d62109501bca3d..d0009de8f78035ec2a7d3b60ecd5a4dcc90af656 100644 (file)
 #include "hash.h"
 #include "s_conf.h"
 
-static int mr_pass(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
 static const char pass_desc[] = "Provides the PASS command to authenticate clients and servers";
 
+static void mr_pass(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
+
 struct Message pass_msgtab = {
        "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_AV2(pass, NULL, NULL, pass_clist, NULL, NULL, NULL, NULL, pass_desc);
 
 /*
@@ -55,14 +57,14 @@ DECLARE_MODULE_AV2(pass, NULL, NULL, pass_clist, NULL, NULL, NULL, NULL, pass_de
  *      parv[2] = "TS" if this server supports TS.
  *      parv[3] = optional TS version field -- needed for TS6
  */
-static int
+static void
 mr_pass(struct MsgBuf *msgbuf_p, 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 || client_p->localClient->auth_user)
-               return 0;
+               return;
 
        if ((pass = strchr(buf, ':')) != NULL)
        {
@@ -81,7 +83,7 @@ mr_pass(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
                client_p->localClient->auth_user = rb_strndup(auth_user, PASSWDLEN);
 
        /* These are for servers only */
-       if(parc > 2 && client_p->user == NULL)
+       if(parc > 2 && client_p->user == NULL && client_p->preClient != NULL)
        {
                /*
                 * It looks to me as if orabidoo wanted to have more
@@ -99,13 +101,11 @@ mr_pass(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
                        /* only mark as TS6 if the SID is valid.. */
                        if(IsDigit(parv[4][0]) && IsIdChar(parv[4][1]) &&
                           IsIdChar(parv[4][2]) && parv[4][3] == '\0' &&
-                          EmptyString(client_p->id))
+                          EmptyString(client_p->preClient->id))
                        {
                                client_p->localClient->caps |= CAP_TS6;
-                               strcpy(client_p->id, parv[4]);
+                               rb_strlcpy(client_p->preClient->id, parv[4], sizeof(client_p->preClient->id));
                        }
                }
        }
-
-       return 0;
 }