/[svn]/ircd-hybrid-8/modules/m_pass.c
ViewVC logotype

Contents of /ircd-hybrid-8/modules/m_pass.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1178 - (show annotations)
Mon Aug 15 08:11:31 2011 UTC (8 years, 3 months ago) by michael
File MIME type: text/x-chdr
File size: 3022 byte(s)
- Cleanup and restore older parts of the irc-command parser.
  Gives back ability to specify maximum amount of parameters
  that are processed within a command.

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

Properties

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

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.26