ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/branches/8.2.x/modules/core/m_server.c
Revision: 1230
Committed: Thu Sep 22 19:41:19 2011 UTC (12 years, 6 months ago) by michael
Content type: text/x-csrc
Original Path: ircd-hybrid-8/modules/core/m_server.c
File size: 22973 byte(s)
Log Message:
- cleanup module loader. Make module api more flexible

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 * m_server.c: Introduces a server.
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 "list.h"
27 #include "handlers.h" /* m_server prototype */
28 #include "client.h" /* client struct */
29 #include "common.h" /* TRUE bleah */
30 #include "event.h"
31 #include "hash.h" /* add_to_client_hash_table */
32 #include "irc_string.h"
33 #include "ircd.h" /* me */
34 #include "numeric.h" /* ERR_xxx */
35 #include "s_conf.h" /* struct AccessItem */
36 #include "s_log.h" /* log level defines */
37 #include "s_serv.h" /* server_estab, check_server */
38 #include "s_user.h"
39 #include "send.h" /* sendto_one */
40 #include "motd.h"
41 #include "msg.h"
42 #include "parse.h"
43 #include "modules.h"
44
45
46 static void set_server_gecos(struct Client *, char *);
47
48 /* mr_server()
49 * parv[0] = sender prefix
50 * parv[1] = servername
51 * parv[2] = serverinfo/hopcount
52 * parv[3] = serverinfo
53 */
54 static void
55 mr_server(struct Client *client_p, struct Client *source_p,
56 int parc, char *parv[])
57 {
58 char info[REALLEN + 1];
59 char *name;
60 struct Client *target_p;
61 int hop;
62
63 if (EmptyString(parv[3]))
64 {
65 sendto_one(client_p, "ERROR :No servername");
66 exit_client(client_p, client_p, "Wrong number of args");
67 return;
68 }
69
70 name = parv[1];
71 hop = atoi(parv[2]);
72 strlcpy(info, parv[3], sizeof(info));
73
74 /*
75 * Reject a direct nonTS server connection if we're TS_ONLY -orabidoo
76 */
77 if (!DoesTS(client_p))
78 {
79 sendto_realops_flags(UMODE_ALL, L_ADMIN,
80 "Unauthorized server connection attempt from %s: Non-TS server "
81 "for server %s", get_client_name(client_p, HIDE_IP), name);
82 sendto_realops_flags(UMODE_ALL, L_OPER,
83 "Unauthorized server connection attempt from %s: Non-TS server "
84 "for server %s", get_client_name(client_p, MASK_IP), name);
85 exit_client(client_p, client_p, "Non-TS server");
86 return;
87 }
88
89 if (!valid_servname(name))
90 {
91 sendto_realops_flags(UMODE_ALL, L_ADMIN,
92 "Unauthorized server connection attempt from %s: Bogus server name "
93 "for server %s", get_client_name(client_p, HIDE_IP), name);
94 sendto_realops_flags(UMODE_ALL, L_OPER,
95 "Unauthorized server connection attempt from %s: Bogus server name "
96 "for server %s", get_client_name(client_p, MASK_IP), name);
97 exit_client(client_p, client_p, "Bogus server name");
98 return;
99 }
100
101 /* Now we just have to call check_server and everything should
102 * be check for us... -A1kmm.
103 */
104 switch (check_server(name, client_p, CHECK_SERVER_NOCRYPTLINK))
105 {
106 case -1:
107 if (ConfigFileEntry.warn_no_nline)
108 {
109 sendto_realops_flags(UMODE_ALL, L_ADMIN,
110 "Unauthorized server connection attempt from %s: No entry for "
111 "servername %s", get_client_name(client_p, HIDE_IP), name);
112
113 sendto_realops_flags(UMODE_ALL, L_OPER,
114 "Unauthorized server connection attempt from %s: No entry for "
115 "servername %s", get_client_name(client_p, MASK_IP), name);
116 }
117
118 exit_client(client_p, client_p, "Invalid servername.");
119 return;
120 /* NOT REACHED */
121 break;
122
123 case -2:
124 sendto_realops_flags(UMODE_ALL, L_ADMIN,
125 "Unauthorized server connection attempt from %s: Bad password "
126 "for server %s", get_client_name(client_p, HIDE_IP), name);
127
128 sendto_realops_flags(UMODE_ALL, L_OPER,
129 "Unauthorized server connection attempt from %s: Bad password "
130 "for server %s", get_client_name(client_p, MASK_IP), name);
131
132 exit_client(client_p, client_p, "Invalid password.");
133 return;
134 /* NOT REACHED */
135 break;
136
137 case -3:
138 sendto_realops_flags(UMODE_ALL, L_ADMIN,
139 "Unauthorized server connection attempt from %s: Invalid host "
140 "for server %s", get_client_name(client_p, HIDE_IP), name);
141
142 sendto_realops_flags(UMODE_ALL, L_OPER,
143 "Unauthorized server connection attempt from %s: Invalid host "
144 "for server %s", get_client_name(client_p, MASK_IP), name);
145
146 exit_client(client_p, client_p, "Invalid host.");
147 return;
148 /* NOT REACHED */
149 break;
150
151 /* servername is > HOSTLEN */
152 case -4:
153 sendto_realops_flags(UMODE_ALL, L_ADMIN,
154 "Invalid servername %s from %s",
155 name, get_client_name(client_p, HIDE_IP));
156 sendto_realops_flags(UMODE_ALL, L_OPER,
157 "Invalid servername %s from %s",
158 name, get_client_name(client_p, MASK_IP));
159
160 exit_client(client_p, client_p, "Invalid servername.");
161 return;
162 /* NOT REACHED */
163 break;
164 }
165
166 if ((client_p->id[0] && (target_p = hash_find_id(client_p->id)))
167 || (target_p = hash_find_server(name)))
168 {
169 /* This link is trying feed me a server that I already have
170 * access through another path -- multiple paths not accepted
171 * currently, kill this link immediately!!
172 *
173 * Rather than KILL the link which introduced it, KILL the
174 * youngest of the two links. -avalon
175 *
176 * Definitely don't do that here. This is from an unregistered
177 * connect - A1kmm.
178 */
179 sendto_realops_flags(UMODE_ALL, L_ADMIN,
180 "Attempt to re-introduce server %s SID %s from %s",
181 name, client_p->id,
182 get_client_name(client_p, HIDE_IP));
183 sendto_realops_flags(UMODE_ALL, L_OPER,
184 "Attempt to re-introduce server %s SID %s from %s",
185 name, client_p->id,
186 get_client_name(client_p, MASK_IP));
187 sendto_one(client_p, "ERROR :Server ID already exists.");
188 exit_client(client_p, client_p, "Server ID Exists");
189 return;
190 }
191
192 /* XXX If somehow there is a connect in progress and
193 * a connect comes in with same name toss the pending one,
194 * but only if it's not the same client! - Dianora
195 */
196 if ((target_p = find_servconn_in_progress(name)))
197 if (target_p != client_p)
198 exit_client(target_p, &me, "Overridden");
199
200 /* if we are connecting (Handshake), we already have the name from the
201 * connect{} block in client_p->name
202 */
203 strlcpy(client_p->name, name, sizeof(client_p->name));
204 set_server_gecos(client_p, info);
205 client_p->hopcount = hop;
206 server_estab(client_p);
207 }
208
209 /* ms_server()
210 * parv[0] = sender prefix
211 * parv[1] = servername
212 * parv[2] = serverinfo/hopcount
213 * parv[3] = serverinfo
214 */
215 static void
216 ms_server(struct Client *client_p, struct Client *source_p,
217 int parc, char *parv[])
218 {
219 char info[REALLEN + 1];
220 char *name;
221 struct Client *target_p;
222 struct Client *bclient_p;
223 struct ConfItem *conf;
224 struct MatchItem *match_item;
225 int hop;
226 int hlined = 0;
227 int llined = 0;
228 dlink_node *ptr, *ptr_next;
229
230 /* Just to be sure -A1kmm. */
231 if (!IsServer(source_p))
232 return;
233
234 if (EmptyString(parv[3]))
235 {
236 sendto_one(client_p, "ERROR :No servername");
237 return;
238 }
239
240 name = parv[1];
241 hop = atoi(parv[2]);
242 strlcpy(info, parv[3], sizeof(info));
243
244 if (!valid_servname(name))
245 {
246 sendto_realops_flags(UMODE_ALL, L_ADMIN,
247 "Link %s introduced server with bogus server name %s",
248 get_client_name(client_p, SHOW_IP), name);
249 sendto_realops_flags(UMODE_ALL, L_OPER,
250 "Link %s introduced server with bogus server name %s",
251 get_client_name(client_p, MASK_IP), name);
252 sendto_one(client_p, "ERROR :Bogus server name introduced");
253 exit_client(client_p, &me, "Bogus server name intoduced");
254 return;
255 }
256
257 if ((target_p = hash_find_server(name)))
258 {
259 /* This link is trying feed me a server that I already have
260 * access through another path -- multiple paths not accepted
261 * currently, kill this link immediately!!
262 *
263 * Rather than KILL the link which introduced it, KILL the
264 * youngest of the two links. -avalon
265 *
266 * I think that we should exit the link itself, not the introducer,
267 * and we should always exit the most recently received(i.e. the
268 * one we are receiving this SERVER for. -A1kmm
269 *
270 * You *cant* do this, if you link somewhere, it bursts you a server
271 * that already exists, then sends you a client burst, you squit the
272 * server, but you keep getting the burst of clients on a server that
273 * doesnt exist, although ircd can handle it, its not a realistic
274 * solution.. --fl_
275 */
276 /* It is behind a host-masked server. Completely ignore the
277 * server message(don't propagate or we will delink from whoever
278 * we propagate to). -A1kmm
279 */
280 if (irccmp(target_p->name, name) && target_p->from == client_p)
281 return;
282
283 sendto_one(client_p, "ERROR :Server %s already exists", name);
284 sendto_realops_flags(UMODE_ALL, L_ADMIN,
285 "Link %s cancelled, server %s already exists",
286 get_client_name(client_p, SHOW_IP), name);
287 sendto_realops_flags(UMODE_ALL, L_OPER,
288 "Link %s cancelled, server %s already exists",
289 client_p->name, name);
290 exit_client(client_p, &me, "Server Exists");
291 return;
292 }
293
294 /* XXX If somehow there is a connect in progress and
295 * a connect comes in with same name toss the pending one,
296 * but only if it's not the same client! - Dianora
297 */
298 if ((target_p = find_servconn_in_progress(name)))
299 if (target_p != client_p)
300 exit_client(target_p, &me, "Overridden");
301
302 /* See if the newly found server is behind a guaranteed
303 * leaf. If so, close the link.
304 */
305 DLINK_FOREACH(ptr, leaf_items.head)
306 {
307 conf = ptr->data;
308
309 if (match(conf->name, client_p->name))
310 {
311 match_item = map_to_conf(conf);
312
313 if (match(match_item->host, name))
314 llined++;
315 }
316 }
317
318 DLINK_FOREACH(ptr, hub_items.head)
319 {
320 conf = ptr->data;
321
322 if (match(conf->name, client_p->name))
323 {
324 match_item = map_to_conf(conf);
325
326 if (match(match_item->host, name))
327 hlined++;
328 }
329 }
330
331 /* Ok, this way this works is
332 *
333 * A server can have a CONF_HUB allowing it to introduce servers
334 * behind it.
335 *
336 * connect {
337 * name = "irc.bighub.net";
338 * hub_mask="*";
339 * ...
340 *
341 * That would allow "irc.bighub.net" to introduce anything it wanted..
342 *
343 * However
344 *
345 * connect {
346 * name = "irc.somehub.fi";
347 * hub_mask="*";
348 * leaf_mask="*.edu";
349 *...
350 * Would allow this server in finland to hub anything but
351 * .edu's
352 */
353
354 /* Ok, check client_p can hub the new server */
355 if (!hlined)
356 {
357 /* OOOPs nope can't HUB */
358 sendto_realops_flags(UMODE_ALL, L_ADMIN, "Non-Hub link %s introduced %s.",
359 get_client_name(client_p, HIDE_IP), name);
360 sendto_realops_flags(UMODE_ALL, L_OPER, "Non-Hub link %s introduced %s.",
361 get_client_name(client_p, MASK_IP), name);
362 exit_client(source_p, &me, "No matching hub_mask.");
363 return;
364 }
365
366 /* Check for the new server being leafed behind this HUB */
367 if (llined)
368 {
369 /* OOOPs nope can't HUB this leaf */
370 sendto_realops_flags(UMODE_ALL, L_ADMIN,
371 "Link %s introduced leafed server %s.",
372 get_client_name(client_p, HIDE_IP), name);
373 sendto_realops_flags(UMODE_ALL, L_OPER,
374 "Link %s introduced leafed server %s.",
375 get_client_name(client_p, MASK_IP), name);
376 /* If it is new, we are probably misconfigured, so split the
377 * non-hub server introducing this. Otherwise, split the new
378 * server. -A1kmm.
379 */
380 /* wastes too much bandwidth, generates too many errors on
381 * larger networks, dont bother. --fl_
382 */
383 exit_client(client_p, &me, "Leafed Server.");
384 return;
385 }
386
387 target_p = make_client(client_p);
388 make_server(target_p);
389 target_p->hopcount = hop;
390 target_p->servptr = source_p;
391
392 strlcpy(target_p->name, name, sizeof(target_p->name));
393
394 set_server_gecos(target_p, info);
395 SetServer(target_p);
396
397 if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(SERVICE_TYPE, target_p->name, NULL, NULL, 0))
398 AddFlag(target_p, FLAGS_SERVICE);
399
400 dlinkAdd(target_p, &target_p->node, &global_client_list);
401 dlinkAdd(target_p, make_dlink_node(), &global_serv_list);
402 dlinkAdd(target_p, &target_p->lnode, &target_p->servptr->serv->server_list);
403
404 hash_add_client(target_p);
405
406 /* Old sendto_serv_but_one() call removed because we now
407 * need to send different names to different servers
408 * (domain name matching)
409 */
410 DLINK_FOREACH_SAFE(ptr, ptr_next, serv_list.head)
411 {
412 bclient_p = ptr->data;
413
414 if (bclient_p == client_p)
415 continue;
416
417 sendto_one(bclient_p, ":%s SERVER %s %d :%s%s",
418 ID_or_name(source_p, bclient_p), target_p->name, hop + 1,
419 IsHidden(target_p) ? "(H) " : "",
420 target_p->info);
421 }
422
423 sendto_realops_flags(UMODE_EXTERNAL, L_ALL,
424 "Server %s being introduced by %s",
425 target_p->name, source_p->name);
426 }
427
428 /* ms_sid()
429 * parv[0] = sender prefix
430 * parv[1] = servername
431 * parv[2] = serverinfo/hopcount
432 * parv[3] = sid of new server
433 * parv[4] = serverinfo
434 */
435 static void
436 ms_sid(struct Client *client_p, struct Client *source_p,
437 int parc, char *parv[])
438 {
439 char info[REALLEN + 1];
440 struct Client *target_p;
441 struct Client *bclient_p;
442 struct ConfItem *conf;
443 struct MatchItem *match_item;
444 int hlined = 0;
445 int llined = 0;
446 dlink_node *ptr, *ptr_next;
447 int hop;
448
449 /* Just to be sure -A1kmm. */
450 if (!IsServer(source_p))
451 return;
452
453 if (EmptyString(parv[4]))
454 {
455 sendto_one(client_p, "ERROR :No servername");
456 return;
457 }
458
459 hop = atoi(parv[2]);
460 strlcpy(info, parv[4], sizeof(info));
461
462 if (!valid_servname(parv[1]))
463 {
464 sendto_realops_flags(UMODE_ALL, L_ADMIN,
465 "Link %s introduced server with bogus server name %s",
466 get_client_name(client_p, SHOW_IP), parv[1]);
467 sendto_realops_flags(UMODE_ALL, L_OPER,
468 "Link %s introduced server with bogus server name %s",
469 get_client_name(client_p, MASK_IP), parv[1]);
470 sendto_one(client_p, "ERROR :Bogus server name introduced");
471 exit_client(client_p, &me, "Bogus server name intoduced");
472 return;
473 }
474
475 if (!valid_sid(parv[3]))
476 {
477 sendto_realops_flags(UMODE_ALL, L_ADMIN,
478 "Link %s introduced server with bogus server ID %s",
479 get_client_name(client_p, SHOW_IP), parv[3]);
480 sendto_realops_flags(UMODE_ALL, L_OPER,
481 "Link %s introduced server with bogus server ID %s",
482 get_client_name(client_p, MASK_IP), parv[3]);
483 sendto_one(client_p, "ERROR :Bogus server ID introduced");
484 exit_client(client_p, &me, "Bogus server ID intoduced");
485 return;
486 }
487
488 /* collision on SID? */
489 if ((target_p = hash_find_id(parv[3])))
490 {
491 sendto_one(client_p, "ERROR :SID %s already exists", parv[3]);
492 sendto_realops_flags(UMODE_ALL, L_ADMIN,
493 "Link %s cancelled, SID %s already exists",
494 get_client_name(client_p, SHOW_IP), parv[3]);
495 sendto_realops_flags(UMODE_ALL, L_OPER,
496 "Link %s cancelled, SID %s already exists",
497 client_p->name, parv[3]);
498 exit_client(client_p, &me, "Server Exists");
499 return;
500 }
501
502 /* collision on name? */
503 if ((target_p = hash_find_server(parv[1])))
504 {
505 sendto_one(client_p, "ERROR :Server %s already exists", parv[1]);
506 sendto_realops_flags(UMODE_ALL, L_ADMIN,
507 "Link %s cancelled, server %s already exists",
508 get_client_name(client_p, SHOW_IP), parv[1]);
509 sendto_realops_flags(UMODE_ALL, L_OPER,
510 "Link %s cancelled, server %s already exists",
511 client_p->name, parv[1]);
512 exit_client(client_p, &me, "Server Exists");
513 return;
514 }
515
516 /* XXX If somehow there is a connect in progress and
517 * a connect comes in with same name toss the pending one,
518 * but only if it's not the same client! - Dianora
519 */
520 if ((target_p = find_servconn_in_progress(parv[1])))
521 if (target_p != client_p)
522 exit_client(target_p, &me, "Overridden");
523
524 /* See if the newly found server is behind a guaranteed
525 * leaf. If so, close the link.
526 */
527 DLINK_FOREACH(ptr, leaf_items.head)
528 {
529 conf = ptr->data;
530
531 if (match(conf->name, client_p->name))
532 {
533 match_item = map_to_conf(conf);
534
535 if (match(match_item->host, parv[1]))
536 llined++;
537 }
538 }
539
540 DLINK_FOREACH(ptr, hub_items.head)
541 {
542 conf = ptr->data;
543
544 if (match(conf->name, client_p->name))
545 {
546 match_item = map_to_conf(conf);
547
548 if (match(match_item->host, parv[1]))
549 hlined++;
550 }
551 }
552
553 /* Ok, this way this works is
554 *
555 * A server can have a CONF_HUB allowing it to introduce servers
556 * behind it.
557 *
558 * connect {
559 * name = "irc.bighub.net";
560 * hub_mask="*";
561 * ...
562 *
563 * That would allow "irc.bighub.net" to introduce anything it wanted..
564 *
565 * However
566 *
567 * connect {
568 * name = "irc.somehub.fi";
569 * hub_mask="*";
570 * leaf_mask="*.edu";
571 *...
572 * Would allow this server in finland to hub anything but
573 * .edu's
574 */
575
576 /* Ok, check client_p can hub the new server, and make sure it's not a LL */
577 if (!hlined)
578 {
579 /* OOOPs nope can't HUB */
580 sendto_realops_flags(UMODE_ALL, L_ADMIN, "Non-Hub link %s introduced %s.",
581 get_client_name(client_p, SHOW_IP), parv[1]);
582 sendto_realops_flags(UMODE_ALL, L_OPER, "Non-Hub link %s introduced %s.",
583 get_client_name(client_p, MASK_IP), parv[1]);
584 exit_client(source_p, &me, "No matching hub_mask.");
585 return;
586 }
587
588 /* Check for the new server being leafed behind this HUB */
589 if (llined)
590 {
591 /* OOOPs nope can't HUB this leaf */
592 sendto_realops_flags(UMODE_ALL, L_ADMIN,
593 "Link %s introduced leafed server %s.",
594 get_client_name(client_p, SHOW_IP), parv[1]);
595 sendto_realops_flags(UMODE_ALL, L_OPER,
596 "Link %s introduced leafed server %s.",
597 get_client_name(client_p, MASK_IP), parv[1]);
598 exit_client(client_p, &me, "Leafed Server.");
599 return;
600 }
601
602 target_p = make_client(client_p);
603 make_server(target_p);
604 target_p->hopcount = hop;
605 target_p->servptr = source_p;
606
607 strlcpy(target_p->name, parv[1], sizeof(target_p->name));
608 strlcpy(target_p->id, parv[3], sizeof(target_p->id));
609
610 set_server_gecos(target_p, info);
611 SetServer(target_p);
612
613 if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(SERVICE_TYPE, target_p->name, NULL, NULL, 0))
614 AddFlag(target_p, FLAGS_SERVICE);
615
616 dlinkAdd(target_p, &target_p->node, &global_client_list);
617 dlinkAdd(target_p, make_dlink_node(), &global_serv_list);
618 dlinkAdd(target_p, &target_p->lnode, &target_p->servptr->serv->server_list);
619
620 hash_add_client(target_p);
621 hash_add_id(target_p);
622
623 DLINK_FOREACH_SAFE(ptr, ptr_next, serv_list.head)
624 {
625 bclient_p = ptr->data;
626
627 if (bclient_p == client_p)
628 continue;
629
630 if (IsCapable(bclient_p, CAP_TS6))
631 sendto_one(bclient_p, ":%s SID %s %d %s :%s%s",
632 ID_or_name(source_p, client_p), target_p->name, hop + 1,
633 parv[3], IsHidden(target_p) ? "(H) " : "",
634 target_p->info);
635 else
636 sendto_one(bclient_p, ":%s SERVER %s %d :%s%s",
637 source_p->name, target_p->name, hop + 1,
638 IsHidden(target_p) ? "(H) " : "",
639 target_p->info);
640 }
641
642 sendto_realops_flags(UMODE_EXTERNAL, L_ALL,
643 "Server %s being introduced by %s",
644 target_p->name, source_p->name);
645 }
646
647 /* set_server_gecos()
648 *
649 * input - pointer to client
650 * output - NONE
651 * side effects - servers gecos field is set
652 */
653 static void
654 set_server_gecos(struct Client *client_p, char *info)
655 {
656 /* check the info for [IP] */
657 if (info[0])
658 {
659 char *p;
660 char *s;
661 char *t;
662
663 s = info;
664
665 /* we should only check the first word for an ip */
666 if ((p = strchr(s, ' ')) != NULL)
667 *p = '\0';
668
669 /* check for a ] which would symbolise an [IP] */
670 if ((t = strchr(s, ']')) != NULL)
671 {
672 /* set s to after the first space */
673 if (p)
674 s = ++p;
675 else
676 s = NULL;
677 }
678 /* no ], put the space back */
679 else if (p)
680 *p = ' ';
681
682 /* p may have been set to a trailing space, so check s exists and that
683 * it isnt \0 */
684 if (s && (*s != '\0'))
685 {
686 /* a space? if not (H) could be the last part of info.. */
687 if ((p = strchr(s, ' ')))
688 *p = '\0';
689
690 /* check for (H) which is a hidden server */
691 if (!strcmp(s, "(H)"))
692 {
693 SetHidden(client_p);
694
695 /* if there was no space.. theres nothing to set info to */
696 if (p)
697 s = ++p;
698 else
699 s = NULL;
700 }
701 else if (p)
702 *p = ' ';
703
704 /* if there was a trailing space, s could point to \0, so check */
705 if (s && (*s != '\0'))
706 strlcpy(client_p->info, s, sizeof(client_p->info));
707 else
708 strlcpy(client_p->info, "(Unknown Location)", sizeof(client_p->info));
709 }
710 else
711 strlcpy(client_p->info, "(Unknown Location)", sizeof(client_p->info));
712 }
713 else
714 strlcpy(client_p->info, "(Unknown Location)", sizeof(client_p->info));
715 }
716
717 static struct Message server_msgtab = {
718 "SERVER", 0, 0, 4, MAXPARA, MFLG_SLOW | MFLG_UNREG, 0,
719 {mr_server, m_registered, ms_server, m_ignore, m_registered, m_ignore}
720 };
721
722 static struct Message sid_msgtab = {
723 "SID", 0, 0, 5, MAXPARA, MFLG_SLOW, 0,
724 {rfc1459_command_send_error, m_ignore, ms_sid, m_ignore, m_ignore, m_ignore}
725 };
726
727 static void
728 module_init(void)
729 {
730 mod_add_cmd(&sid_msgtab);
731 mod_add_cmd(&server_msgtab);
732 }
733
734 static void
735 module_exit(void)
736 {
737 mod_del_cmd(&sid_msgtab);
738 mod_del_cmd(&server_msgtab);
739 }
740
741 struct module module_entry = {
742 .node = { NULL, NULL, NULL },
743 .name = NULL,
744 .version = "$Revision$",
745 .handle = NULL,
746 .modinit = module_init,
747 .modexit = module_exit,
748 .flags = MODULE_FLAG_CORE
749 };

Properties

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