| 1 |
|
/* |
| 2 |
|
* ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd) |
| 3 |
|
* |
| 4 |
< |
* Copyright (c) 1997-2015 ircd-hybrid development team |
| 4 |
> |
* Copyright (c) 1997-2018 ircd-hybrid development team |
| 5 |
|
* |
| 6 |
|
* This program is free software; you can redistribute it and/or modify |
| 7 |
|
* it under the terms of the GNU General Public License as published by |
| 38 |
|
#include "motd.h" |
| 39 |
|
#include "numeric.h" |
| 40 |
|
#include "conf.h" |
| 41 |
+ |
#include "conf_gecos.h" |
| 42 |
|
#include "log.h" |
| 43 |
|
#include "server.h" |
| 44 |
+ |
#include "server_capab.h" /* TBR: RHOST compatibility mode */ |
| 45 |
|
#include "send.h" |
| 46 |
|
#include "memory.h" |
| 47 |
|
#include "packet.h" |
| 48 |
|
#include "rng_mt.h" |
| 47 |
– |
#include "userhost.h" |
| 49 |
|
#include "misc.h" |
| 50 |
|
#include "parse.h" |
| 51 |
|
#include "watch.h" |
| 52 |
|
#include "isupport.h" |
| 53 |
+ |
#include "tls.h" |
| 54 |
|
|
| 55 |
< |
static char umode_buffer[IRCD_BUFSIZE]; |
| 55 |
> |
static char umode_buffer[UMODE_MAX_STR]; |
| 56 |
|
|
| 57 |
|
const struct user_modes *umode_map[256]; |
| 58 |
|
const struct user_modes umode_tab[] = |
| 83 |
|
{ 's', UMODE_SERVNOTICE }, |
| 84 |
|
{ 'u', UMODE_UNAUTH }, |
| 85 |
|
{ 'w', UMODE_WALLOP }, |
| 84 |
– |
{ 'x', UMODE_HIDDENHOST }, |
| 86 |
|
{ 'y', UMODE_SPY }, |
| 87 |
|
{ '\0', 0 } |
| 88 |
|
}; |
| 108 |
|
* side effects - display to client user counts etc. |
| 109 |
|
*/ |
| 110 |
|
void |
| 111 |
< |
show_lusers(struct Client *source_p) |
| 111 |
> |
show_lusers(struct Client *client_p) |
| 112 |
|
{ |
| 113 |
< |
if (!ConfigServerHide.hide_servers || HasUMode(source_p, UMODE_OPER)) |
| 114 |
< |
sendto_one_numeric(source_p, &me, RPL_LUSERCLIENT, (Count.total - Count.invisi), |
| 113 |
> |
if (ConfigServerHide.hide_servers == 0 || HasUMode(client_p, UMODE_OPER)) |
| 114 |
> |
sendto_one_numeric(client_p, &me, RPL_LUSERCLIENT, (dlink_list_length(&global_client_list) - Count.invisi), |
| 115 |
|
Count.invisi, dlink_list_length(&global_server_list)); |
| 116 |
|
else |
| 117 |
< |
sendto_one_numeric(source_p, &me, RPL_LUSERCLIENT, (Count.total - Count.invisi), |
| 117 |
> |
sendto_one_numeric(client_p, &me, RPL_LUSERCLIENT, (dlink_list_length(&global_client_list) - Count.invisi), |
| 118 |
|
Count.invisi, 1); |
| 119 |
|
|
| 120 |
|
if (Count.oper) |
| 121 |
< |
sendto_one_numeric(source_p, &me, RPL_LUSEROP, Count.oper); |
| 121 |
> |
sendto_one_numeric(client_p, &me, RPL_LUSEROP, Count.oper); |
| 122 |
|
|
| 123 |
|
if (dlink_list_length(&unknown_list)) |
| 124 |
< |
sendto_one_numeric(source_p, &me, RPL_LUSERUNKNOWN, dlink_list_length(&unknown_list)); |
| 124 |
> |
sendto_one_numeric(client_p, &me, RPL_LUSERUNKNOWN, dlink_list_length(&unknown_list)); |
| 125 |
|
|
| 126 |
< |
if (dlink_list_length(&channel_list)) |
| 127 |
< |
sendto_one_numeric(source_p, &me, RPL_LUSERCHANNELS, dlink_list_length(&channel_list)); |
| 126 |
> |
if (dlink_list_length(channel_get_list())) |
| 127 |
> |
sendto_one_numeric(client_p, &me, RPL_LUSERCHANNELS, dlink_list_length(channel_get_list())); |
| 128 |
|
|
| 129 |
< |
if (!ConfigServerHide.hide_servers || HasUMode(source_p, UMODE_OPER)) |
| 129 |
> |
if (ConfigServerHide.hide_servers == 0 || HasUMode(client_p, UMODE_OPER)) |
| 130 |
|
{ |
| 131 |
< |
sendto_one_numeric(source_p, &me, RPL_LUSERME, Count.local, Count.myserver); |
| 132 |
< |
sendto_one_numeric(source_p, &me, RPL_LOCALUSERS, Count.local, Count.max_loc); |
| 131 |
> |
sendto_one_numeric(client_p, &me, RPL_LUSERME, dlink_list_length(&local_client_list), dlink_list_length(&local_server_list)); |
| 132 |
> |
sendto_one_numeric(client_p, &me, RPL_LOCALUSERS, dlink_list_length(&local_client_list), Count.max_loc); |
| 133 |
> |
sendto_one_numeric(client_p, &me, RPL_GLOBALUSERS, dlink_list_length(&global_client_list), Count.max_tot); |
| 134 |
> |
sendto_one_numeric(client_p, &me, RPL_STATSCONN, Count.max_loc_con, Count.max_loc, Count.totalrestartcount); |
| 135 |
|
} |
| 136 |
|
else |
| 137 |
|
{ |
| 138 |
< |
sendto_one_numeric(source_p, &me, RPL_LUSERME, Count.total, 0); |
| 139 |
< |
sendto_one_numeric(source_p, &me, RPL_LOCALUSERS, Count.total, Count.max_tot); |
| 138 |
> |
sendto_one_numeric(client_p, &me, RPL_LUSERME, dlink_list_length(&global_client_list), 0); |
| 139 |
> |
sendto_one_numeric(client_p, &me, RPL_LOCALUSERS, dlink_list_length(&global_client_list), Count.max_tot); |
| 140 |
> |
sendto_one_numeric(client_p, &me, RPL_GLOBALUSERS, dlink_list_length(&global_client_list), Count.max_tot); |
| 141 |
|
} |
| 138 |
– |
|
| 139 |
– |
sendto_one_numeric(source_p, &me, RPL_GLOBALUSERS, Count.total, Count.max_tot); |
| 140 |
– |
|
| 141 |
– |
if (!ConfigServerHide.hide_servers || HasUMode(source_p, UMODE_OPER)) |
| 142 |
– |
sendto_one_numeric(source_p, &me, RPL_STATSCONN, Count.max_loc_con, |
| 143 |
– |
Count.max_loc_cli, Count.totalrestartcount); |
| 144 |
– |
|
| 145 |
– |
if (Count.local > Count.max_loc_cli) |
| 146 |
– |
Count.max_loc_cli = Count.local; |
| 147 |
– |
|
| 148 |
– |
if ((Count.local + Count.myserver) > Count.max_loc_con) |
| 149 |
– |
Count.max_loc_con = Count.local + Count.myserver; |
| 142 |
|
} |
| 143 |
|
|
| 144 |
|
/* report_and_set_user_flags() |
| 145 |
|
* |
| 146 |
< |
* inputs - pointer to source_p |
| 146 |
> |
* inputs - pointer to client_p |
| 147 |
|
* - pointer to conf for this user |
| 148 |
|
* output - NONE |
| 149 |
|
* side effects - Report to user any special flags |
| 150 |
|
* they are getting, and set them. |
| 151 |
|
*/ |
| 152 |
|
static void |
| 153 |
< |
report_and_set_user_flags(struct Client *source_p, const struct MaskItem *conf) |
| 153 |
> |
report_and_set_user_flags(struct Client *client_p, const struct MaskItem *conf) |
| 154 |
|
{ |
| 155 |
|
/* If this user is being spoofed, tell them so */ |
| 156 |
|
if (IsConfDoSpoofIp(conf)) |
| 157 |
< |
sendto_one_notice(source_p, &me, ":*** Spoofing your IP. Congrats."); |
| 157 |
> |
sendto_one_notice(client_p, &me, ":*** Spoofing your IP"); |
| 158 |
|
|
| 159 |
|
/* If this user is in the exception class, set it "E lined" */ |
| 160 |
|
if (IsConfExemptKline(conf)) |
| 161 |
|
{ |
| 162 |
< |
AddFlag(source_p, FLAGS_EXEMPTKLINE); |
| 163 |
< |
sendto_one_notice(source_p, &me, ":*** You are exempt from K/D lines. Congrats."); |
| 162 |
> |
AddFlag(client_p, FLAGS_EXEMPTKLINE); |
| 163 |
> |
sendto_one_notice(client_p, &me, ":*** You are exempt from K/D lines"); |
| 164 |
|
} |
| 165 |
|
|
| 166 |
|
if (IsConfExemptXline(conf)) |
| 167 |
|
{ |
| 168 |
< |
AddFlag(source_p, FLAGS_EXEMPTXLINE); |
| 169 |
< |
sendto_one_notice(source_p, &me, ":*** You are exempt from X lines. Congrats."); |
| 168 |
> |
AddFlag(client_p, FLAGS_EXEMPTXLINE); |
| 169 |
> |
sendto_one_notice(client_p, &me, ":*** You are exempt from X lines"); |
| 170 |
|
} |
| 171 |
|
|
| 172 |
|
if (IsConfExemptResv(conf)) |
| 173 |
|
{ |
| 174 |
< |
AddFlag(source_p, FLAGS_EXEMPTRESV); |
| 175 |
< |
sendto_one_notice(source_p, &me, ":*** You are exempt from resvs. Congrats."); |
| 174 |
> |
AddFlag(client_p, FLAGS_EXEMPTRESV); |
| 175 |
> |
sendto_one_notice(client_p, &me, ":*** You are exempt from resvs"); |
| 176 |
|
} |
| 177 |
|
|
| 178 |
|
/* If this user is exempt from user limits set it "F lined" */ |
| 179 |
|
if (IsConfExemptLimits(conf)) |
| 180 |
|
{ |
| 181 |
< |
AddFlag(source_p, FLAGS_NOLIMIT); |
| 182 |
< |
sendto_one_notice(source_p, &me, ":*** You are exempt from user limits. Congrats."); |
| 181 |
> |
AddFlag(client_p, FLAGS_NOLIMIT); |
| 182 |
> |
sendto_one_notice(client_p, &me, ":*** You are exempt from user limits"); |
| 183 |
|
} |
| 184 |
|
|
| 185 |
|
if (IsConfCanFlood(conf)) |
| 186 |
|
{ |
| 187 |
< |
AddFlag(source_p, FLAGS_CANFLOOD); |
| 188 |
< |
sendto_one_notice(source_p, &me, ":*** You are exempt from flood " |
| 197 |
< |
"protection, aren't you fearsome."); |
| 187 |
> |
AddFlag(client_p, FLAGS_CANFLOOD); |
| 188 |
> |
sendto_one_notice(client_p, &me, ":*** You are exempt from flood protection"); |
| 189 |
|
} |
| 190 |
|
} |
| 191 |
|
|
| 192 |
|
/* introduce_client() |
| 193 |
|
* |
| 194 |
< |
* inputs - source_p |
| 194 |
> |
* inputs - client_p |
| 195 |
|
* output - NONE |
| 196 |
|
* side effects - This common function introduces a client to the rest |
| 197 |
|
* of the net, either from a local client connect or |
| 198 |
|
* from a remote connect. |
| 199 |
|
*/ |
| 200 |
|
static void |
| 201 |
< |
introduce_client(struct Client *source_p) |
| 201 |
> |
introduce_client(struct Client *client_p) |
| 202 |
|
{ |
| 203 |
< |
dlink_node *node = NULL; |
| 204 |
< |
char ubuf[IRCD_BUFSIZE] = ""; |
| 203 |
> |
dlink_node *node; |
| 204 |
> |
char buf[UMODE_MAX_STR] = ""; |
| 205 |
|
|
| 206 |
< |
if (MyClient(source_p)) |
| 207 |
< |
send_umode(source_p, source_p, 0, ubuf); |
| 217 |
< |
else |
| 218 |
< |
send_umode(NULL, source_p, 0, ubuf); |
| 219 |
< |
|
| 220 |
< |
watch_check_hash(source_p, RPL_LOGON); |
| 206 |
> |
send_umode(client_p, MyConnect(client_p), 0, buf); |
| 207 |
> |
watch_check_hash(client_p, RPL_LOGON); |
| 208 |
|
|
| 209 |
< |
if (ubuf[0] == '\0') |
| 209 |
> |
if (buf[0] == '\0') |
| 210 |
|
{ |
| 211 |
< |
ubuf[0] = '+'; |
| 212 |
< |
ubuf[1] = '\0'; |
| 211 |
> |
buf[0] = '+'; |
| 212 |
> |
buf[1] = '\0'; |
| 213 |
|
} |
| 214 |
|
|
| 215 |
|
DLINK_FOREACH(node, local_server_list.head) |
| 216 |
|
{ |
| 217 |
< |
struct Client *server = node->data; |
| 217 |
> |
struct Client *server_p = node->data; |
| 218 |
|
|
| 219 |
< |
if (server == source_p->from) |
| 219 |
> |
if (server_p == client_p->from) |
| 220 |
|
continue; |
| 221 |
|
|
| 222 |
< |
if (IsCapable(server, CAPAB_SVS)) |
| 223 |
< |
sendto_one(server, ":%s UID %s %u %lu %s %s %s %s %s %s :%s", |
| 224 |
< |
source_p->servptr->id, |
| 225 |
< |
source_p->name, source_p->hopcount+1, |
| 226 |
< |
(unsigned long)source_p->tsinfo, |
| 227 |
< |
ubuf, source_p->username, source_p->host, |
| 228 |
< |
source_p->sockhost, source_p->id, |
| 229 |
< |
source_p->account, |
| 230 |
< |
source_p->info); |
| 222 |
> |
/* TBR: compatibility mode */ |
| 223 |
> |
if (IsCapable(server_p, CAPAB_RHOST)) |
| 224 |
> |
sendto_one(server_p, ":%s UID %s %u %ju %s %s %s %s %s %s %s :%s", |
| 225 |
> |
client_p->servptr->id, |
| 226 |
> |
client_p->name, client_p->hopcount+1, |
| 227 |
> |
client_p->tsinfo, |
| 228 |
> |
buf, client_p->username, client_p->host, client_p->realhost, |
| 229 |
> |
client_p->sockhost, client_p->id, |
| 230 |
> |
client_p->account, |
| 231 |
> |
client_p->info); |
| 232 |
|
else |
| 233 |
< |
sendto_one(server, ":%s UID %s %u %lu %s %s %s %s %s :%s", |
| 234 |
< |
source_p->servptr->id, |
| 235 |
< |
source_p->name, source_p->hopcount+1, |
| 236 |
< |
(unsigned long)source_p->tsinfo, |
| 237 |
< |
ubuf, source_p->username, source_p->host, |
| 238 |
< |
source_p->sockhost, source_p->id, source_p->info); |
| 233 |
> |
sendto_one(server_p, ":%s UID %s %u %ju %s %s %s %s %s %s :%s", |
| 234 |
> |
client_p->servptr->id, |
| 235 |
> |
client_p->name, client_p->hopcount+1, |
| 236 |
> |
client_p->tsinfo, |
| 237 |
> |
buf, client_p->username, client_p->host, |
| 238 |
> |
client_p->sockhost, client_p->id, |
| 239 |
> |
client_p->account, |
| 240 |
> |
client_p->info); |
| 241 |
|
|
| 242 |
< |
if (!EmptyString(source_p->certfp)) |
| 243 |
< |
sendto_one(server, ":%s CERTFP %s", source_p->id, source_p->certfp); |
| 242 |
> |
if (!EmptyString(client_p->certfp)) |
| 243 |
> |
sendto_one(server_p, ":%s CERTFP %s", client_p->id, client_p->certfp); |
| 244 |
|
} |
| 245 |
|
} |
| 246 |
|
|
| 251 |
|
* side effects - |
| 252 |
|
*/ |
| 253 |
|
static void |
| 254 |
< |
user_welcome(struct Client *source_p) |
| 254 |
> |
user_welcome(struct Client *client_p) |
| 255 |
|
{ |
| 266 |
– |
#ifdef BUILD_DATE |
| 267 |
– |
static const char built_date[] = BUILD_DATE; |
| 268 |
– |
#else |
| 256 |
|
static const char built_date[] = __DATE__ " at " __TIME__; |
| 270 |
– |
#endif |
| 257 |
|
|
| 258 |
< |
#ifdef HAVE_LIBCRYPTO |
| 273 |
< |
if (HasFlag(source_p, FLAGS_SSL)) |
| 258 |
> |
if (HasFlag(client_p, FLAGS_SSL)) |
| 259 |
|
{ |
| 260 |
< |
AddUMode(source_p, UMODE_SSL); |
| 261 |
< |
sendto_one_notice(source_p, &me, ":*** Connected securely via %s", |
| 262 |
< |
ssl_get_cipher(source_p->connection->fd.ssl)); |
| 263 |
< |
} |
| 264 |
< |
#endif |
| 265 |
< |
|
| 266 |
< |
sendto_one_numeric(source_p, &me, RPL_WELCOME, ConfigServerInfo.network_name, |
| 267 |
< |
source_p->name); |
| 268 |
< |
sendto_one_numeric(source_p, &me, RPL_YOURHOST, |
| 269 |
< |
listener_get_name(source_p->connection->listener), ircd_version); |
| 270 |
< |
sendto_one_numeric(source_p, &me, RPL_CREATED, built_date); |
| 271 |
< |
sendto_one_numeric(source_p, &me, RPL_MYINFO, me.name, ircd_version, umode_buffer); |
| 272 |
< |
|
| 273 |
< |
isupport_show(source_p); |
| 274 |
< |
show_lusers(source_p); |
| 290 |
< |
motd_signon(source_p); |
| 260 |
> |
AddUMode(client_p, UMODE_SSL); |
| 261 |
> |
sendto_one_notice(client_p, &me, ":*** Connected securely via %s", |
| 262 |
> |
tls_get_cipher(&client_p->connection->fd->ssl)); |
| 263 |
> |
} |
| 264 |
> |
|
| 265 |
> |
sendto_one_numeric(client_p, &me, RPL_WELCOME, ConfigServerInfo.network_name, |
| 266 |
> |
client_p->name, client_p->username, client_p->realhost); |
| 267 |
> |
sendto_one_numeric(client_p, &me, RPL_YOURHOST, |
| 268 |
> |
listener_get_name(client_p->connection->listener), ircd_version); |
| 269 |
> |
sendto_one_numeric(client_p, &me, RPL_CREATED, built_date); |
| 270 |
> |
sendto_one_numeric(client_p, &me, RPL_MYINFO, me.name, ircd_version, umode_buffer); |
| 271 |
> |
|
| 272 |
> |
isupport_show(client_p); |
| 273 |
> |
show_lusers(client_p); |
| 274 |
> |
motd_signon(client_p); |
| 275 |
|
} |
| 276 |
|
|
| 277 |
|
/* check_xline() |
| 281 |
|
* side effects - |
| 282 |
|
*/ |
| 283 |
|
static int |
| 284 |
< |
check_xline(struct Client *source_p) |
| 284 |
> |
check_xline(struct Client *client_p) |
| 285 |
|
{ |
| 286 |
< |
struct MaskItem *conf = NULL; |
| 286 |
> |
const struct GecosItem *gecos = NULL; |
| 287 |
|
|
| 288 |
< |
if (HasFlag(source_p, FLAGS_EXEMPTXLINE)) |
| 288 |
> |
if (HasFlag(client_p, FLAGS_EXEMPTXLINE)) |
| 289 |
|
return 0; |
| 290 |
|
|
| 291 |
< |
if ((conf = find_matching_name_conf(CONF_XLINE, source_p->info, NULL, NULL, 0))) |
| 291 |
> |
if ((gecos = gecos_find(client_p->info, match))) |
| 292 |
|
{ |
| 309 |
– |
++conf->count; |
| 293 |
|
sendto_realops_flags(UMODE_REJ, L_ALL, SEND_NOTICE, |
| 294 |
|
"X-line Rejecting [%s] [%s], user %s [%s]", |
| 295 |
< |
source_p->info, conf->reason, |
| 296 |
< |
get_client_name(source_p, HIDE_IP), |
| 297 |
< |
source_p->sockhost); |
| 295 |
> |
client_p->info, gecos->reason, |
| 296 |
> |
client_get_name(client_p, HIDE_IP), |
| 297 |
> |
client_p->sockhost); |
| 298 |
|
|
| 299 |
|
++ServerStats.is_ref; |
| 300 |
< |
exit_client(source_p, "Bad user info"); |
| 300 |
> |
exit_client(client_p, "Bad user info"); |
| 301 |
|
return 1; |
| 302 |
|
} |
| 303 |
|
|
| 307 |
|
/*! \brief This function is called when both NICK and USER messages |
| 308 |
|
* have been accepted for the client, in whatever order. Only |
| 309 |
|
* after this, is the UID message propagated. |
| 310 |
< |
* \param source_p Pointer to given client to introduce |
| 310 |
> |
* \param client_p Pointer to given client to introduce |
| 311 |
|
*/ |
| 312 |
|
void |
| 313 |
< |
register_local_user(struct Client *source_p) |
| 313 |
> |
register_local_user(struct Client *client_p) |
| 314 |
|
{ |
| 332 |
– |
const char *id = NULL; |
| 315 |
|
const struct MaskItem *conf = NULL; |
| 316 |
|
|
| 317 |
< |
assert(source_p == source_p->from); |
| 318 |
< |
assert(MyConnect(source_p)); |
| 319 |
< |
assert(IsUnknown(source_p)); |
| 320 |
< |
assert(!source_p->connection->registration); |
| 317 |
> |
assert(client_p == client_p->from); |
| 318 |
> |
assert(client_p->connection->registration == 0); |
| 319 |
> |
assert(MyConnect(client_p)); |
| 320 |
> |
assert(IsUnknown(client_p)); |
| 321 |
|
|
| 322 |
|
if (ConfigGeneral.ping_cookie) |
| 323 |
|
{ |
| 324 |
< |
if (!HasFlag(source_p, FLAGS_PINGSENT) && !source_p->connection->random_ping) |
| 324 |
> |
if (!HasFlag(client_p, FLAGS_PINGSENT) && !client_p->connection->random_ping) |
| 325 |
|
{ |
| 326 |
|
do |
| 327 |
< |
source_p->connection->random_ping = genrand_int32(); |
| 328 |
< |
while (!source_p->connection->random_ping); |
| 327 |
> |
client_p->connection->random_ping = genrand_int32(); |
| 328 |
> |
while (client_p->connection->random_ping == 0); |
| 329 |
|
|
| 330 |
< |
sendto_one(source_p, "PING :%u", source_p->connection->random_ping); |
| 331 |
< |
AddFlag(source_p, FLAGS_PINGSENT); |
| 330 |
> |
sendto_one(client_p, "PING :%u", client_p->connection->random_ping); |
| 331 |
> |
AddFlag(client_p, FLAGS_PINGSENT); |
| 332 |
|
return; |
| 333 |
|
} |
| 334 |
|
|
| 335 |
< |
if (!HasFlag(source_p, FLAGS_PING_COOKIE)) |
| 335 |
> |
if (!HasFlag(client_p, FLAGS_PING_COOKIE)) |
| 336 |
|
return; |
| 337 |
|
} |
| 338 |
|
|
| 339 |
< |
source_p->connection->last_privmsg = CurrentTime; |
| 339 |
> |
client_p->connection->last_privmsg = CurrentTime; |
| 340 |
|
/* Straight up the maximum rate of flooding... */ |
| 341 |
< |
source_p->connection->allow_read = MAX_FLOOD_BURST; |
| 341 |
> |
client_p->connection->allow_read = MAX_FLOOD_BURST; |
| 342 |
|
|
| 343 |
< |
if (!check_client(source_p)) |
| 343 |
> |
if (check_client(client_p) == 0) |
| 344 |
|
return; |
| 345 |
|
|
| 346 |
< |
if (!valid_hostname(source_p->host)) |
| 365 |
< |
{ |
| 366 |
< |
sendto_one_notice(source_p, &me, ":*** Notice -- You have an illegal " |
| 367 |
< |
"character in your hostname"); |
| 368 |
< |
strlcpy(source_p->host, source_p->sockhost, sizeof(source_p->host)); |
| 369 |
< |
} |
| 370 |
< |
|
| 371 |
< |
conf = source_p->connection->confs.head->data; |
| 346 |
> |
conf = client_p->connection->confs.head->data; |
| 347 |
|
|
| 348 |
< |
if (!HasFlag(source_p, FLAGS_GOTID)) |
| 348 |
> |
if (!HasFlag(client_p, FLAGS_GOTID)) |
| 349 |
|
{ |
| 350 |
|
char username[USERLEN + 1] = ""; |
| 351 |
|
unsigned int i = 0; |
| 353 |
|
if (IsNeedIdentd(conf)) |
| 354 |
|
{ |
| 355 |
|
++ServerStats.is_ref; |
| 356 |
< |
sendto_one_notice(source_p, &me, ":*** Notice -- You need to install " |
| 356 |
> |
sendto_one_notice(client_p, &me, ":*** Notice -- You need to install " |
| 357 |
|
"identd to use this server"); |
| 358 |
< |
exit_client(source_p, "Install identd"); |
| 358 |
> |
exit_client(client_p, "Install identd"); |
| 359 |
|
return; |
| 360 |
|
} |
| 361 |
|
|
| 362 |
< |
strlcpy(username, source_p->username, sizeof(username)); |
| 362 |
> |
strlcpy(username, client_p->username, sizeof(username)); |
| 363 |
|
|
| 364 |
|
if (!IsNoTilde(conf)) |
| 365 |
< |
source_p->username[i++] = '~'; |
| 365 |
> |
client_p->username[i++] = '~'; |
| 366 |
|
|
| 367 |
|
for (const char *p = username; *p && i < USERLEN; ++p) |
| 368 |
< |
source_p->username[i++] = *p; |
| 368 |
> |
client_p->username[i++] = *p; |
| 369 |
|
|
| 370 |
< |
source_p->username[i] = '\0'; |
| 370 |
> |
client_p->username[i] = '\0'; |
| 371 |
|
} |
| 372 |
|
|
| 373 |
|
/* Password check */ |
| 374 |
|
if (!EmptyString(conf->passwd)) |
| 375 |
|
{ |
| 376 |
< |
if (!match_conf_password(source_p->connection->password, conf)) |
| 376 |
> |
if (match_conf_password(client_p->connection->password, conf) == 0) |
| 377 |
|
{ |
| 378 |
|
++ServerStats.is_ref; |
| 379 |
|
|
| 380 |
< |
sendto_one_numeric(source_p, &me, ERR_PASSWDMISMATCH); |
| 381 |
< |
exit_client(source_p, "Bad Password"); |
| 380 |
> |
sendto_one_numeric(client_p, &me, ERR_PASSWDMISMATCH); |
| 381 |
> |
exit_client(client_p, "Bad Password"); |
| 382 |
|
return; |
| 383 |
|
} |
| 384 |
|
} |
| 385 |
|
|
| 386 |
|
/* |
| 387 |
< |
* Don't free source_p->connection->password here - it can be required |
| 387 |
> |
* Don't free client_p->connection->password here - it can be required |
| 388 |
|
* by masked /stats I if there are auth {} blocks with need_password = no; |
| 389 |
|
* --adx |
| 390 |
|
*/ |
| 391 |
|
|
| 392 |
|
/* |
| 393 |
< |
* Report if user has &^>= etc. and set flags as needed in source_p |
| 393 |
> |
* Report if user has &^>= etc. and set flags as needed in client_p |
| 394 |
|
*/ |
| 395 |
< |
report_and_set_user_flags(source_p, conf); |
| 395 |
> |
report_and_set_user_flags(client_p, conf); |
| 396 |
|
|
| 397 |
< |
if (IsDead(source_p)) |
| 397 |
> |
if (IsDead(client_p)) |
| 398 |
|
return; |
| 399 |
|
|
| 400 |
|
/* |
| 405 |
|
* probably be just a percentage of the MAXCLIENTS... |
| 406 |
|
* -Taner |
| 407 |
|
*/ |
| 408 |
< |
if ((Count.local >= GlobalSetOptions.maxclients + MAX_BUFFER) || |
| 409 |
< |
(Count.local >= GlobalSetOptions.maxclients && !HasFlag(source_p, FLAGS_NOLIMIT))) |
| 408 |
> |
if ((dlink_list_length(&local_client_list) >= GlobalSetOptions.maxclients + MAX_BUFFER) || |
| 409 |
> |
(dlink_list_length(&local_client_list) >= GlobalSetOptions.maxclients && !HasFlag(client_p, FLAGS_NOLIMIT))) |
| 410 |
|
{ |
| 411 |
|
sendto_realops_flags(UMODE_FULL, L_ALL, SEND_NOTICE, |
| 412 |
|
"Too many clients, rejecting %s[%s].", |
| 413 |
< |
source_p->name, source_p->host); |
| 413 |
> |
client_p->name, client_p->host); |
| 414 |
|
++ServerStats.is_ref; |
| 415 |
< |
exit_client(source_p, "Sorry, server is full - try later"); |
| 415 |
> |
exit_client(client_p, "Sorry, server is full - try later"); |
| 416 |
|
return; |
| 417 |
|
} |
| 418 |
|
|
| 419 |
< |
if (!valid_username(source_p->username, 1)) |
| 419 |
> |
if (valid_username(client_p->username, 1) == 0) |
| 420 |
|
{ |
| 421 |
|
char buf[IRCD_BUFSIZE] = ""; |
| 422 |
|
|
| 423 |
|
sendto_realops_flags(UMODE_REJ, L_ALL, SEND_NOTICE, |
| 424 |
|
"Invalid username: %s (%s@%s)", |
| 425 |
< |
source_p->name, source_p->username, source_p->host); |
| 425 |
> |
client_p->name, client_p->username, client_p->host); |
| 426 |
|
++ServerStats.is_ref; |
| 427 |
< |
snprintf(buf, sizeof(buf), "Invalid username [%s]", source_p->username); |
| 428 |
< |
exit_client(source_p, buf); |
| 427 |
> |
snprintf(buf, sizeof(buf), "Invalid username [%s]", client_p->username); |
| 428 |
> |
exit_client(client_p, buf); |
| 429 |
|
return; |
| 430 |
|
} |
| 431 |
|
|
| 432 |
< |
if (check_xline(source_p)) |
| 432 |
> |
if (check_xline(client_p)) |
| 433 |
|
return; |
| 434 |
|
|
| 435 |
+ |
const char *id; |
| 436 |
|
while (hash_find_id((id = uid_get()))) |
| 437 |
|
; |
| 438 |
|
|
| 439 |
< |
strlcpy(source_p->id, id, sizeof(source_p->id)); |
| 440 |
< |
hash_add_id(source_p); |
| 439 |
> |
strlcpy(client_p->id, id, sizeof(client_p->id)); |
| 440 |
> |
hash_add_id(client_p); |
| 441 |
|
|
| 442 |
|
sendto_realops_flags(UMODE_CCONN, L_ALL, SEND_NOTICE, |
| 443 |
|
"Client connecting: %s (%s@%s) [%s] {%s} [%s] <%s>", |
| 444 |
< |
source_p->name, source_p->username, source_p->host, |
| 445 |
< |
source_p->sockhost, |
| 446 |
< |
get_client_class(&source_p->connection->confs), |
| 447 |
< |
source_p->info, source_p->id); |
| 444 |
> |
client_p->name, client_p->username, client_p->realhost, |
| 445 |
> |
client_p->sockhost, |
| 446 |
> |
get_client_class(&client_p->connection->confs), |
| 447 |
> |
client_p->info, client_p->id); |
| 448 |
|
|
| 449 |
|
if (ConfigGeneral.invisible_on_connect) |
| 450 |
|
{ |
| 451 |
< |
AddUMode(source_p, UMODE_INVISIBLE); |
| 451 |
> |
AddUMode(client_p, UMODE_INVISIBLE); |
| 452 |
|
++Count.invisi; |
| 453 |
|
} |
| 454 |
|
|
| 455 |
< |
if (++Count.local > Count.max_loc) |
| 455 |
> |
assert(client_p->servptr == &me); |
| 456 |
> |
|
| 457 |
> |
SetClient(client_p); |
| 458 |
> |
dlinkAdd(client_p, &client_p->lnode, &client_p->servptr->serv->client_list); |
| 459 |
> |
dlinkAdd(client_p, &client_p->node, &global_client_list); |
| 460 |
> |
|
| 461 |
> |
assert(dlinkFind(&unknown_list, client_p)); |
| 462 |
> |
|
| 463 |
> |
dlink_move_node(&client_p->connection->lclient_node, |
| 464 |
> |
&unknown_list, &local_client_list); |
| 465 |
> |
|
| 466 |
> |
if (dlink_list_length(&local_client_list) > Count.max_loc) |
| 467 |
|
{ |
| 468 |
< |
Count.max_loc = Count.local; |
| 468 |
> |
Count.max_loc = dlink_list_length(&local_client_list); |
| 469 |
|
|
| 470 |
|
if (!(Count.max_loc % 10)) |
| 471 |
|
sendto_realops_flags(UMODE_SERVNOTICE, L_ALL, SEND_NOTICE, |
| 473 |
|
Count.max_loc); |
| 474 |
|
} |
| 475 |
|
|
| 476 |
< |
if (++Count.total > Count.max_tot) |
| 477 |
< |
Count.max_tot = Count.total; |
| 478 |
< |
++Count.totalrestartcount; |
| 479 |
< |
|
| 493 |
< |
assert(source_p->servptr == &me); |
| 494 |
< |
SetClient(source_p); |
| 495 |
< |
dlinkAdd(source_p, &source_p->lnode, &source_p->servptr->serv->client_list); |
| 496 |
< |
dlinkAdd(source_p, &source_p->node, &global_client_list); |
| 476 |
> |
if ((dlink_list_length(&local_client_list) + |
| 477 |
> |
dlink_list_length(&local_server_list)) > Count.max_loc_con) |
| 478 |
> |
Count.max_loc_con = dlink_list_length(&local_client_list) + |
| 479 |
> |
dlink_list_length(&local_server_list); |
| 480 |
|
|
| 481 |
< |
assert(dlinkFind(&unknown_list, source_p)); |
| 482 |
< |
|
| 483 |
< |
dlink_move_node(&source_p->connection->lclient_node, |
| 501 |
< |
&unknown_list, &local_client_list); |
| 481 |
> |
if (dlink_list_length(&global_client_list) > Count.max_tot) |
| 482 |
> |
Count.max_tot = dlink_list_length(&global_client_list); |
| 483 |
> |
++Count.totalrestartcount; |
| 484 |
|
|
| 485 |
< |
user_welcome(source_p); |
| 504 |
< |
userhost_add(source_p->username, source_p->host, 0); |
| 505 |
< |
AddFlag(source_p, FLAGS_USERHOST); |
| 485 |
> |
user_welcome(client_p); |
| 486 |
|
|
| 487 |
< |
introduce_client(source_p); |
| 487 |
> |
introduce_client(client_p); |
| 488 |
|
} |
| 489 |
|
|
| 490 |
|
/* register_remote_user() |
| 491 |
|
* |
| 492 |
< |
* inputs - source_p remote or directly connected client |
| 492 |
> |
* inputs - client_p remote or directly connected client |
| 493 |
|
* - username to register as |
| 494 |
|
* - host name to register as |
| 495 |
|
* - server name |
| 498 |
|
* is introduced by a server. |
| 499 |
|
*/ |
| 500 |
|
void |
| 501 |
< |
register_remote_user(struct Client *source_p) |
| 501 |
> |
register_remote_user(struct Client *client_p) |
| 502 |
|
{ |
| 503 |
< |
const struct Client *target_p = NULL; |
| 524 |
< |
|
| 525 |
< |
if ((target_p = source_p->servptr) && target_p->from != source_p->from) |
| 526 |
< |
{ |
| 527 |
< |
sendto_realops_flags(UMODE_DEBUG, L_ALL, SEND_NOTICE, |
| 528 |
< |
"Bad User [%s] :%s USER %s@%s %s, != %s[%s]", |
| 529 |
< |
source_p->from->name, source_p->name, source_p->username, |
| 530 |
< |
source_p->host, source_p->servptr->name, |
| 531 |
< |
target_p->name, target_p->from->name); |
| 532 |
< |
sendto_one(source_p->from, |
| 533 |
< |
":%s KILL %s :%s (UID from wrong direction (%s != %s))", |
| 534 |
< |
me.id, source_p->id, me.name, source_p->servptr->name, |
| 535 |
< |
target_p->from->name); |
| 536 |
< |
|
| 537 |
< |
AddFlag(source_p, FLAGS_KILLED); |
| 538 |
< |
exit_client(source_p, "UID server wrong direction"); |
| 539 |
< |
return; |
| 540 |
< |
} |
| 503 |
> |
assert(client_p->servptr->from == client_p->from); |
| 504 |
|
|
| 505 |
|
/* |
| 506 |
|
* If the nick has been introduced by a services server, |
| 507 |
|
* make it a service as well. |
| 508 |
|
*/ |
| 509 |
< |
if (HasFlag(source_p->servptr, FLAGS_SERVICE)) |
| 510 |
< |
AddFlag(source_p, FLAGS_SERVICE); |
| 509 |
> |
if (HasFlag(client_p->servptr, FLAGS_SERVICE)) |
| 510 |
> |
AddFlag(client_p, FLAGS_SERVICE); |
| 511 |
|
|
| 512 |
< |
if (++Count.total > Count.max_tot) |
| 513 |
< |
Count.max_tot = Count.total; |
| 512 |
> |
SetClient(client_p); |
| 513 |
> |
dlinkAdd(client_p, &client_p->lnode, &client_p->servptr->serv->client_list); |
| 514 |
> |
dlinkAdd(client_p, &client_p->node, &global_client_list); |
| 515 |
|
|
| 516 |
< |
SetClient(source_p); |
| 517 |
< |
dlinkAdd(source_p, &source_p->lnode, &source_p->servptr->serv->client_list); |
| 554 |
< |
dlinkAdd(source_p, &source_p->node, &global_client_list); |
| 555 |
< |
userhost_add(source_p->username, source_p->host, 1); |
| 556 |
< |
AddFlag(source_p, FLAGS_USERHOST); |
| 516 |
> |
if (dlink_list_length(&global_client_list) > Count.max_tot) |
| 517 |
> |
Count.max_tot = dlink_list_length(&global_client_list); |
| 518 |
|
|
| 519 |
< |
if (HasFlag(source_p->servptr, FLAGS_EOB)) |
| 519 |
> |
if (HasFlag(client_p->servptr, FLAGS_EOB)) |
| 520 |
|
sendto_realops_flags(UMODE_FARCONNECT, L_ALL, SEND_NOTICE, |
| 521 |
|
"Client connecting at %s: %s (%s@%s) [%s] [%s] <%s>", |
| 522 |
< |
source_p->servptr->name, |
| 523 |
< |
source_p->name, source_p->username, source_p->host, |
| 524 |
< |
source_p->sockhost, source_p->info, source_p->id); |
| 522 |
> |
client_p->servptr->name, |
| 523 |
> |
client_p->name, client_p->username, client_p->realhost, |
| 524 |
> |
client_p->sockhost, client_p->info, client_p->id); |
| 525 |
|
|
| 526 |
< |
introduce_client(source_p); |
| 526 |
> |
introduce_client(client_p); |
| 527 |
|
} |
| 528 |
|
|
| 529 |
|
/* valid_hostname() |
| 566 |
|
int |
| 567 |
|
valid_username(const char *username, const int local) |
| 568 |
|
{ |
| 608 |
– |
unsigned int dots = 0; |
| 569 |
|
const char *p = username; |
| 570 |
|
|
| 571 |
|
assert(p); |
| 583 |
|
|
| 584 |
|
if (local) |
| 585 |
|
{ |
| 586 |
+ |
unsigned int dots = 0; |
| 587 |
+ |
|
| 588 |
|
while (*++p) |
| 589 |
|
{ |
| 590 |
|
if (*p == '.' && ConfigGeneral.dots_in_ident) |
| 635 |
|
return p - nickname <= NICKLEN; |
| 636 |
|
} |
| 637 |
|
|
| 638 |
< |
/* send_umode() |
| 639 |
< |
* send the MODE string for user (user) to connection client_p |
| 640 |
< |
* -avalon |
| 641 |
< |
* |
| 642 |
< |
* inputs - client_p |
| 681 |
< |
* - source_p |
| 682 |
< |
* - int old |
| 683 |
< |
* - suplied umode_buf |
| 684 |
< |
* output - NONE |
| 638 |
> |
/*! \brief Builds a mode change string to buffer pointed by \a buf |
| 639 |
> |
* \param client_p Pointer to client |
| 640 |
> |
* \param dispatch Whether to send a MODE message to client_p |
| 641 |
> |
* \param old Old user mode to compare against when building new mode buffer |
| 642 |
> |
* \param buf Pointer to buffer to build string in |
| 643 |
|
*/ |
| 644 |
|
void |
| 645 |
< |
send_umode(struct Client *client_p, struct Client *source_p, |
| 646 |
< |
unsigned int old, char *umode_buf) |
| 645 |
> |
send_umode(struct Client *client_p, unsigned int dispatch, |
| 646 |
> |
unsigned int old, char *buf) |
| 647 |
|
{ |
| 648 |
< |
char *m = umode_buf; |
| 648 |
> |
char *m = buf; |
| 649 |
|
int what = 0; |
| 650 |
|
|
| 651 |
|
/* |
| 652 |
|
* Build a string in umode_buf to represent the change in the user's |
| 653 |
< |
* mode between the new (source_p->umodes) and 'old'. |
| 653 |
> |
* mode between the new (client_p->umodes) and 'old'. |
| 654 |
|
*/ |
| 655 |
|
for (const struct user_modes *tab = umode_tab; tab->c; ++tab) |
| 656 |
|
{ |
| 657 |
< |
if ((tab->flag & old) && !HasUMode(source_p, tab->flag)) |
| 657 |
> |
if ((tab->flag & old) && !HasUMode(client_p, tab->flag)) |
| 658 |
|
{ |
| 659 |
|
if (what == MODE_DEL) |
| 660 |
|
*m++ = tab->c; |
| 665 |
|
*m++ = tab->c; |
| 666 |
|
} |
| 667 |
|
} |
| 668 |
< |
else if (!(tab->flag & old) && HasUMode(source_p, tab->flag)) |
| 668 |
> |
else if (!(tab->flag & old) && HasUMode(client_p, tab->flag)) |
| 669 |
|
{ |
| 670 |
|
if (what == MODE_ADD) |
| 671 |
|
*m++ = tab->c; |
| 680 |
|
|
| 681 |
|
*m = '\0'; |
| 682 |
|
|
| 683 |
< |
if (*umode_buf && client_p) |
| 683 |
> |
if (dispatch && *buf) |
| 684 |
|
sendto_one(client_p, ":%s!%s@%s MODE %s :%s", |
| 685 |
|
client_p->name, client_p->username, |
| 686 |
< |
client_p->host, client_p->name, umode_buf); |
| 686 |
> |
client_p->host, client_p->name, buf); |
| 687 |
|
} |
| 688 |
|
|
| 689 |
|
/* send_umode_out() |
| 693 |
|
* side effects - Only send ubuf out to servers that know about this client |
| 694 |
|
*/ |
| 695 |
|
void |
| 696 |
< |
send_umode_out(struct Client *source_p, unsigned int old) |
| 696 |
> |
send_umode_out(struct Client *client_p, unsigned int old) |
| 697 |
|
{ |
| 698 |
< |
char buf[IRCD_BUFSIZE] = ""; |
| 698 |
> |
char buf[UMODE_MAX_STR] = ""; |
| 699 |
|
|
| 700 |
< |
send_umode(MyClient(source_p) ? source_p : NULL, source_p, old, buf); |
| 700 |
> |
send_umode(client_p, MyConnect(client_p), old, buf); |
| 701 |
|
|
| 702 |
|
if (buf[0]) |
| 703 |
< |
sendto_server(source_p, 0, 0, ":%s MODE %s :%s", |
| 704 |
< |
source_p->id, source_p->id, buf); |
| 703 |
> |
sendto_server(client_p, 0, 0, ":%s MODE %s :%s", |
| 704 |
> |
client_p->id, client_p->id, buf); |
| 705 |
|
} |
| 706 |
|
|
| 707 |
|
void |
| 708 |
< |
user_set_hostmask(struct Client *target_p, const char *hostname, const int what) |
| 708 |
> |
user_set_hostmask(struct Client *client_p, const char *hostname) |
| 709 |
|
{ |
| 710 |
< |
dlink_node *node = NULL; |
| 710 |
> |
dlink_node *node; |
| 711 |
|
|
| 712 |
< |
if (!strcmp(target_p->host, hostname)) |
| 712 |
> |
if (strcmp(client_p->host, hostname) == 0) |
| 713 |
|
return; |
| 714 |
|
|
| 757 |
– |
switch (what) |
| 758 |
– |
{ |
| 759 |
– |
case MODE_ADD: |
| 760 |
– |
AddUMode(target_p, UMODE_HIDDENHOST); |
| 761 |
– |
break; |
| 762 |
– |
case MODE_DEL: |
| 763 |
– |
DelUMode(target_p, UMODE_HIDDENHOST); |
| 764 |
– |
break; |
| 765 |
– |
default: return; |
| 766 |
– |
} |
| 767 |
– |
|
| 715 |
|
if (ConfigGeneral.cycle_on_host_change) |
| 716 |
< |
sendto_common_channels_local(target_p, 0, 0, ":%s!%s@%s QUIT :Changing hostname", |
| 717 |
< |
target_p->name, target_p->username, target_p->host); |
| 771 |
< |
|
| 772 |
< |
if (HasFlag(target_p, FLAGS_USERHOST)) |
| 773 |
< |
userhost_del(target_p->username, target_p->host, !MyConnect(target_p)); |
| 716 |
> |
sendto_common_channels_local(client_p, 0, 0, CAP_CHGHOST, ":%s!%s@%s QUIT :Changing hostname", |
| 717 |
> |
client_p->name, client_p->username, client_p->host); |
| 718 |
|
|
| 719 |
< |
strlcpy(target_p->host, hostname, sizeof(target_p->host)); |
| 719 |
> |
sendto_common_channels_local(client_p, 0, CAP_CHGHOST, 0, ":%s!%s@%s CHGHOST %s %s", |
| 720 |
> |
client_p->name, client_p->username, |
| 721 |
> |
client_p->host, client_p->username, hostname); |
| 722 |
|
|
| 723 |
< |
userhost_add(target_p->username, target_p->host, !MyConnect(target_p)); |
| 778 |
< |
AddFlag(target_p, FLAGS_USERHOST); |
| 723 |
> |
strlcpy(client_p->host, hostname, sizeof(client_p->host)); |
| 724 |
|
|
| 725 |
< |
if (MyClient(target_p)) |
| 725 |
> |
if (MyConnect(client_p)) |
| 726 |
|
{ |
| 727 |
< |
sendto_one_numeric(target_p, &me, RPL_VISIBLEHOST, target_p->host); |
| 728 |
< |
clear_ban_cache_client(target_p); |
| 727 |
> |
sendto_one_numeric(client_p, &me, RPL_VISIBLEHOST, client_p->host); |
| 728 |
> |
clear_ban_cache_list(&client_p->channel); |
| 729 |
|
} |
| 730 |
|
|
| 731 |
< |
if (!ConfigGeneral.cycle_on_host_change) |
| 731 |
> |
if (ConfigGeneral.cycle_on_host_change == 0) |
| 732 |
|
return; |
| 733 |
|
|
| 734 |
< |
DLINK_FOREACH(node, target_p->channel.head) |
| 734 |
> |
DLINK_FOREACH(node, client_p->channel.head) |
| 735 |
|
{ |
| 736 |
< |
char modebuf[4], nickbuf[NICKLEN * 3 + 3] = ""; |
| 736 |
> |
char modebuf[CMEMBER_STATUS_FLAGS_LEN + 1]; |
| 737 |
> |
char nickbuf[CMEMBER_STATUS_FLAGS_LEN * NICKLEN + CMEMBER_STATUS_FLAGS_LEN] = ""; |
| 738 |
|
char *p = modebuf; |
| 739 |
|
int len = 0; |
| 740 |
|
const struct Membership *member = node->data; |
| 742 |
|
if (has_member_flags(member, CHFL_CHANOP)) |
| 743 |
|
{ |
| 744 |
|
*p++ = 'o'; |
| 745 |
< |
len += snprintf(nickbuf + len, sizeof(nickbuf) - len, len ? " %s" : "%s", target_p->name); |
| 745 |
> |
len += snprintf(nickbuf + len, sizeof(nickbuf) - len, len ? " %s" : "%s", client_p->name); |
| 746 |
|
} |
| 747 |
|
|
| 748 |
|
if (has_member_flags(member, CHFL_HALFOP)) |
| 749 |
|
{ |
| 750 |
|
*p++ = 'h'; |
| 751 |
< |
len += snprintf(nickbuf + len, sizeof(nickbuf) - len, len ? " %s" : "%s", target_p->name); |
| 751 |
> |
len += snprintf(nickbuf + len, sizeof(nickbuf) - len, len ? " %s" : "%s", client_p->name); |
| 752 |
|
} |
| 753 |
|
|
| 754 |
|
if (has_member_flags(member, CHFL_VOICE)) |
| 755 |
|
{ |
| 756 |
|
*p++ = 'v'; |
| 757 |
< |
len += snprintf(nickbuf + len, sizeof(nickbuf) - len, len ? " %s" : "%s", target_p->name); |
| 757 |
> |
len += snprintf(nickbuf + len, sizeof(nickbuf) - len, len ? " %s" : "%s", client_p->name); |
| 758 |
|
} |
| 759 |
|
|
| 760 |
|
*p = '\0'; |
| 761 |
|
|
| 762 |
< |
|
| 763 |
< |
sendto_channel_local_butone(target_p, CAP_EXTENDED_JOIN, 0, member->chptr, ":%s!%s@%s JOIN %s %s :%s", |
| 764 |
< |
target_p->name, target_p->username, |
| 765 |
< |
target_p->host, member->chptr->name, |
| 766 |
< |
(!IsDigit(target_p->account[0]) && target_p->account[0] != '*') ? target_p->account : "*", |
| 767 |
< |
target_p->info); |
| 768 |
< |
sendto_channel_local_butone(target_p, 0, CAP_EXTENDED_JOIN, member->chptr, ":%s!%s@%s JOIN :%s", |
| 823 |
< |
target_p->name, target_p->username, |
| 824 |
< |
target_p->host, member->chptr->name); |
| 762 |
> |
sendto_channel_local(client_p, member->chptr, 0, CAP_EXTENDED_JOIN, CAP_CHGHOST, ":%s!%s@%s JOIN %s %s :%s", |
| 763 |
> |
client_p->name, client_p->username, |
| 764 |
> |
client_p->host, member->chptr->name, |
| 765 |
> |
client_p->account, client_p->info); |
| 766 |
> |
sendto_channel_local(client_p, member->chptr, 0, 0, CAP_EXTENDED_JOIN | CAP_CHGHOST, ":%s!%s@%s JOIN :%s", |
| 767 |
> |
client_p->name, client_p->username, |
| 768 |
> |
client_p->host, member->chptr->name); |
| 769 |
|
|
| 770 |
|
if (nickbuf[0]) |
| 771 |
< |
sendto_channel_local_butone(target_p, 0, 0, member->chptr, ":%s MODE %s +%s %s", |
| 772 |
< |
target_p->servptr->name, member->chptr->name, |
| 773 |
< |
modebuf, nickbuf); |
| 830 |
< |
|
| 771 |
> |
sendto_channel_local(client_p, member->chptr, 0, 0, CAP_CHGHOST, ":%s MODE %s +%s %s", |
| 772 |
> |
client_p->servptr->name, member->chptr->name, |
| 773 |
> |
modebuf, nickbuf); |
| 774 |
|
} |
| 775 |
|
|
| 776 |
< |
if (target_p->away[0]) |
| 777 |
< |
sendto_common_channels_local(target_p, 0, CAP_AWAY_NOTIFY, |
| 776 |
> |
if (client_p->away[0]) |
| 777 |
> |
sendto_common_channels_local(client_p, 0, CAP_AWAY_NOTIFY, CAP_CHGHOST, |
| 778 |
|
":%s!%s@%s AWAY :%s", |
| 779 |
< |
target_p->name, target_p->username, |
| 780 |
< |
target_p->host, target_p->away); |
| 779 |
> |
client_p->name, client_p->username, |
| 780 |
> |
client_p->host, client_p->away); |
| 781 |
|
} |