ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_pass.c
Revision: 1666
Committed: Sun Nov 18 17:03:18 2012 UTC (12 years, 9 months ago) by michael
Content type: text/x-csrc
File size: 3081 byte(s)
Log Message:
- Cleanup unused header file includes
- Fixed minor compile warning in conf.c

File Contents

# Content
1 /*
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 * $Id$
23 */
24
25 #include "stdinc.h"
26 #include "client.h" /* client struct */
27 #include "irc_string.h"
28 #include "send.h" /* sendto_one */
29 #include "numeric.h" /* ERR_xxx */
30 #include "ircd.h" /* me */
31 #include "parse.h"
32 #include "modules.h"
33 #include "s_serv.h"
34 #include "s_user.h"
35 #include "s_misc.h"
36 #include "memory.h"
37
38
39 /*
40 * m_pass() - Added Sat, 4 March 1989
41 *
42 *
43 * mr_pass - PASS message handler
44 * parv[0] = sender prefix
45 * parv[1] = password
46 * parv[2] = optional extra version information
47 */
48 static void
49 mr_pass(struct Client *client_p, struct Client *source_p,
50 int parc, char *parv[])
51 {
52 assert(client_p == source_p);
53
54 if (EmptyString(parv[1]))
55 {
56 sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name,
57 source_p->name[0] ? source_p->name : "*", "PASS");
58 return;
59 }
60
61 MyFree(source_p->localClient->passwd);
62 source_p->localClient->passwd = xstrndup(parv[1], IRCD_MIN(strlen(parv[1]), PASSWDLEN));
63
64 if (parc > 2)
65 {
66 /* It looks to me as if orabidoo wanted to have more
67 * than one set of option strings possible here...
68 * i.e. ":AABBTS" as long as TS was the last two chars
69 * however, as we are now using CAPAB, I think we can
70 * safely assume if there is a ":TS" then its a TS server
71 * -Dianora
72 */
73 if (!irccmp(parv[2], "TS") && source_p->tsinfo == 0)
74 source_p->tsinfo = TS_DOESTS;
75 }
76
77 /* only do this stuff if we are doing ts6 */
78 if (parc > 4)
79 {
80 if (atoi(parv[3]) >= 6 && valid_sid(parv[4]))
81 {
82 strlcpy(source_p->id, parv[4], sizeof(source_p->id));
83 SetCapable(source_p, CAP_TS6);
84 }
85 }
86 }
87
88 static struct Message pass_msgtab = {
89 "PASS", 0, 0, 2, MAXPARA, MFLG_SLOW, 0,
90 { mr_pass, m_registered, m_ignore, m_ignore, m_registered, mr_pass }
91 };
92
93 static void
94 module_init(void)
95 {
96 mod_add_cmd(&pass_msgtab);
97 }
98
99 static void
100 module_exit(void)
101 {
102 mod_del_cmd(&pass_msgtab);
103 }
104
105 struct module module_entry = {
106 .node = { NULL, NULL, NULL },
107 .name = NULL,
108 .version = "$Revision$",
109 .handle = NULL,
110 .modinit = module_init,
111 .modexit = module_exit,
112 .flags = 0
113 };

Properties

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