| 29 |
|
#include "channel.h" |
| 30 |
|
#include "channel_mode.h" |
| 31 |
|
#include "client.h" |
| 32 |
– |
#include "common.h" |
| 32 |
|
#include "fdlist.h" |
| 33 |
|
#include "hash.h" |
| 34 |
|
#include "irc_string.h" |
| 38 |
|
#include "listener.h" |
| 39 |
|
#include "motd.h" |
| 40 |
|
#include "numeric.h" |
| 41 |
< |
#include "s_conf.h" |
| 42 |
< |
#include "s_log.h" |
| 41 |
> |
#include "conf.h" |
| 42 |
> |
#include "log.h" |
| 43 |
|
#include "s_serv.h" |
| 44 |
|
#include "send.h" |
| 45 |
|
#include "supported.h" |
| 50 |
|
#include "userhost.h" |
| 51 |
|
#include "hook.h" |
| 52 |
|
#include "s_misc.h" |
| 53 |
< |
#include "msg.h" |
| 53 |
> |
#include "parse.h" |
| 54 |
|
#include "watch.h" |
| 55 |
|
|
| 56 |
|
|
| 95 |
|
0, /* E */ |
| 96 |
|
0, /* F */ |
| 97 |
|
UMODE_SOFTCALLERID, /* G */ |
| 98 |
< |
0, /* H */ |
| 98 |
> |
UMODE_HIDDEN, /* H */ |
| 99 |
|
0, /* I */ |
| 100 |
|
0, /* J */ |
| 101 |
|
0, /* K */ |
| 189 |
|
to = source_p->name; |
| 190 |
|
} |
| 191 |
|
|
| 192 |
< |
if (!ConfigServerHide.hide_servers || IsOper(source_p)) |
| 192 |
> |
if (!ConfigServerHide.hide_servers || HasUMode(source_p, UMODE_OPER)) |
| 193 |
|
sendto_one(source_p, form_str(RPL_LUSERCLIENT), |
| 194 |
|
from, to, (Count.total-Count.invisi), |
| 195 |
|
Count.invisi, dlink_list_length(&global_serv_list)); |
| 209 |
|
sendto_one(source_p, form_str(RPL_LUSERCHANNELS), |
| 210 |
|
from, to, dlink_list_length(&global_channel_list)); |
| 211 |
|
|
| 212 |
< |
if (!ConfigServerHide.hide_servers || IsOper(source_p)) |
| 212 |
> |
if (!ConfigServerHide.hide_servers || HasUMode(source_p, UMODE_OPER)) |
| 213 |
|
{ |
| 214 |
|
sendto_one(source_p, form_str(RPL_LUSERME), |
| 215 |
|
from, to, Count.local, Count.myserver); |
| 230 |
|
from, to, Count.total, Count.max_tot, |
| 231 |
|
Count.total, Count.max_tot); |
| 232 |
|
|
| 233 |
< |
if (!ConfigServerHide.hide_servers || IsOper(source_p)) |
| 233 |
> |
if (!ConfigServerHide.hide_servers || HasUMode(source_p, UMODE_OPER)) |
| 234 |
|
sendto_one(source_p, form_str(RPL_STATSCONN), from, to, |
| 235 |
|
Count.max_loc_con, Count.max_loc_cli, Count.totalrestartcount); |
| 236 |
|
|
| 444 |
|
|
| 445 |
|
if (ConfigFileEntry.invisible_on_connect) |
| 446 |
|
{ |
| 447 |
< |
source_p->umodes |= UMODE_INVISIBLE; |
| 447 |
> |
AddUMode(source_p, UMODE_INVISIBLE); |
| 448 |
|
++Count.invisi; |
| 449 |
|
} |
| 450 |
|
|
| 521 |
|
source_p->host, source_p->from->name); |
| 522 |
|
kill_client(source_p->from, source_p, "%s (Server doesn't exist)", me.name); |
| 523 |
|
|
| 524 |
< |
SetKilled(source_p); |
| 524 |
> |
AddFlag(source_p, FLAGS_KILLED); |
| 525 |
|
exit_client(source_p, &me, "Ghosted Client"); |
| 526 |
|
return; |
| 527 |
|
} |
| 536 |
|
kill_client(source_p->from, source_p, |
| 537 |
|
"%s (NICK from wrong direction (%s != %s))", |
| 538 |
|
me.name, source_p->servptr->name, target_p->from->name); |
| 539 |
< |
SetKilled(source_p); |
| 539 |
> |
AddFlag(source_p, FLAGS_KILLED); |
| 540 |
|
exit_client(source_p, &me, "USER server wrong direction"); |
| 541 |
|
return; |
| 542 |
|
} |
| 545 |
|
* If the nick has been introduced by a services server, |
| 546 |
|
* make it a service as well. |
| 547 |
|
*/ |
| 548 |
< |
if (IsService(source_p->servptr)) |
| 549 |
< |
SetService(source_p); |
| 548 |
> |
if (HasFlag(source_p->servptr, FLAGS_SERVICE)) |
| 549 |
> |
AddFlag(source_p, FLAGS_SERVICE); |
| 550 |
|
|
| 551 |
|
/* Increment our total user count here */ |
| 552 |
|
if (++Count.total > Count.max_tot) |
| 597 |
|
if (IsCapable(server, CAP_SVS)) |
| 598 |
|
{ |
| 599 |
|
if (IsCapable(server, CAP_TS6) && HasID(source_p)) |
| 600 |
< |
sendto_one(server, ":%s UID %s %d %lu %s %s %s %s %s %lu :%s", |
| 600 |
> |
sendto_one(server, ":%s UID %s %d %lu %s %s %s %s %s %s :%s", |
| 601 |
|
source_p->servptr->id, |
| 602 |
|
source_p->name, source_p->hopcount+1, |
| 603 |
|
(unsigned long)source_p->tsinfo, |
| 604 |
|
ubuf, source_p->username, source_p->host, |
| 605 |
|
(MyClient(source_p) && IsIPSpoof(source_p)) ? |
| 606 |
|
"0" : source_p->sockhost, source_p->id, |
| 607 |
< |
(unsigned long)source_p->servicestamp, |
| 607 |
> |
source_p->svid, |
| 608 |
|
source_p->info); |
| 609 |
|
else |
| 610 |
< |
sendto_one(server, "NICK %s %d %lu %s %s %s %s %lu :%s", |
| 610 |
> |
sendto_one(server, "NICK %s %d %lu %s %s %s %s %s :%s", |
| 611 |
|
source_p->name, source_p->hopcount+1, |
| 612 |
|
(unsigned long)source_p->tsinfo, |
| 613 |
|
ubuf, source_p->username, source_p->host, |
| 614 |
< |
source_p->servptr->name, (unsigned long)source_p->servicestamp, |
| 614 |
> |
source_p->servptr->name, source_p->svid, |
| 615 |
|
source_p->info); |
| 616 |
|
|
| 617 |
|
} |
| 728 |
|
if (!IsNickChar(*p)) |
| 729 |
|
return 0; |
| 730 |
|
|
| 731 |
< |
return p - nickname <= (NICKLEN - 1); |
| 731 |
> |
return p - nickname <= NICKLEN; |
| 732 |
|
} |
| 733 |
|
|
| 734 |
|
/* report_and_set_user_flags() |
| 813 |
|
flag = va_arg(args, unsigned int); |
| 814 |
|
|
| 815 |
|
if (what == MODE_ADD) |
| 816 |
< |
source_p->umodes |= flag; |
| 816 |
> |
AddUMode(source_p, flag); |
| 817 |
|
else |
| 818 |
< |
source_p->umodes &= ~flag; |
| 818 |
> |
DelUMode(source_p, flag); |
| 819 |
|
|
| 820 |
|
return NULL; |
| 821 |
|
} |
| 866 |
|
*m++ = '+'; |
| 867 |
|
|
| 868 |
|
for (i = 0; i < 128; i++) |
| 869 |
< |
if (source_p->umodes & user_modes[i]) |
| 869 |
> |
if (HasUMode(source_p, user_modes[i])) |
| 870 |
|
*m++ = (char)i; |
| 871 |
|
*m = '\0'; |
| 872 |
|
|
| 896 |
|
case 'o': |
| 897 |
|
if (what == MODE_ADD) |
| 898 |
|
{ |
| 899 |
< |
if (IsServer(client_p) && !IsOper(source_p)) |
| 899 |
> |
if (IsServer(client_p) && !HasUMode(source_p, UMODE_OPER)) |
| 900 |
|
{ |
| 901 |
|
++Count.oper; |
| 902 |
|
SetOper(source_p); |
| 907 |
|
/* Only decrement the oper counts if an oper to begin with |
| 908 |
|
* found by Pat Szuta, Perly , perly@xnet.com |
| 909 |
|
*/ |
| 910 |
< |
if (!IsOper(source_p)) |
| 910 |
> |
if (!HasUMode(source_p, UMODE_OPER)) |
| 911 |
|
break; |
| 912 |
|
|
| 913 |
|
ClearOper(source_p); |
| 918 |
|
dlink_node *dm; |
| 919 |
|
|
| 920 |
|
detach_conf(source_p, OPER_TYPE); |
| 921 |
< |
ClearOperFlags(source_p); |
| 922 |
< |
source_p->umodes &= ~ConfigFileEntry.oper_only_umodes; |
| 921 |
> |
ClrOFlag(source_p); |
| 922 |
> |
DelUMode(source_p, ConfigFileEntry.oper_only_umodes); |
| 923 |
|
|
| 924 |
|
if ((dm = dlinkFindDelete(&oper_list, source_p)) != NULL) |
| 925 |
|
free_dlink_node(dm); |
| 941 |
|
default: |
| 942 |
|
if ((flag = user_modes[(unsigned char)*m])) |
| 943 |
|
{ |
| 944 |
< |
if (MyConnect(source_p) && !IsOper(source_p) && |
| 944 |
> |
if (MyConnect(source_p) && !HasUMode(source_p, UMODE_OPER) && |
| 945 |
|
(ConfigFileEntry.oper_only_umodes & flag)) |
| 946 |
|
{ |
| 947 |
|
badflag = 1; |
| 964 |
|
sendto_one(source_p, form_str(ERR_UMODEUNKNOWNFLAG), |
| 965 |
|
me.name, source_p->name); |
| 966 |
|
|
| 967 |
< |
if (HasUMode(source_p, UMODE_NCHANGE) && !IsOperN(source_p)) |
| 967 |
> |
if (HasUMode(source_p, UMODE_NCHANGE) && !HasOFlag(source_p, OPER_FLAG_N)) |
| 968 |
|
{ |
| 969 |
< |
sendto_one(source_p, ":%s NOTICE %s :*** You have no admin flag;", |
| 969 |
> |
sendto_one(source_p, ":%s NOTICE %s :*** You have no nchange flag;", |
| 970 |
|
me.name, source_p->name); |
| 971 |
< |
DelUMode(source_p, UMODE_NCHANGE); /* only tcm's really need this */ |
| 971 |
> |
DelUMode(source_p, UMODE_NCHANGE); |
| 972 |
|
} |
| 973 |
|
|
| 974 |
< |
if (MyConnect(source_p) && (source_p->umodes & UMODE_ADMIN) && |
| 975 |
< |
!IsOperAdmin(source_p) && !IsOperHiddenAdmin(source_p)) |
| 974 |
> |
if (MyConnect(source_p) && HasUMode(source_p, UMODE_ADMIN) && |
| 975 |
> |
!HasOFlag(source_p, OPER_FLAG_ADMIN)) |
| 976 |
|
{ |
| 977 |
|
sendto_one(source_p, ":%s NOTICE %s :*** You have no admin flag;", |
| 978 |
|
me.name, source_p->name); |
| 979 |
< |
source_p->umodes &= ~UMODE_ADMIN; |
| 979 |
> |
DelUMode(source_p, UMODE_ADMIN); |
| 980 |
|
} |
| 981 |
|
|
| 982 |
< |
if (!(setflags & UMODE_INVISIBLE) && IsInvisible(source_p)) |
| 982 |
> |
if (!(setflags & UMODE_INVISIBLE) && HasUMode(source_p, UMODE_INVISIBLE)) |
| 983 |
|
++Count.invisi; |
| 984 |
< |
if ((setflags & UMODE_INVISIBLE) && !IsInvisible(source_p)) |
| 984 |
> |
if ((setflags & UMODE_INVISIBLE) && !HasUMode(source_p, UMODE_INVISIBLE)) |
| 985 |
|
--Count.invisi; |
| 986 |
|
|
| 987 |
|
/* |
| 1024 |
|
if (MyClient(source_p) && !(flag & sendmask)) |
| 1025 |
|
continue; |
| 1026 |
|
|
| 1027 |
< |
if ((flag & old) && !(source_p->umodes & flag)) |
| 1027 |
> |
if ((flag & old) && !HasUMode(source_p, flag)) |
| 1028 |
|
{ |
| 1029 |
|
if (what == MODE_DEL) |
| 1030 |
|
*m++ = (char)i; |
| 1035 |
|
*m++ = (char)i; |
| 1036 |
|
} |
| 1037 |
|
} |
| 1038 |
< |
else if (!(flag & old) && (source_p->umodes & flag)) |
| 1038 |
> |
else if (!(flag & old) && HasUMode(source_p, flag)) |
| 1039 |
|
{ |
| 1040 |
|
if (what == MODE_ADD) |
| 1041 |
|
*m++ = (char)i; |
| 1069 |
|
char buf[IRCD_BUFSIZE] = { '\0' }; |
| 1070 |
|
dlink_node *ptr = NULL; |
| 1071 |
|
|
| 1072 |
< |
send_umode(NULL, source_p, old, IsOperHiddenAdmin(source_p) ? |
| 1074 |
< |
SEND_UMODES & ~UMODE_ADMIN : SEND_UMODES, buf); |
| 1072 |
> |
send_umode(NULL, source_p, old, SEND_UMODES, buf); |
| 1073 |
|
|
| 1074 |
|
if (buf[0]) |
| 1075 |
|
{ |
| 1176 |
|
source_p->sockhost); |
| 1177 |
|
|
| 1178 |
|
++ServerStats.is_ref; |
| 1179 |
< |
if (REJECT_HOLD_TIME > 0) |
| 1182 |
< |
{ |
| 1183 |
< |
sendto_one(source_p, ":%s NOTICE %s :Bad user info", |
| 1184 |
< |
me.name, source_p->name); |
| 1185 |
< |
source_p->localClient->reject_delay = CurrentTime + REJECT_HOLD_TIME; |
| 1186 |
< |
SetCaptured(source_p); |
| 1187 |
< |
} |
| 1188 |
< |
else |
| 1189 |
< |
exit_client(source_p, &me, "Bad user info"); |
| 1179 |
> |
exit_client(source_p, &me, "Bad user info"); |
| 1180 |
|
return 1; |
| 1181 |
|
} |
| 1182 |
|
|
| 1194 |
|
void |
| 1195 |
|
oper_up(struct Client *source_p) |
| 1196 |
|
{ |
| 1197 |
< |
unsigned int old = source_p->umodes; |
| 1208 |
< |
const char *operprivs = ""; |
| 1197 |
> |
const unsigned int old = source_p->umodes; |
| 1198 |
|
const struct AccessItem *oconf = NULL; |
| 1199 |
|
|
| 1200 |
|
assert(source_p->localClient->confs.head); |
| 1204 |
|
SetOper(source_p); |
| 1205 |
|
|
| 1206 |
|
if (oconf->modes) |
| 1207 |
< |
source_p->umodes |= oconf->modes; |
| 1207 |
> |
AddUMode(source_p, oconf->modes); |
| 1208 |
|
else if (ConfigFileEntry.oper_umodes) |
| 1209 |
< |
source_p->umodes |= ConfigFileEntry.oper_umodes; |
| 1221 |
< |
else |
| 1222 |
< |
source_p->umodes |= (UMODE_SERVNOTICE|UMODE_OPERWALL| |
| 1223 |
< |
UMODE_WALLOP|UMODE_LOCOPS); |
| 1209 |
> |
AddUMode(source_p, ConfigFileEntry.oper_umodes); |
| 1210 |
|
|
| 1211 |
< |
if (!(old & UMODE_INVISIBLE) && IsInvisible(source_p)) |
| 1211 |
> |
if (!(old & UMODE_INVISIBLE) && HasUMode(source_p, UMODE_INVISIBLE)) |
| 1212 |
|
++Count.invisi; |
| 1213 |
< |
if ((old & UMODE_INVISIBLE) && !IsInvisible(source_p)) |
| 1213 |
> |
if ((old & UMODE_INVISIBLE) && !HasUMode(source_p, UMODE_INVISIBLE)) |
| 1214 |
|
--Count.invisi; |
| 1215 |
|
|
| 1216 |
|
assert(dlinkFind(&oper_list, source_p) == NULL); |
| 1217 |
|
dlinkAdd(source_p, make_dlink_node(), &oper_list); |
| 1218 |
|
|
| 1219 |
< |
operprivs = oper_privs_as_string(oconf->port); |
| 1234 |
< |
|
| 1235 |
< |
SetOFlag(source_p, oconf->port); |
| 1219 |
> |
AddOFlag(source_p, oconf->port); |
| 1220 |
|
|
| 1221 |
< |
if (IsOperAdmin(source_p) || IsOperHiddenAdmin(source_p)) |
| 1221 |
> |
if (HasOFlag(source_p, OPER_FLAG_ADMIN)) |
| 1222 |
|
AddUMode(source_p, UMODE_ADMIN); |
| 1223 |
< |
if (!IsOperN(source_p)) |
| 1223 |
> |
if (!HasOFlag(source_p, OPER_FLAG_N)) |
| 1224 |
|
DelUMode(source_p, UMODE_NCHANGE); |
| 1225 |
|
|
| 1226 |
< |
sendto_realops_flags(UMODE_ALL, L_ALL, "%s (%s@%s) is now an operator", |
| 1227 |
< |
source_p->name, source_p->username, source_p->host); |
| 1226 |
> |
sendto_realops_flags(UMODE_ALL, L_ALL, "%s is now an operator", |
| 1227 |
> |
get_oper_name(source_p)); |
| 1228 |
|
send_umode_out(source_p, source_p, old); |
| 1229 |
|
sendto_one(source_p, form_str(RPL_YOUREOPER), me.name, source_p->name); |
| 1246 |
– |
sendto_one(source_p, ":%s NOTICE %s :*** Oper privs are %s", |
| 1247 |
– |
me.name, source_p->name, operprivs); |
| 1248 |
– |
send_message_file(source_p, &ConfigFileEntry.opermotd); |
| 1230 |
|
} |
| 1231 |
|
|
| 1232 |
|
static char new_uid[TOTALSIDUID + 1]; /* allow for \0 */ |
| 1340 |
|
add_isupport("DEAF", "D", -1); |
| 1341 |
|
add_isupport("KICKLEN", NULL, KICKLEN); |
| 1342 |
|
add_isupport("MODES", NULL, MAXMODEPARAMS); |
| 1343 |
< |
add_isupport("NICKLEN", NULL, NICKLEN-1); |
| 1343 |
> |
add_isupport("NICKLEN", NULL, NICKLEN); |
| 1344 |
|
#ifdef HALFOPS |
| 1345 |
|
add_isupport("PREFIX", "(ohv)@%+", -1); |
| 1346 |
|
add_isupport("STATUSMSG", "@%+", -1); |