2 * ircd-ratbox: A slightly useful ircd.
3 * s_user.c: User related functions.
5 * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
6 * Copyright (C) 1996-2002 Hybrid Development Team
7 * Copyright (C) 2002-2005 ircd-ratbox development team
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
37 #include "s_newconf.h"
43 #include "supported.h"
51 #include "substitution.h"
55 static void report_and_set_user_flags(struct Client
*, struct ConfItem
*);
56 void user_welcome(struct Client
*source_p
);
60 static int orphaned_umodes
= 0;
61 int user_modes
[256] = {
62 /* 0x00 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0F */
63 /* 0x10 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x1F */
64 /* 0x20 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x2F */
65 /* 0x30 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x3F */
83 UMODE_NOFORWARD
, /* Q */
84 UMODE_REGONLYMSG
, /* R */
85 UMODE_SERVICE
, /* S */
92 UMODE_SSLCLIENT
, /* Z */
93 /* 0x5B */ 0, 0, 0, 0, 0, 0, /* 0x60 */
100 UMODE_CALLERID
, /* g */
102 UMODE_INVISIBLE
, /* i */
105 UMODE_LOCOPS
, /* l */
112 UMODE_SERVNOTICE
, /* s */
116 UMODE_WALLOP
, /* w */
119 UMODE_OPERWALL
, /* z */
120 /* 0x7B */ 0, 0, 0, 0, 0, /* 0x7F */
121 /* 0x80 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x9F */
122 /* 0x90 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x9F */
123 /* 0xA0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xAF */
124 /* 0xB0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xBF */
125 /* 0xC0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xCF */
126 /* 0xD0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xDF */
127 /* 0xE0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xEF */
128 /* 0xF0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* 0xFF */
135 * inputs - pointer to client
137 * side effects - display to client user counts etc.
140 show_lusers(struct Client
*source_p
)
142 if(rb_dlink_list_length(&lclient_list
) > (unsigned long)MaxClientCount
)
143 MaxClientCount
= rb_dlink_list_length(&lclient_list
);
145 if((rb_dlink_list_length(&lclient_list
) + rb_dlink_list_length(&serv_list
)) >
146 (unsigned long)MaxConnectionCount
)
147 MaxConnectionCount
= rb_dlink_list_length(&lclient_list
) +
148 rb_dlink_list_length(&serv_list
);
150 sendto_one_numeric(source_p
, RPL_LUSERCLIENT
, form_str(RPL_LUSERCLIENT
),
151 (Count
.total
- Count
.invisi
),
153 (int)rb_dlink_list_length(&global_serv_list
));
155 if(rb_dlink_list_length(&oper_list
) > 0)
156 sendto_one_numeric(source_p
, RPL_LUSEROP
,
157 form_str(RPL_LUSEROP
),
158 (int)rb_dlink_list_length(&oper_list
));
160 if(rb_dlink_list_length(&unknown_list
) > 0)
161 sendto_one_numeric(source_p
, RPL_LUSERUNKNOWN
,
162 form_str(RPL_LUSERUNKNOWN
),
163 (int)rb_dlink_list_length(&unknown_list
));
165 if(rb_dlink_list_length(&global_channel_list
) > 0)
166 sendto_one_numeric(source_p
, RPL_LUSERCHANNELS
,
167 form_str(RPL_LUSERCHANNELS
),
168 rb_dlink_list_length(&global_channel_list
));
170 sendto_one_numeric(source_p
, RPL_LUSERME
, form_str(RPL_LUSERME
),
171 (int)rb_dlink_list_length(&lclient_list
),
172 (int)rb_dlink_list_length(&serv_list
));
174 sendto_one_numeric(source_p
, RPL_LOCALUSERS
,
175 form_str(RPL_LOCALUSERS
),
176 (int)rb_dlink_list_length(&lclient_list
),
178 (int)rb_dlink_list_length(&lclient_list
),
181 sendto_one_numeric(source_p
, RPL_GLOBALUSERS
, form_str(RPL_GLOBALUSERS
),
182 Count
.total
, Count
.max_tot
,
183 Count
.total
, Count
.max_tot
);
185 sendto_one_numeric(source_p
, RPL_STATSCONN
,
186 form_str(RPL_STATSCONN
),
187 MaxConnectionCount
, MaxClientCount
,
188 Count
.totalrestartcount
);
191 /* check if we should exit a client due to authd decision
192 * inputs - client server, client connecting
193 * outputs - true if exited, false if not
194 * side effects - messages/exits client if authd rejected and not exempt
197 authd_check(struct Client
*client_p
, struct Client
*source_p
)
199 struct ConfItem
*aconf
= source_p
->localClient
->att_conf
;
200 rb_dlink_list varlist
= { NULL
, NULL
, 0 };
204 if(source_p
->preClient
->auth
.accepted
== true)
207 substitution_append_var(&varlist
, "nick", source_p
->name
);
208 substitution_append_var(&varlist
, "ip", source_p
->sockhost
);
209 substitution_append_var(&varlist
, "host", source_p
->host
);
210 substitution_append_var(&varlist
, "dnsbl-host", source_p
->preClient
->auth
.data
);
211 substitution_append_var(&varlist
, "network-name", ServerInfo
.network_name
);
212 reason
= substitution_parse(source_p
->preClient
->auth
.reason
, &varlist
);
214 switch(source_p
->preClient
->auth
.cause
)
216 case 'B': /* Blacklists */
218 struct blacklist_stats
*stats
;
219 char *blacklist
= source_p
->preClient
->auth
.data
;
221 if((stats
= rb_dictionary_retrieve(bl_stats
, blacklist
)) != NULL
)
224 if(IsExemptKline(source_p
) || IsConfExemptDNSBL(aconf
))
226 sendto_one_notice(source_p
, ":*** Your IP address %s is listed in %s, but you are exempt",
227 source_p
->sockhost
, blacklist
);
231 sendto_realops_snomask(SNO_REJ
, L_NETWIDE
,
232 "Listed on DNSBL %s: %s (%s@%s) [%s] [%s]",
233 blacklist
, source_p
->name
, source_p
->username
, source_p
->host
,
234 IsIPSpoof(source_p
) ? "255.255.255.255" : source_p
->sockhost
,
237 sendto_one(source_p
, form_str(ERR_YOUREBANNEDCREEP
),
238 me
.name
, source_p
->name
, reason
);
240 sendto_one_notice(source_p
, ":*** Your IP address %s is listed in %s",
241 source_p
->sockhost
, blacklist
);
242 add_reject(source_p
, NULL
, NULL
);
243 exit_client(client_p
, source_p
, &me
, "Banned (DNS blacklist)");
249 char *proxy
= source_p
->preClient
->auth
.data
;
250 char *port
= strrchr(proxy
, ':');
254 /* This shouldn't happen, better tell the ops... */
255 ierror("authd sent us a malformed OPM string %s", proxy
);
256 sendto_realops_snomask(SNO_GENERAL
, L_ALL
,
257 "authd sent us a malformed OPM string %s", proxy
);
261 /* Terminate the proxy type */
264 if(IsExemptKline(source_p
) || IsConfExemptProxy(aconf
))
266 sendto_one_notice(source_p
,
267 ":*** Your IP address %s has been detected as an open proxy (type %s, port %s), but you are exempt",
268 source_p
->sockhost
, proxy
, port
);
271 sendto_realops_snomask(SNO_REJ
, L_NETWIDE
,
272 "Open proxy %s/%s: %s (%s@%s) [%s] [%s]",
275 source_p
->username
, source_p
->host
,
276 IsIPSpoof(source_p
) ? "255.255.255.255" : source_p
->sockhost
,
279 sendto_one(source_p
, form_str(ERR_YOUREBANNEDCREEP
),
280 me
.name
, source_p
->name
, reason
);
282 sendto_one_notice(source_p
,
283 ":*** Your IP address %s has been detected as an open proxy (type %s, port %s)",
284 source_p
->sockhost
, proxy
, port
);
285 add_reject(source_p
, NULL
, NULL
);
286 exit_client(client_p
, source_p
, &me
, "Banned (Open proxy)");
290 default: /* Unknown, but handle the case properly */
291 if(IsExemptKline(source_p
))
293 sendto_one_notice(source_p
,
294 ":*** You were rejected, but you are exempt (reason: %s)",
298 sendto_realops_snomask(SNO_REJ
, L_NETWIDE
,
299 "Rejected by authentication system (reason %s): %s (%s@%s) [%s] [%s]",
300 reason
, source_p
->name
, source_p
->username
, source_p
->host
,
301 IsIPSpoof(source_p
) ? "255.255.255.255" : source_p
->sockhost
,
304 sendto_one(source_p
, form_str(ERR_YOUREBANNEDCREEP
),
305 me
.name
, source_p
->name
, reason
);
307 sendto_one_notice(source_p
, ":*** Rejected by authentication system: %s",
309 add_reject(source_p
, NULL
, NULL
);
310 exit_client(client_p
, source_p
, &me
, "Banned (authentication system)");
316 ServerStats
.is_ref
++;
318 substitution_free(&varlist
);
324 ** register_local_user
325 ** This function is called when both NICK and USER messages
326 ** have been accepted for the client, in whatever order. Only
327 ** after this, is the USER message propagated.
329 ** NICK's must be propagated at once when received, although
330 ** it would be better to delay them too until full info is
331 ** available. Doing it is not so simple though, would have
332 ** to implement the following:
334 ** (actually it has been implemented already for a while) -orabidoo
336 ** 1) user telnets in and gives only "NICK foobar" and waits
337 ** 2) another user far away logs in normally with the nick
338 ** "foobar" (quite legal, as this server didn't propagate
340 ** 3) now this server gets nick "foobar" from outside, but
341 ** has alread the same defined locally. Current server
342 ** would just issue "KILL foobar" to clean out dups. But,
343 ** this is not fair. It should actually request another
344 ** nick from local user or kill him/her...
347 register_local_user(struct Client
*client_p
, struct Client
*source_p
)
349 struct ConfItem
*aconf
, *xconf
;
350 struct User
*user
= source_p
->user
;
351 char tmpstr2
[BUFSIZE
];
352 char ipaddr
[HOSTIPLEN
];
353 char myusername
[USERLEN
+1];
356 s_assert(NULL
!= source_p
);
357 s_assert(MyConnect(source_p
));
362 if(IsAnyDead(source_p
))
365 if(ConfigFileEntry
.ping_cookie
)
367 if(!(source_p
->flags
& FLAGS_PINGSENT
) && source_p
->localClient
->random_ping
== 0)
369 source_p
->localClient
->random_ping
= (unsigned long) (rand() * rand()) << 1;
370 sendto_one(source_p
, "PING :%08lX",
371 (unsigned long) source_p
->localClient
->random_ping
);
372 source_p
->flags
|= FLAGS_PINGSENT
;
375 if(!(source_p
->flags
& FLAGS_PING_COOKIE
))
381 /* hasnt finished client cap negotiation */
382 if(source_p
->flags
& FLAGS_CLICAP
)
385 /* Waiting on authd */
386 if(source_p
->preClient
->auth
.cid
)
389 client_p
->localClient
->last
= rb_current_time();
391 /* XXX - fixme. we shouldnt have to build a users buffer twice.. */
392 if(!IsGotId(source_p
) && (strchr(source_p
->username
, '[') != NULL
))
397 p
= source_p
->username
;
399 while(*p
&& i
< USERLEN
)
402 myusername
[i
++] = *p
;
406 myusername
[i
] = '\0';
409 rb_strlcpy(myusername
, source_p
->username
, sizeof myusername
);
411 if((status
= check_client(client_p
, source_p
, myusername
)) < 0)
412 return (CLIENT_EXITED
);
414 /* Apply nick override */
415 if(*source_p
->preClient
->spoofnick
)
417 char note
[NICKLEN
+ 10];
419 del_from_client_hash(source_p
->name
, source_p
);
420 rb_strlcpy(source_p
->name
, source_p
->preClient
->spoofnick
, NICKLEN
+ 1);
421 add_to_client_hash(source_p
->name
, source_p
);
423 snprintf(note
, NICKLEN
+ 10, "Nick: %s", source_p
->name
);
424 rb_note(source_p
->localClient
->F
, note
);
427 if(!valid_hostname(source_p
->host
))
429 sendto_one_notice(source_p
, ":*** Notice -- You have an illegal character in your hostname");
431 rb_strlcpy(source_p
->host
, source_p
->sockhost
, sizeof(source_p
->host
));
434 aconf
= source_p
->localClient
->att_conf
;
438 exit_client(client_p
, source_p
, &me
, "*** Not Authorised");
439 return (CLIENT_EXITED
);
442 if(IsConfSSLNeeded(aconf
) && !IsSSL(source_p
))
444 ServerStats
.is_ref
++;
445 sendto_one_notice(source_p
, ":*** Notice -- You need to use SSL/TLS to use this server");
446 exit_client(client_p
, source_p
, &me
, "Use SSL/TLS");
447 return (CLIENT_EXITED
);
450 if(!IsGotId(source_p
))
455 if(IsNeedIdentd(aconf
))
457 ServerStats
.is_ref
++;
458 sendto_one_notice(source_p
, ":*** Notice -- You need to install identd to use this server");
459 exit_client(client_p
, source_p
, &me
, "Install identd");
460 return (CLIENT_EXITED
);
463 /* dont replace username if its supposed to be spoofed --fl */
464 if(!IsConfDoSpoofIp(aconf
) || !strchr(aconf
->info
.name
, '@'))
468 if(!IsNoTilde(aconf
))
469 source_p
->username
[i
++] = '~';
471 while (*p
&& i
< USERLEN
)
474 source_p
->username
[i
++] = *p
;
478 source_p
->username
[i
] = '\0';
482 if(IsNeedSasl(aconf
) && !*user
->suser
)
484 ServerStats
.is_ref
++;
485 sendto_one_notice(source_p
, ":*** Notice -- You need to identify via SASL to use this server");
486 exit_client(client_p
, source_p
, &me
, "SASL access only");
487 return (CLIENT_EXITED
);
491 if(!EmptyString(aconf
->passwd
))
495 if(EmptyString(source_p
->localClient
->passwd
))
497 else if(IsConfEncrypted(aconf
))
498 encr
= rb_crypt(source_p
->localClient
->passwd
, aconf
->passwd
);
500 encr
= source_p
->localClient
->passwd
;
502 if(encr
== NULL
|| strcmp(encr
, aconf
->passwd
))
504 ServerStats
.is_ref
++;
505 sendto_one(source_p
, form_str(ERR_PASSWDMISMATCH
), me
.name
, source_p
->name
);
506 exit_client(client_p
, source_p
, &me
, "Bad Password");
507 return (CLIENT_EXITED
);
510 /* clear password only if used now, otherwise send it
511 * to services -- jilles */
512 if(source_p
->localClient
->passwd
)
514 memset(source_p
->localClient
->passwd
, 0, strlen(source_p
->localClient
->passwd
));
515 rb_free(source_p
->localClient
->passwd
);
516 source_p
->localClient
->passwd
= NULL
;
520 /* report and set flags (kline exempt etc.) as needed in source_p */
521 report_and_set_user_flags(source_p
, aconf
);
525 * We want to be able to have servers and F-line clients
526 * connect, so save room for "buffer" connections.
527 * Smaller servers may want to decrease this, and it should
528 * probably be just a percentage of the MAXCLIENTS...
531 /* Except "F:" clients */
532 if(rb_dlink_list_length(&lclient_list
) >=
533 (unsigned long)GlobalSetOptions
.maxclients
&& !IsConfExemptLimits(aconf
))
535 sendto_realops_snomask(SNO_FULL
, L_ALL
,
536 "Too many clients, rejecting %s[%s].", source_p
->name
, source_p
->host
);
538 ServerStats
.is_ref
++;
539 exit_client(client_p
, source_p
, &me
, "Sorry, server is full - try later");
540 return (CLIENT_EXITED
);
543 /* kline exemption extends to xline too */
544 if(!IsExemptKline(source_p
) &&
545 (xconf
= find_xline(source_p
->info
, 1)) != NULL
)
547 ServerStats
.is_ref
++;
548 add_reject(source_p
, xconf
->host
, NULL
);
549 exit_client(client_p
, source_p
, &me
, "Bad user info");
550 return CLIENT_EXITED
;
553 /* authd rejection check */
554 if(authd_check(client_p
, source_p
))
555 return CLIENT_EXITED
;
557 /* valid user name check */
559 if(!valid_username(source_p
->username
))
561 sendto_realops_snomask(SNO_REJ
, L_ALL
,
562 "Invalid username: %s (%s@%s)",
563 source_p
->name
, source_p
->username
, source_p
->host
);
564 ServerStats
.is_ref
++;
565 sendto_one_notice(source_p
, ":*** Your username is invalid. Please make sure that your username contains "
566 "only alphanumeric characters.");
567 sprintf(tmpstr2
, "Invalid username [%s]", source_p
->username
);
568 exit_client(client_p
, source_p
, &me
, tmpstr2
);
569 return (CLIENT_EXITED
);
572 /* end of valid user name check */
574 /* Store original hostname -- jilles */
575 rb_strlcpy(source_p
->orighost
, source_p
->host
, HOSTLEN
+ 1);
577 /* Spoof user@host */
578 if(*source_p
->preClient
->spoofuser
)
579 rb_strlcpy(source_p
->username
, source_p
->preClient
->spoofuser
, USERLEN
+ 1);
580 if(*source_p
->preClient
->spoofhost
)
582 rb_strlcpy(source_p
->host
, source_p
->preClient
->spoofhost
, HOSTLEN
+ 1);
583 if (irccmp(source_p
->host
, source_p
->orighost
))
584 SetDynSpoof(source_p
);
587 source_p
->umodes
|= ConfigFileEntry
.default_umodes
& ~ConfigFileEntry
.oper_only_umodes
& ~orphaned_umodes
;
589 call_hook(h_new_local_user
, source_p
);
591 /* If they have died in send_* or were thrown out by the
592 * new_local_user hook don't do anything. */
593 if(IsAnyDead(source_p
))
594 return CLIENT_EXITED
;
596 /* To avoid inconsistencies, do not abort the registration
597 * starting from this point -- jilles
599 rb_inet_ntop_sock((struct sockaddr
*)&source_p
->localClient
->ip
, ipaddr
, sizeof(ipaddr
));
601 sendto_realops_snomask(SNO_CCONN
, L_ALL
,
602 "Client connecting: %s (%s@%s) [%s] {%s} [%s]",
603 source_p
->name
, source_p
->username
, source_p
->orighost
,
604 show_ip(NULL
, source_p
) ? ipaddr
: "255.255.255.255",
605 get_client_class(source_p
), source_p
->info
);
607 sendto_realops_snomask(SNO_CCONNEXT
, L_ALL
,
608 "CLICONN %s %s %s %s %s %s 0 %s",
609 source_p
->name
, source_p
->username
, source_p
->orighost
,
610 show_ip(NULL
, source_p
) ? ipaddr
: "255.255.255.255",
611 get_client_class(source_p
),
612 /* mirc can sometimes send ips here */
613 show_ip(NULL
, source_p
) ? source_p
->localClient
->fullcaps
: "<hidden> <hidden>",
616 add_to_hostname_hash(source_p
->orighost
, source_p
);
618 /* Allocate a UID if it was not previously allocated.
619 * If this already occured, it was probably during SASL auth...
623 strcpy(source_p
->id
, generate_uid());
624 add_to_id_hash(source_p
->id
, source_p
);
628 source_p
->umodes
|= UMODE_SSLCLIENT
;
630 if (source_p
->umodes
& UMODE_INVISIBLE
)
633 s_assert(!IsClient(source_p
));
634 rb_dlinkMoveNode(&source_p
->localClient
->tnode
, &unknown_list
, &lclient_list
);
637 source_p
->servptr
= &me
;
638 rb_dlinkAdd(source_p
, &source_p
->lnode
, &source_p
->servptr
->serv
->users
);
640 /* Increment our total user count here */
641 if(++Count
.total
> Count
.max_tot
)
642 Count
.max_tot
= Count
.total
;
644 Count
.totalrestartcount
++;
646 s_assert(source_p
->localClient
!= NULL
);
648 if(rb_dlink_list_length(&lclient_list
) > (unsigned long)Count
.max_loc
)
650 Count
.max_loc
= rb_dlink_list_length(&lclient_list
);
651 if(!(Count
.max_loc
% 10))
652 sendto_realops_snomask(SNO_GENERAL
, L_ALL
,
653 "New Max Local Clients: %d", Count
.max_loc
);
656 /* they get a reduced limit */
657 if(find_tgchange(source_p
->sockhost
))
658 source_p
->localClient
->targets_free
= TGCHANGE_INITIAL_LOW
;
660 source_p
->localClient
->targets_free
= TGCHANGE_INITIAL
;
662 monitor_signon(source_p
);
663 user_welcome(source_p
);
665 free_pre_client(source_p
);
667 introduce_client(client_p
, source_p
, user
, source_p
->name
, 1);
676 * side effects - This common function introduces a client to the rest
677 * of the net, either from a local client connect or
678 * from a remote connect.
681 introduce_client(struct Client
*client_p
, struct Client
*source_p
, struct User
*user
, const char *nick
, int use_euid
)
684 struct Client
*identifyservice_p
;
686 hook_data_umode_changed hdata
;
687 hook_data_client hdata2
;
689 if(MyClient(source_p
))
690 send_umode(source_p
, source_p
, 0, ubuf
);
692 send_umode(NULL
, source_p
, 0, ubuf
);
700 s_assert(has_id(source_p
));
703 sendto_server(client_p
, NULL
, CAP_EUID
| CAP_TS6
, NOCAPS
,
704 ":%s EUID %s %d %ld %s %s %s %s %s %s %s :%s",
705 source_p
->servptr
->id
, nick
,
706 source_p
->hopcount
+ 1,
707 (long) source_p
->tsinfo
, ubuf
,
708 source_p
->username
, source_p
->host
,
709 IsIPSpoof(source_p
) ? "0" : source_p
->sockhost
,
711 IsDynSpoof(source_p
) ? source_p
->orighost
: "*",
712 EmptyString(source_p
->user
->suser
) ? "*" : source_p
->user
->suser
,
715 sendto_server(client_p
, NULL
, CAP_TS6
, use_euid
? CAP_EUID
: NOCAPS
,
716 ":%s UID %s %d %ld %s %s %s %s %s :%s",
717 source_p
->servptr
->id
, nick
,
718 source_p
->hopcount
+ 1,
719 (long) source_p
->tsinfo
, ubuf
,
720 source_p
->username
, source_p
->host
,
721 IsIPSpoof(source_p
) ? "0" : source_p
->sockhost
,
722 source_p
->id
, source_p
->info
);
724 if(!EmptyString(source_p
->certfp
))
725 sendto_server(client_p
, NULL
, CAP_TS6
, NOCAPS
,
726 ":%s ENCAP * CERTFP :%s",
727 use_id(source_p
), source_p
->certfp
);
729 if (IsDynSpoof(source_p
))
731 sendto_server(client_p
, NULL
, CAP_TS6
, use_euid
? CAP_EUID
: NOCAPS
, ":%s ENCAP * REALHOST %s",
732 use_id(source_p
), source_p
->orighost
);
735 if (!EmptyString(source_p
->user
->suser
))
737 sendto_server(client_p
, NULL
, CAP_TS6
, use_euid
? CAP_EUID
: NOCAPS
, ":%s ENCAP * LOGIN %s",
738 use_id(source_p
), source_p
->user
->suser
);
741 if(MyConnect(source_p
) && source_p
->localClient
->passwd
)
743 if (!EmptyString(ConfigFileEntry
.identifyservice
) &&
744 !EmptyString(ConfigFileEntry
.identifycommand
))
746 /* use user@server */
747 p
= strchr(ConfigFileEntry
.identifyservice
, '@');
749 identifyservice_p
= find_named_client(p
+ 1);
751 identifyservice_p
= NULL
;
752 if (identifyservice_p
!= NULL
)
754 if (!EmptyString(source_p
->localClient
->auth_user
))
755 sendto_one(identifyservice_p
, ":%s PRIVMSG %s :%s %s %s",
756 get_id(source_p
, identifyservice_p
),
757 ConfigFileEntry
.identifyservice
,
758 ConfigFileEntry
.identifycommand
,
759 source_p
->localClient
->auth_user
,
760 source_p
->localClient
->passwd
);
762 sendto_one(identifyservice_p
, ":%s PRIVMSG %s :%s %s",
763 get_id(source_p
, identifyservice_p
),
764 ConfigFileEntry
.identifyservice
,
765 ConfigFileEntry
.identifycommand
,
766 source_p
->localClient
->passwd
);
769 memset(source_p
->localClient
->passwd
, 0, strlen(source_p
->localClient
->passwd
));
770 rb_free(source_p
->localClient
->passwd
);
771 source_p
->localClient
->passwd
= NULL
;
774 /* let modules providing usermodes know that we've got a new user,
775 * why is this here? -- well, some modules need to be able to send out new
776 * information about a client, so this was the best place to do it
779 hdata
.client
= source_p
;
781 hdata
.oldsnomask
= 0;
782 call_hook(h_umode_changed
, &hdata
);
784 /* On the other hand, some modules need to know when a client is
785 * being introduced, period.
788 hdata2
.client
= client_p
;
789 hdata2
.target
= source_p
;
790 call_hook(h_introduce_client
, &hdata2
);
794 * valid_hostname - check hostname for validity
796 * Inputs - pointer to user
797 * Output - true if valid, false if not
798 * Side effects - NONE
800 * NOTE: this doesn't allow a hostname to begin with a dot and
801 * will not allow more dots than chars.
804 valid_hostname(const char *hostname
)
806 const char *p
= hostname
, *last_slash
= 0;
814 if(!strcmp(hostname
, "localhost"))
817 if('.' == *p
|| ':' == *p
|| '/' == *p
)
824 if(*p
== '.' || *p
== ':')
837 if(last_slash
&& IsDigit(last_slash
[1]))
844 * valid_username - check username for validity
846 * Inputs - pointer to user
847 * Output - true if valid, false if not
848 * Side effects - NONE
850 * Absolutely always reject any '*' '!' '?' '@' in an user name
851 * reject any odd control characters names.
852 * Allow '.' in username to allow for "first.last"
856 valid_username(const char *username
)
859 const char *p
= username
;
869 /* reject usernames that don't start with an alphanum
870 * i.e. reject jokers who have '-@somehost' or '.@somehost'
871 * or "-hi-@somehost", "h-----@somehost" would still be accepted.
878 if((*p
== '.') && ConfigFileEntry
.dots_in_ident
)
881 if(dots
> ConfigFileEntry
.dots_in_ident
)
883 if(!IsUserChar(p
[1]))
886 else if(!IsUserChar(*p
))
892 /* report_and_set_user_flags
894 * Inputs - pointer to source_p
895 * - pointer to aconf for this user
898 * Report to user any special flags they are getting, and set them.
902 report_and_set_user_flags(struct Client
*source_p
, struct ConfItem
*aconf
)
904 /* If this user is being spoofed, tell them so */
905 if(IsConfDoSpoofIp(aconf
))
907 sendto_one_notice(source_p
, ":*** Spoofing your IP");
910 /* If this user is in the exception class, Set it "E lined" */
911 if(IsConfExemptKline(aconf
))
913 SetExemptKline(source_p
);
914 sendto_one_notice(source_p
, ":*** You are exempt from K/X lines");
917 if(IsConfExemptDNSBL(aconf
))
918 /* kline exempt implies this, don't send both */
919 if(!IsConfExemptKline(aconf
))
920 sendto_one_notice(source_p
, ":*** You are exempt from DNS blacklists");
922 /* If this user is exempt from user limits set it F lined" */
923 if(IsConfExemptLimits(aconf
))
925 sendto_one_notice(source_p
, ":*** You are exempt from user limits");
928 if(IsConfExemptFlood(aconf
))
930 SetExemptFlood(source_p
);
931 sendto_one_notice(source_p
, ":*** You are exempt from flood limits");
934 if(IsConfExemptSpambot(aconf
))
936 SetExemptSpambot(source_p
);
937 sendto_one_notice(source_p
, ":*** You are exempt from spambot checks");
940 if(IsConfExemptJupe(aconf
))
942 SetExemptJupe(source_p
);
943 sendto_one_notice(source_p
, ":*** You are exempt from juped channel warnings");
946 if(IsConfExemptResv(aconf
))
948 SetExemptResv(source_p
);
949 sendto_one_notice(source_p
, ":*** You are exempt from resvs");
952 if(IsConfExemptShide(aconf
))
954 SetExemptShide(source_p
);
955 sendto_one_notice(source_p
, ":*** You are exempt from serverhiding");
958 if(IsConfExtendChans(aconf
))
960 SetExtendChans(source_p
);
961 sendto_one_notice(source_p
, ":*** You are exempt from normal channel limits");
966 show_other_user_mode(struct Client
*source_p
, struct Client
*target_p
)
975 for (i
= 0; i
< 128; i
++) /* >= 127 is extended ascii */
976 if (target_p
->umodes
& user_modes
[i
])
980 if (MyConnect(target_p
) && target_p
->snomask
!= 0)
981 sendto_one_notice(source_p
, ":Modes for %s are %s %s",
983 construct_snobuf(target_p
->snomask
));
985 sendto_one_notice(source_p
, ":Modes for %s are %s",
986 target_p
->name
, buf
);
990 * user_mode - set get current users mode
992 * m_umode() added 15/10/91 By Darren Reed.
993 * parv[1] - username to change mode for
994 * parv[2] - modes to change
997 user_mode(struct Client
*client_p
, struct Client
*source_p
, int parc
, const char *parv
[])
1003 struct Client
*target_p
;
1005 bool badflag
= false; /* Only send one bad flag notice */
1006 bool showsnomask
= false;
1007 unsigned int setsnomask
;
1009 hook_data_umode_changed hdata
;
1015 sendto_one(source_p
, form_str(ERR_NEEDMOREPARAMS
), me
.name
, source_p
->name
, "MODE");
1019 if((target_p
= MyClient(source_p
) ? find_named_person(parv
[1]) : find_person(parv
[1])) == NULL
)
1021 if(MyConnect(source_p
))
1022 sendto_one_numeric(source_p
, ERR_NOSUCHCHANNEL
,
1023 form_str(ERR_NOSUCHCHANNEL
), parv
[1]);
1027 /* Dont know why these were commented out..
1028 * put them back using new sendto() funcs
1031 if(IsServer(source_p
))
1033 sendto_realops_snomask(SNO_GENERAL
, L_ADMIN
,
1034 "*** Mode for User %s from %s", parv
[1], source_p
->name
);
1038 if(source_p
!= target_p
)
1040 if (MyOper(source_p
) && parc
< 3)
1041 show_other_user_mode(source_p
, target_p
);
1043 sendto_one(source_p
, form_str(ERR_USERSDONTMATCH
), me
.name
, source_p
->name
);
1052 for (i
= 0; i
< 128; i
++) /* >= 127 is extended ascii */
1053 if (source_p
->umodes
& user_modes
[i
])
1057 sendto_one_numeric(source_p
, RPL_UMODEIS
, form_str(RPL_UMODEIS
), buf
);
1059 if (source_p
->snomask
!= 0)
1060 sendto_one_numeric(source_p
, RPL_SNOMASK
, form_str(RPL_SNOMASK
),
1061 construct_snobuf(source_p
->snomask
));
1066 /* find flags already set for user */
1067 setflags
= source_p
->umodes
;
1068 setsnomask
= source_p
->snomask
;
1071 * parse mode change string(s)
1073 for (pm
= parv
[2]; *pm
; pm
++)
1084 if(what
== MODE_ADD
)
1086 if(IsServer(client_p
) && !IsOper(source_p
))
1090 rb_dlinkAddAlloc(source_p
, &oper_list
);
1095 /* Only decrement the oper counts if an oper to begin with
1096 * found by Pat Szuta, Perly , perly@xnet.com
1099 if(!IsOper(source_p
))
1102 ClearOper(source_p
);
1106 if(MyConnect(source_p
))
1108 source_p
->umodes
&= ~ConfigFileEntry
.oper_only_umodes
;
1109 if (!(source_p
->umodes
& UMODE_SERVNOTICE
) && source_p
->snomask
!= 0)
1111 source_p
->snomask
= 0;
1114 source_p
->flags
&= ~OPER_FLAGS
;
1116 rb_free(source_p
->localClient
->opername
);
1117 source_p
->localClient
->opername
= NULL
;
1119 rb_dlinkFindDestroy(source_p
, &local_oper_list
);
1120 privilegeset_unref(source_p
->localClient
->privset
);
1121 source_p
->localClient
->privset
= NULL
;
1124 rb_dlinkFindDestroy(source_p
, &oper_list
);
1128 /* we may not get these,
1129 * but they shouldnt be in default
1132 /* can only be set on burst */
1142 if (MyConnect(source_p
))
1144 if(!IsOper(source_p
)
1145 && (ConfigFileEntry
.oper_only_umodes
& UMODE_SERVNOTICE
))
1147 if (what
== MODE_ADD
|| source_p
->umodes
& UMODE_SERVNOTICE
)
1152 if(what
== MODE_ADD
)
1155 source_p
->snomask
= parse_snobuf_to_mask(source_p
->snomask
, parv
[3]);
1157 source_p
->snomask
|= SNO_GENERAL
;
1160 source_p
->snomask
= 0;
1161 if (source_p
->snomask
!= 0)
1162 source_p
->umodes
|= UMODE_SERVNOTICE
;
1164 source_p
->umodes
&= ~UMODE_SERVNOTICE
;
1169 if (MyConnect(source_p
) && *pm
== 'Q' && !ConfigChannel
.use_forward
)
1175 if((flag
= user_modes
[(unsigned char) *pm
]))
1177 if(MyConnect(source_p
)
1178 && ((!IsOper(source_p
)
1179 && (ConfigFileEntry
.oper_only_umodes
& flag
))
1180 || (orphaned_umodes
& flag
)))
1182 if (what
== MODE_ADD
|| source_p
->umodes
& flag
)
1187 if(what
== MODE_ADD
)
1188 source_p
->umodes
|= flag
;
1190 source_p
->umodes
&= ~flag
;
1195 if(MyConnect(source_p
))
1202 sendto_one(source_p
, form_str(ERR_UMODEUNKNOWNFLAG
), me
.name
, source_p
->name
);
1204 if(MyClient(source_p
) && (source_p
->snomask
& SNO_NCHANGE
) && !IsOperN(source_p
))
1206 sendto_one_notice(source_p
, ":*** You need oper and nick_changes flag for +s +n");
1207 source_p
->snomask
&= ~SNO_NCHANGE
; /* only tcm's really need this */
1210 if(MyClient(source_p
) && (source_p
->umodes
& UMODE_OPERWALL
) && !IsOperOperwall(source_p
))
1212 sendto_one_notice(source_p
, ":*** You need oper and operwall flag for +z");
1213 source_p
->umodes
&= ~UMODE_OPERWALL
;
1216 if(MyConnect(source_p
) && (source_p
->umodes
& UMODE_ADMIN
) &&
1217 (!IsOperAdmin(source_p
) || IsOperHiddenAdmin(source_p
)))
1219 sendto_one_notice(source_p
, ":*** You need oper and admin flag for +a");
1220 source_p
->umodes
&= ~UMODE_ADMIN
;
1223 /* let modules providing usermodes know that we've changed our usermode --nenolod */
1224 hdata
.client
= source_p
;
1225 hdata
.oldumodes
= setflags
;
1226 hdata
.oldsnomask
= setsnomask
;
1227 call_hook(h_umode_changed
, &hdata
);
1229 if(!(setflags
& UMODE_INVISIBLE
) && IsInvisible(source_p
))
1231 if((setflags
& UMODE_INVISIBLE
) && !IsInvisible(source_p
))
1234 * compare new flags with old flags and send string which
1235 * will cause servers to update correctly.
1237 send_umode_out(client_p
, source_p
, setflags
);
1238 if (showsnomask
&& MyConnect(source_p
))
1239 sendto_one_numeric(source_p
, RPL_SNOMASK
, form_str(RPL_SNOMASK
),
1240 construct_snobuf(source_p
->snomask
));
1246 * send the MODE string for user (user) to connection client_p
1250 send_umode(struct Client
*client_p
, struct Client
*source_p
, int old
, char *umode_buf
)
1258 * build a string in umode_buf to represent the change in the user's
1259 * mode between the new (source_p->flag) and 'old'.
1264 for (i
= 0; i
< 128; i
++)
1266 flag
= user_modes
[i
];
1268 if((flag
& old
) && !(source_p
->umodes
& flag
))
1270 if(what
== MODE_DEL
)
1279 else if(!(flag
& old
) && (source_p
->umodes
& flag
))
1281 if(what
== MODE_ADD
)
1293 if(*umode_buf
&& client_p
)
1294 sendto_one(client_p
, ":%s MODE %s :%s", source_p
->name
, source_p
->name
, umode_buf
);
1305 send_umode_out(struct Client
*client_p
, struct Client
*source_p
, int old
)
1307 struct Client
*target_p
;
1311 send_umode(NULL
, source_p
, old
, buf
);
1313 RB_DLINK_FOREACH(ptr
, serv_list
.head
)
1315 target_p
= ptr
->data
;
1317 if((target_p
!= client_p
) && (target_p
!= source_p
) && (*buf
))
1319 sendto_one(target_p
, ":%s MODE %s :%s",
1320 get_id(source_p
, target_p
),
1321 get_id(source_p
, target_p
), buf
);
1325 if(client_p
&& MyClient(client_p
))
1326 send_umode(client_p
, source_p
, old
, buf
);
1332 * inputs - client pointer to client to welcome
1337 user_welcome(struct Client
*source_p
)
1339 sendto_one_numeric(source_p
, RPL_WELCOME
, form_str(RPL_WELCOME
), ServerInfo
.network_name
, source_p
->name
);
1340 sendto_one_numeric(source_p
, RPL_YOURHOST
, form_str(RPL_YOURHOST
),
1341 get_listener_name(source_p
->localClient
->listener
), ircd_version
);
1342 sendto_one_numeric(source_p
, RPL_CREATED
, form_str(RPL_CREATED
), creation
);
1343 sendto_one_numeric(source_p
, RPL_MYINFO
, form_str(RPL_MYINFO
), me
.name
, ircd_version
, umodebuf
, cflagsmyinfo
);
1345 show_isupport(source_p
);
1347 show_lusers(source_p
);
1349 if(ConfigFileEntry
.short_motd
)
1351 sendto_one_notice(source_p
, ":*** Notice -- motd was last changed at %s", user_motd_changed
);
1352 sendto_one_notice(source_p
, ":*** Notice -- Please read the motd if you haven't read it");
1354 sendto_one(source_p
, form_str(RPL_MOTDSTART
),
1355 me
.name
, source_p
->name
, me
.name
);
1357 sendto_one(source_p
, form_str(RPL_MOTD
),
1358 me
.name
, source_p
->name
, "*** This is the short motd ***");
1360 sendto_one(source_p
, form_str(RPL_ENDOFMOTD
), me
.name
, source_p
->name
);
1363 send_user_motd(source_p
);
1368 * inputs - pointer to given client to oper
1369 * - pointer to ConfItem to use
1371 * side effects - opers up source_p using aconf for reference
1374 oper_up(struct Client
*source_p
, struct oper_conf
*oper_p
)
1376 unsigned int old
= source_p
->umodes
, oldsnomask
= source_p
->snomask
;
1377 hook_data_umode_changed hdata
;
1382 source_p
->umodes
|= oper_p
->umodes
;
1383 else if(ConfigFileEntry
.oper_umodes
)
1384 source_p
->umodes
|= ConfigFileEntry
.oper_umodes
;
1386 source_p
->umodes
|= DEFAULT_OPER_UMODES
;
1388 if (oper_p
->snomask
)
1390 source_p
->snomask
|= oper_p
->snomask
;
1391 source_p
->umodes
|= UMODE_SERVNOTICE
;
1393 else if (source_p
->umodes
& UMODE_SERVNOTICE
)
1395 /* Only apply these if +s is already set -- jilles */
1396 if (ConfigFileEntry
.oper_snomask
)
1397 source_p
->snomask
|= ConfigFileEntry
.oper_snomask
;
1399 source_p
->snomask
|= DEFAULT_OPER_SNOMASK
;
1404 SetExtendChans(source_p
);
1405 SetExemptKline(source_p
);
1407 source_p
->flags
|= oper_p
->flags
;
1408 source_p
->localClient
->opername
= rb_strdup(oper_p
->name
);
1409 source_p
->localClient
->privset
= privilegeset_ref(oper_p
->privset
);
1411 rb_dlinkAddAlloc(source_p
, &local_oper_list
);
1412 rb_dlinkAddAlloc(source_p
, &oper_list
);
1414 if(IsOperAdmin(source_p
) && !IsOperHiddenAdmin(source_p
))
1415 source_p
->umodes
|= UMODE_ADMIN
;
1416 if(!IsOperN(source_p
))
1417 source_p
->snomask
&= ~SNO_NCHANGE
;
1418 if(!IsOperOperwall(source_p
))
1419 source_p
->umodes
&= ~UMODE_OPERWALL
;
1420 hdata
.client
= source_p
;
1421 hdata
.oldumodes
= old
;
1422 hdata
.oldsnomask
= oldsnomask
;
1423 call_hook(h_umode_changed
, &hdata
);
1425 sendto_realops_snomask(SNO_GENERAL
, L_ALL
,
1426 "%s (%s!%s@%s) is now an operator", oper_p
->name
, source_p
->name
,
1427 source_p
->username
, source_p
->host
);
1428 if(!(old
& UMODE_INVISIBLE
) && IsInvisible(source_p
))
1430 if((old
& UMODE_INVISIBLE
) && !IsInvisible(source_p
))
1432 send_umode_out(source_p
, source_p
, old
);
1433 sendto_one_numeric(source_p
, RPL_SNOMASK
, form_str(RPL_SNOMASK
),
1434 construct_snobuf(source_p
->snomask
));
1435 sendto_one(source_p
, form_str(RPL_YOUREOPER
), me
.name
, source_p
->name
);
1436 sendto_one_notice(source_p
, ":*** Oper privilege set is %s", oper_p
->privset
->name
);
1437 sendto_one_notice(source_p
, ":*** Oper privs are %s", oper_p
->privset
->privs
);
1438 send_oper_motd(source_p
);
1445 * outputs - an available umode bitmask or
1446 * 0 if no umodes are available
1447 * side effects - NONE
1450 find_umode_slot(void)
1452 unsigned int all_umodes
= 0, my_umode
= 0, i
;
1454 for (i
= 0; i
< 128; i
++)
1455 all_umodes
|= user_modes
[i
];
1457 for (my_umode
= 1; my_umode
&& (all_umodes
& my_umode
);
1464 construct_umodebuf(void)
1467 char *ptr
= umodebuf
;
1468 static int prev_user_modes
[128];
1472 for (i
= 0; i
< 128; i
++)
1474 if (prev_user_modes
[i
] != 0 && prev_user_modes
[i
] != user_modes
[i
])
1476 if (user_modes
[i
] == 0)
1478 orphaned_umodes
|= prev_user_modes
[i
];
1479 sendto_realops_snomask(SNO_DEBUG
, L_ALL
, "Umode +%c is now orphaned", i
);
1483 orphaned_umodes
&= ~prev_user_modes
[i
];
1484 sendto_realops_snomask(SNO_DEBUG
, L_ALL
, "Orphaned umode +%c is picked up by module", i
);
1486 user_modes
[i
] = prev_user_modes
[i
];
1489 prev_user_modes
[i
] = user_modes
[i
];
1498 change_nick_user_host(struct Client
*target_p
, const char *nick
, const char *user
,
1499 const char *host
, int newts
, const char *format
, ...)
1502 struct Channel
*chptr
;
1503 struct membership
*mscptr
;
1504 int changed
= irccmp(target_p
->name
, nick
);
1505 int changed_case
= strcmp(target_p
->name
, nick
);
1506 int do_qjm
= irccmp(target_p
->username
, user
) || irccmp(target_p
->host
, host
);
1507 char mode
[10], modeval
[NICKLEN
* 2 + 2], reason
[256], *mptr
;
1514 target_p
->tsinfo
= newts
;
1515 monitor_signoff(target_p
);
1517 invalidate_bancache_user(target_p
);
1521 va_start(ap
, format
);
1522 vsnprintf(reason
, 255, format
, ap
);
1525 sendto_common_channels_local_butone(target_p
, NOCAPS
, CLICAP_CHGHOST
, ":%s!%s@%s QUIT :%s",
1526 target_p
->name
, target_p
->username
, target_p
->host
,
1529 RB_DLINK_FOREACH(ptr
, target_p
->user
->channel
.head
)
1532 chptr
= mscptr
->chptr
;
1535 if(is_chanop(mscptr
))
1538 strcat(modeval
, nick
);
1539 strcat(modeval
, " ");
1542 if(is_voiced(mscptr
))
1545 strcat(modeval
, nick
);
1550 sendto_channel_local_with_capability_butone(target_p
, ALL_MEMBERS
, NOCAPS
, CLICAP_EXTENDED_JOIN
| CLICAP_CHGHOST
, chptr
,
1551 ":%s!%s@%s JOIN %s", nick
, user
, host
, chptr
->chname
);
1552 sendto_channel_local_with_capability_butone(target_p
, ALL_MEMBERS
, CLICAP_EXTENDED_JOIN
, CLICAP_CHGHOST
, chptr
,
1553 ":%s!%s@%s JOIN %s %s :%s", nick
, user
, host
, chptr
->chname
,
1554 EmptyString(target_p
->user
->suser
) ? "*" : target_p
->user
->suser
,
1558 sendto_channel_local_with_capability_butone(target_p
, ALL_MEMBERS
, NOCAPS
, CLICAP_CHGHOST
, chptr
,
1559 ":%s MODE %s +%s %s", target_p
->servptr
->name
, chptr
->chname
, mode
, modeval
);
1564 /* Resend away message to away-notify enabled clients. */
1565 if (target_p
->user
->away
)
1566 sendto_common_channels_local_butone(target_p
, CLICAP_AWAY_NOTIFY
, CLICAP_CHGHOST
, ":%s!%s@%s AWAY :%s",
1568 target_p
->user
->away
);
1570 sendto_common_channels_local_butone(target_p
, CLICAP_CHGHOST
, NOCAPS
,
1571 ":%s!%s@%s CHGHOST %s %s",
1572 target_p
->name
, target_p
->username
, target_p
->host
, user
, host
);
1574 if(MyClient(target_p
) && changed_case
)
1575 sendto_one(target_p
, ":%s!%s@%s NICK %s",
1576 target_p
->name
, user
, host
, nick
);
1578 /* TODO: send some snotes to SNO_NCHANGE/SNO_CCONN/SNO_CCONNEXT? */
1580 else if(changed_case
)
1582 sendto_common_channels_local(target_p
, NOCAPS
, NOCAPS
, ":%s!%s@%s NICK :%s",
1583 target_p
->name
, user
, host
, nick
);
1585 if(MyConnect(target_p
))
1586 sendto_realops_snomask(SNO_NCHANGE
, L_ALL
,
1587 "Nick change: From %s to %s [%s@%s]",
1588 target_p
->name
, nick
,
1589 target_p
->username
, target_p
->host
);
1592 if (user
!= target_p
->username
)
1593 rb_strlcpy(target_p
->username
, user
, sizeof target_p
->username
);
1595 rb_strlcpy(target_p
->host
, host
, sizeof target_p
->host
);
1598 whowas_add_history(target_p
, 1);
1600 del_from_client_hash(target_p
->name
, target_p
);
1601 rb_strlcpy(target_p
->name
, nick
, NICKLEN
);
1602 add_to_client_hash(target_p
->name
, target_p
);
1606 monitor_signon(target_p
);
1607 del_all_accepts(target_p
);