ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/branches/newio/modules/m_pass.c
Revision: 2417
Committed: Sun Jul 21 18:11:50 2013 UTC (10 years, 8 months ago) by michael
Content type: text/x-csrc
File size: 3095 byte(s)
Log Message:
- Change command message handlers to int type

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 int
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 0;
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 return 0;
88 }
89
90 static struct Message pass_msgtab =
91 {
92 "PASS", 0, 0, 2, MAXPARA, MFLG_SLOW, 0,
93 { mr_pass, m_registered, m_ignore, m_ignore, m_registered, mr_pass }
94 };
95
96 static void
97 module_init(void)
98 {
99 mod_add_cmd(&pass_msgtab);
100 }
101
102 static void
103 module_exit(void)
104 {
105 mod_del_cmd(&pass_msgtab);
106 }
107
108 struct module module_entry =
109 {
110 .node = { NULL, NULL, NULL },
111 .name = NULL,
112 .version = "$Revision$",
113 .handle = NULL,
114 .modinit = module_init,
115 .modexit = module_exit,
116 .flags = 0
117 };

Properties

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