*
* $Id$
*/
-#include "s_conf.h"
+#include "config.h"
+#include "s_conf.h"
#include "IPcheck.h"
#include "class.h"
#include "client.h"
{
struct SLink *lp;
- for (lp = cptr->confs; lp; lp = lp->next) {
+ for (lp = cli_confs(cptr); lp; lp = lp->next) {
if (lp->value.aconf == aconf)
return 1;
}
ConfLinks(aconf) >= ConfMaxLinks(aconf) && ConfMaxLinks(aconf) > 0)
return ACR_TOO_MANY_IN_CLASS; /* Use this for printing error message */
lp = make_link();
- lp->next = cptr->confs;
+ lp->next = cli_confs(cptr);
lp->value.aconf = aconf;
- cptr->confs = lp;
+ cli_confs(cptr) = lp;
++aconf->clients;
if (aconf->status & CONF_CLIENT_MASK)
ConfLinks(aconf)++;
(EmptyString(aconf->passwd) && !EmptyString(bconf->passwd)))
continue;
if (!EmptyString(bconf->passwd) && (!IsDigit(*bconf->passwd) || bconf->passwd[1])
-#ifdef USEONE
- && 0 != ircd_strcmp(bconf->passwd, "ONE")
-#endif
&& 0 != ircd_strcmp(bconf->passwd, aconf->passwd))
continue;
server->next = serverConfList;
serverConfList = server;
- // if (INADDR_NONE == server->address.s_addr)
- // lookup_confhost(server);
+ /* if (INADDR_NONE == server->address.s_addr) */
+ /* lookup_confhost(server); */
}
void conf_add_deny(const char* const* fields, int count, int ip_kill)
assert(0 != conf);
memset(conf, 0, sizeof(struct DenyConf));
+ if (fields[1][0] == '$' && fields[1][1] == 'R')
+ conf->flags |= DENY_FLAGS_REALNAME;
+
DupString(conf->hostmask, fields[1]);
collapse(conf->hostmask);
if (!EmptyString(fields[2])) {
const char* p = fields[2];
if ('!' == *p) {
- conf->is_file = 1;
+ conf->flags |= DENY_FLAGS_FILE;
++p;
}
DupString(conf->message, p);
conf->s_addr = inet_addr(ipname);
Debug((DEBUG_DEBUG, "IPkill: %s = %08x/%i (%08x)", ipname,
conf->s_addr, conf->bits, NETMASK(conf->bits)));
+ conf->flags |= DENY_FLAGS_IP;
}
conf->next = denyConfList;
denyConfList = conf;
return 0;
}
+ feature_unmark(); /* unmark all features for resetting later */
+
while (fbgets(line, sizeof(line) - 1, file)) {
if ('#' == *line || IsSpace(*line))
continue;
free_conf(aconf);
fbclose(file);
nextping = nextconnect = CurrentTime;
+ feature_mark(); /* reset unmarked features */
return 1;
}
if (IsServer(acptr)) {
det_confs_butmask(acptr,
~(CONF_HUB | CONF_LEAF | CONF_UWORLD | CONF_ILLEGAL));
- attach_confs_byname(acptr, acptr->name,
+ attach_confs_byname(acptr, cli_name(acptr),
CONF_HUB | CONF_LEAF | CONF_UWORLD);
}
/* Because admin's are getting so uppity about people managing to
{
const char* host;
const char* name;
+ const char* realname;
struct DenyConf* deny;
struct Gline* agline = NULL;
host = cli_sockhost(cptr);
name = cli_user(cptr)->username;
+ realname = cli_info(cptr);
assert(strlen(host) <= HOSTLEN);
assert((name ? strlen(name) : 0) <= HOSTLEN);
-
+ assert((realname ? strlen(realname) : 0) <= REALLEN);
+
/* 2000-07-14: Rewrote this loop for massive speed increases.
* -- Isomer
*/
for (deny = denyConfList; deny; deny = deny->next) {
if (0 != match(deny->usermask, name))
continue;
-
+
if (EmptyString(deny->hostmask))
break;
-
- if (deny->ip_kill) { /* k: by IP */
+
+ if (deny->flags & DENY_FLAGS_REALNAME) { /* K: by real name */
+ if (0 == match(deny->hostmask + 2, realname))
+ break;
+ } else if (deny->flags & DENY_FLAGS_IP) { /* k: by IP */
Debug((DEBUG_DEBUG, "ip: %08x network: %08x/%i mask: %08x",
cli_ip(cptr).s_addr, deny->s_addr, deny->bits, NETMASK(deny->bits)));
if ((cli_ip(cptr).s_addr & NETMASK(deny->bits)) == deny->s_addr)
send_reply(cptr, SND_EXPLICIT | ERR_YOUREBANNEDCREEP,
":Connection from your host is refused on this server.");
else {
- if (deny->is_file)
+ if (deny->flags & DENY_FLAGS_FILE)
killcomment(cptr, deny->message);
else
send_reply(cptr, SND_EXPLICIT | ERR_YOUREBANNEDCREEP, ":%s.", deny->message);