ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_pass.c
Revision: 6161
Committed: Thu Jun 18 10:55:29 2015 UTC (11 years, 3 months ago) by michael
Content type: text/x-csrc
File size: 2918 byte(s)
Log Message:
- Move all SID/UID related code to id.c

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 *
4 * Copyright (c) 1997-2015 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 "id.h"
33 #include "ircd.h"
34 #include "parse.h"
35 #include "modules.h"
36 #include "server.h"
37 #include "user.h"
38 #include "misc.h"
39 #include "memory.h"
40
41
42 /*! \brief PASS command handler
43 *
44 * \param source_p Pointer to allocated Client struct from which the message
45 * originally comes from. This can be a local or remote client.
46 * \param parc Integer holding the number of supplied arguments.
47 * \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL
48 * pointers.
49 * \note Valid arguments for this command are:
50 * - parv[0] = command
51 * - parv[1] = password
52 * - parv[2] = unused
53 * - parv[3] = TS protocol version
54 * - parv[4] = server ID (SID)
55 */
56 static int
57 mr_pass(struct Client *source_p, int parc, char *parv[])
58 {
59 assert(MyConnect(source_p));
60
61 if (EmptyString(parv[1]))
62 {
63 sendto_one_numeric(source_p, &me, ERR_NEEDMOREPARAMS, "PASS");
64 return 0;
65 }
66
67 MyFree(source_p->connection->password);
68 source_p->connection->password = xstrndup(parv[1], IRCD_MIN(strlen(parv[1]), PASSWDLEN));
69
70 /* Only do this stuff if we are doing ts6 */
71 if (parc > 4)
72 if (atoi(parv[3]) >= 6 && valid_sid(parv[4]))
73 strlcpy(source_p->id, parv[4], sizeof(source_p->id));
74
75 return 0;
76 }
77
78 static struct Message pass_msgtab =
79 {
80 .cmd = "PASS",
81 .args_min = 2,
82 .args_max = MAXPARA,
83 .handlers[UNREGISTERED_HANDLER] = mr_pass,
84 .handlers[CLIENT_HANDLER] = m_registered,
85 .handlers[SERVER_HANDLER] = m_ignore,
86 .handlers[ENCAP_HANDLER] = m_ignore,
87 .handlers[OPER_HANDLER] = m_registered
88 };
89
90 static void
91 module_init(void)
92 {
93 mod_add_cmd(&pass_msgtab);
94 }
95
96 static void
97 module_exit(void)
98 {
99 mod_del_cmd(&pass_msgtab);
100 }
101
102 struct module module_entry =
103 {
104 .version = "$Revision$",
105 .modinit = module_init,
106 .modexit = module_exit,
107 };

Properties

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