54 |
static void user_welcome(struct Client *); |
static void user_welcome(struct Client *); |
55 |
static void report_and_set_user_flags(struct Client *, const struct AccessItem *); |
static void report_and_set_user_flags(struct Client *, const struct AccessItem *); |
56 |
static int check_xline(struct Client *); |
static int check_xline(struct Client *); |
|
static int check_regexp_xline(struct Client *); |
|
57 |
static void introduce_client(struct Client *, struct Client *); |
static void introduce_client(struct Client *, struct Client *); |
58 |
|
|
59 |
/* Used for building up the isupport string, |
/* Used for building up the isupport string, |
382 |
} |
} |
383 |
|
|
384 |
/* valid user name check */ |
/* valid user name check */ |
385 |
if (valid_username(source_p->username) == 0) |
if (!valid_username(source_p->username)) |
386 |
{ |
{ |
387 |
char tmpstr2[IRCD_BUFSIZE]; |
char tmpstr2[IRCD_BUFSIZE]; |
388 |
|
|
394 |
return; |
return; |
395 |
} |
} |
396 |
|
|
397 |
/* end of valid user name check */ |
if (check_xline(source_p)) |
|
if (check_xline(source_p) || check_regexp_xline(source_p)) |
|
398 |
return; |
return; |
399 |
|
|
400 |
if (me.id[0] != '\0') |
if (me.id[0] != '\0') |
410 |
|
|
411 |
irc_getnameinfo((struct sockaddr *)&source_p->localClient->ip, |
irc_getnameinfo((struct sockaddr *)&source_p->localClient->ip, |
412 |
source_p->localClient->ip.ss_len, ipaddr, |
source_p->localClient->ip.ss_len, ipaddr, |
413 |
HOSTIPLEN, NULL, 0, NI_NUMERICHOST); |
sizeof(ipaddr), NULL, 0, NI_NUMERICHOST); |
414 |
|
|
415 |
sendto_realops_flags(UMODE_CCONN, L_ALL, |
sendto_realops_flags(UMODE_CCONN, L_ALL, |
416 |
"Client connecting: %s (%s@%s) [%s] {%s} [%s]", |
"Client connecting: %s (%s@%s) [%s] {%s} [%s]", |
606 |
if ('.' == *p || ':' == *p) |
if ('.' == *p || ':' == *p) |
607 |
return 0; |
return 0; |
608 |
|
|
609 |
while (*p) |
for (; *p != '\0'; ++p) |
|
{ |
|
610 |
if (!IsHostChar(*p)) |
if (!IsHostChar(*p)) |
611 |
return 0; |
return 0; |
|
p++; |
|
|
} |
|
|
|
|
612 |
return 1; |
return 1; |
613 |
} |
} |
614 |
|
|
1082 |
static int |
static int |
1083 |
check_xline(struct Client *source_p) |
check_xline(struct Client *source_p) |
1084 |
{ |
{ |
1085 |
struct ConfItem *conf; |
struct ConfItem *conf = NULL; |
1086 |
struct MatchItem *xconf; |
const char *reason = NULL; |
|
const char *reason; |
|
1087 |
|
|
1088 |
if ((conf = find_matching_name_conf(XLINE_TYPE, source_p->info, |
if ((conf = find_matching_name_conf(XLINE_TYPE, source_p->info, NULL, NULL, 0)) || |
1089 |
NULL, NULL, 0)) != NULL) |
(conf = find_matching_name_conf(RXLINE_TYPE, source_p->info, NULL, NULL, 0))) |
1090 |
{ |
{ |
1091 |
xconf = &conf->conf.MatchItem; |
struct MatchItem *reg = &conf->conf.MatchItem; |
1092 |
xconf->count++; |
|
1093 |
|
++reg->count; |
1094 |
|
|
1095 |
if (xconf->reason != NULL) |
if (reg->reason != NULL) |
1096 |
reason = xconf->reason; |
reason = reg->reason; |
1097 |
else |
else |
1098 |
reason = "No Reason"; |
reason = "No Reason"; |
1099 |
|
|
1103 |
get_client_name(source_p, HIDE_IP), |
get_client_name(source_p, HIDE_IP), |
1104 |
source_p->sockhost); |
source_p->sockhost); |
1105 |
|
|
1106 |
++ServerStats.is_ref; |
++ServerStats.is_ref; |
1107 |
if (REJECT_HOLD_TIME > 0) |
if (REJECT_HOLD_TIME > 0) |
1108 |
{ |
{ |
1109 |
sendto_one(source_p, ":%s NOTICE %s :Bad user info", |
sendto_one(source_p, ":%s NOTICE %s :Bad user info", |
1116 |
return 1; |
return 1; |
1117 |
} |
} |
1118 |
|
|
|
return 0; |
|
|
} |
|
|
|
|
|
static int |
|
|
check_regexp_xline(struct Client *source_p) |
|
|
{ |
|
|
struct ConfItem *conf = NULL; |
|
|
const char *reason = NULL; |
|
|
|
|
|
if ((conf = find_matching_name_conf(RXLINE_TYPE, source_p->info, NULL, NULL, 0))) |
|
|
{ |
|
|
struct MatchItem *reg = &conf->conf.MatchItem; |
|
|
|
|
|
++reg->count; |
|
|
|
|
|
if (reg->reason != NULL) |
|
|
reason = reg->reason; |
|
|
else |
|
|
reason = "No Reason"; |
|
|
|
|
|
sendto_realops_flags(UMODE_REJ, L_ALL, |
|
|
"X-line (REGEX) Rejecting [%s] [%s], user %s [%s]", |
|
|
source_p->info, reason, |
|
|
get_client_name(source_p, HIDE_IP), |
|
|
source_p->sockhost); |
|
|
|
|
|
++ServerStats.is_ref; |
|
|
exit_client(source_p, &me, "Bad user info"); |
|
|
return 1; |
|
|
} |
|
|
|
|
1119 |
return 0; |
return 0; |
1120 |
} |
} |
1121 |
|
|