ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_pass.c
(Generate patch)

Comparing:
ircd-hybrid-8/modules/m_pass.c (file contents), Revision 1156 by michael, Tue Aug 9 20:29:20 2011 UTC vs.
ircd-hybrid/trunk/modules/m_pass.c (file contents), Revision 1832 by michael, Fri Apr 19 19:16:09 2013 UTC

# Line 23 | Line 23
23   */
24  
25   #include "stdinc.h"
26 – #include "handlers.h"  /* m_pass prototype */
26   #include "client.h"      /* client struct */
27   #include "irc_string.h"
28   #include "send.h"        /* sendto_one */
29   #include "numeric.h"     /* ERR_xxx */
30   #include "ircd.h"        /* me */
32 – #include "msg.h"
31   #include "parse.h"
32   #include "modules.h"
33   #include "s_serv.h"
34   #include "s_user.h"
35 + #include "s_misc.h"
36 + #include "memory.h"
37  
38 – static void mr_pass(struct Client *, struct Client *, int, char *[]);
39 –
40 – struct Message pass_msgtab = {
41 –  "PASS", 0, 0, 2, 0, MFLG_SLOW | MFLG_UNREG, 0,
42 –  { mr_pass, m_registered, m_ignore, m_ignore, m_registered, mr_pass }
43 – };
44 –
45 – void
46 – _modinit(void)
47 – {
48 –  mod_add_cmd(&pass_msgtab);
49 – }
50 –
51 – void
52 – _moddeinit(void)
53 – {
54 –  mod_del_cmd(&pass_msgtab);
55 – }
56 –
57 – const char *_version = "$Revision$";
38  
39   /*
40   * m_pass() - Added Sat, 4 March 1989
# Line 69 | Line 49 | static void
49   mr_pass(struct Client *client_p, struct Client *source_p,
50          int parc, char *parv[])
51   {
52 <  char *password = parv[1];
52 >  assert(client_p == source_p);
53  
54 <  if (EmptyString(password))
54 >  if (EmptyString(parv[1]))
55    {
56 <    sendto_one(client_p, form_str(ERR_NEEDMOREPARAMS),
57 <               me.name, EmptyString(parv[0]) ? "*" : parv[0], "PASS");
56 >    sendto_one(source_p, ERR_NEEDMOREPARAMS, me.name,
57 >               source_p->name[0] ? source_p->name : "*", "PASS");
58      return;
59    }
60  
61 <  MyFree(client_p->localClient->passwd);
62 <  if (strlen(password) > PASSWDLEN)
83 <    password[PASSWDLEN] = '\0';
84 <  DupString(client_p->localClient->passwd, password);
61 >  MyFree(source_p->localClient->passwd);
62 >  source_p->localClient->passwd = xstrndup(parv[1], IRCD_MIN(strlen(parv[1]), PASSWDLEN));
63  
64    if (parc > 2)
65    {
# Line 92 | Line 70 | mr_pass(struct Client *client_p, struct
70       * safely assume if there is a ":TS" then its a TS server
71       * -Dianora
72       */
73 <    if (!irccmp(parv[2], "TS") && client_p->tsinfo == 0)
74 <      client_p->tsinfo = TS_DOESTS;
73 >    if (!irccmp(parv[2], "TS") && source_p->tsinfo == 0)
74 >      source_p->tsinfo = TS_DOESTS;
75    }
76  
77    /* only do this stuff if we are doing ts6 */
# Line 101 | Line 79 | mr_pass(struct Client *client_p, struct
79    {
80      if (atoi(parv[3]) >= 6 && valid_sid(parv[4]))
81      {
82 <      strlcpy(client_p->id, parv[4], sizeof(client_p->id));
83 <      SetCapable(client_p, CAP_TS6);
82 >      strlcpy(source_p->id, parv[4], sizeof(source_p->id));
83 >      SetCapable(source_p, CAP_TS6);
84      }
85    }
86   }
87 +
88 + static struct Message pass_msgtab = {
89 +  "PASS", 0, 0, 2, MAXPARA, MFLG_SLOW, 0,
90 +  { mr_pass, m_registered, m_ignore, m_ignore, m_registered, mr_pass }
91 + };
92 +
93 + static void
94 + module_init(void)
95 + {
96 +  mod_add_cmd(&pass_msgtab);
97 + }
98 +
99 + static void
100 + module_exit(void)
101 + {
102 +  mod_del_cmd(&pass_msgtab);
103 + }
104 +
105 + struct module module_entry = {
106 +  .node    = { NULL, NULL, NULL },
107 +  .name    = NULL,
108 +  .version = "$Revision$",
109 +  .handle  = NULL,
110 +  .modinit = module_init,
111 +  .modexit = module_exit,
112 +  .flags   = 0
113 + };

Diff Legend

– Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)