ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/branches/8.1.x/modules/m_pass.c
Revision: 2821
Committed: Wed Jan 15 23:12:35 2014 UTC (12 years, 6 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

# Content
1 /*
2 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 *
4 * Copyright (c) 1997-2014 ircd-hybrid development team
5 *
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 /*! \file m_pass.c
23 * \brief Includes required functions for processing the PASS command.
24 * \version $Id$
25 */
26
27 #include "stdinc.h"
28 #include "client.h"
29 #include "irc_string.h"
30 #include "send.h"
31 #include "numeric.h"
32 #include "ircd.h"
33 #include "parse.h"
34 #include "modules.h"
35 #include "s_serv.h"
36 #include "s_user.h"
37 #include "s_misc.h"
38 #include "memory.h"
39
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 static int
51 mr_pass(struct Client *client_p, struct Client *source_p,
52 int parc, char *parv[])
53 {
54 assert(client_p == source_p);
55
56 if (EmptyString(parv[1]))
57 {
58 sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name,
59 source_p->name[0] ? source_p->name : "*", "PASS");
60 return 0;
61 }
62
63 MyFree(source_p->localClient->passwd);
64 source_p->localClient->passwd = xstrndup(parv[1], IRCD_MIN(strlen(parv[1]), PASSWDLEN));
65
66 if (parc > 2)
67 {
68 /*
69 * It looks to me as if orabidoo wanted to have more
70 * 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 * safely assume if there is a ":TS" then it's a TS server
74 * -Dianora
75 */
76 if (!irccmp(parv[2], "TS") && source_p->tsinfo == 0)
77 source_p->tsinfo = TS_DOESTS;
78 }
79
80 /* Only do this stuff if we are doing ts6 */
81 if (parc > 4)
82 {
83 if (atoi(parv[3]) >= 6 && valid_sid(parv[4]))
84 {
85 strlcpy(source_p->id, parv[4], sizeof(source_p->id));
86 SetCapable(source_p, CAP_TS6);
87 }
88 }
89
90 return 0;
91 }
92
93 static struct Message pass_msgtab =
94 {
95 "PASS", 0, 0, 2, MAXPARA, MFLG_SLOW, 0,
96 { 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 struct module module_entry =
112 {
113 .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