mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-09 20:53:12 +02:00
Stupid SAMODE bug fixed.
This commit is contained in:
@@ -429,3 +429,18 @@ permanent gline, which is essentially what an akill
|
||||
is anyway (yes, I know they disappear when you rehash)
|
||||
--Luke
|
||||
===================================
|
||||
|
||||
Rewrote m_oper, massive mods to most set* and chg* functions
|
||||
--Luke
|
||||
===================================
|
||||
|
||||
Reintroduced original patch in channel.c with mode overflow
|
||||
(saves char * for each function call)
|
||||
-- Luke
|
||||
===================================
|
||||
|
||||
Fixed a seriously stupid bug introduced by myself with SAMODE
|
||||
globops. (Thanks to Zerwas)
|
||||
--Luke
|
||||
===================================
|
||||
|
||||
|
||||
+1
-1
@@ -330,7 +330,7 @@ extern char *find_by_aln PROTO((char *));
|
||||
extern char *convert2aln PROTO((int));
|
||||
extern int convertfromaln PROTO((char *));
|
||||
extern char *find_server_aln PROTO((char *));
|
||||
extern atime(char *xtime);
|
||||
extern time_t atime(char *xtime);
|
||||
|
||||
|
||||
extern int dopacket PROTO((aClient *, char *, int));
|
||||
|
||||
+5
-2
@@ -353,6 +353,8 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */
|
||||
#define SetHelpOp(x) ((x)->umodes |= UMODE_HELPOP)
|
||||
#define SetOper(x) ((x)->umodes |= UMODE_OPER)
|
||||
#define SetLocOp(x) ((x)->umodes |= UMODE_LOCOP)
|
||||
#define SetWhois(x) ((x)->umodes |= UMODE_WHOIS)
|
||||
#define SetHide(x) ((x)->umodes |= UMODE_HIDE)
|
||||
#define SetAdmin(x) ((x)->umodes |= UMODE_ADMIN)
|
||||
#define SetSAdmin(x) ((x)->umodes |= UMODE_SADMIN)
|
||||
#define SetNetAdmin(x) ((x)->umodes |= UMODE_NETADMIN)
|
||||
@@ -466,8 +468,8 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */
|
||||
#ifdef ENABLE_INVISOPER
|
||||
#define OFLAG_INVISIBLE 0x80000000
|
||||
#endif
|
||||
#define OFLAG_LOCAL (OFLAG_REHASH|OFLAG_HELPOP|OFLAG_GLOBOP|OFLAG_WALLOP|OFLAG_LOCOP|OFLAG_LROUTE|OFLAG_LKILL|OFLAG_KLINE|OFLAG_UNKLINE|OFLAG_LNOTICE|OFLAG_UMODEC|OFLAG_UMODEF)
|
||||
#define OFLAG_GLOBAL (OFLAG_LOCAL|OFLAG_GROUTE|OFLAG_GKILL|OFLAG_GNOTICE)
|
||||
#define OFLAG_LOCAL (OFLAG_REHASH|OFLAG_HELPOP|OFLAG_LOCOP|OFLAG_LROUTE|OFLAG_LKILL|OFLAG_KLINE|OFLAG_UNKLINE|OFLAG_LNOTICE|OFLAG_UMODEC|OFLAG_ZLINE|OFLAG_HIDE)
|
||||
#define OFLAG_GLOBAL (OFLAG_LOCAL|OFLAG_GLOBOP|OFLAG_WALLOP|OFLAG_UMODEF|OFLAG_GROUTE|OFLAG_GKILL|OFLAG_GNOTICE|OFLAG_HIDE)
|
||||
#define OFLAG_ISGLOBAL (OFLAG_GROUTE|OFLAG_GKILL|OFLAG_GNOTICE)
|
||||
|
||||
|
||||
@@ -490,6 +492,7 @@ typedef unsigned int u_int32_t; /* XXX Hope this works! */
|
||||
#define OPIsAdmin(x) ((x)->oflag & OFLAG_ADMIN)
|
||||
#define OPIsSAdmin(x) ((x)->oflag & OFLAG_SADMIN)
|
||||
#define OPIsNetAdmin(x) ((x)->oflag & OFLAG_NETADMIN)
|
||||
#define OPIsGlobal(x) ((x)->oflag & OFLAG_ISGLOBAL)
|
||||
#define OPIsCoAdmin(x) ((x)->oflag & OFLAG_COADMIN)
|
||||
#define OPCanUModeC(x) ((x)->oflag & OFLAG_UMODEC)
|
||||
#define OPCanUModeF(x) ((x)->oflag & OFLAG_UMODEF)
|
||||
|
||||
+19
-21
@@ -1318,7 +1318,7 @@ void do_mode(chptr, cptr, sptr, parc, parv, sendts, samode)
|
||||
sptr->user->username, sptr->user->realhost, chptr->chname,
|
||||
mode_buf, parabuf);
|
||||
sendto_failops_whoare_opers
|
||||
("from %s: %s (%s@%s) used SAMODE %s %s %s", sptr->name,
|
||||
("from %s: %s (%s@%s) used SAMODE %s %s %s", me.name, sptr->name,
|
||||
sptr->user->username, sptr->user->realhost, chptr->chname,
|
||||
mode_buf, parabuf);
|
||||
sptr = &me;
|
||||
@@ -2080,7 +2080,6 @@ void set_mode(chptr, cptr, parc, parv, pcount, pvar, bounce)
|
||||
char *curchr;
|
||||
u_int what = MODE_ADD;
|
||||
long modetype = 0;
|
||||
char *param = NULL;
|
||||
int paracount = 1;
|
||||
#ifdef DEVELOP
|
||||
char *tmpo = NULL;
|
||||
@@ -2120,7 +2119,6 @@ void set_mode(chptr, cptr, parc, parv, pcount, pvar, bounce)
|
||||
/* compatiblity */
|
||||
*curchr = 'V';
|
||||
}
|
||||
jumpdammit:
|
||||
default:
|
||||
found = 0;
|
||||
tab = &cFlagTab[0];
|
||||
@@ -2149,18 +2147,14 @@ void set_mode(chptr, cptr, parc, parv, pcount, pvar, bounce)
|
||||
break;
|
||||
}
|
||||
/* We can afford to send off a param */
|
||||
if (parc - paracount >= 1)
|
||||
{
|
||||
param = parv[paracount];
|
||||
}
|
||||
else
|
||||
param = NULL;
|
||||
|
||||
if (param && ((strlen(param) >= MODEBUFLEN)))
|
||||
param[MODEBUFLEN - 1] = '\0';
|
||||
if (parc - paracount < 1)
|
||||
parv[paracount] = NULL;
|
||||
if (parv[paracount] &&
|
||||
strlen(parv[paracount]) >= MODEBUFLEN)
|
||||
parv[paracount][MODEBUFLEN-1] = '\0';
|
||||
paracount +=
|
||||
do_mode_char(chptr, modetype, *curchr,
|
||||
param, what, cptr, pcount, pvar,
|
||||
parv[paracount], what, cptr, pcount, pvar,
|
||||
bounce);
|
||||
break;
|
||||
}
|
||||
@@ -2191,6 +2185,8 @@ int sendmodeto_one(cptr, from, name, mode, param, creationtime)
|
||||
else
|
||||
sendto_one(cptr, ":%s %s %s %s %s", from,
|
||||
(IsToken(cptr) ? TOK_MODE : MSG_MODE), name, mode, param);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *pretty_mask(mask)
|
||||
@@ -2626,7 +2622,7 @@ int channel_link(cptr, sptr, parc, parv)
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** Cannot join %s: bounced through too many links.",
|
||||
me.name, sptr->name, parv[1]);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
for (i = 0, name = strtoken(&p, parv[1], ","); name;
|
||||
name = strtoken(&p, NULL, ","))
|
||||
@@ -2726,7 +2722,7 @@ int channel_link(cptr, sptr, parc, parv)
|
||||
|
||||
i1 = 0;
|
||||
if (chptr == NULL)
|
||||
return;
|
||||
return 0;
|
||||
|
||||
if (!chptr ||
|
||||
(MyConnect(sptr)
|
||||
@@ -3396,27 +3392,27 @@ int m_kick(cptr, sptr, parc, parv)
|
||||
|
||||
/* Overriding channel mode +Q */
|
||||
if ((chptr->mode.mode & MODE_NOKICKS) &&
|
||||
(IsOper(sptr) && !IsServices(who) || IsNetAdmin(sptr)))
|
||||
((IsOper(sptr) && !IsServices(who)) || IsNetAdmin(sptr)))
|
||||
goto override;
|
||||
|
||||
/* sptr isn't a channel operator or a halfop, automatically means override */
|
||||
if ((!is_chan_op(sptr,chptr) && !is_halfop(sptr,chptr)) &&
|
||||
(IsOper(sptr) && !IsServices(who) || IsNetAdmin(sptr)))
|
||||
((IsOper(sptr) && !IsServices(who)) || IsNetAdmin(sptr)))
|
||||
goto override;
|
||||
|
||||
/* Half op oper kicking a channel operator */
|
||||
if (is_chan_op(who,chptr) && !is_chan_op(sptr,chptr) && is_halfop(sptr,chptr) &&
|
||||
(!IsServices(who) && IsOper(sptr) || IsNetAdmin(sptr)))
|
||||
((!IsServices(who) && IsOper(sptr)) || IsNetAdmin(sptr)))
|
||||
goto override;
|
||||
|
||||
/* Oper taking out a protected user */
|
||||
if (is_chanprot(who,chptr) && !is_chanowner(sptr,chptr) &&
|
||||
(!IsServices(who) && IsOper(sptr) || IsNetAdmin(sptr)))
|
||||
((!IsServices(who) && IsOper(sptr)) || IsNetAdmin(sptr)))
|
||||
goto override;
|
||||
|
||||
/* Oper taking out channel owner */
|
||||
if (is_chanowner(who,chptr) &&
|
||||
(!IsServices(who) && IsOper(sptr) || IsNetAdmin(sptr)))
|
||||
((!IsServices(who) && IsOper(sptr)) || IsNetAdmin(sptr)))
|
||||
goto override;
|
||||
#endif
|
||||
|
||||
@@ -3629,7 +3625,7 @@ int m_topic(cptr, sptr, parc, parv)
|
||||
}
|
||||
else if (((chptr->mode.mode & MODE_TOPICLIMIT) == 0 ||
|
||||
is_chan_op(sptr, chptr)) || IsOper(sptr)
|
||||
|| IsULine(sptr) || is_halfop(sptr, chptr) && topic)
|
||||
|| IsULine(sptr) || (is_halfop(sptr, chptr) && topic))
|
||||
{
|
||||
/* setting a topic */
|
||||
if (IsOper(sptr) && !(is_halfop(sptr, chptr)
|
||||
@@ -4001,6 +3997,8 @@ int check_for_chan_flood(cptr, sptr, chptr)
|
||||
remove_user_from_channel(sptr, chptr);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Originally from bahamut, modified a bit for Unreal by codemastr
|
||||
|
||||
+1
-1
@@ -92,7 +92,7 @@ static int openconf()
|
||||
return open(configfile, O_RDONLY);
|
||||
}
|
||||
|
||||
#define STAR1 OFLAG_SADMIN|OFLAG_ADMIN|OFLAG_NETADMIN|OFLAG_COADMIN
|
||||
#define STAR1 OFLAG_SADMIN|OFLAG_ADMIN|OFLAG_NETADMIN
|
||||
#define STAR2 OFLAG_ZLINE|OFLAG_HIDE|OFLAG_WHOIS
|
||||
static int oper_access[] = {
|
||||
~(STAR1 | STAR2), '*',
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "common.h"
|
||||
#include "sys.h"
|
||||
#include "h.h"
|
||||
#include <string.h>
|
||||
|
||||
char *collapse PROTO((char *pattern));
|
||||
extern aClient *client, *local[];
|
||||
@@ -379,12 +380,16 @@ char *crule_parse(rule)
|
||||
if ((errcode = crule_parseorexpr(&ruleroot, &next_tok,
|
||||
&ruleptr)) == CR_NOERR)
|
||||
if (ruleroot != NULL)
|
||||
{
|
||||
if (next_tok == CR_END)
|
||||
return ((char *)ruleroot);
|
||||
else
|
||||
errcode = CR_UNEXPCTTOK;
|
||||
}
|
||||
else
|
||||
{
|
||||
errcode = CR_EXPCTOR;
|
||||
}
|
||||
if (ruleroot != NULL)
|
||||
crule_free((char **)&ruleroot);
|
||||
#if !defined(CR_DEBUG) && !defined(CR_CHKCONF)
|
||||
|
||||
+1
-2
@@ -316,8 +316,7 @@ int load_conf2(FILE * conf, char *filename, int type)
|
||||
"[fatal error] STOP code in %s\n",
|
||||
filename);
|
||||
fprintf(stderr,
|
||||
"*** READ/EDIT YOUR CONFIGURATION FILES! ***",
|
||||
filename);
|
||||
"*** READ/EDIT YOUR CONFIGURATION FILES! ***");
|
||||
#endif
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "h.h"
|
||||
#include "config.h"
|
||||
#include "fdlist.h"
|
||||
#include <string.h>
|
||||
|
||||
void addto_fdlist(int fd, fdlist * listp)
|
||||
{
|
||||
|
||||
+16
-11
@@ -81,6 +81,9 @@ int un_gid = 99;
|
||||
extern char unreallogo[];
|
||||
#endif
|
||||
|
||||
#ifndef NO_FDLIST
|
||||
extern void flush_fdlist_connections(fdlist * listp);
|
||||
#endif
|
||||
LoopStruct loop;
|
||||
extern aMotd *opermotd;
|
||||
extern aMotd *svsmotd;
|
||||
@@ -132,15 +135,15 @@ void save_stats(void)
|
||||
FILE *stats = fopen("ircd.stats", "w");
|
||||
if (!stats)
|
||||
return;
|
||||
fprintf(stats, "%li\n", IRCstats.clients);
|
||||
fprintf(stats, "%li\n", IRCstats.invisible);
|
||||
fprintf(stats, "%li\n", IRCstats.servers);
|
||||
fprintf(stats, "%li\n", IRCstats.operators);
|
||||
fprintf(stats, "%li\n", IRCstats.unknown);
|
||||
fprintf(stats, "%li\n", IRCstats.me_clients);
|
||||
fprintf(stats, "%li\n", IRCstats.me_servers);
|
||||
fprintf(stats, "%li\n", IRCstats.me_max);
|
||||
fprintf(stats, "%li\n", IRCstats.global_max);
|
||||
fprintf(stats, "%i\n", IRCstats.clients);
|
||||
fprintf(stats, "%i\n", IRCstats.invisible);
|
||||
fprintf(stats, "%i\n", IRCstats.servers);
|
||||
fprintf(stats, "%i\n", IRCstats.operators);
|
||||
fprintf(stats, "%i\n", IRCstats.unknown);
|
||||
fprintf(stats, "%i\n", IRCstats.me_clients);
|
||||
fprintf(stats, "%i\n", IRCstats.me_servers);
|
||||
fprintf(stats, "%i\n", IRCstats.me_max);
|
||||
fprintf(stats, "%i\n", IRCstats.global_max);
|
||||
fclose(stats);
|
||||
}
|
||||
|
||||
@@ -409,7 +412,8 @@ static TS try_connections(currenttime)
|
||||
int connecting, confrq;
|
||||
TS next = 0;
|
||||
aClass *cltmp;
|
||||
aConfItem *cconf, *con_conf;
|
||||
aConfItem *cconf;
|
||||
aConfItem *con_conf = NULL;
|
||||
int con_class = 0;
|
||||
|
||||
connecting = FALSE;
|
||||
@@ -736,7 +740,6 @@ int InitwIRCD(argc, argv)
|
||||
uid_t uid, euid;
|
||||
TS delay = 0;
|
||||
#endif
|
||||
int i;
|
||||
int portarg = 0;
|
||||
#ifdef FORCE_CORE
|
||||
struct rlimit corelim;
|
||||
@@ -808,7 +811,9 @@ int InitwIRCD(argc, argv)
|
||||
argc -= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
p = "";
|
||||
}
|
||||
|
||||
switch (flag)
|
||||
{
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@
|
||||
*/
|
||||
#include "ircsprintf.h"
|
||||
#include <stdio.h>
|
||||
|
||||
extern char *xbase64enc(long i);
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
|
||||
|
||||
@@ -41,12 +41,14 @@
|
||||
#include "sys.h"
|
||||
#include "h.h"
|
||||
#include "numeric.h"
|
||||
#include <string.h>
|
||||
#ifdef DBMALLOC
|
||||
#include "malloc.h"
|
||||
#endif
|
||||
void free_link PROTO((Link *));
|
||||
Link *make_link PROTO(());
|
||||
extern ircstats IRCstats;
|
||||
extern void remove_server_from_table(aClient *what);
|
||||
|
||||
ID_Copyright
|
||||
("(C) 1988 University of Oulu, Computing Center and Jarkko Oikarinen");
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ int match(mask, name)
|
||||
u_char *n;
|
||||
u_char cm;
|
||||
u_char *mylowertab;
|
||||
u_char *wsn;
|
||||
u_char *wsn = NULL;
|
||||
u_char *wsm;
|
||||
|
||||
m = (u_char *)mask;
|
||||
|
||||
@@ -622,7 +622,6 @@ static int cancel_clients(cptr, sptr, cmd)
|
||||
(cptr->name!=NULL)?cptr->name:"<unknown>",
|
||||
(fromname!=NULL)?fromname:"<unknown>");
|
||||
|
||||
/*
|
||||
* We don't drop the server anymore. Just ignore
|
||||
* the message and go about your business. And hope
|
||||
* we don't get flooded. :-) -Cabal95
|
||||
|
||||
@@ -1528,4 +1528,3 @@ int m_rakill(cptr, sptr, parc, parv)
|
||||
/* call the tkl layer .. */
|
||||
m_tkl(&me, &me, 6, tkllayer);
|
||||
}
|
||||
|
||||
|
||||
+94
-179
@@ -74,49 +74,22 @@ int m_sethost(cptr, sptr, parc, parv)
|
||||
char *parv[];
|
||||
{
|
||||
char *vhost, *s;
|
||||
#ifndef DISABLE_USERMOD
|
||||
int permit = 0; /* 0 = opers(glob/locop) 1 = global oper 2 = not MY clients.. */
|
||||
#else
|
||||
int permit = 2;
|
||||
#endif
|
||||
int legalhost = 1; /* is legal characters? */
|
||||
|
||||
#ifdef DISABLE_USERMOD
|
||||
if (MyClient(sptr))
|
||||
{
|
||||
sendto_one(sptr, ":%s NOTICE %s :*** The /sethost command is disabled on this server", me.name, sptr->name);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!MyConnect(sptr))
|
||||
goto have_permit1;
|
||||
switch (permit)
|
||||
{
|
||||
case 0:
|
||||
if (!IsAnOper(sptr))
|
||||
{
|
||||
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name,
|
||||
parv[0]);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (!IsOper(sptr))
|
||||
{
|
||||
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name,
|
||||
parv[0]);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (MyConnect(sptr))
|
||||
{
|
||||
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name,
|
||||
parv[0]);
|
||||
return 0;
|
||||
}
|
||||
default:
|
||||
sendto_ops_butone(IsServer(cptr) ? cptr : NULL, sptr,
|
||||
":%s WALLOPS :[SETHOST] Somebody fixing this corrupted server? !(0|1) !!!",
|
||||
me.name);
|
||||
break;
|
||||
if (MyClient(sptr) && !IsAnOper(sptr))
|
||||
{
|
||||
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name,
|
||||
parv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
have_permit1:
|
||||
if (parc < 2)
|
||||
vhost = NULL;
|
||||
else
|
||||
@@ -128,18 +101,19 @@ int m_sethost(cptr, sptr, parc, parv)
|
||||
if (MyConnect(sptr))
|
||||
{
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** Syntax: /SetHost <new host>",
|
||||
":%s NOTICE %s :*** SetHost Error: Syntax is /sethost <new host>",
|
||||
me.name, parv[0]);
|
||||
}
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
/* uh uh .. too small */
|
||||
if (strlen(parv[1]) < 1)
|
||||
{
|
||||
if (MyConnect(sptr))
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** /SetHost Error: Atleast write SOMETHING that makes sense (':' string)",
|
||||
":%s NOTICE %s :*** SetHost Error: Host cannot be NULL.",
|
||||
me.name, sptr->name);
|
||||
return 0;
|
||||
}
|
||||
/* too large huh? */
|
||||
if (strlen(parv[1]) > (HOSTLEN))
|
||||
@@ -147,9 +121,9 @@ int m_sethost(cptr, sptr, parc, parv)
|
||||
/* ignore us as well if we're not a child of 3k */
|
||||
if (MyConnect(sptr))
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** /SetHost Error: Hostnames are limited to %i characters.",
|
||||
":%s NOTICE %s :*** SetHost Error: Hostnames are limited to %i characters.",
|
||||
me.name, sptr->name, HOSTLEN);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* illegal?! */
|
||||
@@ -157,18 +131,13 @@ int m_sethost(cptr, sptr, parc, parv)
|
||||
{
|
||||
if (!isallowed(*s))
|
||||
{
|
||||
legalhost = 0;
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** SetHost Error: Hostnames may only contain a-z, A-Z, 0-9, '-' & '.'",
|
||||
me.name, parv[0]);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (legalhost == 0)
|
||||
{
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** /SetHost Error: A hostname may contain a-z, A-Z, 0-9, '-' & '.' - Please only use them",
|
||||
me.name, parv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* hide it */
|
||||
sptr->umodes |= UMODE_HIDE;
|
||||
sptr->umodes |= UMODE_SETHOST;
|
||||
@@ -208,7 +177,6 @@ int m_chghost(cptr, sptr, parc, parv)
|
||||
{
|
||||
aClient *acptr;
|
||||
char *s;
|
||||
int legalhost = 1;
|
||||
|
||||
#ifdef DISABLE_USERMOD
|
||||
if (MyClient(sptr))
|
||||
@@ -218,19 +186,17 @@ int m_chghost(cptr, sptr, parc, parv)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (MyClient(sptr))
|
||||
if (!IsAnOper(sptr))
|
||||
{
|
||||
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name,
|
||||
parv[0]);
|
||||
return 0;
|
||||
|
||||
}
|
||||
if (MyClient(sptr) && !IsOper(sptr))
|
||||
{
|
||||
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name,
|
||||
parv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (parc < 3)
|
||||
{
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** /ChgHost syntax is /ChgHost <nick> <newhost>",
|
||||
":%s NOTICE %s :*** ChgHost Error: Syntax is /chghost <nick> <newhost>",
|
||||
me.name, sptr->name);
|
||||
return 0;
|
||||
}
|
||||
@@ -238,7 +204,7 @@ int m_chghost(cptr, sptr, parc, parv)
|
||||
if (strlen(parv[2]) < 1)
|
||||
{
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** Write atleast something to change the host to!",
|
||||
":%s NOTICE %s :*** ChgHost Error: The host cannot be NULL.",
|
||||
me.name, sptr->name);
|
||||
return 0;
|
||||
}
|
||||
@@ -246,8 +212,8 @@ int m_chghost(cptr, sptr, parc, parv)
|
||||
if (strlen(parv[2]) > (HOSTLEN))
|
||||
{
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** ChgHost Error: Too long hostname!!",
|
||||
me.name, sptr->name);
|
||||
":%s NOTICE %s :*** ChgHost Error: Hostnames are limited to %i characters.",
|
||||
me.name, sptr->name, HOSTLEN);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -256,18 +222,13 @@ int m_chghost(cptr, sptr, parc, parv)
|
||||
{
|
||||
if (!isallowed(*s))
|
||||
{
|
||||
legalhost = 0;
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** ChgHost Error: Hostnames may only contain a-z, A-Z, 0-9, '-' & '.'",
|
||||
me.name, parv[0]);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (legalhost == 0)
|
||||
{
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** /ChgHost Error: A hostname may contain a-z, A-Z, 0-9, '-' & '.' - Please only use them",
|
||||
me.name, parv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((acptr = find_person(parv[1], NULL)))
|
||||
{
|
||||
if (!IsULine(sptr))
|
||||
@@ -312,7 +273,6 @@ int m_chgident(cptr, sptr, parc, parv)
|
||||
{
|
||||
aClient *acptr;
|
||||
char *s;
|
||||
int legalident = 1;
|
||||
|
||||
#ifdef DISABLE_USERMOD
|
||||
if (MyClient(sptr))
|
||||
@@ -322,19 +282,17 @@ int m_chgident(cptr, sptr, parc, parv)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (MyClient(sptr))
|
||||
if (!IsAnOper(sptr))
|
||||
{
|
||||
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name,
|
||||
parv[0]);
|
||||
return 0;
|
||||
|
||||
}
|
||||
if (MyClient(sptr) && !IsOper(sptr))
|
||||
{
|
||||
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name,
|
||||
parv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (parc < 3)
|
||||
{
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** /ChgIdent syntax is /ChgIdent <nick> <newident>",
|
||||
":%s NOTICE %s :*** ChgIdent Error: Syntax is /chgident <nick> <newident>",
|
||||
me.name, sptr->name);
|
||||
return 0;
|
||||
}
|
||||
@@ -342,7 +300,7 @@ int m_chgident(cptr, sptr, parc, parv)
|
||||
if (strlen(parv[2]) < 1)
|
||||
{
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** Write atleast something to change the ident to!",
|
||||
":%s NOTICE %s :*** ChgIdent Error: Ident cannot be NULL.",
|
||||
me.name, sptr->name);
|
||||
return 0;
|
||||
}
|
||||
@@ -350,28 +308,23 @@ int m_chgident(cptr, sptr, parc, parv)
|
||||
if (strlen(parv[2]) > (USERLEN))
|
||||
{
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** ChgIdent Error: Too long ident!!",
|
||||
me.name, sptr->name);
|
||||
":%s NOTICE %s :*** ChgIdent Error: Ident is limited to %i characters.",
|
||||
me.name, sptr->name, USERLEN);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* illegal?! */
|
||||
for (s = parv[2]; *s; s++)
|
||||
{
|
||||
if (!isallowed(*s))
|
||||
if (!isallowed(*s) && (*s != '~'))
|
||||
{
|
||||
legalident = 0;
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** ChgIdent Error: Ident may only contain a-z, A-Z, 0-9, '-', '~' & '.'",
|
||||
me.name, parv[0]);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (legalident == 0)
|
||||
{
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** /ChgIdent Error: A ident may contain a-z, A-Z, 0-9, '-' & '.' - Please only use them",
|
||||
me.name, parv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((acptr = find_person(parv[1], NULL)))
|
||||
{
|
||||
if (!IsULine(sptr))
|
||||
@@ -412,49 +365,23 @@ int m_setident(cptr, sptr, parc, parv)
|
||||
int parc;
|
||||
char *parv[];
|
||||
{
|
||||
|
||||
char *vident, *s;
|
||||
#ifndef DISABLE_USERMOD
|
||||
int permit = 0; /* 0 = opers(glob/locop) 1 = global oper */
|
||||
#else
|
||||
int permit = 2;
|
||||
#endif
|
||||
int legalident = 1; /* is legal characters? */
|
||||
if (!MyConnect(sptr))
|
||||
goto permit_2;
|
||||
switch (permit)
|
||||
{
|
||||
case 0:
|
||||
if (!IsAnOper(sptr))
|
||||
{
|
||||
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name,
|
||||
parv[0]);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (!IsOper(sptr))
|
||||
{
|
||||
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name,
|
||||
parv[0]);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (MyConnect(sptr))
|
||||
{
|
||||
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name,
|
||||
parv[0]);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
sendto_ops_butone(IsServer(cptr) ? cptr : NULL, sptr,
|
||||
":%s WALLOPS :[SETIDENT] Somebody fixing this corrupted server? !(0|1) !!!",
|
||||
me.name);
|
||||
break;
|
||||
|
||||
#ifdef DISABLE_USERMOD
|
||||
if (MyClient(sptr))
|
||||
{
|
||||
sendto_one(sptr, ":%s NOTICE %s :*** The /setident command is disabled on this server", me.name, sptr->name);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (MyClient(sptr) && !IsAnOper(sptr))
|
||||
{
|
||||
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name,
|
||||
parv[0]);
|
||||
return 0;
|
||||
}
|
||||
permit_2:
|
||||
|
||||
if (parc < 2)
|
||||
vident = NULL;
|
||||
else
|
||||
@@ -466,17 +393,18 @@ int m_setident(cptr, sptr, parc, parv)
|
||||
if (MyConnect(sptr))
|
||||
{
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** Syntax: /SetIdent <new host>",
|
||||
":%s NOTICE %s :*** SetIdent Error: Syntax /setident <new ident>",
|
||||
me.name, parv[0]);
|
||||
}
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
if (strlen(parv[1]) < 1)
|
||||
{
|
||||
if (MyConnect(sptr))
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** /SetIdent Error: Atleast write SOMETHING that makes sense (':' string)",
|
||||
":%s NOTICE %s :*** SetIdent Error: Ident cannot be NULL.",
|
||||
me.name, sptr->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* too large huh? */
|
||||
@@ -485,29 +413,21 @@ int m_setident(cptr, sptr, parc, parv)
|
||||
/* ignore us as well if we're not a child of 3k */
|
||||
if (MyConnect(sptr))
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** /SetIdent Error: Usernames are limited to %i characters.",
|
||||
":%s NOTICE %s :*** SetIdent Error: Ident is limited to %i characters.",
|
||||
me.name, sptr->name, USERLEN);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* illegal?! */
|
||||
for (s = vident; *s; s++)
|
||||
{
|
||||
if (!isallowed(*s))
|
||||
if (!isallowed(*s) && (*s != '~'))
|
||||
{
|
||||
legalident = 0;
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** SetIdent Error: Ident may only contain a-z, A-Z, 0-9, '-', '~' & '.'",
|
||||
me.name, parv[0]);
|
||||
return 0;
|
||||
}
|
||||
if (*s == '~')
|
||||
legalident = 1;
|
||||
|
||||
}
|
||||
|
||||
if (legalident == 0)
|
||||
{
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** /SetIdent Error: A username may contain a-z, A-Z, 0-9, '-', '~' & '.' - Please only use them",
|
||||
me.name, parv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* get it in */
|
||||
@@ -524,7 +444,7 @@ int m_setident(cptr, sptr, parc, parv)
|
||||
IsHidden(sptr) ? sptr->user->virthost : sptr->
|
||||
user->realhost);
|
||||
}
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
/* m_setname - 12/05/1999 - Stskeeps
|
||||
* :prefix SETNAME :gecos
|
||||
@@ -542,12 +462,13 @@ int m_setname(cptr, sptr, parc, parv)
|
||||
{
|
||||
if (parc < 2)
|
||||
return;
|
||||
|
||||
if (strlen(parv[1]) > (REALLEN))
|
||||
{
|
||||
if (MyConnect(sptr))
|
||||
{
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** /SetName Error: \"Real names\" may maximum be %i characters of length",
|
||||
":%s NOTICE %s :*** SetName Error: GECOS may be %i characters of length max.",
|
||||
me.name, sptr->name, REALLEN);
|
||||
}
|
||||
return 0;
|
||||
@@ -556,7 +477,7 @@ int m_setname(cptr, sptr, parc, parv)
|
||||
if (strlen(parv[1]) < 1)
|
||||
{
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :Couldn't change realname - Nothing in parameter",
|
||||
":%s NOTICE %s :*** SetName Error: GECOS cannot be NULL.",
|
||||
me.name, sptr->name);
|
||||
return 0;
|
||||
}
|
||||
@@ -579,13 +500,10 @@ int m_setname(cptr, sptr, parc, parv)
|
||||
":%s", parv[1]);
|
||||
if (MyConnect(sptr))
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :Your \"real name\" is now set to be %s - you have to set it manually to undo it",
|
||||
":%s NOTICE %s :*** SetName: Your GECOS is now set to be %s - you have to set it manually to undo it",
|
||||
me.name, parv[0], parv[1]);
|
||||
|
||||
return 0;
|
||||
|
||||
/* sendto_serv_butone(cptr, ":%s SETNAME %s", parv[0], parv[1]); */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* m_sdesc - 15/05/1999 - Stskeeps
|
||||
@@ -597,7 +515,7 @@ int m_setname(cptr, sptr, parc, parv)
|
||||
|
||||
int m_sdesc(aClient *cptr, aClient *sptr, int parc, char *parv[])
|
||||
{
|
||||
if (!IsAdmin(sptr) && !IsCoAdmin(sptr))
|
||||
if (!IsAdmin(sptr))
|
||||
return 0;
|
||||
|
||||
if (parc < 2)
|
||||
@@ -699,8 +617,7 @@ int m_nachat(cptr, sptr, parc, parv)
|
||||
return 0;
|
||||
}
|
||||
#ifdef ADMINCHAT
|
||||
if (MyClient(sptr))
|
||||
if (!(IsNetAdmin(sptr)))
|
||||
if (MyClient(sptr) && !IsNetAdmin(sptr))
|
||||
#else
|
||||
if (MyClient(sptr))
|
||||
#endif
|
||||
@@ -1387,19 +1304,17 @@ int m_chgname(cptr, sptr, parc, parv)
|
||||
#endif
|
||||
|
||||
|
||||
if (MyClient(sptr))
|
||||
if (!IsAnOper(sptr))
|
||||
{
|
||||
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name,
|
||||
parv[0]);
|
||||
return 0;
|
||||
|
||||
}
|
||||
if (MyClient(sptr) && !IsOper(sptr))
|
||||
{
|
||||
sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name,
|
||||
parv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (parc < 3)
|
||||
{
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** /ChgName syntax is /ChgName <nick> <newident>",
|
||||
":%s NOTICE %s :*** ChgName Error: Syntax is /chgname <nick> <newident>",
|
||||
me.name, sptr->name);
|
||||
return 0;
|
||||
}
|
||||
@@ -1407,7 +1322,7 @@ int m_chgname(cptr, sptr, parc, parv)
|
||||
if (strlen(parv[2]) < 1)
|
||||
{
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** Write atleast something to change the ident to!",
|
||||
":%s NOTICE %s :*** ChgName Error: GECOS cannot be NULL.",
|
||||
me.name, sptr->name);
|
||||
return 0;
|
||||
}
|
||||
@@ -1415,8 +1330,8 @@ int m_chgname(cptr, sptr, parc, parv)
|
||||
if (strlen(parv[2]) > (REALLEN - 1))
|
||||
{
|
||||
sendto_one(sptr,
|
||||
":%s NOTICE %s :*** ChgName Error: Too long !!", me.name,
|
||||
sptr->name);
|
||||
":%s NOTICE %s :*** ChgName Error: GECOS can be %i characters of length max.", me.name,
|
||||
sptr->name, REALLEN);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+21
-93
@@ -3774,124 +3774,52 @@ int m_oper(cptr, sptr, parc, parv)
|
||||
|
||||
s = index(aconf->host, '@');
|
||||
*s++ = '\0';
|
||||
/*if ((aconf->port & OFLAG_AGENT))
|
||||
sptr->umodes |= UMODE_AGENT; */
|
||||
if ((aconf->port & OFLAG_HELPOP))
|
||||
SetHelpOp(sptr);
|
||||
|
||||
if (aconf->port & OFLAG_NETADMIN)
|
||||
{
|
||||
sptr->umodes |= UMODE_HELPOP;
|
||||
}
|
||||
|
||||
if (!(aconf->port & OFLAG_ISGLOBAL))
|
||||
{
|
||||
SetLocOp(sptr);
|
||||
}
|
||||
else if (aconf->port & OFLAG_NETADMIN)
|
||||
{
|
||||
if (aconf->port & OFLAG_SADMIN)
|
||||
{
|
||||
sptr->umodes |=
|
||||
(UMODE_NETADMIN | UMODE_ADMIN |
|
||||
UMODE_SADMIN);
|
||||
SetNetAdmin(sptr);
|
||||
SetSAdmin(sptr);
|
||||
SetAdmin(sptr);
|
||||
|
||||
SetOper(sptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
sptr->umodes |= (UMODE_NETADMIN | UMODE_ADMIN);
|
||||
SetNetAdmin(sptr);
|
||||
SetAdmin(sptr);
|
||||
SetOper(sptr);
|
||||
|
||||
}
|
||||
}
|
||||
else if (aconf->port & OFLAG_COADMIN)
|
||||
{
|
||||
if (aconf->port & OFLAG_SADMIN)
|
||||
{
|
||||
sptr->umodes |=
|
||||
(UMODE_COADMIN | UMODE_ADMIN |
|
||||
UMODE_SADMIN);
|
||||
SetCoAdmin(sptr);
|
||||
SetSAdmin(sptr);
|
||||
SetAdmin(sptr);
|
||||
SetOper(sptr);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
sptr->umodes |= (UMODE_COADMIN | UMODE_ADMIN);
|
||||
SetCoAdmin(sptr);
|
||||
SetAdmin(sptr);
|
||||
SetOper(sptr);
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
if (aconf->port & OFLAG_ADMIN && aconf->port & OFLAG_SADMIN)
|
||||
{
|
||||
sptr->umodes |= (UMODE_ADMIN | UMODE_SADMIN);
|
||||
SetNetAdmin(sptr);
|
||||
SetAdmin(sptr);
|
||||
SetSAdmin(sptr);
|
||||
SetOper(sptr);
|
||||
|
||||
}
|
||||
else if (aconf->port & OFLAG_SADMIN)
|
||||
{
|
||||
sptr->umodes |= (UMODE_SADMIN);
|
||||
SetSAdmin(sptr);
|
||||
SetOper(sptr);
|
||||
|
||||
}
|
||||
else if (aconf->port & OFLAG_ADMIN)
|
||||
{
|
||||
sptr->umodes |= (UMODE_ADMIN);
|
||||
SetAdmin(sptr);
|
||||
SetOper(sptr);
|
||||
|
||||
}
|
||||
else if (aconf->port & OFLAG_COADMIN)
|
||||
{
|
||||
SetCoAdmin(sptr);
|
||||
SetAdmin(sptr);
|
||||
SetOper(sptr);
|
||||
}
|
||||
else if (aconf->port & OFLAG_ISGLOBAL)
|
||||
SetOper(sptr);
|
||||
else
|
||||
{
|
||||
if (aconf->port & OFLAG_SADMIN)
|
||||
{
|
||||
sptr->umodes |= (UMODE_OPER | UMODE_SADMIN);
|
||||
SetSAdmin(sptr);
|
||||
SetOper(sptr);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
sptr->umodes |= (UMODE_OPER);
|
||||
SetOper(sptr);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
SetLocOp(sptr);
|
||||
|
||||
if (aconf->port & OFLAG_SADMIN)
|
||||
SetSAdmin(sptr);
|
||||
|
||||
if (aconf->port & OFLAG_EYES)
|
||||
{
|
||||
sptr->umodes |= (UMODE_EYES);
|
||||
SetEyes(sptr);
|
||||
}
|
||||
|
||||
if (aconf->port & OFLAG_WHOIS)
|
||||
{
|
||||
sptr->umodes |= (UMODE_WHOIS);
|
||||
}
|
||||
SetWhois(sptr);
|
||||
|
||||
if (aconf->port & OFLAG_HIDE)
|
||||
{
|
||||
sptr->umodes |= (UMODE_HIDE);
|
||||
}
|
||||
SetHide(sptr);
|
||||
|
||||
sptr->oflag = aconf->port;
|
||||
|
||||
*--s = '@';
|
||||
|
||||
/* Set useful modes here */
|
||||
sptr->umodes |=
|
||||
(UMODE_SERVNOTICE | UMODE_WALLOP | UMODE_FAILOP |
|
||||
UMODE_FLOOD | UMODE_CLIENT | UMODE_KILLS);
|
||||
|
||||
send_umode_out(cptr, sptr, old);
|
||||
#ifndef NO_FDLIST
|
||||
addto_fdlist(sptr->fd, &oper_fdlist);
|
||||
|
||||
Reference in New Issue
Block a user