19 |
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
20 |
|
* USA |
21 |
|
* |
22 |
< |
* $Id: m_pass.c,v 1.33 2005/08/18 00:52:09 db Exp $ |
22 |
> |
* $Id$ |
23 |
|
*/ |
24 |
|
|
25 |
|
#include "stdinc.h" |
26 |
– |
#include "handlers.h" /* m_pass prototype */ |
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 */ |
32 |
– |
#include "msg.h" |
31 |
|
#include "parse.h" |
32 |
|
#include "modules.h" |
33 |
|
#include "s_serv.h" |
34 |
< |
#include "hash.h" |
34 |
> |
#include "s_user.h" |
35 |
|
|
38 |
– |
static void mr_pass(struct Client *, struct Client *, int, char **); |
39 |
– |
|
40 |
– |
struct Message pass_msgtab = { |
41 |
– |
"PASS", 0, 0, 2, 0, MFLG_SLOW | MFLG_UNREG, 0, |
42 |
– |
{mr_pass, m_registered, m_ignore, m_ignore, m_registered, mr_pass} |
43 |
– |
}; |
44 |
– |
|
45 |
– |
#ifndef STATIC_MODULES |
46 |
– |
void |
47 |
– |
_modinit(void) |
48 |
– |
{ |
49 |
– |
mod_add_cmd(&pass_msgtab); |
50 |
– |
} |
51 |
– |
|
52 |
– |
void |
53 |
– |
_moddeinit(void) |
54 |
– |
{ |
55 |
– |
mod_del_cmd(&pass_msgtab); |
56 |
– |
} |
57 |
– |
|
58 |
– |
const char *_version = "$Revision: 1.33 $"; |
59 |
– |
#endif |
36 |
|
|
37 |
|
/* |
38 |
|
* m_pass() - Added Sat, 4 March 1989 |
49 |
|
{ |
50 |
|
char *password = parv[1]; |
51 |
|
|
52 |
+ |
assert(client_p == source_p); |
53 |
+ |
|
54 |
|
if (EmptyString(password)) |
55 |
|
{ |
56 |
< |
sendto_one(client_p, form_str(ERR_NEEDMOREPARAMS), |
57 |
< |
me.name, EmptyString(parv[0]) ? "*" : parv[0], "PASS"); |
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(client_p->localClient->passwd); |
61 |
> |
MyFree(source_p->localClient->passwd); |
62 |
|
if (strlen(password) > PASSWDLEN) |
63 |
|
password[PASSWDLEN] = '\0'; |
64 |
< |
DupString(client_p->localClient->passwd, password); |
64 |
> |
DupString(source_p->localClient->passwd, password); |
65 |
|
|
66 |
|
if (parc > 2) |
67 |
|
{ |
72 |
|
* safely assume if there is a ":TS" then its a TS server |
73 |
|
* -Dianora |
74 |
|
*/ |
75 |
< |
if (!irccmp(parv[2], "TS") && client_p->tsinfo == 0) |
76 |
< |
client_p->tsinfo = TS_DOESTS; |
75 |
> |
if (!irccmp(parv[2], "TS") && source_p->tsinfo == 0) |
76 |
> |
source_p->tsinfo = TS_DOESTS; |
77 |
|
} |
78 |
|
|
79 |
|
/* only do this stuff if we are doing ts6 */ |
80 |
< |
if (parc > 4 && me.id[0]) |
80 |
> |
if (parc > 4) |
81 |
|
{ |
82 |
< |
if (atoi(parv[3]) >= 6) |
82 |
> |
if (atoi(parv[3]) >= 6 && valid_sid(parv[4])) |
83 |
|
{ |
84 |
< |
strlcpy(client_p->id, parv[4], sizeof(client_p->id)); |
85 |
< |
SetCapable(client_p, CAP_TS6); |
84 |
> |
strlcpy(source_p->id, parv[4], sizeof(source_p->id)); |
85 |
> |
SetCapable(source_p, CAP_TS6); |
86 |
|
} |
87 |
|
} |
88 |
|
} |
89 |
|
|
90 |
+ |
static struct Message pass_msgtab = { |
91 |
+ |
"PASS", 0, 0, 2, MAXPARA, MFLG_SLOW | MFLG_UNREG, 0, |
92 |
+ |
{ mr_pass, m_registered, m_ignore, m_ignore, m_registered, mr_pass } |
93 |
+ |
}; |
94 |
+ |
|
95 |
+ |
static void |
96 |
+ |
module_init(void) |
97 |
+ |
{ |
98 |
+ |
mod_add_cmd(&pass_msgtab); |
99 |
+ |
} |
100 |
+ |
|
101 |
+ |
static void |
102 |
+ |
module_exit(void) |
103 |
+ |
{ |
104 |
+ |
mod_del_cmd(&pass_msgtab); |
105 |
+ |
} |
106 |
+ |
|
107 |
+ |
struct module module_entry = { |
108 |
+ |
.node = { NULL, NULL, NULL }, |
109 |
+ |
.name = NULL, |
110 |
+ |
.version = "$Revision$", |
111 |
+ |
.handle = NULL, |
112 |
+ |
.modinit = module_init, |
113 |
+ |
.modexit = module_exit, |
114 |
+ |
.flags = 0 |
115 |
+ |
}; |