53 |
|
#include "watch.h" |
54 |
|
|
55 |
|
|
56 |
– |
struct Callback *entering_umode_cb = NULL; |
57 |
– |
struct Callback *umode_cb = NULL; |
58 |
– |
|
56 |
|
static char umode_buffer[IRCD_BUFSIZE]; |
57 |
|
|
58 |
|
static void user_welcome(struct Client *); |
77 |
|
MessageFile *isupportFile; |
78 |
|
|
79 |
|
/* memory is cheap. map 0-255 to equivalent mode */ |
80 |
< |
unsigned int user_modes[256] = |
80 |
> |
const unsigned int user_modes[256] = |
81 |
|
{ |
82 |
|
/* 0x00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x0F */ |
83 |
|
/* 0x10 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x1F */ |
89 |
|
UMODE_CCONN_FULL, /* C */ |
90 |
|
UMODE_DEAF, /* D */ |
91 |
|
0, /* E */ |
92 |
< |
0, /* F */ |
92 |
> |
UMODE_FARCONNECT, /* F */ |
93 |
|
UMODE_SOFTCALLERID, /* G */ |
94 |
|
UMODE_HIDDEN, /* H */ |
95 |
|
0, /* I */ |
210 |
|
sendto_one(source_p, form_str(RPL_LUSERME), |
211 |
|
from, to, Count.local, Count.myserver); |
212 |
|
sendto_one(source_p, form_str(RPL_LOCALUSERS), |
213 |
< |
from, to, Count.local, Count.max_loc, |
217 |
< |
Count.local, Count.max_loc); |
213 |
> |
from, to, Count.local, Count.max_loc); |
214 |
|
} |
215 |
|
else |
216 |
|
{ |
217 |
|
sendto_one(source_p, form_str(RPL_LUSERME), |
218 |
|
from, to, Count.total, 0); |
219 |
|
sendto_one(source_p, form_str(RPL_LOCALUSERS), |
220 |
< |
from, to, Count.total, Count.max_tot, |
225 |
< |
Count.total, Count.max_tot); |
220 |
> |
from, to, Count.total, Count.max_tot); |
221 |
|
} |
222 |
|
|
223 |
|
sendto_one(source_p, form_str(RPL_GLOBALUSERS), |
224 |
< |
from, to, Count.total, Count.max_tot, |
230 |
< |
Count.total, Count.max_tot); |
224 |
> |
from, to, Count.total, Count.max_tot); |
225 |
|
|
226 |
|
if (!ConfigServerHide.hide_servers || HasUMode(source_p, UMODE_OPER)) |
227 |
|
sendto_one(source_p, form_str(RPL_STATSCONN), from, to, |
390 |
|
} |
391 |
|
|
392 |
|
/* valid user name check */ |
393 |
< |
if (valid_username(source_p->username) == 0) |
393 |
> |
if (valid_username(source_p->username, 1) == 0) |
394 |
|
{ |
395 |
|
char tmpstr2[IRCD_BUFSIZE]; |
396 |
|
|
551 |
|
add_user_host(source_p->username, source_p->host, 1); |
552 |
|
SetUserHost(source_p); |
553 |
|
|
554 |
+ |
if (HasFlag(source_p->servptr, FLAGS_EOB)) |
555 |
+ |
sendto_realops_flags(UMODE_FARCONNECT, L_ALL, SEND_NOTICE, |
556 |
+ |
"Client connecting at %s: %s (%s@%s) [%s] <%s>", |
557 |
+ |
source_p->servptr->name, |
558 |
+ |
source_p->name, source_p->username, source_p->host, |
559 |
+ |
source_p->info, source_p->id); |
560 |
+ |
|
561 |
|
introduce_client(source_p); |
562 |
|
} |
563 |
|
|
674 |
|
* style of username |
675 |
|
*/ |
676 |
|
int |
677 |
< |
valid_username(const char *username) |
677 |
> |
valid_username(const char *username, const int local) |
678 |
|
{ |
679 |
|
int dots = 0; |
680 |
|
const char *p = username; |
684 |
|
if (*p == '~') |
685 |
|
++p; |
686 |
|
|
687 |
< |
/* reject usernames that don't start with an alphanum |
687 |
> |
/* |
688 |
> |
* Reject usernames that don't start with an alphanum |
689 |
|
* i.e. reject jokers who have '-@somehost' or '.@somehost' |
690 |
|
* or "-hi-@somehost", "h-----@somehost" would still be accepted. |
691 |
|
*/ |
692 |
|
if (!IsAlNum(*p)) |
693 |
|
return 0; |
694 |
|
|
695 |
< |
while (*++p) |
695 |
> |
if (local) |
696 |
|
{ |
697 |
< |
if ((*p == '.') && ConfigFileEntry.dots_in_ident) |
697 |
> |
while (*++p) |
698 |
|
{ |
699 |
< |
if (++dots > ConfigFileEntry.dots_in_ident) |
700 |
< |
return 0; |
701 |
< |
if (!IsUserChar(*(p + 1))) |
699 |
> |
if ((*p == '.') && ConfigFileEntry.dots_in_ident) |
700 |
> |
{ |
701 |
> |
if (++dots > ConfigFileEntry.dots_in_ident) |
702 |
> |
return 0; |
703 |
> |
if (!IsUserChar(*(p + 1))) |
704 |
> |
return 0; |
705 |
> |
} |
706 |
> |
else if (!IsUserChar(*p)) |
707 |
|
return 0; |
708 |
|
} |
709 |
< |
else if (!IsUserChar(*p)) |
710 |
< |
return 0; |
709 |
> |
} |
710 |
> |
else |
711 |
> |
{ |
712 |
> |
while (*++p) |
713 |
> |
if (!IsUserChar(*p)) |
714 |
> |
return 0; |
715 |
|
} |
716 |
|
|
717 |
< |
return 1; |
717 |
> |
return p - username <= USERLEN;; |
718 |
|
} |
719 |
|
|
720 |
|
/* clean_nick_name() |
755 |
|
{ |
756 |
|
/* If this user is being spoofed, tell them so */ |
757 |
|
if (IsConfDoSpoofIp(conf)) |
747 |
– |
{ |
758 |
|
sendto_one(source_p, |
759 |
< |
":%s NOTICE %s :*** Spoofing your IP. congrats.", |
759 |
> |
":%s NOTICE %s :*** Spoofing your IP. Congrats.", |
760 |
|
me.name, source_p->name); |
751 |
– |
} |
761 |
|
|
762 |
|
/* If this user is in the exception class, Set it "E lined" */ |
763 |
|
if (IsConfExemptKline(conf)) |
764 |
|
{ |
765 |
|
SetExemptKline(source_p); |
766 |
|
sendto_one(source_p, |
767 |
< |
":%s NOTICE %s :*** You are exempt from K/D/G lines. congrats.", |
767 |
> |
":%s NOTICE %s :*** You are exempt from K/D/G lines. Congrats.", |
768 |
|
me.name, source_p->name); |
769 |
|
} |
770 |
|
|
774 |
|
else if (IsConfExemptGline(conf)) |
775 |
|
{ |
776 |
|
SetExemptGline(source_p); |
777 |
< |
sendto_one(source_p, ":%s NOTICE %s :*** You are exempt from G lines.", |
777 |
> |
sendto_one(source_p, ":%s NOTICE %s :*** You are exempt from G lines. Congrats.", |
778 |
|
me.name, source_p->name); |
779 |
|
} |
780 |
|
|
781 |
|
if (IsConfExemptResv(conf)) |
782 |
|
{ |
783 |
|
SetExemptResv(source_p); |
784 |
< |
sendto_one(source_p, ":%s NOTICE %s :*** You are exempt from resvs.", |
784 |
> |
sendto_one(source_p, ":%s NOTICE %s :*** You are exempt from resvs. Congrats.", |
785 |
|
me.name, source_p->name); |
786 |
|
} |
787 |
|
|
790 |
|
{ |
791 |
|
SetExemptLimits(source_p); |
792 |
|
sendto_one(source_p, |
793 |
< |
":%s NOTICE %s :*** You are exempt from user limits. congrats.", |
793 |
> |
":%s NOTICE %s :*** You are exempt from user limits. Congrats.", |
794 |
|
me.name,source_p->name); |
795 |
|
} |
796 |
|
|
803 |
|
} |
804 |
|
} |
805 |
|
|
797 |
– |
/* change_simple_umode() |
798 |
– |
* |
799 |
– |
* this callback can be hooked to allow special handling of |
800 |
– |
* certain usermodes |
801 |
– |
*/ |
802 |
– |
static void * |
803 |
– |
change_simple_umode(va_list args) |
804 |
– |
{ |
805 |
– |
struct Client *client_p; |
806 |
– |
struct Client *source_p; |
807 |
– |
int what; |
808 |
– |
unsigned int flag; |
809 |
– |
|
810 |
– |
client_p = va_arg(args, struct Client *); |
811 |
– |
source_p = va_arg(args, struct Client *); |
812 |
– |
what = va_arg(args, int); |
813 |
– |
flag = va_arg(args, unsigned int); |
814 |
– |
|
815 |
– |
if (what == MODE_ADD) |
816 |
– |
AddUMode(source_p, flag); |
817 |
– |
else |
818 |
– |
DelUMode(source_p, flag); |
819 |
– |
|
820 |
– |
return NULL; |
821 |
– |
} |
822 |
– |
|
806 |
|
/* set_user_mode() |
807 |
|
* |
808 |
|
* added 15/10/91 By Darren Reed. |
812 |
|
*/ |
813 |
|
void |
814 |
|
set_user_mode(struct Client *client_p, struct Client *source_p, |
815 |
< |
int parc, char *parv[]) |
815 |
> |
const int parc, char *parv[]) |
816 |
|
{ |
817 |
|
unsigned int flag, setflags; |
818 |
|
char **p, *m, buf[IRCD_BUFSIZE]; |
851 |
|
return; |
852 |
|
} |
853 |
|
|
871 |
– |
execute_callback(entering_umode_cb, client_p, source_p); |
872 |
– |
|
854 |
|
/* find flags already set for user */ |
855 |
|
setflags = source_p->umodes; |
856 |
|
|
902 |
|
|
903 |
|
break; |
904 |
|
|
905 |
< |
/* we may not get these, |
925 |
< |
* but they shouldnt be in default |
926 |
< |
*/ |
927 |
< |
case 'r': |
928 |
< |
case ' ' : |
929 |
< |
case '\n': |
930 |
< |
case '\r': |
931 |
< |
case '\t': |
905 |
> |
case 'r': /* Only services may set +r */ |
906 |
|
break; |
907 |
|
|
908 |
|
default: |
910 |
|
{ |
911 |
|
if (MyConnect(source_p) && !HasUMode(source_p, UMODE_OPER) && |
912 |
|
(ConfigFileEntry.oper_only_umodes & flag)) |
939 |
– |
{ |
913 |
|
badflag = 1; |
941 |
– |
} |
914 |
|
else |
915 |
< |
execute_callback(umode_cb, client_p, source_p, what, flag); |
915 |
> |
{ |
916 |
> |
if (what == MODE_ADD) |
917 |
> |
AddUMode(source_p, flag); |
918 |
> |
else |
919 |
> |
DelUMode(source_p, flag); |
920 |
> |
} |
921 |
|
} |
922 |
|
else |
923 |
|
{ |
934 |
|
sendto_one(source_p, form_str(ERR_UMODEUNKNOWNFLAG), |
935 |
|
me.name, source_p->name); |
936 |
|
|
960 |
– |
if (HasUMode(source_p, UMODE_NCHANGE) && !HasOFlag(source_p, OPER_FLAG_N)) |
961 |
– |
{ |
962 |
– |
sendto_one(source_p, ":%s NOTICE %s :*** You have no nchange flag;", |
963 |
– |
me.name, source_p->name); |
964 |
– |
DelUMode(source_p, UMODE_NCHANGE); |
965 |
– |
} |
966 |
– |
|
937 |
|
if (MyConnect(source_p) && HasUMode(source_p, UMODE_ADMIN) && |
938 |
|
!HasOFlag(source_p, OPER_FLAG_ADMIN)) |
939 |
|
{ |
1139 |
|
struct MaskItem *conf = NULL; |
1140 |
|
const char *reason = NULL; |
1141 |
|
|
1142 |
< |
if ((conf = find_matching_name_conf(CONF_XLINE, source_p->info, NULL, NULL, 0)) || |
1173 |
< |
(conf = find_matching_name_conf(CONF_RXLINE, source_p->info, NULL, NULL, 0))) |
1142 |
> |
if ((conf = find_matching_name_conf(CONF_XLINE, source_p->info, NULL, NULL, 0))) |
1143 |
|
{ |
1144 |
|
++conf->count; |
1145 |
|
|
1198 |
|
|
1199 |
|
if (HasOFlag(source_p, OPER_FLAG_ADMIN)) |
1200 |
|
AddUMode(source_p, UMODE_ADMIN); |
1232 |
– |
if (!HasOFlag(source_p, OPER_FLAG_N)) |
1233 |
– |
DelUMode(source_p, UMODE_NCHANGE); |
1201 |
|
|
1202 |
|
sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE, "%s is now an operator", |
1203 |
|
get_oper_name(source_p)); |
1230 |
|
void |
1231 |
|
init_uid(void) |
1232 |
|
{ |
1233 |
< |
int i; |
1233 |
> |
unsigned int i; |
1234 |
|
|
1235 |
|
memset(new_uid, 0, sizeof(new_uid)); |
1236 |
|
|
1247 |
|
* -Dianora |
1248 |
|
*/ |
1249 |
|
memcpy(new_uid + IRC_MAXSID, "AAAAA@", IRC_MAXUID); |
1283 |
– |
|
1284 |
– |
entering_umode_cb = register_callback("entering_umode", NULL); |
1285 |
– |
umode_cb = register_callback("changing_umode", change_simple_umode); |
1250 |
|
} |
1251 |
|
|
1252 |
|
/* |