ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_pass.c
Revision: 4588
Committed: Tue Aug 26 15:59:07 2014 UTC (11 years ago) by michael
Content type: text/x-csrc
File size: 3369 byte(s)
Log Message:
- Renamed 'localClient' Client structure member to just 'connection'

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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
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 "server.h"
36 #include "user.h"
37 #include "misc.h"
38 #include "memory.h"
39
40
41 /*! \brief PASS command handler
42 *
43 * \param source_p Pointer to allocated Client struct from which the message
44 * originally comes from. This can be a local or remote client.
45 * \param parc Integer holding the number of supplied arguments.
46 * \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL
47 * pointers.
48 * \note Valid arguments for this command are:
49 * - parv[0] = command
50 * - parv[1] = password
51 * - parv[2] = optional extra version information
52 * - parv[3] = TS protocol version
53 * - parv[4] = server ID (SID)
54 */
55 static int
56 mr_pass(struct Client *source_p, int parc, char *parv[])
57 {
58 assert(MyConnect(source_p));
59
60 if (EmptyString(parv[1]))
61 {
62 sendto_one_numeric(source_p, &me, ERR_NEEDMOREPARAMS, "PASS");
63 return 0;
64 }
65
66 MyFree(source_p->connection->password);
67 source_p->connection->password = xstrndup(parv[1], IRCD_MIN(strlen(parv[1]), PASSWDLEN));
68
69 if (parc > 2)
70 {
71 /*
72 * It looks to me as if orabidoo wanted to have more
73 * than one set of option strings possible here...
74 * i.e. ":AABBTS" as long as TS was the last two chars
75 * however, as we are now using CAPAB, I think we can
76 * safely assume if there is a ":TS" then it's a TS server
77 * -Dianora
78 */
79 if (!irccmp(parv[2], "TS") && source_p->tsinfo == 0)
80 source_p->tsinfo = TS_DOESTS;
81 }
82
83 /* Only do this stuff if we are doing ts6 */
84 if (parc > 4)
85 {
86 if (atoi(parv[3]) >= 6 && valid_sid(parv[4]))
87 {
88 strlcpy(source_p->id, parv[4], sizeof(source_p->id));
89 SetCapable(source_p, CAP_TS6);
90 }
91 }
92
93 return 0;
94 }
95
96 static struct Message pass_msgtab =
97 {
98 "PASS", NULL, 0, 0, 2, MAXPARA, MFLG_SLOW, 0,
99 { mr_pass, m_registered, m_ignore, m_ignore, m_registered, mr_pass }
100 };
101
102 static void
103 module_init(void)
104 {
105 mod_add_cmd(&pass_msgtab);
106 }
107
108 static void
109 module_exit(void)
110 {
111 mod_del_cmd(&pass_msgtab);
112 }
113
114 struct module module_entry =
115 {
116 .node = { NULL, NULL, NULL },
117 .name = NULL,
118 .version = "$Revision$",
119 .handle = NULL,
120 .modinit = module_init,
121 .modexit = module_exit,
122 .flags = 0
123 };

Properties

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