BADCHAN patch, Remote usage defaults YES, local usage defaults NO.
Warning is given, LOCAL USAGE is NOT approved for undernet.
Author: WT
Log message:
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@7
c9e4aea6-c8fd-4c43-8297-
357d70d61c8c
#
# ChangeLog for Undernet ircu Servers
#
#
# ChangeLog for Undernet ircu Servers
#
-# $Id: ChangeLog,v 1.2 1999-11-25 02:07:53 bleep Exp $
+# $Id: ChangeLog,v 1.3 1999-11-28 01:36:25 danny Exp $
#
# Please insert new entries on the top of the list, a one or two line comment
# is sufficient. Please include your name on the entries we know who to blame.
# Please keep lines < 80 chars.
#-------------------------------------------------------------------------------
#
# Please insert new entries on the top of the list, a one or two line comment
# is sufficient. Please include your name on the entries we know who to blame.
# Please keep lines < 80 chars.
#-------------------------------------------------------------------------------
+* list.h list.c s_conf.h s_conf.c opercmds.c:
+ badchan patch 2 seperate settings, allow global, and allow local.
+ currently allow_local is 'unapproved' for use on undernet. --WildThang
* ircd.h, s_serv.h, s_debug.h, ircd.c, s_user.c, s_bsd.c:
removed STAT_MASTER/BOOT_OPER code, original patch by Isomer --Bleep
* s_user.c (m_nick): removed redundant check for acptr --Bleep
* ircd.h, s_serv.h, s_debug.h, ircd.c, s_user.c, s_bsd.c:
removed STAT_MASTER/BOOT_OPER code, original patch by Isomer --Bleep
* s_user.c (m_nick): removed redundant check for acptr --Bleep
if [ "$CONFIG_LOG_WHOX" = "y" ]; then
string ' Give the path and(or) filename of this log file' WPATH 'whox.log'
fi
if [ "$CONFIG_LOG_WHOX" = "y" ]; then
string ' Give the path and(or) filename of this log file' WPATH 'whox.log'
fi
+
+ comment 'Bad Channel G-Lines allow operators to add channel masks to a list which prohibits local clients from being able joining channels which match the mask. Remote BadChan Glines allow Uworld to add or remove channels from the servers internal list of badchans'
+ WT_BADCHAN=y
+ bool 'Do you want to enable Bad Channel G-lines' WT_BADCHAN
+ if [ "$WT_BADCHAN" = "y" ]; then
+ echo " "
+ echo " WARNING DO _NOT_ USE LOCAL BADCHANNEL GLINES ON UNDERNET"
+ echo " Use of LOCAL BAD Channel G-Lines can be cause for REMOVAL"
+ bool 'Allow LOCAL BAD Channel G-lines' WT_LOCAL_BADCHAN
+ fi
+
bool 'Do you want to log G-lines to a separate file' CONFIG_LOG_GLINES
if [ "$CONFIG_LOG_GLINES" = "y" ]; then
string ' Give the path and(or) filename of this log file' GPATH 'gline.log'
bool 'Do you want to log G-lines to a separate file' CONFIG_LOG_GLINES
if [ "$CONFIG_LOG_GLINES" = "y" ]; then
string ' Give the path and(or) filename of this log file' GPATH 'gline.log'
extern aGline *find_gline(aClient *cptr, aGline **pgline);
extern void free_gline(aGline *agline, aGline *pgline);
extern void send_listinfo(aClient *cptr, char *name);
extern aGline *find_gline(aClient *cptr, aGline **pgline);
extern void free_gline(aGline *agline, aGline *pgline);
extern void send_listinfo(aClient *cptr, char *name);
+#ifdef WT_BADCHAN
+extern int bad_channel(char *name);
+#endif
/*
* Deliberate empty lines
/*
* Deliberate empty lines
extern aConfItem *conf;
extern aGline *gline;
extern aConfItem *conf;
extern aGline *gline;
extern struct tm motd_tm;
extern aMotdItem *motd;
extern aMotdItem *rmotd;
extern struct tm motd_tm;
extern aMotdItem *motd;
extern aMotdItem *rmotd;
+ {
+#ifdef WT_BADCHAN
+ if(bad_channel(name) && !IsAnOper(sptr))
+ {
+ sendto_one(sptr, err_str(ERR_CHANNELISFULL), me.name, parv[0],name);
+ continue;
+ }
+#endif
+
/*
* Local client is first to enter previously nonexistant
* channel so make them (rightfully) the Channel Operator.
/*
* Local client is first to enter previously nonexistant
* channel so make them (rightfully) the Channel Operator.
char *name, time_t expire)
{
Reg4 aGline *agline;
char *name, time_t expire)
{
Reg4 aGline *agline;
+#ifdef WT_BADCHAN
+ int gtype=0;
+ if(*host == '#') gtype=1; /* BAD CHANNEL GLINE */
+#endif
agline = (struct Gline *)RunMalloc(sizeof(aGline)); /* alloc memory */
DupString(agline->host, host); /* copy vital information */
agline = (struct Gline *)RunMalloc(sizeof(aGline)); /* alloc memory */
DupString(agline->host, host); /* copy vital information */
agline->gflags = GLINE_ACTIVE; /* gline is active */
if (is_ipmask)
SetGlineIsIpMask(agline);
agline->gflags = GLINE_ACTIVE; /* gline is active */
if (is_ipmask)
SetGlineIsIpMask(agline);
+
+#ifdef WT_BADCHAN
+ if(gtype)
+ { agline->next = badchan; /* link it into the list */
+ return (badchan = agline);
+ }
+#endif
agline->next = gline; /* link it into the list */
return (gline = agline);
}
agline->next = gline; /* link it into the list */
return (gline = agline);
}
if (pgline)
pgline->next = agline->next; /* squeeze agline out */
else
if (pgline)
pgline->next = agline->next; /* squeeze agline out */
else
+ {
+#ifdef WT_BADCHAN
+ if(*agline->host =='#')
+ {
+ badchan = agline->next;
+ }
+ else
+#endif
+ gline = agline->next;
+ }
RunFree(agline->host); /* and free up the memory */
RunFree(agline->reason);
RunFree(agline->host); /* and free up the memory */
RunFree(agline->reason);
+#ifdef WT_BADCHAN
+int bad_channel(char *name)
+{ aGline *agline;
+
+ agline=badchan;
+ while(agline)
+ {
+ if ((agline->gflags&GLINE_ACTIVE) && (agline->expire >TStime()) &&
+ !mmatch(agline->host,name))
+ { return 1;
+ }
+ agline=agline->next;
+ }
+ return 0;
+}
+#endif
+
#ifdef DEBUGMODE
void send_listinfo(aClient *cptr, char *name)
{
#ifdef DEBUGMODE
void send_listinfo(aClient *cptr, char *name)
{
{
aClient *acptr;
aGline *agline;
{
aClient *acptr;
aGline *agline;
+#ifdef WT_BADCHAN
+ if(*host=='#')
+ gtype=1; /* BAD CHANNEL */
+#endif
/* Inform ops */
sendto_op_mask(SNO_GLINE,
/* Inform ops */
sendto_op_mask(SNO_GLINE,
- "%s adding %sGLINE for %s@%s, expiring at " TIME_T_FMT ": %s", sptr->name,
- local ? "local " : "", user, host, expire, comment);
+ "%s adding %s%s for %s@%s, expiring at " TIME_T_FMT ": %s", sptr->name,
+ local ? "local " : "",
+ gtype ? "BADCHAN":"GLINE", user, host, expire, comment);
#ifdef GPATH
write_log(GPATH,
#ifdef GPATH
write_log(GPATH,
- "# " TIME_T_FMT " %s adding %s GLINE for %s@%s, expiring at " TIME_T_FMT
+ "# " TIME_T_FMT " %s adding %s %s for %s@%s, expiring at " TIME_T_FMT
": %s\n", TStime(), sptr->name, local ? "local" : "global",
": %s\n", TStime(), sptr->name, local ? "local" : "global",
- user, host, expire, comment);
+ gtype ? "BADCHAN" : "GLINE", user, host, expire, comment);
/* this can be inserted into the conf */
/* this can be inserted into the conf */
- write_log(GPATH, "%c:%s:%s:%s\n", ip_mask ? 'k' : 'K', host, comment, user);
+ if(!gtype)
+ write_log(GPATH, "%c:%s:%s:%s\n", ip_mask ? 'k' : 'K', host, comment,
+ user);
#endif /* GPATH */
agline = make_gline(ip_mask, host, comment, user, expire);
if (local)
SetGlineIsLocal(agline);
#endif /* GPATH */
agline = make_gline(ip_mask, host, comment, user, expire);
if (local)
SetGlineIsLocal(agline);
+#ifdef WT_BADCHAN
+ if(gtype) return;
+#endif
+
for (fd = highest_fd; fd >= 0; --fd) /* get the users! */
if ((acptr = loc_clients[fd]) && !IsMe(acptr))
{
for (fd = highest_fd; fd >= 0; --fd) /* get the users! */
if ((acptr = loc_clients[fd]) && !IsMe(acptr))
{
aGline *agline, *a2gline;
char *user, *host;
aGline *agline, *a2gline;
char *user, *host;
+ int active, ip_mask,gtype = 0;
time_t expire = 0;
/* Remove expired G-lines */
time_t expire = 0;
/* Remove expired G-lines */
+#ifdef WT_BADCHAN
+ /* Remove expired bad channels */
+ for (agline = badchan, a2gline = NULL; agline; agline = agline->next)
+ {
+ if (agline->expire <= TStime())
+ {
+ free_gline(agline, a2gline);
+ agline = a2gline ? a2gline : badchan;
+ if (!agline)
+ break;
+ continue;
+ }
+ a2gline = agline;
+ }
+#endif
+
+
if (IsServer(cptr))
{
if (find_conf_host(cptr->confs, sptr->name, CONF_UWORLD))
if (IsServer(cptr))
{
if (find_conf_host(cptr->confs, sptr->name, CONF_UWORLD))
parv[2]++; /* step past mode indicator */
/* forward the message appropriately */
parv[2]++; /* step past mode indicator */
/* forward the message appropriately */
- if (!strCasediff(parv[1], "*"))
+ if (!strCasediff(parv[1], "*")) /* global! */
sendto_serv_butone(cptr, active ? ":%s GLINE %s +%s %s :%s" :
sendto_serv_butone(cptr, active ? ":%s GLINE %s +%s %s :%s" :
- ":%s GLINE %s -%s", parv[0], parv[1], parv[2], parv[3], parv[4]); /* global! */
+ ":%s GLINE %s -%s", parv[0], parv[1], parv[2], parv[3], parv[4]);
*(host++) = '\0'; /* break up string at the '@' */
}
ip_mask = check_if_ipmask(host); /* Store this boolean */
*(host++) = '\0'; /* break up string at the '@' */
}
ip_mask = check_if_ipmask(host); /* Store this boolean */
+#ifdef WT_BADCHAN
+ if(*host == '#') gtype=1; /* BAD CHANNEL GLINE */
+#endif
- for (agline = gline, a2gline = NULL; agline; agline = agline->next)
+ for (agline = (gtype)?badchan:gline, a2gline = NULL; agline;
+ agline = agline->next)
{
if (!strCasediff(agline->name, user)
&& !strCasediff(agline->host, host))
{
if (!strCasediff(agline->name, user)
&& !strCasediff(agline->host, host))
if (!active && agline)
{ /* removing the gline */
if (!active && agline)
{ /* removing the gline */
- sendto_op_mask(SNO_GLINE, "%s removing GLINE for %s@%s", parv[0],
- agline->name, agline->host); /* notify opers */
+ /* notify opers */
+ sendto_op_mask(SNO_GLINE, "%s removing %s for %s@%s", parv[0],
+ gtype?"BADCHAN":"GLINE",agline->name, agline->host);
- write_log(GPATH, "# " TIME_T_FMT " %s removing GLINE for %s@%s\n",
- TStime(), parv[0], agline->name, agline->host);
+ write_log(GPATH, "# " TIME_T_FMT " %s removing %s for %s@%s\n",
+ TStime(), parv[0], gtype?"BADCHAN":"GLINE",agline->name,
+ agline->host);
#endif /* GPATH */
free_gline(agline, a2gline); /* remove the gline */
#endif /* GPATH */
free_gline(agline, a2gline); /* remove the gline */
{ /* new expire time? */
/* yes, notify the opers */
sendto_op_mask(SNO_GLINE,
{ /* new expire time? */
/* yes, notify the opers */
sendto_op_mask(SNO_GLINE,
- "%s resetting expiration time on GLINE for %s@%s to " TIME_T_FMT,
- parv[0], agline->name, agline->host, expire);
+ "%s resetting expiration time on %s for %s@%s to " TIME_T_FMT,
+ parv[0], gtype?"BADCHAN":"GLINE",agline->name, agline->host,
+ expire);
#ifdef GPATH
write_log(GPATH, "# " TIME_T_FMT " %s resetting expiration time "
#ifdef GPATH
write_log(GPATH, "# " TIME_T_FMT " %s resetting expiration time "
- "on GLINE for %s@%s to " TIME_T_FMT "\n",
- TStime(), parv[0], agline->name, agline->host, expire);
+ "on %s for %s@%s to " TIME_T_FMT "\n",
+ TStime(), parv[0], gtype?"BADCHAN":"GLINE",
+ agline->name, agline->host, expire);
#endif /* GPATH */
agline->expire = expire; /* reset the expire time */
}
else if (!agline)
{ /* create gline */
#endif /* GPATH */
agline->expire = expire; /* reset the expire time */
}
else if (!agline)
{ /* create gline */
- for (agline = gline; agline; agline = agline->next)
+ for (agline = gtype?badchan:gline; agline; agline = agline->next)
if (!mmatch(agline->name, user) &&
(ip_mask ? GlineIsIpMask(agline) : !GlineIsIpMask(agline)) &&
!mmatch(agline->host, host))
if (!mmatch(agline->name, user) &&
(ip_mask ? GlineIsIpMask(agline) : !GlineIsIpMask(agline)) &&
!mmatch(agline->host, host))
*(host++) = '\0'; /* break up string at the '@' */
}
ip_mask = check_if_ipmask(host); /* Store this boolean */
*(host++) = '\0'; /* break up string at the '@' */
}
ip_mask = check_if_ipmask(host); /* Store this boolean */
+#ifdef WT_BADCHAN
+ if(*host == '#')
+#ifndef WT_LOCAL_BADCHAN
+ return 0;
+#else
+ gtype=1; /* BAD CHANNEL */
+#endif
+#endif
- for (agline = gline, a2gline = NULL; agline; agline = agline->next)
+ for (agline = gtype?badchan:gline, a2gline = NULL; agline;
+ agline = agline->next)
{
if (!mmatch(agline->name, user) &&
(ip_mask ? GlineIsIpMask(agline) : !GlineIsIpMask(agline)) &&
{
if (!mmatch(agline->name, user) &&
(ip_mask ? GlineIsIpMask(agline) : !GlineIsIpMask(agline)) &&
else if (GlineIsLocal(agline))
{
/* Remove local G-line */
else if (GlineIsLocal(agline))
{
/* Remove local G-line */
- sendto_op_mask(SNO_GLINE, "%s removed local GLINE for %s@%s",
- parv[0], agline->name, agline->host);
+ sendto_op_mask(SNO_GLINE, "%s removed local %s for %s@%s",
+ parv[0], gtype?"BADCHAN":"GLINE",agline->name, agline->host);
#ifdef GPATH
write_log(GPATH, "# " TIME_T_FMT
#ifdef GPATH
write_log(GPATH, "# " TIME_T_FMT
- " %s!%s@%s removed local GLINE for %s@%s\n",
+ " %s!%s@%s removed local %s for %s@%s\n",
TStime(), parv[0], cptr->user->username, cptr->user->host,
TStime(), parv[0], cptr->user->username, cptr->user->host,
+ gtype?"BADCHAN":"GLINE",
agline->name, agline->host);
#endif /* GPATH */
free_gline(agline, a2gline); /* remove the gline */
agline->name, agline->host);
#endif /* GPATH */
free_gline(agline, a2gline); /* remove the gline */
/* inform the operators what's up */
if (active != -1)
{ /* changing the activation */
/* inform the operators what's up */
if (active != -1)
{ /* changing the activation */
- sendto_op_mask(SNO_GLINE, !expire ? "%s %sactivating GLINE for %s@%s" :
- "%s %sactivating GLINE for %s@%s and "
+ sendto_op_mask(SNO_GLINE, !expire ? "%s %sactivating %s for %s@%s" :
+ "%s %sactivating %s for %s@%s and "
"resetting expiration time to " TIME_T_FMT,
"resetting expiration time to " TIME_T_FMT,
- parv[0], active ? "re" : "de", agline->name,
+ parv[0], active ? "re" : "de", gtype?"BADCHAN":"GLINE",agline->name,
agline->host, agline->expire);
#ifdef GPATH
write_log(GPATH, !expire ? "# " TIME_T_FMT " %s!%s@%s %sactivating "
agline->host, agline->expire);
#ifdef GPATH
write_log(GPATH, !expire ? "# " TIME_T_FMT " %s!%s@%s %sactivating "
- "GLINE for %s@%s\n" : "# " TIME_T_FMT " %s!%s@%s %sactivating GLINE "
+ "%s for %s@%s\n" : "# " TIME_T_FMT " %s!%s@%s %sactivating %s "
"for %s@%s and resetting expiration time to " TIME_T_FMT "\n",
TStime(), parv[0], cptr->user->username, cptr->user->host,
"for %s@%s and resetting expiration time to " TIME_T_FMT "\n",
TStime(), parv[0], cptr->user->username, cptr->user->host,
- active ? "re" : "de", agline->name, agline->host, agline->expire);
+ active ? "re" : "de", gtype?"BADCHAN":"GLINE",agline->name,
+ agline->host, agline->expire);
#endif /* GPATH */
}
else if (expire)
{ /* changing only the expiration */
sendto_op_mask(SNO_GLINE,
#endif /* GPATH */
}
else if (expire)
{ /* changing only the expiration */
sendto_op_mask(SNO_GLINE,
- "%s resetting expiration time on GLINE for %s@%s to " TIME_T_FMT,
- parv[0], agline->name, agline->host, agline->expire);
+ "%s resetting expiration time on %s for %s@%s to " TIME_T_FMT,
+ parv[0], gtype?"BADCHAN":"GLINE",agline->name, agline->host,
+ agline->expire);
#ifdef GPATH
write_log(GPATH, "# " TIME_T_FMT " %s!%s@%s resetting expiration "
#ifdef GPATH
write_log(GPATH, "# " TIME_T_FMT " %s!%s@%s resetting expiration "
- "time on GLINE for %s@%s to " TIME_T_FMT "\n", TStime(), parv[0],
- cptr->user->username, cptr->user->host, agline->name,
- agline->host, agline->expire);
+ "time on %s for %s@%s to " TIME_T_FMT "\n", TStime(), parv[0],
+ cptr->user->username, cptr->user->host,gtype?"BADCHAN":"GLINE",
+ agline->name, agline->host, agline->expire);
aConfItem *conf = NULL;
aGline *gline = NULL;
aConfItem *conf = NULL;
aGline *gline = NULL;
aMotdItem *motd = NULL;
aMotdItem *rmotd = NULL;
atrecord *tdata = NULL;
aMotdItem *motd = NULL;
aMotdItem *rmotd = NULL;
atrecord *tdata = NULL;
#ifdef VIRTUAL_HOST
'v',
#endif
#ifdef VIRTUAL_HOST
'v',
#endif
+#ifdef WT_BADCHAN
+ 'W',
+#ifdef WT_LOCAL_BADCHAN
+ 't',
+#endif
+#endif
#ifdef UNIXPORT
'X',
#endif
#ifdef UNIXPORT
'X',
#endif