2007-01-25 06:40:21 +00:00
|
|
|
/*
|
|
|
|
* ircd-ratbox: A slightly useful ircd.
|
|
|
|
* s_user.c: User related functions.
|
|
|
|
*
|
|
|
|
* Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
|
|
|
|
* Copyright (C) 1996-2002 Hybrid Development Team
|
|
|
|
* Copyright (C) 2002-2005 ircd-ratbox development team
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
|
* USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "stdinc.h"
|
|
|
|
#include "s_user.h"
|
|
|
|
#include "channel.h"
|
|
|
|
#include "class.h"
|
|
|
|
#include "client.h"
|
|
|
|
#include "hash.h"
|
2008-04-20 05:47:38 +00:00
|
|
|
#include "match.h"
|
2007-01-25 06:40:21 +00:00
|
|
|
#include "ircd.h"
|
|
|
|
#include "listener.h"
|
|
|
|
#include "msg.h"
|
|
|
|
#include "numeric.h"
|
|
|
|
#include "s_conf.h"
|
|
|
|
#include "s_newconf.h"
|
2008-04-03 02:52:01 +00:00
|
|
|
#include "logger.h"
|
2007-01-25 06:40:21 +00:00
|
|
|
#include "s_serv.h"
|
|
|
|
#include "s_stats.h"
|
|
|
|
#include "scache.h"
|
|
|
|
#include "send.h"
|
|
|
|
#include "supported.h"
|
|
|
|
#include "whowas.h"
|
|
|
|
#include "packet.h"
|
|
|
|
#include "reject.h"
|
|
|
|
#include "cache.h"
|
|
|
|
#include "hook.h"
|
|
|
|
#include "monitor.h"
|
|
|
|
#include "snomask.h"
|
2007-01-25 07:08:21 +00:00
|
|
|
#include "substitution.h"
|
2008-06-25 03:51:32 +00:00
|
|
|
#include "chmode.h"
|
2013-09-10 05:35:56 +00:00
|
|
|
#include "s_assert.h"
|
2007-01-25 06:40:21 +00:00
|
|
|
|
|
|
|
static void report_and_set_user_flags(struct Client *, struct ConfItem *);
|
|
|
|
void user_welcome(struct Client *source_p);
|
|
|
|
|
|
|
|
char umodebuf[128];
|
|
|
|
|
2007-02-04 15:08:04 +00:00
|
|
|
static int orphaned_umodes = 0;
|
2007-01-25 06:40:21 +00:00
|
|
|
int user_modes[256] = {
|
|
|
|
/* 0x00 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0F */
|
|
|
|
/* 0x10 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x1F */
|
|
|
|
/* 0x20 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x2F */
|
|
|
|
/* 0x30 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x3F */
|
|
|
|
0, /* @ */
|
|
|
|
0, /* A */
|
|
|
|
0, /* B */
|
|
|
|
0, /* C */
|
|
|
|
UMODE_DEAF, /* D */
|
|
|
|
0, /* E */
|
|
|
|
0, /* F */
|
|
|
|
0, /* G */
|
|
|
|
0, /* H */
|
|
|
|
0, /* I */
|
|
|
|
0, /* J */
|
|
|
|
0, /* K */
|
|
|
|
0, /* L */
|
|
|
|
0, /* M */
|
|
|
|
0, /* N */
|
|
|
|
0, /* O */
|
|
|
|
0, /* P */
|
|
|
|
UMODE_NOFORWARD, /* Q */
|
2020-06-26 17:55:30 +00:00
|
|
|
0, /* R */
|
2007-01-25 06:40:21 +00:00
|
|
|
UMODE_SERVICE, /* S */
|
|
|
|
0, /* T */
|
|
|
|
0, /* U */
|
|
|
|
0, /* V */
|
|
|
|
0, /* W */
|
|
|
|
0, /* X */
|
|
|
|
0, /* Y */
|
2008-04-06 16:55:12 +00:00
|
|
|
UMODE_SSLCLIENT, /* Z */
|
2007-01-25 06:40:21 +00:00
|
|
|
/* 0x5B */ 0, 0, 0, 0, 0, 0, /* 0x60 */
|
|
|
|
UMODE_ADMIN, /* a */
|
|
|
|
0, /* b */
|
|
|
|
0, /* c */
|
|
|
|
0, /* d */
|
|
|
|
0, /* e */
|
|
|
|
0, /* f */
|
2020-06-26 18:50:24 +00:00
|
|
|
0, /* g */
|
2007-01-25 06:40:21 +00:00
|
|
|
0, /* h */
|
|
|
|
UMODE_INVISIBLE, /* i */
|
|
|
|
0, /* j */
|
|
|
|
0, /* k */
|
|
|
|
UMODE_LOCOPS, /* l */
|
|
|
|
0, /* m */
|
|
|
|
0, /* n */
|
|
|
|
UMODE_OPER, /* o */
|
|
|
|
0, /* p */
|
|
|
|
0, /* q */
|
|
|
|
0, /* r */
|
|
|
|
UMODE_SERVNOTICE, /* s */
|
|
|
|
0, /* t */
|
|
|
|
0, /* u */
|
|
|
|
0, /* v */
|
|
|
|
UMODE_WALLOP, /* w */
|
|
|
|
0, /* x */
|
|
|
|
0, /* y */
|
|
|
|
UMODE_OPERWALL, /* z */
|
|
|
|
/* 0x7B */ 0, 0, 0, 0, 0, /* 0x7F */
|
|
|
|
/* 0x80 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x9F */
|
|
|
|
/* 0x90 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x9F */
|
|
|
|
/* 0xA0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xAF */
|
|
|
|
/* 0xB0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xBF */
|
|
|
|
/* 0xC0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xCF */
|
|
|
|
/* 0xD0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xDF */
|
|
|
|
/* 0xE0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xEF */
|
|
|
|
/* 0xF0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* 0xFF */
|
|
|
|
};
|
|
|
|
/* *INDENT-ON* */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* show_lusers -
|
|
|
|
*
|
|
|
|
* inputs - pointer to client
|
|
|
|
* output -
|
|
|
|
* side effects - display to client user counts etc.
|
|
|
|
*/
|
2016-03-08 11:06:29 +00:00
|
|
|
void
|
2007-01-25 06:40:21 +00:00
|
|
|
show_lusers(struct Client *source_p)
|
|
|
|
{
|
2008-04-01 20:41:52 +00:00
|
|
|
if(rb_dlink_list_length(&lclient_list) > (unsigned long)MaxClientCount)
|
|
|
|
MaxClientCount = rb_dlink_list_length(&lclient_list);
|
2007-08-01 20:18:12 +00:00
|
|
|
|
2008-04-01 20:41:52 +00:00
|
|
|
if((rb_dlink_list_length(&lclient_list) + rb_dlink_list_length(&serv_list)) >
|
2007-08-01 20:18:12 +00:00
|
|
|
(unsigned long)MaxConnectionCount)
|
2014-03-03 04:25:47 +00:00
|
|
|
MaxConnectionCount = rb_dlink_list_length(&lclient_list) +
|
2008-04-01 20:41:52 +00:00
|
|
|
rb_dlink_list_length(&serv_list);
|
2007-08-01 20:18:12 +00:00
|
|
|
|
2007-01-25 06:40:21 +00:00
|
|
|
sendto_one_numeric(source_p, RPL_LUSERCLIENT, form_str(RPL_LUSERCLIENT),
|
|
|
|
(Count.total - Count.invisi),
|
2011-11-12 23:22:09 +00:00
|
|
|
Count.invisi,
|
|
|
|
(int)rb_dlink_list_length(&global_serv_list));
|
2007-01-25 06:40:21 +00:00
|
|
|
|
2008-04-01 20:41:52 +00:00
|
|
|
if(rb_dlink_list_length(&oper_list) > 0)
|
2014-03-03 04:25:47 +00:00
|
|
|
sendto_one_numeric(source_p, RPL_LUSEROP,
|
2014-02-23 21:46:06 +00:00
|
|
|
form_str(RPL_LUSEROP),
|
|
|
|
(int)rb_dlink_list_length(&oper_list));
|
2007-01-25 06:40:21 +00:00
|
|
|
|
2008-04-01 20:41:52 +00:00
|
|
|
if(rb_dlink_list_length(&unknown_list) > 0)
|
2014-03-03 04:25:47 +00:00
|
|
|
sendto_one_numeric(source_p, RPL_LUSERUNKNOWN,
|
2007-01-25 06:40:21 +00:00
|
|
|
form_str(RPL_LUSERUNKNOWN),
|
2011-11-12 23:22:09 +00:00
|
|
|
(int)rb_dlink_list_length(&unknown_list));
|
2007-01-25 06:40:21 +00:00
|
|
|
|
2008-04-01 20:41:52 +00:00
|
|
|
if(rb_dlink_list_length(&global_channel_list) > 0)
|
2014-03-03 04:25:47 +00:00
|
|
|
sendto_one_numeric(source_p, RPL_LUSERCHANNELS,
|
2007-01-25 06:40:21 +00:00
|
|
|
form_str(RPL_LUSERCHANNELS),
|
2008-04-01 20:41:52 +00:00
|
|
|
rb_dlink_list_length(&global_channel_list));
|
2007-01-25 06:40:21 +00:00
|
|
|
|
|
|
|
sendto_one_numeric(source_p, RPL_LUSERME, form_str(RPL_LUSERME),
|
2011-11-12 23:22:09 +00:00
|
|
|
(int)rb_dlink_list_length(&lclient_list),
|
|
|
|
(int)rb_dlink_list_length(&serv_list));
|
2007-01-25 06:40:21 +00:00
|
|
|
|
2014-03-03 04:25:47 +00:00
|
|
|
sendto_one_numeric(source_p, RPL_LOCALUSERS,
|
2007-01-25 06:40:21 +00:00
|
|
|
form_str(RPL_LOCALUSERS),
|
2011-11-12 23:22:09 +00:00
|
|
|
(int)rb_dlink_list_length(&lclient_list),
|
2007-01-25 06:40:21 +00:00
|
|
|
Count.max_loc,
|
2011-11-12 23:22:09 +00:00
|
|
|
(int)rb_dlink_list_length(&lclient_list),
|
2007-01-25 06:40:21 +00:00
|
|
|
Count.max_loc);
|
|
|
|
|
|
|
|
sendto_one_numeric(source_p, RPL_GLOBALUSERS, form_str(RPL_GLOBALUSERS),
|
|
|
|
Count.total, Count.max_tot,
|
|
|
|
Count.total, Count.max_tot);
|
|
|
|
|
|
|
|
sendto_one_numeric(source_p, RPL_STATSCONN,
|
|
|
|
form_str(RPL_STATSCONN),
|
2014-03-03 04:25:47 +00:00
|
|
|
MaxConnectionCount, MaxClientCount,
|
2007-01-25 06:40:21 +00:00
|
|
|
Count.totalrestartcount);
|
|
|
|
}
|
|
|
|
|
2016-04-10 15:02:33 +00:00
|
|
|
/* check if we should exit a client due to authd decision
|
|
|
|
* inputs - client server, client connecting
|
|
|
|
* outputs - true if exited, false if not
|
|
|
|
* side effects - messages/exits client if authd rejected and not exempt
|
|
|
|
*/
|
|
|
|
static bool
|
|
|
|
authd_check(struct Client *client_p, struct Client *source_p)
|
|
|
|
{
|
|
|
|
struct ConfItem *aconf = source_p->localClient->att_conf;
|
|
|
|
rb_dlink_list varlist = { NULL, NULL, 0 };
|
|
|
|
bool reject = false;
|
|
|
|
char *reason;
|
|
|
|
|
|
|
|
if(source_p->preClient->auth.accepted == true)
|
|
|
|
return reject;
|
|
|
|
|
|
|
|
substitution_append_var(&varlist, "nick", source_p->name);
|
|
|
|
substitution_append_var(&varlist, "ip", source_p->sockhost);
|
|
|
|
substitution_append_var(&varlist, "host", source_p->host);
|
|
|
|
substitution_append_var(&varlist, "dnsbl-host", source_p->preClient->auth.data);
|
|
|
|
substitution_append_var(&varlist, "network-name", ServerInfo.network_name);
|
|
|
|
reason = substitution_parse(source_p->preClient->auth.reason, &varlist);
|
|
|
|
|
|
|
|
switch(source_p->preClient->auth.cause)
|
|
|
|
{
|
2020-07-06 03:01:56 +00:00
|
|
|
case 'B': /* DNSBL */
|
2016-04-10 15:02:33 +00:00
|
|
|
{
|
2020-07-06 03:01:56 +00:00
|
|
|
struct DNSBLEntryStats *stats;
|
|
|
|
char *dnsbl_name = source_p->preClient->auth.data;
|
2016-04-10 15:02:33 +00:00
|
|
|
|
2020-07-06 03:01:56 +00:00
|
|
|
if(dnsbl_stats != NULL)
|
|
|
|
if((stats = rb_dictionary_retrieve(dnsbl_stats, dnsbl_name)) != NULL)
|
2016-04-30 12:18:06 +00:00
|
|
|
stats->hits++;
|
2016-04-10 15:02:33 +00:00
|
|
|
|
|
|
|
if(IsExemptKline(source_p) || IsConfExemptDNSBL(aconf))
|
|
|
|
{
|
|
|
|
sendto_one_notice(source_p, ":*** Your IP address %s is listed in %s, but you are exempt",
|
2020-07-06 03:01:56 +00:00
|
|
|
source_p->sockhost, dnsbl_name);
|
2016-04-10 15:02:33 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
sendto_realops_snomask(SNO_REJ, L_NETWIDE,
|
|
|
|
"Listed on DNSBL %s: %s (%s@%s) [%s] [%s]",
|
2020-07-06 03:01:56 +00:00
|
|
|
dnsbl_name, source_p->name, source_p->username, source_p->host,
|
2016-04-10 15:02:33 +00:00
|
|
|
IsIPSpoof(source_p) ? "255.255.255.255" : source_p->sockhost,
|
|
|
|
source_p->info);
|
|
|
|
|
|
|
|
sendto_one(source_p, form_str(ERR_YOUREBANNEDCREEP),
|
|
|
|
me.name, source_p->name, reason);
|
|
|
|
|
|
|
|
sendto_one_notice(source_p, ":*** Your IP address %s is listed in %s",
|
2020-07-06 03:01:56 +00:00
|
|
|
source_p->sockhost, dnsbl_name);
|
|
|
|
add_reject(source_p, NULL, NULL, NULL, "Banned (listed in a DNSBL)");
|
|
|
|
exit_client(client_p, source_p, &me, "Banned (listed in a DNSBL)");
|
2016-04-10 15:02:33 +00:00
|
|
|
reject = true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'O': /* OPM */
|
|
|
|
{
|
|
|
|
char *proxy = source_p->preClient->auth.data;
|
|
|
|
char *port = strrchr(proxy, ':');
|
|
|
|
|
|
|
|
if(port == NULL)
|
|
|
|
{
|
|
|
|
/* This shouldn't happen, better tell the ops... */
|
|
|
|
ierror("authd sent us a malformed OPM string %s", proxy);
|
|
|
|
sendto_realops_snomask(SNO_GENERAL, L_ALL,
|
|
|
|
"authd sent us a malformed OPM string %s", proxy);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Terminate the proxy type */
|
|
|
|
*(port++) = '\0';
|
|
|
|
|
|
|
|
if(IsExemptKline(source_p) || IsConfExemptProxy(aconf))
|
|
|
|
{
|
|
|
|
sendto_one_notice(source_p,
|
|
|
|
":*** Your IP address %s has been detected as an open proxy (type %s, port %s), but you are exempt",
|
|
|
|
source_p->sockhost, proxy, port);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
sendto_realops_snomask(SNO_REJ, L_NETWIDE,
|
|
|
|
"Open proxy %s/%s: %s (%s@%s) [%s] [%s]",
|
|
|
|
proxy, port,
|
|
|
|
source_p->name,
|
|
|
|
source_p->username, source_p->host,
|
|
|
|
IsIPSpoof(source_p) ? "255.255.255.255" : source_p->sockhost,
|
|
|
|
source_p->info);
|
|
|
|
|
|
|
|
sendto_one(source_p, form_str(ERR_YOUREBANNEDCREEP),
|
|
|
|
me.name, source_p->name, reason);
|
|
|
|
|
|
|
|
sendto_one_notice(source_p,
|
|
|
|
":*** Your IP address %s has been detected as an open proxy (type %s, port %s)",
|
|
|
|
source_p->sockhost, proxy, port);
|
2019-12-31 01:11:45 +00:00
|
|
|
add_reject(source_p, NULL, NULL, NULL, "Banned (Open proxy)");
|
2016-04-10 15:02:33 +00:00
|
|
|
exit_client(client_p, source_p, &me, "Banned (Open proxy)");
|
|
|
|
reject = true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default: /* Unknown, but handle the case properly */
|
|
|
|
if(IsExemptKline(source_p))
|
|
|
|
{
|
|
|
|
sendto_one_notice(source_p,
|
|
|
|
":*** You were rejected, but you are exempt (reason: %s)",
|
|
|
|
reason);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
sendto_realops_snomask(SNO_REJ, L_NETWIDE,
|
|
|
|
"Rejected by authentication system (reason %s): %s (%s@%s) [%s] [%s]",
|
|
|
|
reason, source_p->name, source_p->username, source_p->host,
|
|
|
|
IsIPSpoof(source_p) ? "255.255.255.255" : source_p->sockhost,
|
|
|
|
source_p->info);
|
|
|
|
|
|
|
|
sendto_one(source_p, form_str(ERR_YOUREBANNEDCREEP),
|
|
|
|
me.name, source_p->name, reason);
|
|
|
|
|
|
|
|
sendto_one_notice(source_p, ":*** Rejected by authentication system: %s",
|
|
|
|
reason);
|
2019-12-31 01:11:45 +00:00
|
|
|
add_reject(source_p, NULL, NULL, NULL, "Banned (authentication system)");
|
2016-04-10 15:02:33 +00:00
|
|
|
exit_client(client_p, source_p, &me, "Banned (authentication system)");
|
|
|
|
reject = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(reject)
|
|
|
|
ServerStats.is_ref++;
|
|
|
|
|
|
|
|
substitution_free(&varlist);
|
|
|
|
|
|
|
|
return reject;
|
|
|
|
}
|
|
|
|
|
2007-01-25 06:40:21 +00:00
|
|
|
/*
|
|
|
|
** register_local_user
|
|
|
|
** This function is called when both NICK and USER messages
|
|
|
|
** have been accepted for the client, in whatever order. Only
|
|
|
|
** after this, is the USER message propagated.
|
|
|
|
**
|
|
|
|
** NICK's must be propagated at once when received, although
|
|
|
|
** it would be better to delay them too until full info is
|
|
|
|
** available. Doing it is not so simple though, would have
|
|
|
|
** to implement the following:
|
|
|
|
**
|
|
|
|
** (actually it has been implemented already for a while) -orabidoo
|
|
|
|
**
|
|
|
|
** 1) user telnets in and gives only "NICK foobar" and waits
|
|
|
|
** 2) another user far away logs in normally with the nick
|
|
|
|
** "foobar" (quite legal, as this server didn't propagate
|
|
|
|
** it).
|
|
|
|
** 3) now this server gets nick "foobar" from outside, but
|
|
|
|
** has alread the same defined locally. Current server
|
|
|
|
** would just issue "KILL foobar" to clean out dups. But,
|
|
|
|
** this is not fair. It should actually request another
|
|
|
|
** nick from local user or kill him/her...
|
2016-03-06 08:46:13 +00:00
|
|
|
*/
|
2007-01-25 06:40:21 +00:00
|
|
|
int
|
2015-03-05 23:41:51 +00:00
|
|
|
register_local_user(struct Client *client_p, struct Client *source_p)
|
2007-01-25 06:40:21 +00:00
|
|
|
{
|
2007-12-08 20:54:51 +00:00
|
|
|
struct ConfItem *aconf, *xconf;
|
2016-03-23 14:22:55 +00:00
|
|
|
char tmpstr2[BUFSIZE];
|
2007-01-25 06:40:21 +00:00
|
|
|
char ipaddr[HOSTIPLEN];
|
|
|
|
char myusername[USERLEN+1];
|
|
|
|
int status;
|
|
|
|
|
|
|
|
s_assert(NULL != source_p);
|
|
|
|
s_assert(MyConnect(source_p));
|
|
|
|
|
|
|
|
if(source_p == NULL)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
if(IsAnyDead(source_p))
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
if(ConfigFileEntry.ping_cookie)
|
|
|
|
{
|
|
|
|
if(!(source_p->flags & FLAGS_PINGSENT) && source_p->localClient->random_ping == 0)
|
|
|
|
{
|
2016-05-02 20:14:16 +00:00
|
|
|
source_p->localClient->random_ping = (uint32_t)(((rand() * rand()) << 1) | 1);
|
|
|
|
sendto_one(source_p, "PING :%08X",
|
|
|
|
(unsigned int) source_p->localClient->random_ping);
|
2007-01-25 06:40:21 +00:00
|
|
|
source_p->flags |= FLAGS_PINGSENT;
|
|
|
|
return -1;
|
|
|
|
}
|
2007-12-24 19:58:55 +00:00
|
|
|
if(!(source_p->flags & FLAGS_PING_COOKIE))
|
2007-01-25 06:40:21 +00:00
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* hasnt finished client cap negotiation */
|
2007-12-24 19:58:55 +00:00
|
|
|
if(source_p->flags & FLAGS_CLICAP)
|
2007-01-25 06:40:21 +00:00
|
|
|
return -1;
|
|
|
|
|
2016-03-28 07:11:16 +00:00
|
|
|
/* Waiting on authd */
|
2016-04-10 14:20:51 +00:00
|
|
|
if(source_p->preClient->auth.cid)
|
2007-01-25 06:40:21 +00:00
|
|
|
return -1;
|
|
|
|
|
2010-01-13 23:54:49 +00:00
|
|
|
/* Set firsttime here so that post_registration_delay works from registration,
|
|
|
|
* rather than initial connection. */
|
|
|
|
source_p->localClient->firsttime = client_p->localClient->last = rb_current_time();
|
2007-01-25 06:40:21 +00:00
|
|
|
|
|
|
|
/* XXX - fixme. we shouldnt have to build a users buffer twice.. */
|
2015-03-05 23:41:51 +00:00
|
|
|
if(!IsGotId(source_p) && (strchr(source_p->username, '[') != NULL))
|
2007-01-25 06:40:21 +00:00
|
|
|
{
|
|
|
|
const char *p;
|
|
|
|
int i = 0;
|
|
|
|
|
2015-03-05 23:41:51 +00:00
|
|
|
p = source_p->username;
|
2007-01-25 06:40:21 +00:00
|
|
|
|
|
|
|
while(*p && i < USERLEN)
|
|
|
|
{
|
|
|
|
if(*p != '[')
|
|
|
|
myusername[i++] = *p;
|
|
|
|
p++;
|
|
|
|
}
|
|
|
|
|
|
|
|
myusername[i] = '\0';
|
|
|
|
}
|
2015-03-05 23:41:51 +00:00
|
|
|
else
|
2015-10-01 20:54:29 +00:00
|
|
|
rb_strlcpy(myusername, source_p->username, sizeof myusername);
|
2007-01-25 06:40:21 +00:00
|
|
|
|
2015-03-05 23:41:51 +00:00
|
|
|
if((status = check_client(client_p, source_p, myusername)) < 0)
|
2007-01-25 06:40:21 +00:00
|
|
|
return (CLIENT_EXITED);
|
|
|
|
|
|
|
|
/* Apply nick override */
|
|
|
|
if(*source_p->preClient->spoofnick)
|
|
|
|
{
|
2018-01-19 23:24:55 +00:00
|
|
|
char note[NAMELEN + 10];
|
2008-04-02 01:36:50 +00:00
|
|
|
|
2007-01-25 06:40:21 +00:00
|
|
|
del_from_client_hash(source_p->name, source_p);
|
2008-04-20 04:40:40 +00:00
|
|
|
rb_strlcpy(source_p->name, source_p->preClient->spoofnick, NICKLEN + 1);
|
2007-01-25 06:40:21 +00:00
|
|
|
add_to_client_hash(source_p->name, source_p);
|
2008-04-02 01:36:50 +00:00
|
|
|
|
2018-01-19 23:24:55 +00:00
|
|
|
snprintf(note, sizeof(note), "Nick: %s", source_p->name);
|
2008-04-02 01:36:50 +00:00
|
|
|
rb_note(source_p->localClient->F, note);
|
2007-01-25 06:40:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(!valid_hostname(source_p->host))
|
|
|
|
{
|
2007-01-25 07:23:01 +00:00
|
|
|
sendto_one_notice(source_p, ":*** Notice -- You have an illegal character in your hostname");
|
2007-01-25 06:40:21 +00:00
|
|
|
|
2008-04-20 04:40:40 +00:00
|
|
|
rb_strlcpy(source_p->host, source_p->sockhost, sizeof(source_p->host));
|
2007-01-25 06:40:21 +00:00
|
|
|
}
|
2014-03-03 04:25:47 +00:00
|
|
|
|
2007-01-25 06:40:21 +00:00
|
|
|
aconf = source_p->localClient->att_conf;
|
|
|
|
|
|
|
|
if(aconf == NULL)
|
|
|
|
{
|
|
|
|
exit_client(client_p, source_p, &me, "*** Not Authorised");
|
|
|
|
return (CLIENT_EXITED);
|
|
|
|
}
|
|
|
|
|
2008-09-06 23:18:58 +00:00
|
|
|
if(IsConfSSLNeeded(aconf) && !IsSSL(source_p))
|
|
|
|
{
|
|
|
|
ServerStats.is_ref++;
|
|
|
|
sendto_one_notice(source_p, ":*** Notice -- You need to use SSL/TLS to use this server");
|
|
|
|
exit_client(client_p, source_p, &me, "Use SSL/TLS");
|
|
|
|
return (CLIENT_EXITED);
|
|
|
|
}
|
|
|
|
|
2017-08-19 14:11:49 +00:00
|
|
|
if(IsSCTP(source_p) && !IsConfAllowSCTP(aconf))
|
|
|
|
{
|
|
|
|
ServerStats.is_ref++;
|
|
|
|
sendto_one_notice(source_p, ":*** Notice -- You are not allowed to use SCTP on this server");
|
|
|
|
exit_client(client_p, source_p, &me, "SCTP not allowed");
|
|
|
|
return (CLIENT_EXITED);
|
|
|
|
}
|
|
|
|
|
2007-01-25 06:40:21 +00:00
|
|
|
if(!IsGotId(source_p))
|
|
|
|
{
|
|
|
|
const char *p;
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
if(IsNeedIdentd(aconf))
|
|
|
|
{
|
2008-04-04 15:54:37 +00:00
|
|
|
ServerStats.is_ref++;
|
2007-01-25 07:23:01 +00:00
|
|
|
sendto_one_notice(source_p, ":*** Notice -- You need to install identd to use this server");
|
2007-01-25 06:40:21 +00:00
|
|
|
exit_client(client_p, source_p, &me, "Install identd");
|
|
|
|
return (CLIENT_EXITED);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* dont replace username if its supposed to be spoofed --fl */
|
2010-03-01 00:23:22 +00:00
|
|
|
if(!IsConfDoSpoofIp(aconf) || !strchr(aconf->info.name, '@'))
|
2007-01-25 06:40:21 +00:00
|
|
|
{
|
2015-03-05 23:41:51 +00:00
|
|
|
p = myusername;
|
2007-01-25 06:40:21 +00:00
|
|
|
|
|
|
|
if(!IsNoTilde(aconf))
|
|
|
|
source_p->username[i++] = '~';
|
|
|
|
|
|
|
|
while (*p && i < USERLEN)
|
|
|
|
{
|
|
|
|
if(*p != '[')
|
|
|
|
source_p->username[i++] = *p;
|
|
|
|
p++;
|
|
|
|
}
|
|
|
|
|
|
|
|
source_p->username[i] = '\0';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-28 18:23:21 +00:00
|
|
|
if(IsNeedSasl(aconf) && !*source_p->user->suser)
|
2007-01-25 06:40:21 +00:00
|
|
|
{
|
2008-04-04 15:54:37 +00:00
|
|
|
ServerStats.is_ref++;
|
2007-01-25 07:23:01 +00:00
|
|
|
sendto_one_notice(source_p, ":*** Notice -- You need to identify via SASL to use this server");
|
2007-01-25 06:40:21 +00:00
|
|
|
exit_client(client_p, source_p, &me, "SASL access only");
|
|
|
|
return (CLIENT_EXITED);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* password check */
|
|
|
|
if(!EmptyString(aconf->passwd))
|
|
|
|
{
|
|
|
|
const char *encr;
|
|
|
|
|
|
|
|
if(EmptyString(source_p->localClient->passwd))
|
|
|
|
encr = "";
|
|
|
|
else if(IsConfEncrypted(aconf))
|
2008-07-27 10:52:46 +00:00
|
|
|
encr = rb_crypt(source_p->localClient->passwd, aconf->passwd);
|
2007-01-25 06:40:21 +00:00
|
|
|
else
|
|
|
|
encr = source_p->localClient->passwd;
|
|
|
|
|
2013-02-01 23:54:32 +00:00
|
|
|
if(encr == NULL || strcmp(encr, aconf->passwd))
|
2007-01-25 06:40:21 +00:00
|
|
|
{
|
2008-04-04 15:54:37 +00:00
|
|
|
ServerStats.is_ref++;
|
2007-01-25 06:40:21 +00:00
|
|
|
sendto_one(source_p, form_str(ERR_PASSWDMISMATCH), me.name, source_p->name);
|
|
|
|
exit_client(client_p, source_p, &me, "Bad Password");
|
|
|
|
return (CLIENT_EXITED);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* clear password only if used now, otherwise send it
|
|
|
|
* to services -- jilles */
|
|
|
|
if(source_p->localClient->passwd)
|
|
|
|
{
|
|
|
|
memset(source_p->localClient->passwd, 0, strlen(source_p->localClient->passwd));
|
2008-04-01 22:47:17 +00:00
|
|
|
rb_free(source_p->localClient->passwd);
|
2007-01-25 06:40:21 +00:00
|
|
|
source_p->localClient->passwd = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-10 15:02:33 +00:00
|
|
|
/* report and set flags (kline exempt etc.) as needed in source_p */
|
2007-01-25 06:40:21 +00:00
|
|
|
report_and_set_user_flags(source_p, aconf);
|
|
|
|
|
|
|
|
/* Limit clients */
|
|
|
|
/*
|
|
|
|
* We want to be able to have servers and F-line clients
|
|
|
|
* connect, so save room for "buffer" connections.
|
|
|
|
* Smaller servers may want to decrease this, and it should
|
|
|
|
* probably be just a percentage of the MAXCLIENTS...
|
|
|
|
* -Taner
|
|
|
|
*/
|
|
|
|
/* Except "F:" clients */
|
2008-04-01 20:41:52 +00:00
|
|
|
if(rb_dlink_list_length(&lclient_list) >=
|
2008-01-05 23:16:57 +00:00
|
|
|
(unsigned long)GlobalSetOptions.maxclients && !IsConfExemptLimits(aconf))
|
2007-01-25 06:40:21 +00:00
|
|
|
{
|
|
|
|
sendto_realops_snomask(SNO_FULL, L_ALL,
|
|
|
|
"Too many clients, rejecting %s[%s].", source_p->name, source_p->host);
|
|
|
|
|
2008-04-04 15:54:37 +00:00
|
|
|
ServerStats.is_ref++;
|
2007-01-25 06:40:21 +00:00
|
|
|
exit_client(client_p, source_p, &me, "Sorry, server is full - try later");
|
|
|
|
return (CLIENT_EXITED);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* kline exemption extends to xline too */
|
|
|
|
if(!IsExemptKline(source_p) &&
|
2007-12-08 20:54:51 +00:00
|
|
|
(xconf = find_xline(source_p->info, 1)) != NULL)
|
2007-01-25 06:40:21 +00:00
|
|
|
{
|
2008-04-04 15:54:37 +00:00
|
|
|
ServerStats.is_ref++;
|
2019-12-31 01:11:45 +00:00
|
|
|
add_reject(source_p, xconf->host, NULL, NULL, NULL);
|
2007-01-25 06:40:21 +00:00
|
|
|
exit_client(client_p, source_p, &me, "Bad user info");
|
|
|
|
return CLIENT_EXITED;
|
|
|
|
}
|
|
|
|
|
2016-03-28 07:11:16 +00:00
|
|
|
/* authd rejection check */
|
2016-04-10 15:02:33 +00:00
|
|
|
if(authd_check(client_p, source_p))
|
|
|
|
return CLIENT_EXITED;
|
2007-01-25 06:40:21 +00:00
|
|
|
|
2007-03-06 14:07:11 +00:00
|
|
|
/* valid user name check */
|
|
|
|
|
|
|
|
if(!valid_username(source_p->username))
|
|
|
|
{
|
|
|
|
sendto_realops_snomask(SNO_REJ, L_ALL,
|
|
|
|
"Invalid username: %s (%s@%s)",
|
|
|
|
source_p->name, source_p->username, source_p->host);
|
2008-04-04 15:54:37 +00:00
|
|
|
ServerStats.is_ref++;
|
2007-11-20 11:08:23 +00:00
|
|
|
sendto_one_notice(source_p, ":*** Your username is invalid. Please make sure that your username contains "
|
|
|
|
"only alphanumeric characters.");
|
2016-02-10 01:25:32 +00:00
|
|
|
sprintf(tmpstr2, "Invalid username [%s]", source_p->username);
|
2007-03-06 14:07:11 +00:00
|
|
|
exit_client(client_p, source_p, &me, tmpstr2);
|
|
|
|
return (CLIENT_EXITED);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* end of valid user name check */
|
|
|
|
|
2007-01-25 06:40:21 +00:00
|
|
|
/* Store original hostname -- jilles */
|
2008-04-20 04:40:40 +00:00
|
|
|
rb_strlcpy(source_p->orighost, source_p->host, HOSTLEN + 1);
|
2007-01-25 06:40:21 +00:00
|
|
|
|
|
|
|
/* Spoof user@host */
|
|
|
|
if(*source_p->preClient->spoofuser)
|
2008-04-20 04:40:40 +00:00
|
|
|
rb_strlcpy(source_p->username, source_p->preClient->spoofuser, USERLEN + 1);
|
2007-01-25 06:40:21 +00:00
|
|
|
if(*source_p->preClient->spoofhost)
|
|
|
|
{
|
2008-04-20 04:40:40 +00:00
|
|
|
rb_strlcpy(source_p->host, source_p->preClient->spoofhost, HOSTLEN + 1);
|
2007-01-25 06:40:21 +00:00
|
|
|
if (irccmp(source_p->host, source_p->orighost))
|
|
|
|
SetDynSpoof(source_p);
|
|
|
|
}
|
|
|
|
|
2007-04-15 16:54:50 +00:00
|
|
|
source_p->umodes |= ConfigFileEntry.default_umodes & ~ConfigFileEntry.oper_only_umodes & ~orphaned_umodes;
|
|
|
|
|
|
|
|
call_hook(h_new_local_user, source_p);
|
|
|
|
|
|
|
|
/* If they have died in send_* or were thrown out by the
|
|
|
|
* new_local_user hook don't do anything. */
|
|
|
|
if(IsAnyDead(source_p))
|
2007-01-25 06:40:21 +00:00
|
|
|
return CLIENT_EXITED;
|
|
|
|
|
2007-04-15 16:54:50 +00:00
|
|
|
/* To avoid inconsistencies, do not abort the registration
|
|
|
|
* starting from this point -- jilles
|
|
|
|
*/
|
2008-04-20 04:55:41 +00:00
|
|
|
rb_inet_ntop_sock((struct sockaddr *)&source_p->localClient->ip, ipaddr, sizeof(ipaddr));
|
2007-01-25 06:40:21 +00:00
|
|
|
|
|
|
|
sendto_realops_snomask(SNO_CCONN, L_ALL,
|
|
|
|
"Client connecting: %s (%s@%s) [%s] {%s} [%s]",
|
|
|
|
source_p->name, source_p->username, source_p->orighost,
|
|
|
|
show_ip(NULL, source_p) ? ipaddr : "255.255.255.255",
|
|
|
|
get_client_class(source_p), source_p->info);
|
|
|
|
|
|
|
|
sendto_realops_snomask(SNO_CCONNEXT, L_ALL,
|
|
|
|
"CLICONN %s %s %s %s %s %s 0 %s",
|
|
|
|
source_p->name, source_p->username, source_p->orighost,
|
|
|
|
show_ip(NULL, source_p) ? ipaddr : "255.255.255.255",
|
|
|
|
get_client_class(source_p),
|
|
|
|
/* mirc can sometimes send ips here */
|
|
|
|
show_ip(NULL, source_p) ? source_p->localClient->fullcaps : "<hidden> <hidden>",
|
|
|
|
source_p->info);
|
|
|
|
|
|
|
|
add_to_hostname_hash(source_p->orighost, source_p);
|
|
|
|
|
|
|
|
/* Allocate a UID if it was not previously allocated.
|
|
|
|
* If this already occured, it was probably during SASL auth...
|
|
|
|
*/
|
|
|
|
if(!*source_p->id)
|
|
|
|
{
|
2016-05-15 03:57:16 +00:00
|
|
|
rb_strlcpy(source_p->id, generate_uid(), sizeof(source_p->id));
|
2007-01-25 06:40:21 +00:00
|
|
|
add_to_id_hash(source_p->id, source_p);
|
|
|
|
}
|
|
|
|
|
2019-06-09 00:12:52 +00:00
|
|
|
if (IsSSL(source_p) && !IsInsecure(source_p))
|
2008-04-06 16:55:12 +00:00
|
|
|
source_p->umodes |= UMODE_SSLCLIENT;
|
|
|
|
|
2007-01-25 06:40:21 +00:00
|
|
|
if (source_p->umodes & UMODE_INVISIBLE)
|
|
|
|
Count.invisi++;
|
|
|
|
|
|
|
|
s_assert(!IsClient(source_p));
|
2008-04-01 20:41:52 +00:00
|
|
|
rb_dlinkMoveNode(&source_p->localClient->tnode, &unknown_list, &lclient_list);
|
2007-01-25 06:40:21 +00:00
|
|
|
SetClient(source_p);
|
|
|
|
|
2007-11-20 11:16:43 +00:00
|
|
|
source_p->servptr = &me;
|
2008-04-01 20:41:52 +00:00
|
|
|
rb_dlinkAdd(source_p, &source_p->lnode, &source_p->servptr->serv->users);
|
2007-11-20 11:16:43 +00:00
|
|
|
|
2007-01-25 06:40:21 +00:00
|
|
|
/* Increment our total user count here */
|
|
|
|
if(++Count.total > Count.max_tot)
|
|
|
|
Count.max_tot = Count.total;
|
2007-11-20 11:16:43 +00:00
|
|
|
|
2007-01-25 06:40:21 +00:00
|
|
|
Count.totalrestartcount++;
|
|
|
|
|
|
|
|
s_assert(source_p->localClient != NULL);
|
|
|
|
|
2008-04-01 20:41:52 +00:00
|
|
|
if(rb_dlink_list_length(&lclient_list) > (unsigned long)Count.max_loc)
|
2007-01-25 06:40:21 +00:00
|
|
|
{
|
2008-04-01 20:41:52 +00:00
|
|
|
Count.max_loc = rb_dlink_list_length(&lclient_list);
|
2007-01-25 06:40:21 +00:00
|
|
|
if(!(Count.max_loc % 10))
|
|
|
|
sendto_realops_snomask(SNO_GENERAL, L_ALL,
|
|
|
|
"New Max Local Clients: %d", Count.max_loc);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* they get a reduced limit */
|
|
|
|
if(find_tgchange(source_p->sockhost))
|
2010-02-14 23:31:17 +00:00
|
|
|
source_p->localClient->targets_free = TGCHANGE_INITIAL_LOW;
|
|
|
|
else
|
|
|
|
source_p->localClient->targets_free = TGCHANGE_INITIAL;
|
2007-01-25 06:40:21 +00:00
|
|
|
|
|
|
|
monitor_signon(source_p);
|
|
|
|
user_welcome(source_p);
|
|
|
|
|
|
|
|
free_pre_client(source_p);
|
|
|
|
|
2016-10-28 18:23:21 +00:00
|
|
|
introduce_client(client_p, source_p, source_p->user, source_p->name, 1);
|
2016-03-08 11:06:29 +00:00
|
|
|
return 0;
|
2007-01-25 06:40:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* introduce_clients
|
|
|
|
*
|
|
|
|
* inputs -
|
|
|
|
* output -
|
|
|
|
* side effects - This common function introduces a client to the rest
|
|
|
|
* of the net, either from a local client connect or
|
|
|
|
* from a remote connect.
|
|
|
|
*/
|
2016-03-08 11:06:29 +00:00
|
|
|
void
|
2007-01-25 06:40:21 +00:00
|
|
|
introduce_client(struct Client *client_p, struct Client *source_p, struct User *user, const char *nick, int use_euid)
|
|
|
|
{
|
2014-05-13 23:21:27 +00:00
|
|
|
char ubuf[BUFSIZE];
|
2007-01-25 06:40:21 +00:00
|
|
|
struct Client *identifyservice_p;
|
|
|
|
char *p;
|
|
|
|
hook_data_umode_changed hdata;
|
|
|
|
hook_data_client hdata2;
|
|
|
|
|
|
|
|
if(MyClient(source_p))
|
2015-04-20 05:55:20 +00:00
|
|
|
send_umode(source_p, source_p, 0, ubuf);
|
2007-01-25 06:40:21 +00:00
|
|
|
else
|
2015-04-20 05:55:20 +00:00
|
|
|
send_umode(NULL, source_p, 0, ubuf);
|
2007-01-25 06:40:21 +00:00
|
|
|
|
|
|
|
if(!*ubuf)
|
|
|
|
{
|
|
|
|
ubuf[0] = '+';
|
|
|
|
ubuf[1] = '\0';
|
|
|
|
}
|
|
|
|
|
2008-06-08 06:29:26 +00:00
|
|
|
s_assert(has_id(source_p));
|
|
|
|
|
|
|
|
if (use_euid)
|
|
|
|
sendto_server(client_p, NULL, CAP_EUID | CAP_TS6, NOCAPS,
|
|
|
|
":%s EUID %s %d %ld %s %s %s %s %s %s %s :%s",
|
|
|
|
source_p->servptr->id, nick,
|
|
|
|
source_p->hopcount + 1,
|
|
|
|
(long) source_p->tsinfo, ubuf,
|
|
|
|
source_p->username, source_p->host,
|
2015-01-25 21:11:16 +00:00
|
|
|
IsIPSpoof(source_p) ? "0" : source_p->sockhost,
|
2008-06-08 06:29:26 +00:00
|
|
|
source_p->id,
|
|
|
|
IsDynSpoof(source_p) ? source_p->orighost : "*",
|
|
|
|
EmptyString(source_p->user->suser) ? "*" : source_p->user->suser,
|
|
|
|
source_p->info);
|
|
|
|
|
|
|
|
sendto_server(client_p, NULL, CAP_TS6, use_euid ? CAP_EUID : NOCAPS,
|
|
|
|
":%s UID %s %d %ld %s %s %s %s %s :%s",
|
|
|
|
source_p->servptr->id, nick,
|
|
|
|
source_p->hopcount + 1,
|
|
|
|
(long) source_p->tsinfo, ubuf,
|
|
|
|
source_p->username, source_p->host,
|
2015-01-25 21:11:16 +00:00
|
|
|
IsIPSpoof(source_p) ? "0" : source_p->sockhost,
|
2008-06-08 06:29:26 +00:00
|
|
|
source_p->id, source_p->info);
|
2007-01-25 06:40:21 +00:00
|
|
|
|
2010-02-05 23:18:27 +00:00
|
|
|
if(!EmptyString(source_p->certfp))
|
|
|
|
sendto_server(client_p, NULL, CAP_TS6, NOCAPS,
|
|
|
|
":%s ENCAP * CERTFP :%s",
|
|
|
|
use_id(source_p), source_p->certfp);
|
|
|
|
|
2007-01-25 06:40:21 +00:00
|
|
|
if (IsDynSpoof(source_p))
|
|
|
|
{
|
|
|
|
sendto_server(client_p, NULL, CAP_TS6, use_euid ? CAP_EUID : NOCAPS, ":%s ENCAP * REALHOST %s",
|
|
|
|
use_id(source_p), source_p->orighost);
|
|
|
|
}
|
2008-06-08 06:29:26 +00:00
|
|
|
|
2007-01-25 06:40:21 +00:00
|
|
|
if (!EmptyString(source_p->user->suser))
|
|
|
|
{
|
|
|
|
sendto_server(client_p, NULL, CAP_TS6, use_euid ? CAP_EUID : NOCAPS, ":%s ENCAP * LOGIN %s",
|
|
|
|
use_id(source_p), source_p->user->suser);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(MyConnect(source_p) && source_p->localClient->passwd)
|
|
|
|
{
|
2010-04-18 11:54:03 +00:00
|
|
|
if (!EmptyString(ConfigFileEntry.identifyservice) &&
|
|
|
|
!EmptyString(ConfigFileEntry.identifycommand))
|
2007-01-25 06:40:21 +00:00
|
|
|
{
|
|
|
|
/* use user@server */
|
|
|
|
p = strchr(ConfigFileEntry.identifyservice, '@');
|
|
|
|
if (p != NULL)
|
|
|
|
identifyservice_p = find_named_client(p + 1);
|
|
|
|
else
|
|
|
|
identifyservice_p = NULL;
|
|
|
|
if (identifyservice_p != NULL)
|
2008-08-29 19:45:30 +00:00
|
|
|
{
|
|
|
|
if (!EmptyString(source_p->localClient->auth_user))
|
|
|
|
sendto_one(identifyservice_p, ":%s PRIVMSG %s :%s %s %s",
|
|
|
|
get_id(source_p, identifyservice_p),
|
|
|
|
ConfigFileEntry.identifyservice,
|
|
|
|
ConfigFileEntry.identifycommand,
|
|
|
|
source_p->localClient->auth_user,
|
|
|
|
source_p->localClient->passwd);
|
|
|
|
else
|
|
|
|
sendto_one(identifyservice_p, ":%s PRIVMSG %s :%s %s",
|
|
|
|
get_id(source_p, identifyservice_p),
|
|
|
|
ConfigFileEntry.identifyservice,
|
|
|
|
ConfigFileEntry.identifycommand,
|
|
|
|
source_p->localClient->passwd);
|
|
|
|
}
|
2007-01-25 06:40:21 +00:00
|
|
|
}
|
|
|
|
memset(source_p->localClient->passwd, 0, strlen(source_p->localClient->passwd));
|
2008-04-01 22:47:17 +00:00
|
|
|
rb_free(source_p->localClient->passwd);
|
2007-01-25 06:40:21 +00:00
|
|
|
source_p->localClient->passwd = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* let modules providing usermodes know that we've got a new user,
|
|
|
|
* why is this here? -- well, some modules need to be able to send out new
|
|
|
|
* information about a client, so this was the best place to do it
|
|
|
|
* --nenolod
|
|
|
|
*/
|
|
|
|
hdata.client = source_p;
|
|
|
|
hdata.oldumodes = 0;
|
|
|
|
hdata.oldsnomask = 0;
|
|
|
|
call_hook(h_umode_changed, &hdata);
|
|
|
|
|
|
|
|
/* On the other hand, some modules need to know when a client is
|
|
|
|
* being introduced, period.
|
|
|
|
* --gxti
|
|
|
|
*/
|
|
|
|
hdata2.client = client_p;
|
|
|
|
hdata2.target = source_p;
|
|
|
|
call_hook(h_introduce_client, &hdata2);
|
|
|
|
}
|
|
|
|
|
2014-03-03 04:25:47 +00:00
|
|
|
/*
|
2007-01-25 06:40:21 +00:00
|
|
|
* valid_hostname - check hostname for validity
|
|
|
|
*
|
|
|
|
* Inputs - pointer to user
|
2016-03-08 11:06:29 +00:00
|
|
|
* Output - true if valid, false if not
|
2007-01-25 06:40:21 +00:00
|
|
|
* Side effects - NONE
|
|
|
|
*
|
|
|
|
* NOTE: this doesn't allow a hostname to begin with a dot and
|
|
|
|
* will not allow more dots than chars.
|
|
|
|
*/
|
2016-03-08 11:06:29 +00:00
|
|
|
bool
|
2007-01-25 06:40:21 +00:00
|
|
|
valid_hostname(const char *hostname)
|
|
|
|
{
|
2009-04-20 13:37:13 +00:00
|
|
|
const char *p = hostname, *last_slash = 0;
|
2007-01-25 06:40:21 +00:00
|
|
|
int found_sep = 0;
|
|
|
|
|
|
|
|
s_assert(NULL != p);
|
|
|
|
|
|
|
|
if(hostname == NULL)
|
2016-03-08 11:06:29 +00:00
|
|
|
return false;
|
2007-01-25 06:40:21 +00:00
|
|
|
|
2015-01-15 00:00:00 +00:00
|
|
|
if(!strcmp(hostname, "localhost"))
|
2016-03-08 11:06:29 +00:00
|
|
|
return true;
|
2015-01-15 00:00:00 +00:00
|
|
|
|
2009-04-20 13:37:13 +00:00
|
|
|
if('.' == *p || ':' == *p || '/' == *p)
|
2016-03-08 11:06:29 +00:00
|
|
|
return false;
|
2007-01-25 06:40:21 +00:00
|
|
|
|
|
|
|
while (*p)
|
|
|
|
{
|
|
|
|
if(!IsHostChar(*p))
|
2016-03-08 11:06:29 +00:00
|
|
|
return false;
|
2007-01-25 06:40:21 +00:00
|
|
|
if(*p == '.' || *p == ':')
|
|
|
|
found_sep++;
|
2009-04-20 13:37:13 +00:00
|
|
|
else if(*p == '/')
|
|
|
|
{
|
|
|
|
found_sep++;
|
|
|
|
last_slash = p;
|
|
|
|
}
|
2007-01-25 06:40:21 +00:00
|
|
|
p++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(found_sep == 0)
|
2016-03-08 11:06:29 +00:00
|
|
|
return false;
|
2009-04-20 13:37:13 +00:00
|
|
|
|
|
|
|
if(last_slash && IsDigit(last_slash[1]))
|
2016-03-08 11:06:29 +00:00
|
|
|
return false;
|
2007-01-25 06:40:21 +00:00
|
|
|
|
2016-03-08 11:06:29 +00:00
|
|
|
return true;
|
2007-01-25 06:40:21 +00:00
|
|
|
}
|
|
|
|
|
2014-03-03 04:25:47 +00:00
|
|
|
/*
|
2007-01-25 06:40:21 +00:00
|
|
|
* valid_username - check username for validity
|
|
|
|
*
|
|
|
|
* Inputs - pointer to user
|
2016-03-08 11:06:29 +00:00
|
|
|
* Output - true if valid, false if not
|
2007-01-25 06:40:21 +00:00
|
|
|
* Side effects - NONE
|
2014-03-03 04:25:47 +00:00
|
|
|
*
|
2007-01-25 06:40:21 +00:00
|
|
|
* Absolutely always reject any '*' '!' '?' '@' in an user name
|
|
|
|
* reject any odd control characters names.
|
|
|
|
* Allow '.' in username to allow for "first.last"
|
|
|
|
* style of username
|
|
|
|
*/
|
2016-03-08 11:06:29 +00:00
|
|
|
bool
|
2007-01-25 06:40:21 +00:00
|
|
|
valid_username(const char *username)
|
|
|
|
{
|
|
|
|
int dots = 0;
|
|
|
|
const char *p = username;
|
|
|
|
|
|
|
|
s_assert(NULL != p);
|
|
|
|
|
|
|
|
if(username == NULL)
|
2016-03-08 11:06:29 +00:00
|
|
|
return false;
|
2007-01-25 06:40:21 +00:00
|
|
|
|
|
|
|
if('~' == *p)
|
|
|
|
++p;
|
|
|
|
|
|
|
|
/* reject usernames that don't start with an alphanum
|
|
|
|
* i.e. reject jokers who have '-@somehost' or '.@somehost'
|
|
|
|
* or "-hi-@somehost", "h-----@somehost" would still be accepted.
|
|
|
|
*/
|
|
|
|
if(!IsAlNum(*p))
|
2016-03-08 11:06:29 +00:00
|
|
|
return false;
|
2007-01-25 06:40:21 +00:00
|
|
|
|
|
|
|
while (*++p)
|
|
|
|
{
|
|
|
|
if((*p == '.') && ConfigFileEntry.dots_in_ident)
|
|
|
|
{
|
|
|
|
dots++;
|
|
|
|
if(dots > ConfigFileEntry.dots_in_ident)
|
2016-03-08 11:06:29 +00:00
|
|
|
return false;
|
2007-01-25 06:40:21 +00:00
|
|
|
if(!IsUserChar(p[1]))
|
2016-03-08 11:06:29 +00:00
|
|
|
return false;
|
2007-01-25 06:40:21 +00:00
|
|
|
}
|
|
|
|
else if(!IsUserChar(*p))
|
2016-03-08 11:06:29 +00:00
|
|
|
return false;
|
2007-01-25 06:40:21 +00:00
|
|
|
}
|
2016-03-08 11:06:29 +00:00
|
|
|
return true;
|
2007-01-25 06:40:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* report_and_set_user_flags
|
|
|
|
*
|
|
|
|
* Inputs - pointer to source_p
|
|
|
|
* - pointer to aconf for this user
|
|
|
|
* Output - NONE
|
|
|
|
* Side effects -
|
|
|
|
* Report to user any special flags they are getting, and set them.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
report_and_set_user_flags(struct Client *source_p, struct ConfItem *aconf)
|
|
|
|
{
|
|
|
|
/* If this user is being spoofed, tell them so */
|
|
|
|
if(IsConfDoSpoofIp(aconf))
|
|
|
|
{
|
2008-11-19 21:45:13 +00:00
|
|
|
sendto_one_notice(source_p, ":*** Spoofing your IP");
|
2007-01-25 06:40:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* If this user is in the exception class, Set it "E lined" */
|
|
|
|
if(IsConfExemptKline(aconf))
|
|
|
|
{
|
|
|
|
SetExemptKline(source_p);
|
2008-11-26 20:38:49 +00:00
|
|
|
sendto_one_notice(source_p, ":*** You are exempt from K/X lines");
|
2007-01-25 06:40:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(IsConfExemptDNSBL(aconf))
|
|
|
|
/* kline exempt implies this, don't send both */
|
|
|
|
if(!IsConfExemptKline(aconf))
|
2020-07-06 03:01:56 +00:00
|
|
|
sendto_one_notice(source_p, ":*** You are exempt from DNSBL listings");
|
2007-01-25 06:40:21 +00:00
|
|
|
|
|
|
|
/* If this user is exempt from user limits set it F lined" */
|
|
|
|
if(IsConfExemptLimits(aconf))
|
|
|
|
{
|
2008-11-19 21:45:13 +00:00
|
|
|
sendto_one_notice(source_p, ":*** You are exempt from user limits");
|
2007-01-25 06:40:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(IsConfExemptFlood(aconf))
|
|
|
|
{
|
|
|
|
SetExemptFlood(source_p);
|
2008-11-19 21:45:13 +00:00
|
|
|
sendto_one_notice(source_p, ":*** You are exempt from flood limits");
|
2007-01-25 06:40:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(IsConfExemptSpambot(aconf))
|
|
|
|
{
|
|
|
|
SetExemptSpambot(source_p);
|
2008-11-19 21:45:13 +00:00
|
|
|
sendto_one_notice(source_p, ":*** You are exempt from spambot checks");
|
2007-01-25 06:40:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(IsConfExemptJupe(aconf))
|
|
|
|
{
|
|
|
|
SetExemptJupe(source_p);
|
2008-11-19 21:45:13 +00:00
|
|
|
sendto_one_notice(source_p, ":*** You are exempt from juped channel warnings");
|
2007-01-25 06:40:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(IsConfExemptResv(aconf))
|
|
|
|
{
|
|
|
|
SetExemptResv(source_p);
|
2008-11-19 21:45:13 +00:00
|
|
|
sendto_one_notice(source_p, ":*** You are exempt from resvs");
|
2007-01-25 06:40:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(IsConfExemptShide(aconf))
|
|
|
|
{
|
|
|
|
SetExemptShide(source_p);
|
2008-11-19 21:45:13 +00:00
|
|
|
sendto_one_notice(source_p, ":*** You are exempt from serverhiding");
|
2007-01-25 06:40:21 +00:00
|
|
|
}
|
2016-01-12 05:32:23 +00:00
|
|
|
|
|
|
|
if(IsConfExtendChans(aconf))
|
|
|
|
{
|
|
|
|
SetExtendChans(source_p);
|
|
|
|
sendto_one_notice(source_p, ":*** You are exempt from normal channel limits");
|
|
|
|
}
|
2007-01-25 06:40:21 +00:00
|
|
|
}
|
|
|
|
|
2009-01-01 18:24:38 +00:00
|
|
|
static void
|
|
|
|
show_other_user_mode(struct Client *source_p, struct Client *target_p)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
char buf[BUFSIZE];
|
|
|
|
char *m;
|
|
|
|
|
|
|
|
m = buf;
|
|
|
|
*m++ = '+';
|
|
|
|
|
|
|
|
for (i = 0; i < 128; i++) /* >= 127 is extended ascii */
|
|
|
|
if (target_p->umodes & user_modes[i])
|
|
|
|
*m++ = (char) i;
|
|
|
|
*m = '\0';
|
|
|
|
|
|
|
|
if (MyConnect(target_p) && target_p->snomask != 0)
|
|
|
|
sendto_one_notice(source_p, ":Modes for %s are %s %s",
|
|
|
|
target_p->name, buf,
|
|
|
|
construct_snobuf(target_p->snomask));
|
|
|
|
else
|
|
|
|
sendto_one_notice(source_p, ":Modes for %s are %s",
|
|
|
|
target_p->name, buf);
|
|
|
|
}
|
|
|
|
|
2007-01-25 06:40:21 +00:00
|
|
|
/*
|
|
|
|
* user_mode - set get current users mode
|
|
|
|
*
|
|
|
|
* m_umode() added 15/10/91 By Darren Reed.
|
|
|
|
* parv[1] - username to change mode for
|
|
|
|
* parv[2] - modes to change
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
user_mode(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
|
|
|
{
|
|
|
|
int flag;
|
|
|
|
int i;
|
|
|
|
char *m;
|
|
|
|
const char *pm;
|
|
|
|
struct Client *target_p;
|
|
|
|
int what, setflags;
|
2016-03-08 11:06:29 +00:00
|
|
|
bool badflag = false; /* Only send one bad flag notice */
|
|
|
|
bool showsnomask = false;
|
2007-01-25 06:40:21 +00:00
|
|
|
unsigned int setsnomask;
|
|
|
|
char buf[BUFSIZE];
|
|
|
|
hook_data_umode_changed hdata;
|
|
|
|
|
|
|
|
what = MODE_ADD;
|
|
|
|
|
|
|
|
if(parc < 2)
|
|
|
|
{
|
|
|
|
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "MODE");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if((target_p = MyClient(source_p) ? find_named_person(parv[1]) : find_person(parv[1])) == NULL)
|
|
|
|
{
|
|
|
|
if(MyConnect(source_p))
|
|
|
|
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
|
|
|
|
form_str(ERR_NOSUCHCHANNEL), parv[1]);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Dont know why these were commented out..
|
|
|
|
* put them back using new sendto() funcs
|
|
|
|
*/
|
|
|
|
|
|
|
|
if(IsServer(source_p))
|
|
|
|
{
|
|
|
|
sendto_realops_snomask(SNO_GENERAL, L_ADMIN,
|
|
|
|
"*** Mode for User %s from %s", parv[1], source_p->name);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-12-28 17:36:41 +00:00
|
|
|
if(source_p != target_p)
|
2007-01-25 06:40:21 +00:00
|
|
|
{
|
2009-01-01 18:24:38 +00:00
|
|
|
if (MyOper(source_p) && parc < 3)
|
|
|
|
show_other_user_mode(source_p, target_p);
|
|
|
|
else
|
|
|
|
sendto_one(source_p, form_str(ERR_USERSDONTMATCH), me.name, source_p->name);
|
2007-01-25 06:40:21 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(parc < 3)
|
|
|
|
{
|
|
|
|
m = buf;
|
|
|
|
*m++ = '+';
|
|
|
|
|
|
|
|
for (i = 0; i < 128; i++) /* >= 127 is extended ascii */
|
|
|
|
if (source_p->umodes & user_modes[i])
|
|
|
|
*m++ = (char) i;
|
|
|
|
|
|
|
|
*m = '\0';
|
2007-04-03 10:15:39 +00:00
|
|
|
sendto_one_numeric(source_p, RPL_UMODEIS, form_str(RPL_UMODEIS), buf);
|
2007-04-03 10:11:06 +00:00
|
|
|
|
2007-01-25 06:40:21 +00:00
|
|
|
if (source_p->snomask != 0)
|
2007-04-03 10:11:06 +00:00
|
|
|
sendto_one_numeric(source_p, RPL_SNOMASK, form_str(RPL_SNOMASK),
|
2007-01-25 06:40:21 +00:00
|
|
|
construct_snobuf(source_p->snomask));
|
2007-04-03 10:11:06 +00:00
|
|
|
|
2007-01-25 06:40:21 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* find flags already set for user */
|
|
|
|
setflags = source_p->umodes;
|
|
|
|
setsnomask = source_p->snomask;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* parse mode change string(s)
|
|
|
|
*/
|
|
|
|
for (pm = parv[2]; *pm; pm++)
|
|
|
|
switch (*pm)
|
|
|
|
{
|
|
|
|
case '+':
|
|
|
|
what = MODE_ADD;
|
|
|
|
break;
|
|
|
|
case '-':
|
|
|
|
what = MODE_DEL;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'o':
|
|
|
|
if(what == MODE_ADD)
|
|
|
|
{
|
|
|
|
if(IsServer(client_p) && !IsOper(source_p))
|
|
|
|
{
|
|
|
|
++Count.oper;
|
|
|
|
SetOper(source_p);
|
2008-04-01 20:41:52 +00:00
|
|
|
rb_dlinkAddAlloc(source_p, &oper_list);
|
2007-01-25 06:40:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Only decrement the oper counts if an oper to begin with
|
2014-03-03 04:25:47 +00:00
|
|
|
* found by Pat Szuta, Perly , perly@xnet.com
|
2007-01-25 06:40:21 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
if(!IsOper(source_p))
|
|
|
|
break;
|
|
|
|
|
|
|
|
ClearOper(source_p);
|
|
|
|
|
|
|
|
Count.oper--;
|
|
|
|
|
|
|
|
if(MyConnect(source_p))
|
|
|
|
{
|
|
|
|
source_p->umodes &= ~ConfigFileEntry.oper_only_umodes;
|
|
|
|
if (!(source_p->umodes & UMODE_SERVNOTICE) && source_p->snomask != 0)
|
|
|
|
{
|
|
|
|
source_p->snomask = 0;
|
2016-03-08 11:06:29 +00:00
|
|
|
showsnomask = true;
|
2007-01-25 06:40:21 +00:00
|
|
|
}
|
2016-04-07 12:40:55 +00:00
|
|
|
source_p->flags &= ~OPER_FLAGS;
|
2007-01-25 06:40:21 +00:00
|
|
|
|
2008-04-01 20:41:52 +00:00
|
|
|
rb_dlinkFindDestroy(source_p, &local_oper_list);
|
2019-07-07 01:36:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(source_p->user->opername != NULL)
|
|
|
|
{
|
|
|
|
rb_free(source_p->user->opername);
|
|
|
|
source_p->user->opername = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(source_p->user->privset != NULL)
|
|
|
|
{
|
|
|
|
privilegeset_unref(source_p->user->privset);
|
|
|
|
source_p->user->privset = NULL;
|
2007-01-25 06:40:21 +00:00
|
|
|
}
|
|
|
|
|
2008-04-01 20:41:52 +00:00
|
|
|
rb_dlinkFindDestroy(source_p, &oper_list);
|
2007-01-25 06:40:21 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* we may not get these,
|
|
|
|
* but they shouldnt be in default
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* can only be set on burst */
|
|
|
|
case 'S':
|
2008-04-06 16:55:12 +00:00
|
|
|
case 'Z':
|
2007-01-25 06:40:21 +00:00
|
|
|
case ' ':
|
|
|
|
case '\n':
|
|
|
|
case '\r':
|
|
|
|
case '\t':
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 's':
|
|
|
|
if (MyConnect(source_p))
|
|
|
|
{
|
|
|
|
if(!IsOper(source_p)
|
|
|
|
&& (ConfigFileEntry.oper_only_umodes & UMODE_SERVNOTICE))
|
|
|
|
{
|
|
|
|
if (what == MODE_ADD || source_p->umodes & UMODE_SERVNOTICE)
|
2016-03-08 11:06:29 +00:00
|
|
|
badflag = true;
|
2007-01-25 06:40:21 +00:00
|
|
|
continue;
|
|
|
|
}
|
2016-03-08 11:06:29 +00:00
|
|
|
showsnomask = true;
|
2007-01-25 06:40:21 +00:00
|
|
|
if(what == MODE_ADD)
|
|
|
|
{
|
|
|
|
if (parc > 3)
|
|
|
|
source_p->snomask = parse_snobuf_to_mask(source_p->snomask, parv[3]);
|
|
|
|
else
|
|
|
|
source_p->snomask |= SNO_GENERAL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
source_p->snomask = 0;
|
|
|
|
if (source_p->snomask != 0)
|
|
|
|
source_p->umodes |= UMODE_SERVNOTICE;
|
|
|
|
else
|
|
|
|
source_p->umodes &= ~UMODE_SERVNOTICE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* FALLTHROUGH */
|
|
|
|
default:
|
2011-09-25 14:22:29 +00:00
|
|
|
if (MyConnect(source_p) && *pm == 'Q' && !ConfigChannel.use_forward)
|
|
|
|
{
|
2016-03-08 11:06:29 +00:00
|
|
|
badflag = true;
|
2011-09-25 14:22:29 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-01-25 06:40:21 +00:00
|
|
|
if((flag = user_modes[(unsigned char) *pm]))
|
|
|
|
{
|
|
|
|
if(MyConnect(source_p)
|
2007-02-04 15:08:04 +00:00
|
|
|
&& ((!IsOper(source_p)
|
|
|
|
&& (ConfigFileEntry.oper_only_umodes & flag))
|
|
|
|
|| (orphaned_umodes & flag)))
|
2007-01-25 06:40:21 +00:00
|
|
|
{
|
|
|
|
if (what == MODE_ADD || source_p->umodes & flag)
|
2016-03-08 11:06:29 +00:00
|
|
|
badflag = true;
|
2007-01-25 06:40:21 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(what == MODE_ADD)
|
|
|
|
source_p->umodes |= flag;
|
|
|
|
else
|
|
|
|
source_p->umodes &= ~flag;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(MyConnect(source_p))
|
2016-03-08 11:06:29 +00:00
|
|
|
badflag = true;
|
2007-01-25 06:40:21 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(badflag)
|
|
|
|
sendto_one(source_p, form_str(ERR_UMODEUNKNOWNFLAG), me.name, source_p->name);
|
|
|
|
|
|
|
|
if(MyClient(source_p) && (source_p->snomask & SNO_NCHANGE) && !IsOperN(source_p))
|
|
|
|
{
|
2008-01-05 00:37:03 +00:00
|
|
|
sendto_one_notice(source_p, ":*** You need oper and nick_changes flag for +s +n");
|
2007-01-25 06:40:21 +00:00
|
|
|
source_p->snomask &= ~SNO_NCHANGE; /* only tcm's really need this */
|
|
|
|
}
|
|
|
|
|
|
|
|
if(MyClient(source_p) && (source_p->umodes & UMODE_OPERWALL) && !IsOperOperwall(source_p))
|
|
|
|
{
|
2007-01-25 07:23:01 +00:00
|
|
|
sendto_one_notice(source_p, ":*** You need oper and operwall flag for +z");
|
2007-01-25 06:40:21 +00:00
|
|
|
source_p->umodes &= ~UMODE_OPERWALL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(MyConnect(source_p) && (source_p->umodes & UMODE_ADMIN) &&
|
|
|
|
(!IsOperAdmin(source_p) || IsOperHiddenAdmin(source_p)))
|
|
|
|
{
|
2008-01-05 00:37:03 +00:00
|
|
|
sendto_one_notice(source_p, ":*** You need oper and admin flag for +a");
|
2007-01-25 06:40:21 +00:00
|
|
|
source_p->umodes &= ~UMODE_ADMIN;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* let modules providing usermodes know that we've changed our usermode --nenolod */
|
|
|
|
hdata.client = source_p;
|
|
|
|
hdata.oldumodes = setflags;
|
|
|
|
hdata.oldsnomask = setsnomask;
|
|
|
|
call_hook(h_umode_changed, &hdata);
|
|
|
|
|
|
|
|
if(!(setflags & UMODE_INVISIBLE) && IsInvisible(source_p))
|
|
|
|
++Count.invisi;
|
|
|
|
if((setflags & UMODE_INVISIBLE) && !IsInvisible(source_p))
|
|
|
|
--Count.invisi;
|
|
|
|
/*
|
|
|
|
* compare new flags with old flags and send string which
|
|
|
|
* will cause servers to update correctly.
|
|
|
|
*/
|
|
|
|
send_umode_out(client_p, source_p, setflags);
|
|
|
|
if (showsnomask && MyConnect(source_p))
|
2007-04-03 10:11:06 +00:00
|
|
|
sendto_one_numeric(source_p, RPL_SNOMASK, form_str(RPL_SNOMASK),
|
2007-01-25 06:40:21 +00:00
|
|
|
construct_snobuf(source_p->snomask));
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* send the MODE string for user (user) to connection client_p
|
|
|
|
* -avalon
|
|
|
|
*/
|
|
|
|
void
|
2015-04-20 05:55:20 +00:00
|
|
|
send_umode(struct Client *client_p, struct Client *source_p, int old, char *umode_buf)
|
2007-01-25 06:40:21 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int flag;
|
|
|
|
char *m;
|
|
|
|
int what = 0;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* build a string in umode_buf to represent the change in the user's
|
|
|
|
* mode between the new (source_p->flag) and 'old'.
|
|
|
|
*/
|
|
|
|
m = umode_buf;
|
|
|
|
*m = '\0';
|
|
|
|
|
|
|
|
for (i = 0; i < 128; i++)
|
|
|
|
{
|
|
|
|
flag = user_modes[i];
|
|
|
|
|
|
|
|
if((flag & old) && !(source_p->umodes & flag))
|
|
|
|
{
|
|
|
|
if(what == MODE_DEL)
|
|
|
|
*m++ = (char) i;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
what = MODE_DEL;
|
|
|
|
*m++ = '-';
|
|
|
|
*m++ = (char) i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(!(flag & old) && (source_p->umodes & flag))
|
|
|
|
{
|
|
|
|
if(what == MODE_ADD)
|
|
|
|
*m++ = (char) i;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
what = MODE_ADD;
|
|
|
|
*m++ = '+';
|
|
|
|
*m++ = (char) i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*m = '\0';
|
|
|
|
|
|
|
|
if(*umode_buf && client_p)
|
|
|
|
sendto_one(client_p, ":%s MODE %s :%s", source_p->name, source_p->name, umode_buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* send_umode_out
|
|
|
|
*
|
|
|
|
* inputs -
|
|
|
|
* output - NONE
|
2014-03-03 04:25:47 +00:00
|
|
|
* side effects -
|
2007-01-25 06:40:21 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
send_umode_out(struct Client *client_p, struct Client *source_p, int old)
|
|
|
|
{
|
|
|
|
struct Client *target_p;
|
|
|
|
char buf[BUFSIZE];
|
2008-04-01 20:41:52 +00:00
|
|
|
rb_dlink_node *ptr;
|
2007-01-25 06:40:21 +00:00
|
|
|
|
2015-04-20 05:55:20 +00:00
|
|
|
send_umode(NULL, source_p, old, buf);
|
2007-01-25 06:40:21 +00:00
|
|
|
|
2008-04-01 20:43:10 +00:00
|
|
|
RB_DLINK_FOREACH(ptr, serv_list.head)
|
2007-01-25 06:40:21 +00:00
|
|
|
{
|
|
|
|
target_p = ptr->data;
|
|
|
|
|
|
|
|
if((target_p != client_p) && (target_p != source_p) && (*buf))
|
|
|
|
{
|
|
|
|
sendto_one(target_p, ":%s MODE %s :%s",
|
2014-03-03 04:25:47 +00:00
|
|
|
get_id(source_p, target_p),
|
2007-01-25 06:40:21 +00:00
|
|
|
get_id(source_p, target_p), buf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(client_p && MyClient(client_p))
|
2015-04-20 05:55:20 +00:00
|
|
|
send_umode(client_p, source_p, old, buf);
|
2007-01-25 06:40:21 +00:00
|
|
|
}
|
|
|
|
|
2014-03-03 04:25:47 +00:00
|
|
|
/*
|
2007-01-25 06:40:21 +00:00
|
|
|
* user_welcome
|
|
|
|
*
|
|
|
|
* inputs - client pointer to client to welcome
|
|
|
|
* output - NONE
|
|
|
|
* side effects -
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
user_welcome(struct Client *source_p)
|
|
|
|
{
|
2007-04-03 10:11:06 +00:00
|
|
|
sendto_one_numeric(source_p, RPL_WELCOME, form_str(RPL_WELCOME), ServerInfo.network_name, source_p->name);
|
|
|
|
sendto_one_numeric(source_p, RPL_YOURHOST, form_str(RPL_YOURHOST),
|
2007-01-25 06:40:21 +00:00
|
|
|
get_listener_name(source_p->localClient->listener), ircd_version);
|
2007-04-03 10:11:06 +00:00
|
|
|
sendto_one_numeric(source_p, RPL_CREATED, form_str(RPL_CREATED), creation);
|
2008-06-25 03:51:32 +00:00
|
|
|
sendto_one_numeric(source_p, RPL_MYINFO, form_str(RPL_MYINFO), me.name, ircd_version, umodebuf, cflagsmyinfo);
|
2007-01-25 06:40:21 +00:00
|
|
|
|
|
|
|
show_isupport(source_p);
|
|
|
|
|
|
|
|
show_lusers(source_p);
|
|
|
|
|
|
|
|
if(ConfigFileEntry.short_motd)
|
|
|
|
{
|
2007-01-25 07:23:01 +00:00
|
|
|
sendto_one_notice(source_p, ":*** Notice -- motd was last changed at %s", user_motd_changed);
|
|
|
|
sendto_one_notice(source_p, ":*** Notice -- Please read the motd if you haven't read it");
|
2007-01-25 06:40:21 +00:00
|
|
|
|
2014-03-03 04:25:47 +00:00
|
|
|
sendto_one(source_p, form_str(RPL_MOTDSTART),
|
2007-01-25 06:40:21 +00:00
|
|
|
me.name, source_p->name, me.name);
|
|
|
|
|
|
|
|
sendto_one(source_p, form_str(RPL_MOTD),
|
|
|
|
me.name, source_p->name, "*** This is the short motd ***");
|
|
|
|
|
|
|
|
sendto_one(source_p, form_str(RPL_ENDOFMOTD), me.name, source_p->name);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
send_user_motd(source_p);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* oper_up()
|
|
|
|
*
|
|
|
|
* inputs - pointer to given client to oper
|
|
|
|
* - pointer to ConfItem to use
|
|
|
|
* output - none
|
|
|
|
* side effects - opers up source_p using aconf for reference
|
|
|
|
*/
|
2016-03-08 11:06:29 +00:00
|
|
|
void
|
2007-01-25 06:40:21 +00:00
|
|
|
oper_up(struct Client *source_p, struct oper_conf *oper_p)
|
|
|
|
{
|
|
|
|
unsigned int old = source_p->umodes, oldsnomask = source_p->snomask;
|
|
|
|
hook_data_umode_changed hdata;
|
|
|
|
|
|
|
|
SetOper(source_p);
|
|
|
|
|
|
|
|
if(oper_p->umodes)
|
|
|
|
source_p->umodes |= oper_p->umodes;
|
|
|
|
else if(ConfigFileEntry.oper_umodes)
|
|
|
|
source_p->umodes |= ConfigFileEntry.oper_umodes;
|
|
|
|
else
|
|
|
|
source_p->umodes |= DEFAULT_OPER_UMODES;
|
|
|
|
|
|
|
|
if (oper_p->snomask)
|
|
|
|
{
|
|
|
|
source_p->snomask |= oper_p->snomask;
|
|
|
|
source_p->umodes |= UMODE_SERVNOTICE;
|
|
|
|
}
|
|
|
|
else if (source_p->umodes & UMODE_SERVNOTICE)
|
|
|
|
{
|
|
|
|
/* Only apply these if +s is already set -- jilles */
|
|
|
|
if (ConfigFileEntry.oper_snomask)
|
|
|
|
source_p->snomask |= ConfigFileEntry.oper_snomask;
|
|
|
|
else
|
|
|
|
source_p->snomask |= DEFAULT_OPER_SNOMASK;
|
|
|
|
}
|
|
|
|
|
|
|
|
Count.oper++;
|
|
|
|
|
2016-01-12 05:32:23 +00:00
|
|
|
SetExtendChans(source_p);
|
2007-01-25 06:40:21 +00:00
|
|
|
SetExemptKline(source_p);
|
|
|
|
|
2016-04-07 12:40:55 +00:00
|
|
|
source_p->flags |= oper_p->flags;
|
2019-07-07 01:36:58 +00:00
|
|
|
source_p->user->opername = rb_strdup(oper_p->name);
|
|
|
|
source_p->user->privset = privilegeset_ref(oper_p->privset);
|
2007-01-25 06:40:21 +00:00
|
|
|
|
2008-04-01 20:41:52 +00:00
|
|
|
rb_dlinkAddAlloc(source_p, &local_oper_list);
|
|
|
|
rb_dlinkAddAlloc(source_p, &oper_list);
|
2007-01-25 06:40:21 +00:00
|
|
|
|
|
|
|
if(IsOperAdmin(source_p) && !IsOperHiddenAdmin(source_p))
|
|
|
|
source_p->umodes |= UMODE_ADMIN;
|
|
|
|
if(!IsOperN(source_p))
|
|
|
|
source_p->snomask &= ~SNO_NCHANGE;
|
|
|
|
if(!IsOperOperwall(source_p))
|
|
|
|
source_p->umodes &= ~UMODE_OPERWALL;
|
|
|
|
hdata.client = source_p;
|
|
|
|
hdata.oldumodes = old;
|
|
|
|
hdata.oldsnomask = oldsnomask;
|
|
|
|
call_hook(h_umode_changed, &hdata);
|
|
|
|
|
|
|
|
sendto_realops_snomask(SNO_GENERAL, L_ALL,
|
2009-07-13 17:55:35 +00:00
|
|
|
"%s (%s!%s@%s) is now an operator", oper_p->name, source_p->name,
|
2007-01-25 06:40:21 +00:00
|
|
|
source_p->username, source_p->host);
|
2019-07-07 01:36:58 +00:00
|
|
|
sendto_server(NULL, NULL, CAP_TS6, NOCAPS, ":%s OPER %s %s",
|
|
|
|
use_id(source_p), oper_p->name, oper_p->privset->name);
|
2007-02-24 19:34:28 +00:00
|
|
|
if(!(old & UMODE_INVISIBLE) && IsInvisible(source_p))
|
|
|
|
++Count.invisi;
|
|
|
|
if((old & UMODE_INVISIBLE) && !IsInvisible(source_p))
|
|
|
|
--Count.invisi;
|
2007-01-25 06:40:21 +00:00
|
|
|
send_umode_out(source_p, source_p, old);
|
2007-04-03 10:11:06 +00:00
|
|
|
sendto_one_numeric(source_p, RPL_SNOMASK, form_str(RPL_SNOMASK),
|
2007-01-25 06:40:21 +00:00
|
|
|
construct_snobuf(source_p->snomask));
|
|
|
|
sendto_one(source_p, form_str(RPL_YOUREOPER), me.name, source_p->name);
|
2008-08-17 12:40:27 +00:00
|
|
|
sendto_one_notice(source_p, ":*** Oper privilege set is %s", oper_p->privset->name);
|
|
|
|
sendto_one_notice(source_p, ":*** Oper privs are %s", oper_p->privset->privs);
|
2007-01-25 06:40:21 +00:00
|
|
|
send_oper_motd(source_p);
|
|
|
|
}
|
|
|
|
|
2007-02-04 01:59:38 +00:00
|
|
|
/*
|
|
|
|
* find_umode_slot
|
|
|
|
*
|
|
|
|
* inputs - NONE
|
|
|
|
* outputs - an available umode bitmask or
|
|
|
|
* 0 if no umodes are available
|
|
|
|
* side effects - NONE
|
|
|
|
*/
|
|
|
|
unsigned int
|
|
|
|
find_umode_slot(void)
|
|
|
|
{
|
|
|
|
unsigned int all_umodes = 0, my_umode = 0, i;
|
|
|
|
|
|
|
|
for (i = 0; i < 128; i++)
|
|
|
|
all_umodes |= user_modes[i];
|
|
|
|
|
|
|
|
for (my_umode = 1; my_umode && (all_umodes & my_umode);
|
|
|
|
my_umode <<= 1);
|
|
|
|
|
|
|
|
return my_umode;
|
|
|
|
}
|
|
|
|
|
2007-01-25 06:40:21 +00:00
|
|
|
void
|
|
|
|
construct_umodebuf(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
char *ptr = umodebuf;
|
2007-02-04 15:08:04 +00:00
|
|
|
static int prev_user_modes[128];
|
2007-01-25 06:40:21 +00:00
|
|
|
|
|
|
|
*ptr = '\0';
|
|
|
|
|
|
|
|
for (i = 0; i < 128; i++)
|
2007-02-04 15:08:04 +00:00
|
|
|
{
|
|
|
|
if (prev_user_modes[i] != 0 && prev_user_modes[i] != user_modes[i])
|
|
|
|
{
|
|
|
|
if (user_modes[i] == 0)
|
|
|
|
{
|
|
|
|
orphaned_umodes |= prev_user_modes[i];
|
2019-08-31 13:43:34 +00:00
|
|
|
sendto_realops_snomask(SNO_DEBUG, L_ALL, "Umode +%c is now orphaned", i);
|
2007-02-04 15:08:04 +00:00
|
|
|
}
|
|
|
|
else
|
2019-08-31 13:43:34 +00:00
|
|
|
{
|
2007-02-04 15:08:04 +00:00
|
|
|
orphaned_umodes &= ~prev_user_modes[i];
|
2019-08-31 13:43:34 +00:00
|
|
|
sendto_realops_snomask(SNO_DEBUG, L_ALL, "Orphaned umode +%c is picked up by module", i);
|
|
|
|
}
|
|
|
|
user_modes[i] = prev_user_modes[i];
|
2007-02-04 15:08:04 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
prev_user_modes[i] = user_modes[i];
|
2007-01-25 06:40:21 +00:00
|
|
|
if (user_modes[i])
|
|
|
|
*ptr++ = (char) i;
|
2007-02-04 15:08:04 +00:00
|
|
|
}
|
2007-01-25 06:40:21 +00:00
|
|
|
|
|
|
|
*ptr++ = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
change_nick_user_host(struct Client *target_p, const char *nick, const char *user,
|
2008-04-08 16:54:58 +00:00
|
|
|
const char *host, int newts, const char *format, ...)
|
2007-01-25 06:40:21 +00:00
|
|
|
{
|
2008-04-01 20:41:52 +00:00
|
|
|
rb_dlink_node *ptr;
|
2007-01-25 06:40:21 +00:00
|
|
|
struct Channel *chptr;
|
|
|
|
struct membership *mscptr;
|
|
|
|
int changed = irccmp(target_p->name, nick);
|
|
|
|
int changed_case = strcmp(target_p->name, nick);
|
|
|
|
int do_qjm = irccmp(target_p->username, user) || irccmp(target_p->host, host);
|
|
|
|
char mode[10], modeval[NICKLEN * 2 + 2], reason[256], *mptr;
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
modeval[0] = '\0';
|
2014-03-03 04:25:47 +00:00
|
|
|
|
2007-01-25 06:40:21 +00:00
|
|
|
if(changed)
|
|
|
|
{
|
|
|
|
target_p->tsinfo = newts;
|
|
|
|
monitor_signoff(target_p);
|
|
|
|
}
|
|
|
|
invalidate_bancache_user(target_p);
|
|
|
|
|
|
|
|
if(do_qjm)
|
|
|
|
{
|
|
|
|
va_start(ap, format);
|
|
|
|
vsnprintf(reason, 255, format, ap);
|
|
|
|
va_end(ap);
|
|
|
|
|
2015-11-20 04:53:55 +00:00
|
|
|
sendto_common_channels_local_butone(target_p, NOCAPS, CLICAP_CHGHOST, ":%s!%s@%s QUIT :%s",
|
2007-01-25 06:40:21 +00:00
|
|
|
target_p->name, target_p->username, target_p->host,
|
|
|
|
reason);
|
|
|
|
|
2008-04-01 20:43:10 +00:00
|
|
|
RB_DLINK_FOREACH(ptr, target_p->user->channel.head)
|
2007-01-25 06:40:21 +00:00
|
|
|
{
|
|
|
|
mscptr = ptr->data;
|
|
|
|
chptr = mscptr->chptr;
|
|
|
|
mptr = mode;
|
|
|
|
|
|
|
|
if(is_chanop(mscptr))
|
|
|
|
{
|
|
|
|
*mptr++ = 'o';
|
|
|
|
strcat(modeval, nick);
|
|
|
|
strcat(modeval, " ");
|
|
|
|
}
|
|
|
|
|
|
|
|
if(is_voiced(mscptr))
|
|
|
|
{
|
|
|
|
*mptr++ = 'v';
|
|
|
|
strcat(modeval, nick);
|
|
|
|
}
|
|
|
|
|
|
|
|
*mptr = '\0';
|
|
|
|
|
2015-11-20 04:53:55 +00:00
|
|
|
sendto_channel_local_with_capability_butone(target_p, ALL_MEMBERS, NOCAPS, CLICAP_EXTENDED_JOIN | CLICAP_CHGHOST, chptr,
|
2011-11-12 14:41:01 +00:00
|
|
|
":%s!%s@%s JOIN %s", nick, user, host, chptr->chname);
|
2015-11-20 04:53:55 +00:00
|
|
|
sendto_channel_local_with_capability_butone(target_p, ALL_MEMBERS, CLICAP_EXTENDED_JOIN, CLICAP_CHGHOST, chptr,
|
2011-11-12 14:41:01 +00:00
|
|
|
":%s!%s@%s JOIN %s %s :%s", nick, user, host, chptr->chname,
|
|
|
|
EmptyString(target_p->user->suser) ? "*" : target_p->user->suser,
|
|
|
|
target_p->info);
|
|
|
|
|
2007-01-25 06:40:21 +00:00
|
|
|
if(*mode)
|
2016-03-20 22:59:07 +00:00
|
|
|
sendto_channel_local_with_capability_butone(target_p, ALL_MEMBERS, NOCAPS, CLICAP_CHGHOST, chptr,
|
|
|
|
":%s MODE %s +%s %s", target_p->servptr->name, chptr->chname, mode, modeval);
|
2007-01-25 06:40:21 +00:00
|
|
|
|
|
|
|
*modeval = '\0';
|
|
|
|
}
|
|
|
|
|
2012-02-14 14:15:44 +00:00
|
|
|
/* Resend away message to away-notify enabled clients. */
|
|
|
|
if (target_p->user->away)
|
2015-11-20 04:53:55 +00:00
|
|
|
sendto_common_channels_local_butone(target_p, CLICAP_AWAY_NOTIFY, CLICAP_CHGHOST, ":%s!%s@%s AWAY :%s",
|
2015-09-20 13:20:05 +00:00
|
|
|
nick, user, host,
|
2012-02-14 14:15:44 +00:00
|
|
|
target_p->user->away);
|
|
|
|
|
2015-11-20 04:53:55 +00:00
|
|
|
sendto_common_channels_local_butone(target_p, CLICAP_CHGHOST, NOCAPS,
|
|
|
|
":%s!%s@%s CHGHOST %s %s",
|
|
|
|
target_p->name, target_p->username, target_p->host, user, host);
|
|
|
|
|
2007-01-25 06:40:21 +00:00
|
|
|
if(MyClient(target_p) && changed_case)
|
|
|
|
sendto_one(target_p, ":%s!%s@%s NICK %s",
|
2015-11-20 04:53:55 +00:00
|
|
|
target_p->name, user, host, nick);
|
2012-03-25 01:59:20 +00:00
|
|
|
|
|
|
|
/* TODO: send some snotes to SNO_NCHANGE/SNO_CCONN/SNO_CCONNEXT? */
|
2007-01-25 06:40:21 +00:00
|
|
|
}
|
|
|
|
else if(changed_case)
|
|
|
|
{
|
2015-11-20 04:43:45 +00:00
|
|
|
sendto_common_channels_local(target_p, NOCAPS, NOCAPS, ":%s!%s@%s NICK :%s",
|
2015-11-20 04:53:55 +00:00
|
|
|
target_p->name, user, host, nick);
|
2012-03-25 01:59:20 +00:00
|
|
|
|
2012-03-26 22:46:50 +00:00
|
|
|
if(MyConnect(target_p))
|
|
|
|
sendto_realops_snomask(SNO_NCHANGE, L_ALL,
|
|
|
|
"Nick change: From %s to %s [%s@%s]",
|
|
|
|
target_p->name, nick,
|
|
|
|
target_p->username, target_p->host);
|
2007-01-25 06:40:21 +00:00
|
|
|
}
|
|
|
|
|
2016-01-12 04:46:49 +00:00
|
|
|
if (user != target_p->username)
|
|
|
|
rb_strlcpy(target_p->username, user, sizeof target_p->username);
|
|
|
|
|
2008-04-20 04:40:40 +00:00
|
|
|
rb_strlcpy(target_p->host, host, sizeof target_p->host);
|
2007-01-25 06:40:21 +00:00
|
|
|
|
|
|
|
if (changed)
|
2016-01-23 16:16:34 +00:00
|
|
|
whowas_add_history(target_p, 1);
|
2007-01-25 06:40:21 +00:00
|
|
|
|
|
|
|
del_from_client_hash(target_p->name, target_p);
|
2008-04-20 04:40:40 +00:00
|
|
|
rb_strlcpy(target_p->name, nick, NICKLEN);
|
2007-01-25 06:40:21 +00:00
|
|
|
add_to_client_hash(target_p->name, target_p);
|
|
|
|
|
|
|
|
if(changed)
|
|
|
|
{
|
|
|
|
monitor_signon(target_p);
|
|
|
|
del_all_accepts(target_p);
|
|
|
|
}
|
|
|
|
}
|