ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/modules/m_pass.c
Revision: 470
Committed: Fri Feb 17 05:07:43 2006 UTC (19 years, 6 months ago) by db
Content type: text/x-csrc
File size: 2951 byte(s)
Log Message:
- fix compile errors with moved modules.h
- fix a few missing includes, msg.h and parse.h


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

Properties

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