*/
#include "stdinc.h"
-#include "tools.h"
#include "s_gline.h"
#include "channel.h"
#include "client.h"
#include "ircd.h"
#include "hostmask.h"
#include "numeric.h"
-#include "commio.h"
#include "s_conf.h"
#include "s_newconf.h"
#include "scache.h"
#include "hash.h"
#include "parse.h"
#include "modules.h"
-#include "s_log.h"
+#include "logger.h"
+#include "reject.h"
static int mo_gline(struct Client *, struct Client *, int, const char **);
static int mc_gline(struct Client *, struct Client *, int, const char **);
source_p->host, me.name, user, host, reason);
ilog(L_GLINE, "R %s %s %s %s %s %s %s",
source_p->name, source_p->username, source_p->host,
- source_p->user->server, user, host, reason);
+ source_p->servptr->name, user, host, reason);
/* If at least 3 opers agree this user should be G lined then do it */
majority_gline(source_p, user, host, reason);
sendto_server(NULL, NULL, NOCAPS, CAP_GLN,
":%s GLINE %s %s %s %s %s %s :%s",
me.name, source_p->name, source_p->username,
- source_p->host, source_p->user->server,
+ source_p->host, source_p->servptr->name,
user, host, reason);
return 0;
}
acptr->name, user, host, reason);
sendto_server(client_p, NULL, NOCAPS, CAP_GLN,
":%s GLINE %s %s %s %s %s %s :%s",
- acptr->user->server, acptr->name,
+ acptr->servptr->name, acptr->name,
acptr->username, acptr->host,
- acptr->user->server, user, host, reason);
+ acptr->servptr->name, user, host, reason);
if(!ConfigFileEntry.glines)
return 0;
"%s!%s@%s on %s is requesting a gline without "
"%d non-wildcard characters for [%s@%s] [%s]",
acptr->name, acptr->username,
- acptr->host, acptr->user->server,
+ acptr->host, acptr->servptr->name,
ConfigFileEntry.min_nonwildcard,
user, host, reason);
return 0;
sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s!%s@%s on %s is requesting a "
"gline with a cidr mask < %d for [%s@%s] [%s]",
acptr->name, acptr->username, acptr->host,
- acptr->user->server,
+ acptr->servptr->name,
ConfigFileEntry.gline_min_cidr,
user, host, reason);
return 0;
sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s!%s@%s on %s is requesting a "
"gline with a cidr mask < %d for [%s@%s] [%s]",
acptr->name, acptr->username, acptr->host,
- acptr->user->server,
+ acptr->servptr->name,
ConfigFileEntry.gline_min_cidr6,
user, host, reason);
return 0;
sendto_realops_snomask(SNO_GENERAL, L_ALL,
"%s!%s@%s on %s is requesting gline for [%s@%s] [%s]",
acptr->name, acptr->username, acptr->host,
- acptr->user->server, user, host, reason);
+ acptr->servptr->name, user, host, reason);
ilog(L_GLINE, "R %s %s %s %s %s %s %s",
source_p->name, source_p->username, source_p->host,
- source_p->user->server, user, host, reason);
+ source_p->servptr->name, user, host, reason);
/* If at least 3 opers agree this user should be G lined then do it */
majority_gline(acptr, user, host, reason);
acptr->name, user, host, reason);
sendto_server(client_p, NULL, NOCAPS, CAP_GLN,
":%s GLINE %s %s %s %s %s %s :%s",
- acptr->user->server, acptr->name,
+ acptr->servptr->name, acptr->name,
acptr->username, acptr->host,
- acptr->user->server, user, host, reason);
+ acptr->servptr->name, user, host, reason);
if(!ConfigFileEntry.glines)
return 0;
"%s!%s@%s on %s is requesting a gline without "
"%d non-wildcard characters for [%s@%s] [%s]",
acptr->name, acptr->username,
- acptr->host, acptr->user->server,
+ acptr->host, acptr->servptr->name,
ConfigFileEntry.min_nonwildcard,
user, host, reason);
return 0;
sendto_realops_snomask(SNO_GENERAL, L_ALL,
"%s!%s@%s on %s is requesting gline for [%s@%s] [%s]",
acptr->name, acptr->username, acptr->host,
- acptr->user->server, user, host, reason);
+ acptr->servptr->name, user, host, reason);
ilog(L_GLINE, "R %s %s %s %s %s %s %s",
acptr->name, acptr->username, acptr->host,
- acptr->user->server, user, host, reason);
+ acptr->servptr->name, user, host, reason);
/* If at least 3 opers agree this user should be G lined then do it */
majority_gline(acptr, user, host, reason);
get_oper_name(source_p), user, host);
ilog(L_GLINE, "U %s %s %s %s %s %s",
source_p->name, source_p->username, source_p->host,
- source_p->user->server, user, host);
+ source_p->servptr->name, user, host);
}
else
{
oper_reason++;
if(!EmptyString(oper_reason))
- DupString(aconf->spasswd, oper_reason);
+ aconf->spasswd = rb_strdup(oper_reason);
}
- ircsnprintf(buffer, sizeof(buffer), "%s (%s)", reason, current_date);
+ rb_snprintf(buffer, sizeof(buffer), "%s (%s)", reason, current_date);
- DupString(aconf->passwd, buffer);
- DupString(aconf->user, user);
- DupString(aconf->host, host);
- aconf->hold = CurrentTime + ConfigFileEntry.gline_time;
+ aconf->passwd = rb_strdup(buffer);
+ aconf->user = rb_strdup(user);
+ aconf->host = rb_strdup(host);
+ aconf->hold = rb_current_time() + ConfigFileEntry.gline_time;
add_gline(aconf);
sendto_realops_snomask(SNO_GENERAL, L_ALL,
"%s!%s@%s on %s has triggered gline for [%s@%s] [%s]",
source_p->name, source_p->username,
- source_p->host, source_p->user->server,
+ source_p->host, source_p->servptr->name,
user, host, reason);
ilog(L_GLINE, "T %s %s %s %s %s %s %s",
source_p->name, source_p->username, source_p->host,
- source_p->user->server, user, host, reason);
+ source_p->servptr->name, user, host, reason);
check_glines();
}
majority_gline(struct Client *source_p, const char *user,
const char *host, const char *reason)
{
- dlink_node *pending_node;
+ rb_dlink_node *pending_node;
struct gline_pending *pending;
/* to avoid desync.. --fl */
if(find_is_glined(host, user))
return NO;
- DLINK_FOREACH(pending_node, pending_glines.head)
+ RB_DLINK_FOREACH(pending_node, pending_glines.head)
{
pending = pending_node->data;
sendto_realops_snomask(SNO_GENERAL, L_ALL, "oper has already voted");
return NO;
}
- else if(irccmp(pending->oper_server1, source_p->user->server) == 0)
+ else if(irccmp(pending->oper_server1, source_p->servptr->name) == 0)
{
sendto_realops_snomask(SNO_GENERAL, L_ALL, "server has already voted");
return NO;
"oper has already voted");
return NO;
}
- else if(irccmp(pending->oper_server2, source_p->user->server) == 0)
+ else if(irccmp(pending->oper_server2, source_p->servptr->name) == 0)
{
sendto_realops_snomask(SNO_GENERAL, L_ALL,
"server has already voted");
sizeof(pending->oper_user2));
strlcpy(pending->oper_host2, source_p->host,
sizeof(pending->oper_host2));
- DupString(pending->reason2, reason);
- pending->oper_server2 = find_or_add(source_p->user->server);
- pending->last_gline_time = CurrentTime;
- pending->time_request2 = CurrentTime;
+ pending->reason2 = rb_strdup(reason);
+ pending->oper_server2 = scache_get_name(source_p->servptr->serv->nameinfo);
+ pending->last_gline_time = rb_current_time();
+ pending->time_request2 = rb_current_time();
return NO;
}
}
/* no pending gline, create a new one */
pending = (struct gline_pending *)
- MyMalloc(sizeof(struct gline_pending));
+ rb_malloc(sizeof(struct gline_pending));
strlcpy(pending->oper_nick1, source_p->name,
sizeof(pending->oper_nick1));
strlcpy(pending->oper_host1, source_p->host,
sizeof(pending->oper_host1));
- pending->oper_server1 = find_or_add(source_p->user->server);
+ pending->oper_server1 = scache_get_name(source_p->servptr->serv->nameinfo);
strlcpy(pending->user, user, sizeof(pending->user));
strlcpy(pending->host, host, sizeof(pending->host));
- DupString(pending->reason1, reason);
+ pending->reason1 = rb_strdup(reason);
pending->reason2 = NULL;
- pending->last_gline_time = CurrentTime;
- pending->time_request1 = CurrentTime;
+ pending->last_gline_time = rb_current_time();
+ pending->time_request1 = rb_current_time();
- dlinkAddAlloc(pending, &pending_glines);
+ rb_dlinkAddAlloc(pending, &pending_glines);
return NO;
}
remove_temp_gline(const char *user, const char *host)
{
struct ConfItem *aconf;
- dlink_node *ptr;
- struct irc_sockaddr_storage addr, caddr;
+ rb_dlink_node *ptr;
+ struct rb_sockaddr_storage addr, caddr;
int bits, cbits;
int mtype, gtype;
mtype = parse_netmask(host, (struct sockaddr *)&addr, &bits);
- DLINK_FOREACH(ptr, glines.head)
+ RB_DLINK_FOREACH(ptr, glines.head)
{
aconf = ptr->data;
(struct sockaddr *)&caddr, bits))
continue;
- dlinkDestroy(ptr, &glines);
+ rb_dlinkDestroy(ptr, &glines);
+ remove_reject_mask(aconf->user, aconf->host);
delete_one_address_conf(aconf->host, aconf);
return YES;
}