ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid-8/modules/m_pass.c
Revision: 1121
Committed: Sun Jan 9 11:03:03 2011 UTC (15 years, 6 months ago) by michael
Content type: text/x-csrc
Original Path: ircd-hybrid-7.3/modules/m_pass.c
File size: 3016 byte(s)
Log Message:
- removed all instances of STATIC_MODULES since we don't have
  static modules anymore
- removed m_mkpasswd module from contrib

File Contents

# User Rev Content
1 adx 30 /*
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 knight 31 * $Id$
23 adx 30 */
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 michael 573 #include "s_user.h"
37 adx 30
38 michael 573 static void mr_pass(struct Client *, struct Client *, int, char *[]);
39 adx 30
40     struct Message pass_msgtab = {
41     "PASS", 0, 0, 2, 0, MFLG_SLOW | MFLG_UNREG, 0,
42 michael 573 { mr_pass, m_registered, m_ignore, m_ignore, m_registered, mr_pass }
43 adx 30 };
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 knight 31 const char *_version = "$Revision$";
58 adx 30
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 michael 1115 if (parc > 4)
101 adx 30 {
102 michael 573 if (atoi(parv[3]) >= 6 && valid_sid(parv[4]))
103 adx 30 {
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