ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_pass.c
Revision: 2820
Committed: Wed Jan 15 23:10:26 2014 UTC (11 years, 7 months ago) by michael
Content type: text/x-csrc
File size: 3047 byte(s)
Log Message:
- Clean up all files in modules/ (fixed indentation, removed whitespaces/tabs)
- Fixed copyright years
- Made module handlers int type for later use

File Contents

# User Rev Content
1 adx 30 /*
2 michael 2820 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 adx 30 *
4 michael 2820 * Copyright (c) 1997-2014 ircd-hybrid development team
5 adx 30 *
6     * This program is free software; you can redistribute it and/or modify
7     * it under the terms of the GNU General Public License as published by
8     * the Free Software Foundation; either version 2 of the License, or
9     * (at your option) any later version.
10     *
11     * This program is distributed in the hope that it will be useful,
12     * but WITHOUT ANY WARRANTY; without even the implied warranty of
13     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14     * GNU General Public License for more details.
15     *
16     * You should have received a copy of the GNU General Public License
17     * along with this program; if not, write to the Free Software
18     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19     * USA
20     */
21    
22 michael 2820 /*! \file m_pass.c
23     * \brief Includes required functions for processing the PASS command.
24     * \version $Id$
25     */
26    
27 adx 30 #include "stdinc.h"
28 michael 2820 #include "client.h"
29     #include "irc_string.h"
30     #include "send.h"
31     #include "numeric.h"
32     #include "ircd.h"
33 adx 30 #include "parse.h"
34     #include "modules.h"
35     #include "s_serv.h"
36 michael 573 #include "s_user.h"
37 michael 1646 #include "s_misc.h"
38 michael 1666 #include "memory.h"
39 adx 30
40    
41     /*
42     * m_pass() - Added Sat, 4 March 1989
43     *
44     *
45     * mr_pass - PASS message handler
46     * parv[0] = sender prefix
47     * parv[1] = password
48     * parv[2] = optional extra version information
49     */
50 michael 2820 static int
51 adx 30 mr_pass(struct Client *client_p, struct Client *source_p,
52     int parc, char *parv[])
53     {
54 michael 1230 assert(client_p == source_p);
55    
56 michael 1646 if (EmptyString(parv[1]))
57 adx 30 {
58 michael 1834 sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name,
59 michael 1230 source_p->name[0] ? source_p->name : "*", "PASS");
60 michael 2820 return 0;
61 adx 30 }
62    
63 michael 1230 MyFree(source_p->localClient->passwd);
64 michael 1646 source_p->localClient->passwd = xstrndup(parv[1], IRCD_MIN(strlen(parv[1]), PASSWDLEN));
65 adx 30
66     if (parc > 2)
67     {
68 michael 2820 /*
69     * It looks to me as if orabidoo wanted to have more
70 adx 30 * than one set of option strings possible here...
71     * i.e. ":AABBTS" as long as TS was the last two chars
72     * however, as we are now using CAPAB, I think we can
73 michael 2820 * safely assume if there is a ":TS" then it's a TS server
74 adx 30 * -Dianora
75     */
76 michael 1230 if (!irccmp(parv[2], "TS") && source_p->tsinfo == 0)
77     source_p->tsinfo = TS_DOESTS;
78 adx 30 }
79    
80 michael 2820 /* Only do this stuff if we are doing ts6 */
81 michael 1115 if (parc > 4)
82 adx 30 {
83 michael 573 if (atoi(parv[3]) >= 6 && valid_sid(parv[4]))
84 adx 30 {
85 michael 1230 strlcpy(source_p->id, parv[4], sizeof(source_p->id));
86     SetCapable(source_p, CAP_TS6);
87 adx 30 }
88     }
89 michael 2820
90     return 0;
91 adx 30 }
92 michael 1230
93 michael 2820 static struct Message pass_msgtab =
94     {
95 michael 1569 "PASS", 0, 0, 2, MAXPARA, MFLG_SLOW, 0,
96 michael 1230 { mr_pass, m_registered, m_ignore, m_ignore, m_registered, mr_pass }
97     };
98    
99     static void
100     module_init(void)
101     {
102     mod_add_cmd(&pass_msgtab);
103     }
104    
105     static void
106     module_exit(void)
107     {
108     mod_del_cmd(&pass_msgtab);
109     }
110    
111 michael 2820 struct module module_entry =
112     {
113 michael 1230 .node = { NULL, NULL, NULL },
114     .name = NULL,
115     .version = "$Revision$",
116     .handle = NULL,
117     .modinit = module_init,
118     .modexit = module_exit,
119     .flags = 0
120     };

Properties

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