ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid-7.2/modules/m_pass.c
Revision: 32
Committed: Sun Oct 2 20:41:23 2005 UTC (18 years, 5 months ago) by knight
Content type: text/x-csrc
Original Path: ircd-hybrid/modules/m_pass.c
File size: 3032 byte(s)
Log Message:
- svn:keywords

File Contents

# User Rev Content
1 adx 30 /*
2     * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3     * m_pass.c: Used to send a password for a server or client{} block.
4     *
5     * Copyright (C) 2002 by the past and present ircd coders, and others.
6     *
7     * This program is free software; you can redistribute it and/or modify
8     * it under the terms of the GNU General Public License as published by
9     * the Free Software Foundation; either version 2 of the License, or
10     * (at your option) any later version.
11     *
12     * This program is distributed in the hope that it will be useful,
13     * but WITHOUT ANY WARRANTY; without even the implied warranty of
14     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15     * GNU General Public License for more details.
16     *
17     * You should have received a copy of the GNU General Public License
18     * along with this program; if not, write to the Free Software
19     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20     * USA
21     *
22 knight 31 * $Id$
23 adx 30 */
24    
25     #include "stdinc.h"
26     #include "handlers.h" /* m_pass prototype */
27     #include "client.h" /* client struct */
28     #include "irc_string.h"
29     #include "send.h" /* sendto_one */
30     #include "numeric.h" /* ERR_xxx */
31     #include "ircd.h" /* me */
32     #include "msg.h"
33     #include "parse.h"
34     #include "modules.h"
35     #include "s_serv.h"
36     #include "hash.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     #ifndef STATIC_MODULES
46     void
47     _modinit(void)
48     {
49     mod_add_cmd(&pass_msgtab);
50     }
51    
52     void
53     _moddeinit(void)
54     {
55     mod_del_cmd(&pass_msgtab);
56     }
57    
58 knight 31 const char *_version = "$Revision$";
59 adx 30 #endif
60    
61     /*
62     * m_pass() - Added Sat, 4 March 1989
63     *
64     *
65     * mr_pass - PASS message handler
66     * parv[0] = sender prefix
67     * parv[1] = password
68     * parv[2] = optional extra version information
69     */
70     static void
71     mr_pass(struct Client *client_p, struct Client *source_p,
72     int parc, char *parv[])
73     {
74     char *password = parv[1];
75    
76     if (EmptyString(password))
77     {
78     sendto_one(client_p, form_str(ERR_NEEDMOREPARAMS),
79     me.name, EmptyString(parv[0]) ? "*" : parv[0], "PASS");
80     return;
81     }
82    
83     MyFree(client_p->localClient->passwd);
84     if (strlen(password) > PASSWDLEN)
85     password[PASSWDLEN] = '\0';
86     DupString(client_p->localClient->passwd, password);
87    
88     if (parc > 2)
89     {
90     /* It looks to me as if orabidoo wanted to have more
91     * than one set of option strings possible here...
92     * i.e. ":AABBTS" as long as TS was the last two chars
93     * however, as we are now using CAPAB, I think we can
94     * safely assume if there is a ":TS" then its a TS server
95     * -Dianora
96     */
97     if (!irccmp(parv[2], "TS") && client_p->tsinfo == 0)
98     client_p->tsinfo = TS_DOESTS;
99     }
100    
101     /* only do this stuff if we are doing ts6 */
102     if (parc > 4 && me.id[0])
103     {
104     if (atoi(parv[3]) >= 6)
105     {
106     strlcpy(client_p->id, parv[4], sizeof(client_p->id));
107     SetCapable(client_p, CAP_TS6);
108     }
109     }
110     }
111    

Properties

Name Value
svn:eol-style native
svn:keywords Revision