1 |
adx |
30 |
/* |
2 |
michael |
2820 |
* ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd) |
3 |
adx |
30 |
* |
4 |
michael |
2820 |
* Copyright (c) 1997-2014 ircd-hybrid development team |
5 |
adx |
30 |
* |
6 |
|
|
* This program is free software; you can redistribute it and/or modify |
7 |
|
|
* it under the terms of the GNU General Public License as published by |
8 |
|
|
* the Free Software Foundation; either version 2 of the License, or |
9 |
|
|
* (at your option) any later version. |
10 |
|
|
* |
11 |
|
|
* This program is distributed in the hope that it will be useful, |
12 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
|
|
* GNU General Public License for more details. |
15 |
|
|
* |
16 |
|
|
* You should have received a copy of the GNU General Public License |
17 |
|
|
* along with this program; if not, write to the Free Software |
18 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
19 |
|
|
* USA |
20 |
|
|
*/ |
21 |
|
|
|
22 |
michael |
2820 |
/*! \file m_server.c |
23 |
|
|
* \brief Includes required functions for processing the SERVER/SID command. |
24 |
|
|
* \version $Id$ |
25 |
|
|
*/ |
26 |
|
|
|
27 |
adx |
30 |
#include "stdinc.h" |
28 |
michael |
1011 |
#include "list.h" |
29 |
michael |
2820 |
#include "client.h" |
30 |
adx |
30 |
#include "event.h" |
31 |
michael |
2820 |
#include "hash.h" |
32 |
|
|
#include "irc_string.h" |
33 |
|
|
#include "ircd.h" |
34 |
|
|
#include "numeric.h" |
35 |
|
|
#include "conf.h" |
36 |
|
|
#include "log.h" |
37 |
michael |
3347 |
#include "misc.h" |
38 |
|
|
#include "server.h" |
39 |
|
|
#include "user.h" |
40 |
michael |
2820 |
#include "send.h" |
41 |
adx |
30 |
#include "parse.h" |
42 |
michael |
3303 |
#include "memory.h" |
43 |
adx |
30 |
#include "modules.h" |
44 |
|
|
|
45 |
|
|
|
46 |
michael |
3303 |
/* |
47 |
|
|
* send_tb |
48 |
|
|
* |
49 |
|
|
* inputs - pointer to Client |
50 |
|
|
* - pointer to channel |
51 |
|
|
* output - NONE |
52 |
|
|
* side effects - Called on a server burst when |
53 |
|
|
* server is CAP_TBURST capable |
54 |
|
|
*/ |
55 |
|
|
static void |
56 |
|
|
send_tb(struct Client *client_p, struct Channel *chptr) |
57 |
|
|
{ |
58 |
|
|
/* |
59 |
|
|
* We may also send an empty topic here, but only if topic_time isn't 0, |
60 |
|
|
* i.e. if we had a topic that got unset. This is required for syncing |
61 |
|
|
* topics properly. |
62 |
|
|
* |
63 |
|
|
* Imagine the following scenario: Our downlink introduces a channel |
64 |
|
|
* to us with a TS that is equal to ours, but the channel topic on |
65 |
|
|
* their side got unset while the servers were in splitmode, which means |
66 |
|
|
* their 'topic' is newer. They simply wanted to unset it, so we have to |
67 |
|
|
* deal with it in a more sophisticated fashion instead of just resetting |
68 |
|
|
* it to their old topic they had before. Read m_tburst.c:ms_tburst |
69 |
|
|
* for further information -Michael |
70 |
|
|
*/ |
71 |
|
|
if (chptr->topic_time) |
72 |
|
|
sendto_one(client_p, ":%s TBURST %lu %s %lu %s :%s", me.id, |
73 |
|
|
(unsigned long)chptr->channelts, chptr->chname, |
74 |
|
|
(unsigned long)chptr->topic_time, |
75 |
|
|
chptr->topic_info, |
76 |
|
|
chptr->topic); |
77 |
|
|
} |
78 |
|
|
|
79 |
|
|
/* sendnick_TS() |
80 |
|
|
* |
81 |
|
|
* inputs - client (server) to send nick towards |
82 |
|
|
* - client to send nick for |
83 |
|
|
* output - NONE |
84 |
|
|
* side effects - NICK message is sent towards given client_p |
85 |
|
|
*/ |
86 |
michael |
3306 |
static void |
87 |
michael |
3303 |
sendnick_TS(struct Client *client_p, struct Client *target_p) |
88 |
|
|
{ |
89 |
|
|
char ubuf[IRCD_BUFSIZE] = ""; |
90 |
|
|
|
91 |
|
|
if (!IsClient(target_p)) |
92 |
|
|
return; |
93 |
|
|
|
94 |
michael |
4020 |
send_umode(NULL, target_p, 0, ubuf); |
95 |
michael |
3303 |
|
96 |
|
|
if (ubuf[0] == '\0') |
97 |
|
|
{ |
98 |
|
|
ubuf[0] = '+'; |
99 |
|
|
ubuf[1] = '\0'; |
100 |
|
|
} |
101 |
|
|
|
102 |
|
|
if (IsCapable(client_p, CAP_SVS)) |
103 |
|
|
sendto_one(client_p, ":%s UID %s %d %lu %s %s %s %s %s %s :%s", |
104 |
|
|
target_p->servptr->id, |
105 |
|
|
target_p->name, target_p->hopcount + 1, |
106 |
|
|
(unsigned long) target_p->tsinfo, |
107 |
|
|
ubuf, target_p->username, target_p->host, |
108 |
|
|
(MyClient(target_p) && IsIPSpoof(target_p)) ? |
109 |
|
|
"0" : target_p->sockhost, target_p->id, |
110 |
|
|
target_p->svid, target_p->info); |
111 |
|
|
else |
112 |
|
|
sendto_one(client_p, ":%s UID %s %d %lu %s %s %s %s %s :%s", |
113 |
|
|
target_p->servptr->id, |
114 |
|
|
target_p->name, target_p->hopcount + 1, |
115 |
|
|
(unsigned long) target_p->tsinfo, |
116 |
|
|
ubuf, target_p->username, target_p->host, |
117 |
|
|
(MyClient(target_p) && IsIPSpoof(target_p)) ? |
118 |
|
|
"0" : target_p->sockhost, target_p->id, target_p->info); |
119 |
|
|
|
120 |
|
|
if (!EmptyString(target_p->certfp)) |
121 |
|
|
sendto_one(client_p, ":%s CERTFP %s", target_p->id, target_p->certfp); |
122 |
|
|
|
123 |
|
|
if (target_p->away[0]) |
124 |
|
|
sendto_one(client_p, ":%s AWAY :%s", target_p->id, target_p->away); |
125 |
|
|
|
126 |
|
|
} |
127 |
|
|
|
128 |
|
|
/* burst_members() |
129 |
|
|
* |
130 |
|
|
* inputs - pointer to server to send members to |
131 |
|
|
* - dlink_list pointer to membership list to send |
132 |
|
|
* output - NONE |
133 |
|
|
* side effects - |
134 |
|
|
*/ |
135 |
|
|
static void |
136 |
|
|
burst_members(struct Client *client_p, struct Channel *chptr) |
137 |
|
|
{ |
138 |
|
|
struct Client *target_p; |
139 |
|
|
struct Membership *ms; |
140 |
|
|
dlink_node *ptr; |
141 |
|
|
|
142 |
|
|
DLINK_FOREACH(ptr, chptr->members.head) |
143 |
|
|
{ |
144 |
|
|
ms = ptr->data; |
145 |
|
|
target_p = ms->client_p; |
146 |
|
|
|
147 |
|
|
if (!HasFlag(target_p, FLAGS_BURSTED)) |
148 |
|
|
{ |
149 |
|
|
AddFlag(target_p, FLAGS_BURSTED); |
150 |
|
|
|
151 |
|
|
if (target_p->from != client_p) |
152 |
|
|
sendnick_TS(client_p, target_p); |
153 |
|
|
} |
154 |
|
|
} |
155 |
|
|
} |
156 |
|
|
|
157 |
|
|
/* burst_all() |
158 |
|
|
* |
159 |
|
|
* inputs - pointer to server to send burst to |
160 |
|
|
* output - NONE |
161 |
|
|
* side effects - complete burst of channels/nicks is sent to client_p |
162 |
|
|
*/ |
163 |
|
|
static void |
164 |
|
|
burst_all(struct Client *client_p) |
165 |
|
|
{ |
166 |
|
|
dlink_node *ptr = NULL; |
167 |
|
|
|
168 |
michael |
3944 |
DLINK_FOREACH(ptr, channel_list.head) |
169 |
michael |
3303 |
{ |
170 |
|
|
struct Channel *chptr = ptr->data; |
171 |
|
|
|
172 |
|
|
if (dlink_list_length(&chptr->members)) |
173 |
|
|
{ |
174 |
|
|
burst_members(client_p, chptr); |
175 |
|
|
send_channel_modes(client_p, chptr); |
176 |
|
|
|
177 |
|
|
if (IsCapable(client_p, CAP_TBURST)) |
178 |
|
|
send_tb(client_p, chptr); |
179 |
|
|
} |
180 |
|
|
} |
181 |
|
|
|
182 |
|
|
/* also send out those that are not on any channel |
183 |
|
|
*/ |
184 |
|
|
DLINK_FOREACH(ptr, global_client_list.head) |
185 |
|
|
{ |
186 |
|
|
struct Client *target_p = ptr->data; |
187 |
|
|
|
188 |
|
|
if (!HasFlag(target_p, FLAGS_BURSTED) && target_p->from != client_p) |
189 |
|
|
sendnick_TS(client_p, target_p); |
190 |
|
|
|
191 |
|
|
DelFlag(target_p, FLAGS_BURSTED); |
192 |
|
|
} |
193 |
|
|
|
194 |
|
|
if (IsCapable(client_p, CAP_EOB)) |
195 |
|
|
sendto_one(client_p, ":%s EOB", me.id); |
196 |
|
|
} |
197 |
|
|
|
198 |
|
|
/* server_burst() |
199 |
|
|
* |
200 |
|
|
* inputs - struct Client pointer server |
201 |
|
|
* - |
202 |
|
|
* output - none |
203 |
|
|
* side effects - send a server burst |
204 |
|
|
* bugs - still too long |
205 |
|
|
*/ |
206 |
|
|
static void |
207 |
|
|
server_burst(struct Client *client_p) |
208 |
|
|
{ |
209 |
|
|
/* Send it in the shortened format with the TS, if |
210 |
|
|
** it's a TS server; walk the list of channels, sending |
211 |
|
|
** all the nicks that haven't been sent yet for each |
212 |
|
|
** channel, then send the channel itself -- it's less |
213 |
|
|
** obvious than sending all nicks first, but on the |
214 |
|
|
** receiving side memory will be allocated more nicely |
215 |
|
|
** saving a few seconds in the handling of a split |
216 |
|
|
** -orabidoo |
217 |
|
|
*/ |
218 |
|
|
|
219 |
|
|
burst_all(client_p); |
220 |
|
|
|
221 |
|
|
/* EOB stuff is now in burst_all */ |
222 |
|
|
/* Always send a PING after connect burst is done */ |
223 |
|
|
sendto_one(client_p, "PING :%s", me.id); |
224 |
|
|
} |
225 |
|
|
|
226 |
|
|
/* server_estab() |
227 |
|
|
* |
228 |
|
|
* inputs - pointer to a struct Client |
229 |
|
|
* output - |
230 |
|
|
* side effects - |
231 |
|
|
*/ |
232 |
michael |
3306 |
static void |
233 |
michael |
3303 |
server_estab(struct Client *client_p) |
234 |
|
|
{ |
235 |
|
|
struct MaskItem *conf = NULL; |
236 |
|
|
char *host; |
237 |
|
|
const char *inpath; |
238 |
|
|
static char inpath_ip[HOSTLEN * 2 + USERLEN + 6]; |
239 |
|
|
dlink_node *ptr; |
240 |
michael |
4247 |
#if defined(HAVE_LIBCRYPTO) && !defined(OPENSSL_NO_COMP) |
241 |
michael |
3303 |
const COMP_METHOD *compression = NULL, *expansion = NULL; |
242 |
|
|
#endif |
243 |
|
|
|
244 |
|
|
assert(client_p); |
245 |
|
|
|
246 |
|
|
strlcpy(inpath_ip, get_client_name(client_p, SHOW_IP), sizeof(inpath_ip)); |
247 |
|
|
|
248 |
|
|
inpath = get_client_name(client_p, MASK_IP); /* "refresh" inpath with host */ |
249 |
|
|
host = client_p->name; |
250 |
|
|
|
251 |
|
|
if ((conf = find_conf_name(&client_p->localClient->confs, host, CONF_SERVER)) |
252 |
|
|
== NULL) |
253 |
|
|
{ |
254 |
|
|
/* This shouldn't happen, better tell the ops... -A1kmm */ |
255 |
|
|
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, |
256 |
|
|
"Warning: Lost connect{} block " |
257 |
|
|
"for server %s(this shouldn't happen)!", host); |
258 |
|
|
exit_client(client_p, "Lost connect{} block!"); |
259 |
|
|
return; |
260 |
|
|
} |
261 |
|
|
|
262 |
michael |
4439 |
MyFree(client_p->localClient->password); |
263 |
|
|
client_p->localClient->password = NULL; |
264 |
michael |
3303 |
|
265 |
michael |
4298 |
/* Its got identd, since it's a server */ |
266 |
michael |
3303 |
SetGotId(client_p); |
267 |
|
|
|
268 |
|
|
/* If there is something in the serv_list, it might be this |
269 |
|
|
* connecting server.. |
270 |
|
|
*/ |
271 |
michael |
4340 |
if (!ConfigServerInfo.hub && local_server_list.head) |
272 |
michael |
3303 |
{ |
273 |
michael |
4213 |
if (client_p != local_server_list.head->data || local_server_list.head->next) |
274 |
michael |
3303 |
{ |
275 |
|
|
++ServerStats.is_ref; |
276 |
|
|
sendto_one(client_p, "ERROR :I'm a leaf not a hub"); |
277 |
|
|
exit_client(client_p, "I'm a leaf"); |
278 |
|
|
return; |
279 |
|
|
} |
280 |
|
|
} |
281 |
|
|
|
282 |
|
|
if (IsUnknown(client_p)) |
283 |
|
|
{ |
284 |
|
|
sendto_one(client_p, "PASS %s TS %d %s", conf->spasswd, TS_CURRENT, me.id); |
285 |
|
|
|
286 |
|
|
send_capabilities(client_p, 0); |
287 |
|
|
|
288 |
|
|
sendto_one(client_p, "SERVER %s 1 :%s%s", |
289 |
|
|
me.name, ConfigServerHide.hidden ? "(H) " : "", me.info); |
290 |
|
|
} |
291 |
|
|
|
292 |
michael |
4009 |
sendto_one(client_p, ":%s SVINFO %d %d 0 :%lu", me.id, TS_CURRENT, TS_MIN, |
293 |
michael |
3303 |
(unsigned long)CurrentTime); |
294 |
|
|
|
295 |
|
|
/* XXX Does this ever happen? I don't think so -db */ |
296 |
|
|
detach_conf(client_p, CONF_OPER); |
297 |
|
|
|
298 |
|
|
/* *WARNING* |
299 |
|
|
** In the following code in place of plain server's |
300 |
|
|
** name we send what is returned by get_client_name |
301 |
|
|
** which may add the "sockhost" after the name. It's |
302 |
|
|
** *very* *important* that there is a SPACE between |
303 |
|
|
** the name and sockhost (if present). The receiving |
304 |
|
|
** server will start the information field from this |
305 |
|
|
** first blank and thus puts the sockhost into info. |
306 |
|
|
** ...a bit tricky, but you have been warned, besides |
307 |
|
|
** code is more neat this way... --msa |
308 |
|
|
*/ |
309 |
|
|
client_p->servptr = &me; |
310 |
|
|
|
311 |
|
|
if (IsClosing(client_p)) |
312 |
|
|
return; |
313 |
|
|
|
314 |
|
|
SetServer(client_p); |
315 |
|
|
|
316 |
|
|
/* Some day, all these lists will be consolidated *sigh* */ |
317 |
|
|
dlinkAdd(client_p, &client_p->lnode, &me.serv->server_list); |
318 |
|
|
|
319 |
|
|
assert(dlinkFind(&unknown_list, client_p)); |
320 |
|
|
|
321 |
|
|
dlink_move_node(&client_p->localClient->lclient_node, |
322 |
michael |
4213 |
&unknown_list, &local_server_list); |
323 |
michael |
3303 |
|
324 |
|
|
Count.myserver++; |
325 |
|
|
|
326 |
michael |
4189 |
dlinkAdd(client_p, &client_p->node, &global_client_list); |
327 |
michael |
4209 |
dlinkAdd(client_p, make_dlink_node(), &global_server_list); |
328 |
michael |
3303 |
hash_add_client(client_p); |
329 |
|
|
hash_add_id(client_p); |
330 |
|
|
|
331 |
|
|
/* doesnt duplicate client_p->serv if allocated this struct already */ |
332 |
|
|
make_server(client_p); |
333 |
|
|
|
334 |
|
|
/* fixing eob timings.. -gnp */ |
335 |
|
|
client_p->localClient->firsttime = CurrentTime; |
336 |
|
|
|
337 |
|
|
if (find_matching_name_conf(CONF_SERVICE, client_p->name, NULL, NULL, 0)) |
338 |
|
|
AddFlag(client_p, FLAGS_SERVICE); |
339 |
|
|
|
340 |
|
|
/* Show the real host/IP to admins */ |
341 |
|
|
#ifdef HAVE_LIBCRYPTO |
342 |
|
|
if (client_p->localClient->fd.ssl) |
343 |
|
|
{ |
344 |
michael |
4247 |
#ifndef OPENSSL_NO_COMP |
345 |
michael |
3303 |
compression = SSL_get_current_compression(client_p->localClient->fd.ssl); |
346 |
|
|
expansion = SSL_get_current_expansion(client_p->localClient->fd.ssl); |
347 |
michael |
4247 |
#endif |
348 |
michael |
3303 |
sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE, |
349 |
|
|
"Link with %s established: [SSL: %s, Compression/Expansion method: %s/%s] (Capabilities: %s)", |
350 |
|
|
inpath_ip, ssl_get_cipher(client_p->localClient->fd.ssl), |
351 |
michael |
4247 |
#ifndef OPENSSL_NO_COMP |
352 |
michael |
3303 |
compression ? SSL_COMP_get_name(compression) : "NONE", |
353 |
|
|
expansion ? SSL_COMP_get_name(expansion) : "NONE", |
354 |
michael |
4247 |
#else |
355 |
|
|
"NONE", "NONE", |
356 |
|
|
#endif |
357 |
michael |
3303 |
show_capabilities(client_p)); |
358 |
|
|
/* Now show the masked hostname/IP to opers */ |
359 |
|
|
sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE, |
360 |
|
|
"Link with %s established: [SSL: %s, Compression/Expansion method: %s/%s] (Capabilities: %s)", |
361 |
|
|
inpath, ssl_get_cipher(client_p->localClient->fd.ssl), |
362 |
michael |
4247 |
#ifndef OPENSSL_NO_COMP |
363 |
michael |
3303 |
compression ? SSL_COMP_get_name(compression) : "NONE", |
364 |
|
|
expansion ? SSL_COMP_get_name(expansion) : "NONE", |
365 |
michael |
4247 |
#else |
366 |
|
|
"NONE", "NONE", |
367 |
|
|
#endif |
368 |
michael |
3303 |
show_capabilities(client_p)); |
369 |
|
|
ilog(LOG_TYPE_IRCD, "Link with %s established: [SSL: %s, Compression/Expansion method: %s/%s] (Capabilities: %s)", |
370 |
|
|
inpath_ip, ssl_get_cipher(client_p->localClient->fd.ssl), |
371 |
michael |
4247 |
#ifndef OPENSSL_NO_COMP |
372 |
michael |
3303 |
compression ? SSL_COMP_get_name(compression) : "NONE", |
373 |
|
|
expansion ? SSL_COMP_get_name(expansion) : "NONE", |
374 |
michael |
4247 |
#else |
375 |
|
|
"NONE", "NONE", |
376 |
|
|
#endif |
377 |
michael |
3303 |
show_capabilities(client_p)); |
378 |
|
|
} |
379 |
|
|
else |
380 |
|
|
#endif |
381 |
|
|
{ |
382 |
|
|
sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE, |
383 |
|
|
"Link with %s established: (Capabilities: %s)", |
384 |
|
|
inpath_ip, show_capabilities(client_p)); |
385 |
|
|
/* Now show the masked hostname/IP to opers */ |
386 |
|
|
sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE, |
387 |
|
|
"Link with %s established: (Capabilities: %s)", |
388 |
|
|
inpath, show_capabilities(client_p)); |
389 |
|
|
ilog(LOG_TYPE_IRCD, "Link with %s established: (Capabilities: %s)", |
390 |
|
|
inpath_ip, show_capabilities(client_p)); |
391 |
|
|
} |
392 |
|
|
|
393 |
|
|
fd_note(&client_p->localClient->fd, "Server: %s", client_p->name); |
394 |
|
|
|
395 |
|
|
sendto_server(client_p, NOCAPS, NOCAPS, ":%s SID %s 2 %s :%s%s", |
396 |
|
|
me.id, client_p->name, client_p->id, |
397 |
|
|
IsHidden(client_p) ? "(H) " : "", client_p->info); |
398 |
|
|
|
399 |
|
|
/* |
400 |
|
|
* Pass on my client information to the new server |
401 |
|
|
* |
402 |
|
|
* First, pass only servers (idea is that if the link gets |
403 |
|
|
* cancelled beacause the server was already there, |
404 |
|
|
* there are no NICK's to be cancelled...). Of course, |
405 |
|
|
* if cancellation occurs, all this info is sent anyway, |
406 |
|
|
* and I guess the link dies when a read is attempted...? --msa |
407 |
|
|
* |
408 |
|
|
* Note: Link cancellation to occur at this point means |
409 |
|
|
* that at least two servers from my fragment are building |
410 |
|
|
* up connection this other fragment at the same time, it's |
411 |
|
|
* a race condition, not the normal way of operation... |
412 |
|
|
* |
413 |
|
|
* ALSO NOTE: using the get_client_name for server names-- |
414 |
|
|
* see previous *WARNING*!!! (Also, original inpath |
415 |
|
|
* is destroyed...) |
416 |
|
|
*/ |
417 |
michael |
4209 |
DLINK_FOREACH_PREV(ptr, global_server_list.tail) |
418 |
michael |
3303 |
{ |
419 |
|
|
struct Client *target_p = ptr->data; |
420 |
|
|
|
421 |
|
|
/* target_p->from == target_p for target_p == client_p */ |
422 |
|
|
if (IsMe(target_p) || target_p->from == client_p) |
423 |
|
|
continue; |
424 |
|
|
|
425 |
|
|
sendto_one(client_p, ":%s SID %s %d %s :%s%s", |
426 |
|
|
target_p->servptr->id, target_p->name, target_p->hopcount+1, |
427 |
|
|
target_p->id, IsHidden(target_p) ? "(H) " : "", |
428 |
|
|
target_p->info); |
429 |
|
|
} |
430 |
|
|
|
431 |
|
|
server_burst(client_p); |
432 |
|
|
} |
433 |
|
|
|
434 |
michael |
1997 |
/* set_server_gecos() |
435 |
|
|
* |
436 |
|
|
* input - pointer to client |
437 |
|
|
* output - NONE |
438 |
|
|
* side effects - servers gecos field is set |
439 |
|
|
*/ |
440 |
|
|
static void |
441 |
|
|
set_server_gecos(struct Client *client_p, const char *info) |
442 |
|
|
{ |
443 |
|
|
const char *s = info; |
444 |
adx |
30 |
|
445 |
michael |
1997 |
/* check for (H) which is a hidden server */ |
446 |
|
|
if (!strncmp(s, "(H) ", 4)) |
447 |
|
|
{ |
448 |
|
|
SetHidden(client_p); |
449 |
|
|
s = s + 4; |
450 |
|
|
} |
451 |
|
|
|
452 |
|
|
if (!EmptyString(s)) |
453 |
|
|
strlcpy(client_p->info, s, sizeof(client_p->info)); |
454 |
|
|
else |
455 |
|
|
strlcpy(client_p->info, "(Unknown Location)", sizeof(client_p->info)); |
456 |
|
|
} |
457 |
|
|
|
458 |
adx |
30 |
/* mr_server() |
459 |
michael |
3096 |
* parv[0] = command |
460 |
adx |
30 |
* parv[1] = servername |
461 |
michael |
3139 |
* parv[2] = hopcount |
462 |
adx |
30 |
* parv[3] = serverinfo |
463 |
|
|
*/ |
464 |
michael |
2820 |
static int |
465 |
michael |
3156 |
mr_server(struct Client *source_p, int parc, char *parv[]) |
466 |
adx |
30 |
{ |
467 |
michael |
3246 |
char *name = NULL; |
468 |
|
|
struct Client *target_p = NULL; |
469 |
adx |
30 |
|
470 |
michael |
1178 |
if (EmptyString(parv[3])) |
471 |
adx |
30 |
{ |
472 |
michael |
3156 |
sendto_one(source_p, "ERROR :No servername"); |
473 |
michael |
3171 |
exit_client(source_p, "Wrong number of args"); |
474 |
michael |
2820 |
return 0; |
475 |
adx |
30 |
} |
476 |
|
|
|
477 |
|
|
name = parv[1]; |
478 |
|
|
|
479 |
michael |
1118 |
/* |
480 |
|
|
* Reject a direct nonTS server connection if we're TS_ONLY -orabidoo |
481 |
adx |
30 |
*/ |
482 |
michael |
3156 |
if (!DoesTS(source_p)) |
483 |
adx |
30 |
{ |
484 |
michael |
1618 |
sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE, |
485 |
michael |
1118 |
"Unauthorized server connection attempt from %s: Non-TS server " |
486 |
michael |
3156 |
"for server %s", get_client_name(source_p, HIDE_IP), name); |
487 |
michael |
1618 |
sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE, |
488 |
michael |
1118 |
"Unauthorized server connection attempt from %s: Non-TS server " |
489 |
michael |
3156 |
"for server %s", get_client_name(source_p, MASK_IP), name); |
490 |
michael |
3171 |
exit_client(source_p, "Non-TS server"); |
491 |
michael |
2820 |
return 0; |
492 |
adx |
30 |
} |
493 |
|
|
|
494 |
michael |
1118 |
if (!valid_servname(name)) |
495 |
adx |
30 |
{ |
496 |
michael |
1618 |
sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE, |
497 |
michael |
1118 |
"Unauthorized server connection attempt from %s: Bogus server name " |
498 |
michael |
3156 |
"for server %s", get_client_name(source_p, HIDE_IP), name); |
499 |
michael |
1624 |
sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE, |
500 |
michael |
1118 |
"Unauthorized server connection attempt from %s: Bogus server name " |
501 |
michael |
3156 |
"for server %s", get_client_name(source_p, MASK_IP), name); |
502 |
michael |
3171 |
exit_client(source_p, "Bogus server name"); |
503 |
michael |
2820 |
return 0; |
504 |
adx |
30 |
} |
505 |
|
|
|
506 |
michael |
3156 |
if (!valid_sid(source_p->id)) |
507 |
michael |
3148 |
{ |
508 |
|
|
sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE, |
509 |
|
|
"Link %s introduced server with bogus server ID %s", |
510 |
michael |
3156 |
get_client_name(source_p, SHOW_IP), source_p->id); |
511 |
michael |
3148 |
sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE, |
512 |
|
|
"Link %s introduced server with bogus server ID %s", |
513 |
michael |
3156 |
get_client_name(source_p, MASK_IP), source_p->id); |
514 |
|
|
sendto_one(source_p, "ERROR :Bogus server ID introduced"); |
515 |
michael |
3171 |
exit_client(source_p, "Bogus server ID intoduced"); |
516 |
michael |
3148 |
return 0; |
517 |
|
|
} |
518 |
|
|
|
519 |
adx |
30 |
/* Now we just have to call check_server and everything should |
520 |
|
|
* be check for us... -A1kmm. |
521 |
|
|
*/ |
522 |
michael |
3156 |
switch (check_server(name, source_p)) |
523 |
adx |
30 |
{ |
524 |
|
|
case -1: |
525 |
michael |
4340 |
if (ConfigGeneral.warn_no_connect_block) |
526 |
adx |
30 |
{ |
527 |
michael |
1618 |
sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE, |
528 |
adx |
30 |
"Unauthorized server connection attempt from %s: No entry for " |
529 |
michael |
3156 |
"servername %s", get_client_name(source_p, HIDE_IP), name); |
530 |
adx |
30 |
|
531 |
michael |
1618 |
sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE, |
532 |
adx |
30 |
"Unauthorized server connection attempt from %s: No entry for " |
533 |
michael |
3156 |
"servername %s", get_client_name(source_p, MASK_IP), name); |
534 |
adx |
30 |
} |
535 |
|
|
|
536 |
michael |
3171 |
exit_client(source_p, "No connect{} block."); |
537 |
michael |
2820 |
return 0; |
538 |
adx |
30 |
/* NOT REACHED */ |
539 |
|
|
break; |
540 |
|
|
|
541 |
|
|
case -2: |
542 |
michael |
1618 |
sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE, |
543 |
adx |
30 |
"Unauthorized server connection attempt from %s: Bad password " |
544 |
michael |
3156 |
"for server %s", get_client_name(source_p, HIDE_IP), name); |
545 |
adx |
30 |
|
546 |
michael |
1618 |
sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE, |
547 |
adx |
30 |
"Unauthorized server connection attempt from %s: Bad password " |
548 |
michael |
3156 |
"for server %s", get_client_name(source_p, MASK_IP), name); |
549 |
adx |
30 |
|
550 |
michael |
3171 |
exit_client(source_p, "Invalid password."); |
551 |
michael |
2820 |
return 0; |
552 |
adx |
30 |
/* NOT REACHED */ |
553 |
|
|
break; |
554 |
|
|
|
555 |
|
|
case -3: |
556 |
michael |
1618 |
sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE, |
557 |
adx |
30 |
"Unauthorized server connection attempt from %s: Invalid host " |
558 |
michael |
3156 |
"for server %s", get_client_name(source_p, HIDE_IP), name); |
559 |
adx |
30 |
|
560 |
michael |
1618 |
sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE, |
561 |
adx |
30 |
"Unauthorized server connection attempt from %s: Invalid host " |
562 |
michael |
3156 |
"for server %s", get_client_name(source_p, MASK_IP), name); |
563 |
adx |
30 |
|
564 |
michael |
3171 |
exit_client(source_p, "Invalid host."); |
565 |
michael |
2820 |
return 0; |
566 |
michael |
2228 |
case -4: |
567 |
|
|
sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE, |
568 |
|
|
"Unauthorized server connection attempt from %s: Invalid certificate fingerprint " |
569 |
michael |
3156 |
"for server %s", get_client_name(source_p, HIDE_IP), name); |
570 |
michael |
2228 |
|
571 |
|
|
sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE, |
572 |
|
|
"Unauthorized server connection attempt from %s: Invalid certificate fingerprint " |
573 |
michael |
3156 |
"for server %s", get_client_name(source_p, MASK_IP), name); |
574 |
michael |
2228 |
|
575 |
michael |
3171 |
exit_client(source_p, "Invalid certificate fingerprint."); |
576 |
michael |
2820 |
return 0; |
577 |
adx |
30 |
/* NOT REACHED */ |
578 |
|
|
break; |
579 |
|
|
} |
580 |
|
|
|
581 |
michael |
2976 |
if ((target_p = hash_find_server(name))) |
582 |
adx |
30 |
{ |
583 |
|
|
/* This link is trying feed me a server that I already have |
584 |
|
|
* access through another path -- multiple paths not accepted |
585 |
|
|
* currently, kill this link immediately!! |
586 |
|
|
* |
587 |
|
|
* Rather than KILL the link which introduced it, KILL the |
588 |
|
|
* youngest of the two links. -avalon |
589 |
|
|
* |
590 |
|
|
* Definitely don't do that here. This is from an unregistered |
591 |
|
|
* connect - A1kmm. |
592 |
|
|
*/ |
593 |
michael |
1618 |
sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE, |
594 |
michael |
2976 |
"Attempt to re-introduce server %s from %s", |
595 |
michael |
3156 |
name, get_client_name(source_p, HIDE_IP)); |
596 |
michael |
2976 |
sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE, |
597 |
|
|
"Attempt to re-introduce server %s from %s", |
598 |
michael |
3156 |
name, get_client_name(source_p, MASK_IP)); |
599 |
|
|
sendto_one(source_p, "ERROR :Server already exists."); |
600 |
michael |
3171 |
exit_client(source_p, "Server already exists"); |
601 |
michael |
2976 |
return 0; |
602 |
|
|
} |
603 |
|
|
|
604 |
michael |
3156 |
if ((target_p = hash_find_id(source_p->id))) |
605 |
michael |
2976 |
{ |
606 |
|
|
sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE, |
607 |
michael |
2820 |
"Attempt to re-introduce server %s SID %s from %s", |
608 |
michael |
3156 |
name, source_p->id, |
609 |
|
|
get_client_name(source_p, HIDE_IP)); |
610 |
michael |
1618 |
sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE, |
611 |
michael |
2820 |
"Attempt to re-introduce server %s SID %s from %s", |
612 |
michael |
3156 |
name, source_p->id, |
613 |
|
|
get_client_name(source_p, MASK_IP)); |
614 |
|
|
sendto_one(source_p, "ERROR :Server ID already exists."); |
615 |
michael |
3171 |
exit_client(source_p, "Server ID already exists"); |
616 |
michael |
2820 |
return 0; |
617 |
adx |
30 |
} |
618 |
|
|
|
619 |
|
|
/* XXX If somehow there is a connect in progress and |
620 |
|
|
* a connect comes in with same name toss the pending one, |
621 |
|
|
* but only if it's not the same client! - Dianora |
622 |
|
|
*/ |
623 |
|
|
if ((target_p = find_servconn_in_progress(name))) |
624 |
michael |
3156 |
if (target_p != source_p) |
625 |
michael |
3171 |
exit_client(target_p, "Overridden"); |
626 |
adx |
30 |
|
627 |
|
|
/* if we are connecting (Handshake), we already have the name from the |
628 |
michael |
3156 |
* connect{} block in source_p->name |
629 |
adx |
30 |
*/ |
630 |
michael |
3156 |
strlcpy(source_p->name, name, sizeof(source_p->name)); |
631 |
|
|
set_server_gecos(source_p, parv[3]); |
632 |
michael |
3190 |
source_p->hopcount = atoi(parv[2]); |
633 |
michael |
3156 |
server_estab(source_p); |
634 |
michael |
2820 |
return 0; |
635 |
adx |
30 |
} |
636 |
|
|
|
637 |
|
|
/* ms_sid() |
638 |
michael |
3096 |
* parv[0] = command |
639 |
adx |
30 |
* parv[1] = servername |
640 |
michael |
3139 |
* parv[2] = hopcount |
641 |
adx |
30 |
* parv[3] = sid of new server |
642 |
|
|
* parv[4] = serverinfo |
643 |
|
|
*/ |
644 |
michael |
2820 |
static int |
645 |
michael |
3156 |
ms_sid(struct Client *source_p, int parc, char *parv[]) |
646 |
adx |
30 |
{ |
647 |
michael |
3139 |
dlink_node *ptr = NULL; |
648 |
|
|
struct Client *target_p = NULL; |
649 |
michael |
3156 |
struct Client *client_p = source_p->from; /* XXX */ |
650 |
michael |
3139 |
const struct MaskItem *conf = NULL; |
651 |
adx |
30 |
int hlined = 0; |
652 |
|
|
int llined = 0; |
653 |
|
|
|
654 |
|
|
/* Just to be sure -A1kmm. */ |
655 |
|
|
if (!IsServer(source_p)) |
656 |
michael |
2820 |
return 0; |
657 |
adx |
30 |
|
658 |
michael |
1178 |
if (EmptyString(parv[4])) |
659 |
michael |
1118 |
{ |
660 |
|
|
sendto_one(client_p, "ERROR :No servername"); |
661 |
michael |
2820 |
return 0; |
662 |
michael |
1118 |
} |
663 |
adx |
30 |
|
664 |
michael |
1118 |
if (!valid_servname(parv[1])) |
665 |
|
|
{ |
666 |
michael |
1618 |
sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE, |
667 |
michael |
1118 |
"Link %s introduced server with bogus server name %s", |
668 |
|
|
get_client_name(client_p, SHOW_IP), parv[1]); |
669 |
michael |
1618 |
sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE, |
670 |
michael |
1118 |
"Link %s introduced server with bogus server name %s", |
671 |
|
|
get_client_name(client_p, MASK_IP), parv[1]); |
672 |
|
|
sendto_one(client_p, "ERROR :Bogus server name introduced"); |
673 |
michael |
3171 |
exit_client(client_p, "Bogus server name intoduced"); |
674 |
michael |
2820 |
return 0; |
675 |
michael |
1118 |
} |
676 |
|
|
|
677 |
|
|
if (!valid_sid(parv[3])) |
678 |
|
|
{ |
679 |
michael |
1618 |
sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE, |
680 |
michael |
1118 |
"Link %s introduced server with bogus server ID %s", |
681 |
|
|
get_client_name(client_p, SHOW_IP), parv[3]); |
682 |
michael |
1618 |
sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE, |
683 |
michael |
1118 |
"Link %s introduced server with bogus server ID %s", |
684 |
|
|
get_client_name(client_p, MASK_IP), parv[3]); |
685 |
|
|
sendto_one(client_p, "ERROR :Bogus server ID introduced"); |
686 |
michael |
3171 |
exit_client(client_p, "Bogus server ID intoduced"); |
687 |
michael |
2820 |
return 0; |
688 |
michael |
1118 |
} |
689 |
|
|
|
690 |
adx |
30 |
/* collision on SID? */ |
691 |
michael |
1118 |
if ((target_p = hash_find_id(parv[3]))) |
692 |
adx |
30 |
{ |
693 |
michael |
1118 |
sendto_one(client_p, "ERROR :SID %s already exists", parv[3]); |
694 |
michael |
1618 |
sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE, |
695 |
michael |
2820 |
"Link %s cancelled, SID %s already exists", |
696 |
michael |
1118 |
get_client_name(client_p, SHOW_IP), parv[3]); |
697 |
michael |
1618 |
sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE, |
698 |
michael |
2820 |
"Link %s cancelled, SID %s already exists", |
699 |
michael |
1118 |
client_p->name, parv[3]); |
700 |
michael |
3171 |
exit_client(client_p, "SID Exists"); |
701 |
michael |
2820 |
return 0; |
702 |
adx |
30 |
} |
703 |
|
|
|
704 |
|
|
/* collision on name? */ |
705 |
michael |
1169 |
if ((target_p = hash_find_server(parv[1]))) |
706 |
adx |
30 |
{ |
707 |
michael |
1118 |
sendto_one(client_p, "ERROR :Server %s already exists", parv[1]); |
708 |
michael |
1618 |
sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE, |
709 |
michael |
2820 |
"Link %s cancelled, server %s already exists", |
710 |
michael |
1118 |
get_client_name(client_p, SHOW_IP), parv[1]); |
711 |
michael |
1618 |
sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE, |
712 |
michael |
2820 |
"Link %s cancelled, server %s already exists", |
713 |
michael |
1118 |
client_p->name, parv[1]); |
714 |
michael |
3171 |
exit_client(client_p, "Server Exists"); |
715 |
michael |
2820 |
return 0; |
716 |
adx |
30 |
} |
717 |
|
|
|
718 |
|
|
/* XXX If somehow there is a connect in progress and |
719 |
|
|
* a connect comes in with same name toss the pending one, |
720 |
|
|
* but only if it's not the same client! - Dianora |
721 |
|
|
*/ |
722 |
michael |
1118 |
if ((target_p = find_servconn_in_progress(parv[1]))) |
723 |
adx |
30 |
if (target_p != client_p) |
724 |
michael |
3171 |
exit_client(target_p, "Overridden"); |
725 |
adx |
30 |
|
726 |
michael |
1632 |
conf = client_p->localClient->confs.head->data; |
727 |
michael |
1384 |
|
728 |
adx |
30 |
/* See if the newly found server is behind a guaranteed |
729 |
|
|
* leaf. If so, close the link. |
730 |
|
|
*/ |
731 |
michael |
1632 |
DLINK_FOREACH(ptr, conf->leaf_list.head) |
732 |
michael |
3139 |
{ |
733 |
michael |
1652 |
if (!match(ptr->data, parv[1])) |
734 |
michael |
1529 |
{ |
735 |
|
|
llined = 1; |
736 |
|
|
break; |
737 |
|
|
} |
738 |
michael |
3139 |
} |
739 |
adx |
30 |
|
740 |
michael |
1632 |
DLINK_FOREACH(ptr, conf->hub_list.head) |
741 |
michael |
3139 |
{ |
742 |
michael |
1652 |
if (!match(ptr->data, parv[1])) |
743 |
michael |
1529 |
{ |
744 |
|
|
hlined = 1; |
745 |
|
|
break; |
746 |
|
|
} |
747 |
michael |
3139 |
} |
748 |
michael |
1118 |
|
749 |
adx |
30 |
/* Ok, this way this works is |
750 |
|
|
* |
751 |
|
|
* A server can have a CONF_HUB allowing it to introduce servers |
752 |
|
|
* behind it. |
753 |
|
|
* |
754 |
|
|
* connect { |
755 |
|
|
* name = "irc.bighub.net"; |
756 |
|
|
* hub_mask="*"; |
757 |
|
|
* ... |
758 |
michael |
2820 |
* |
759 |
adx |
30 |
* That would allow "irc.bighub.net" to introduce anything it wanted.. |
760 |
|
|
* |
761 |
|
|
* However |
762 |
|
|
* |
763 |
|
|
* connect { |
764 |
|
|
* name = "irc.somehub.fi"; |
765 |
|
|
* hub_mask="*"; |
766 |
|
|
* leaf_mask="*.edu"; |
767 |
|
|
*... |
768 |
|
|
* Would allow this server in finland to hub anything but |
769 |
|
|
* .edu's |
770 |
|
|
*/ |
771 |
|
|
|
772 |
|
|
/* Ok, check client_p can hub the new server, and make sure it's not a LL */ |
773 |
michael |
885 |
if (!hlined) |
774 |
adx |
30 |
{ |
775 |
|
|
/* OOOPs nope can't HUB */ |
776 |
michael |
1618 |
sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE, |
777 |
|
|
"Non-Hub link %s introduced %s.", |
778 |
michael |
1118 |
get_client_name(client_p, SHOW_IP), parv[1]); |
779 |
michael |
1618 |
sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE, |
780 |
|
|
"Non-Hub link %s introduced %s.", |
781 |
michael |
1118 |
get_client_name(client_p, MASK_IP), parv[1]); |
782 |
michael |
3171 |
exit_client(source_p, "No matching hub_mask."); |
783 |
michael |
2820 |
return 0; |
784 |
adx |
30 |
} |
785 |
|
|
|
786 |
|
|
/* Check for the new server being leafed behind this HUB */ |
787 |
|
|
if (llined) |
788 |
|
|
{ |
789 |
|
|
/* OOOPs nope can't HUB this leaf */ |
790 |
michael |
1618 |
sendto_realops_flags(UMODE_ALL, L_ADMIN, SEND_NOTICE, |
791 |
michael |
2820 |
"Link %s introduced leafed server %s.", |
792 |
michael |
1118 |
get_client_name(client_p, SHOW_IP), parv[1]); |
793 |
michael |
1618 |
sendto_realops_flags(UMODE_ALL, L_OPER, SEND_NOTICE, |
794 |
michael |
2820 |
"Link %s introduced leafed server %s.", |
795 |
michael |
1118 |
get_client_name(client_p, MASK_IP), parv[1]); |
796 |
michael |
3171 |
exit_client(client_p, "Leafed Server."); |
797 |
michael |
2820 |
return 0; |
798 |
adx |
30 |
} |
799 |
|
|
|
800 |
|
|
target_p = make_client(client_p); |
801 |
|
|
make_server(target_p); |
802 |
michael |
3190 |
target_p->hopcount = atoi(parv[2]); |
803 |
michael |
1118 |
target_p->servptr = source_p; |
804 |
adx |
30 |
|
805 |
michael |
1118 |
strlcpy(target_p->name, parv[1], sizeof(target_p->name)); |
806 |
|
|
strlcpy(target_p->id, parv[3], sizeof(target_p->id)); |
807 |
adx |
30 |
|
808 |
michael |
1533 |
set_server_gecos(target_p, parv[4]); |
809 |
adx |
30 |
SetServer(target_p); |
810 |
|
|
|
811 |
michael |
1632 |
if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(CONF_SERVICE, target_p->name, NULL, NULL, 0)) |
812 |
michael |
1219 |
AddFlag(target_p, FLAGS_SERVICE); |
813 |
michael |
1157 |
|
814 |
michael |
1118 |
dlinkAdd(target_p, &target_p->node, &global_client_list); |
815 |
michael |
4209 |
dlinkAdd(target_p, make_dlink_node(), &global_server_list); |
816 |
michael |
1118 |
dlinkAdd(target_p, &target_p->lnode, &target_p->servptr->serv->server_list); |
817 |
adx |
30 |
|
818 |
|
|
hash_add_client(target_p); |
819 |
|
|
hash_add_id(target_p); |
820 |
|
|
|
821 |
michael |
3135 |
sendto_server(client_p, NOCAPS, NOCAPS, ":%s SID %s %d %s :%s%s", |
822 |
michael |
3192 |
source_p->id, target_p->name, target_p->hopcount + 1, |
823 |
michael |
1527 |
target_p->id, IsHidden(target_p) ? "(H) " : "", target_p->info); |
824 |
michael |
1618 |
sendto_realops_flags(UMODE_EXTERNAL, L_ALL, SEND_NOTICE, |
825 |
michael |
1118 |
"Server %s being introduced by %s", |
826 |
adx |
30 |
target_p->name, source_p->name); |
827 |
michael |
2820 |
return 0; |
828 |
adx |
30 |
} |
829 |
|
|
|
830 |
michael |
2820 |
static struct Message server_msgtab = |
831 |
|
|
{ |
832 |
michael |
1569 |
"SERVER", 0, 0, 4, MAXPARA, MFLG_SLOW, 0, |
833 |
michael |
3135 |
{ mr_server, m_registered, m_ignore, m_ignore, m_registered, m_ignore } |
834 |
michael |
1230 |
}; |
835 |
|
|
|
836 |
michael |
2820 |
static struct Message sid_msgtab = |
837 |
|
|
{ |
838 |
michael |
1230 |
"SID", 0, 0, 5, MAXPARA, MFLG_SLOW, 0, |
839 |
michael |
2820 |
{ m_ignore, m_ignore, ms_sid, m_ignore, m_ignore, m_ignore } |
840 |
michael |
1230 |
}; |
841 |
|
|
|
842 |
|
|
static void |
843 |
|
|
module_init(void) |
844 |
|
|
{ |
845 |
|
|
mod_add_cmd(&sid_msgtab); |
846 |
|
|
mod_add_cmd(&server_msgtab); |
847 |
|
|
} |
848 |
|
|
|
849 |
|
|
static void |
850 |
|
|
module_exit(void) |
851 |
|
|
{ |
852 |
|
|
mod_del_cmd(&sid_msgtab); |
853 |
|
|
mod_del_cmd(&server_msgtab); |
854 |
|
|
} |
855 |
|
|
|
856 |
michael |
2820 |
struct module module_entry = |
857 |
|
|
{ |
858 |
michael |
1230 |
.node = { NULL, NULL, NULL }, |
859 |
|
|
.name = NULL, |
860 |
|
|
.version = "$Revision$", |
861 |
|
|
.handle = NULL, |
862 |
|
|
.modinit = module_init, |
863 |
|
|
.modexit = module_exit, |
864 |
|
|
.flags = MODULE_FLAG_CORE |
865 |
|
|
}; |