Track who set a dline/kline/xline/resv as in ratbox3.
Like in ratbox3, there is no way to query this information (other than bandb's tables, but they worked before this commit).
This commit is contained in:
parent
3d242eb30f
commit
27f616ddf5
15 changed files with 193 additions and 24 deletions
|
@ -91,7 +91,7 @@ mr_webirc(struct Client *client_p, struct Client *source_p, int parc, const char
|
||||||
client_p->localClient->ip.ss_family, NULL);
|
client_p->localClient->ip.ss_family, NULL);
|
||||||
if (aconf == NULL || !(aconf->status & CONF_CLIENT))
|
if (aconf == NULL || !(aconf->status & CONF_CLIENT))
|
||||||
return 0;
|
return 0;
|
||||||
if (!IsConfDoSpoofIp(aconf) || irccmp(aconf->name, "webirc."))
|
if (!IsConfDoSpoofIp(aconf) || irccmp(aconf->info.name, "webirc."))
|
||||||
{
|
{
|
||||||
/* XXX */
|
/* XXX */
|
||||||
sendto_one(source_p, "NOTICE * :Not a CGI:IRC auth block");
|
sendto_one(source_p, "NOTICE * :Not a CGI:IRC auth block");
|
||||||
|
|
15
include/operhash.h
Normal file
15
include/operhash.h
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#ifndef INCLUDED_operhash_h
|
||||||
|
#define INCLUDED_operhash_h
|
||||||
|
|
||||||
|
struct operhash_entry
|
||||||
|
{
|
||||||
|
char *name;
|
||||||
|
int refcount;
|
||||||
|
};
|
||||||
|
|
||||||
|
void init_operhash(void);
|
||||||
|
const char *operhash_add(const char *name);
|
||||||
|
const char *operhash_find(const char *name);
|
||||||
|
void operhash_delete(const char *name);
|
||||||
|
|
||||||
|
#endif
|
|
@ -60,7 +60,11 @@ struct ConfItem
|
||||||
unsigned int status; /* If CONF_ILLEGAL, delete when no clients */
|
unsigned int status; /* If CONF_ILLEGAL, delete when no clients */
|
||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
int clients; /* Number of *LOCAL* clients using this */
|
int clients; /* Number of *LOCAL* clients using this */
|
||||||
|
union
|
||||||
|
{
|
||||||
char *name; /* IRC name, nick, server name, or original u@h */
|
char *name; /* IRC name, nick, server name, or original u@h */
|
||||||
|
const char *oper;
|
||||||
|
} info;
|
||||||
char *host; /* host part of user@host */
|
char *host; /* host part of user@host */
|
||||||
char *passwd; /* doubles as kline reason *ugh* */
|
char *passwd; /* doubles as kline reason *ugh* */
|
||||||
char *spasswd; /* Password to send. */
|
char *spasswd; /* Password to send. */
|
||||||
|
@ -110,6 +114,9 @@ struct ConfItem
|
||||||
|
|
||||||
|
|
||||||
/* Macros for struct ConfItem */
|
/* Macros for struct ConfItem */
|
||||||
|
#define IsConfBan(x) ((x)->status & (CONF_KILL|CONF_XLINE|CONF_DLINE|\
|
||||||
|
CONF_RESV_CHANNEL|CONF_RESV_NICK))
|
||||||
|
|
||||||
#define IsNoTilde(x) ((x)->flags & CONF_FLAGS_NO_TILDE)
|
#define IsNoTilde(x) ((x)->flags & CONF_FLAGS_NO_TILDE)
|
||||||
#define IsNeedIdentd(x) ((x)->flags & CONF_FLAGS_NEED_IDENTD)
|
#define IsNeedIdentd(x) ((x)->flags & CONF_FLAGS_NEED_IDENTD)
|
||||||
#define IsConfExemptKline(x) ((x)->flags & CONF_FLAGS_EXEMPTKLINE)
|
#define IsConfExemptKline(x) ((x)->flags & CONF_FLAGS_EXEMPTKLINE)
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
#include "parse.h"
|
#include "parse.h"
|
||||||
#include "modules.h"
|
#include "modules.h"
|
||||||
#include "bandbi.h"
|
#include "bandbi.h"
|
||||||
|
#include "operhash.h"
|
||||||
|
|
||||||
static int mo_dline(struct Client *, struct Client *, int, const char **);
|
static int mo_dline(struct Client *, struct Client *, int, const char **);
|
||||||
static int me_dline(struct Client *, struct Client *, int, const char **);
|
static int me_dline(struct Client *, struct Client *, int, const char **);
|
||||||
|
@ -289,6 +290,7 @@ apply_dline(struct Client *source_p, const char *dlhost, int tdline_time, char *
|
||||||
aconf->created = rb_current_time();
|
aconf->created = rb_current_time();
|
||||||
aconf->host = rb_strdup(dlhost);
|
aconf->host = rb_strdup(dlhost);
|
||||||
aconf->passwd = rb_strdup(reason);
|
aconf->passwd = rb_strdup(reason);
|
||||||
|
aconf->info.oper = operhash_add(get_oper_name(source_p));
|
||||||
|
|
||||||
/* Look for an oper reason */
|
/* Look for an oper reason */
|
||||||
if((oper_reason = strchr(reason, '|')) != NULL)
|
if((oper_reason = strchr(reason, '|')) != NULL)
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#include "modules.h"
|
#include "modules.h"
|
||||||
#include "reject.h"
|
#include "reject.h"
|
||||||
#include "bandbi.h"
|
#include "bandbi.h"
|
||||||
|
#include "operhash.h"
|
||||||
|
|
||||||
static int mo_kline(struct Client *, struct Client *, int, const char **);
|
static int mo_kline(struct Client *, struct Client *, int, const char **);
|
||||||
static int ms_kline(struct Client *, struct Client *, int, const char **);
|
static int ms_kline(struct Client *, struct Client *, int, const char **);
|
||||||
|
@ -174,6 +175,7 @@ mo_kline(struct Client *client_p, struct Client *source_p, int parc, const char
|
||||||
aconf->user = rb_strdup(user);
|
aconf->user = rb_strdup(user);
|
||||||
aconf->port = 0;
|
aconf->port = 0;
|
||||||
aconf->passwd = rb_strdup(reason);
|
aconf->passwd = rb_strdup(reason);
|
||||||
|
aconf->info.oper = operhash_add(get_oper_name(source_p));
|
||||||
|
|
||||||
/* Look for an oper reason */
|
/* Look for an oper reason */
|
||||||
if((oper_reason = strchr(reason, '|')) != NULL)
|
if((oper_reason = strchr(reason, '|')) != NULL)
|
||||||
|
@ -276,6 +278,7 @@ handle_remote_kline(struct Client *source_p, int tkline_time,
|
||||||
aconf->user = rb_strdup(user);
|
aconf->user = rb_strdup(user);
|
||||||
aconf->host = rb_strdup(host);
|
aconf->host = rb_strdup(host);
|
||||||
aconf->passwd = rb_strdup(reason);
|
aconf->passwd = rb_strdup(reason);
|
||||||
|
aconf->info.oper = operhash_add(get_oper_name(source_p));
|
||||||
|
|
||||||
/* Look for an oper reason */
|
/* Look for an oper reason */
|
||||||
if((oper_reason = strchr(reason, '|')) != NULL)
|
if((oper_reason = strchr(reason, '|')) != NULL)
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include "hash.h"
|
#include "hash.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
#include "bandbi.h"
|
#include "bandbi.h"
|
||||||
|
#include "operhash.h"
|
||||||
|
|
||||||
static int mo_resv(struct Client *, struct Client *, int, const char **);
|
static int mo_resv(struct Client *, struct Client *, int, const char **);
|
||||||
static int ms_resv(struct Client *, struct Client *, int, const char **);
|
static int ms_resv(struct Client *, struct Client *, int, const char **);
|
||||||
|
@ -221,6 +222,7 @@ parse_resv(struct Client *source_p, const char *name, const char *reason, int te
|
||||||
aconf->created = rb_current_time();
|
aconf->created = rb_current_time();
|
||||||
aconf->host = rb_strdup(name);
|
aconf->host = rb_strdup(name);
|
||||||
aconf->passwd = rb_strdup(reason);
|
aconf->passwd = rb_strdup(reason);
|
||||||
|
aconf->info.oper = operhash_add(get_oper_name(source_p));
|
||||||
add_to_resv_hash(aconf->host, aconf);
|
add_to_resv_hash(aconf->host, aconf);
|
||||||
resv_chan_forcepart(aconf->host, aconf->passwd, temp_time);
|
resv_chan_forcepart(aconf->host, aconf->passwd, temp_time);
|
||||||
|
|
||||||
|
@ -285,6 +287,7 @@ parse_resv(struct Client *source_p, const char *name, const char *reason, int te
|
||||||
aconf->created = rb_current_time();
|
aconf->created = rb_current_time();
|
||||||
aconf->host = rb_strdup(name);
|
aconf->host = rb_strdup(name);
|
||||||
aconf->passwd = rb_strdup(reason);
|
aconf->passwd = rb_strdup(reason);
|
||||||
|
aconf->info.oper = operhash_add(get_oper_name(source_p));
|
||||||
rb_dlinkAddAlloc(aconf, &resv_conf_list);
|
rb_dlinkAddAlloc(aconf, &resv_conf_list);
|
||||||
|
|
||||||
if(temp_time > 0)
|
if(temp_time > 0)
|
||||||
|
|
|
@ -218,7 +218,7 @@ mo_testline(struct Client *client_p, struct Client *source_p, int parc, const ch
|
||||||
if(aconf && aconf->status & CONF_CLIENT)
|
if(aconf && aconf->status & CONF_CLIENT)
|
||||||
{
|
{
|
||||||
sendto_one_numeric(source_p, RPL_STATSILINE, form_str(RPL_STATSILINE),
|
sendto_one_numeric(source_p, RPL_STATSILINE, form_str(RPL_STATSILINE),
|
||||||
aconf->name, EmptyString(aconf->spasswd) ? "<NULL>" : aconf->spasswd,
|
aconf->info.name, EmptyString(aconf->spasswd) ? "<NULL>" : aconf->spasswd,
|
||||||
show_iline_prefix(source_p, aconf, aconf->user),
|
show_iline_prefix(source_p, aconf, aconf->user),
|
||||||
aconf->host, aconf->port, aconf->className);
|
aconf->host, aconf->port, aconf->className);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -51,6 +51,7 @@
|
||||||
#include "s_newconf.h"
|
#include "s_newconf.h"
|
||||||
#include "reject.h"
|
#include "reject.h"
|
||||||
#include "bandbi.h"
|
#include "bandbi.h"
|
||||||
|
#include "operhash.h"
|
||||||
|
|
||||||
static int mo_xline(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
|
static int mo_xline(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
|
||||||
static int ms_xline(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
|
static int ms_xline(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
|
||||||
|
@ -280,6 +281,8 @@ apply_xline(struct Client *source_p, const char *name, const char *reason, int t
|
||||||
aconf->passwd = rb_strdup(reason);
|
aconf->passwd = rb_strdup(reason);
|
||||||
collapse(aconf->host);
|
collapse(aconf->host);
|
||||||
|
|
||||||
|
aconf->info.oper = operhash_add(get_oper_name(source_p));
|
||||||
|
|
||||||
if(temp_time > 0)
|
if(temp_time > 0)
|
||||||
{
|
{
|
||||||
aconf->hold = rb_current_time() + temp_time;
|
aconf->hold = rb_current_time() + temp_time;
|
||||||
|
|
|
@ -76,6 +76,7 @@ SRCS = \
|
||||||
monitor.c \
|
monitor.c \
|
||||||
newconf.c \
|
newconf.c \
|
||||||
numeric.c \
|
numeric.c \
|
||||||
|
operhash.c \
|
||||||
packet.c \
|
packet.c \
|
||||||
parse.c \
|
parse.c \
|
||||||
privilege.c \
|
privilege.c \
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
#include "send.h"
|
#include "send.h"
|
||||||
#include "ircd.h"
|
#include "ircd.h"
|
||||||
#include "msg.h" /* XXX: MAXPARA */
|
#include "msg.h" /* XXX: MAXPARA */
|
||||||
|
#include "operhash.h"
|
||||||
|
|
||||||
static char bandb_add_letter[LAST_BANDB_TYPE] = {
|
static char bandb_add_letter[LAST_BANDB_TYPE] = {
|
||||||
'K', 'D', 'X', 'R'
|
'K', 'D', 'X', 'R'
|
||||||
|
@ -170,8 +171,7 @@ bandb_handle_ban(char *parv[], int parc)
|
||||||
aconf->user = rb_strdup(parv[para++]);
|
aconf->user = rb_strdup(parv[para++]);
|
||||||
|
|
||||||
aconf->host = rb_strdup(parv[para++]);
|
aconf->host = rb_strdup(parv[para++]);
|
||||||
/* We do not have the 'oper' field yet. */
|
aconf->info.oper = operhash_add(parv[para++]);
|
||||||
para++;
|
|
||||||
|
|
||||||
switch (parv[0][0])
|
switch (parv[0][0])
|
||||||
{
|
{
|
||||||
|
|
|
@ -390,7 +390,7 @@ find_address_conf(const char *host, const char *sockhost, const char *user,
|
||||||
/* if theres a spoof, check it against klines.. */
|
/* if theres a spoof, check it against klines.. */
|
||||||
if(IsConfDoSpoofIp(iconf))
|
if(IsConfDoSpoofIp(iconf))
|
||||||
{
|
{
|
||||||
char *p = strchr(iconf->name, '@');
|
char *p = strchr(iconf->info.name, '@');
|
||||||
|
|
||||||
/* note, we dont need to pass sockhost here, as its
|
/* note, we dont need to pass sockhost here, as its
|
||||||
* guaranteed to not match by whats above.. --anfl
|
* guaranteed to not match by whats above.. --anfl
|
||||||
|
@ -398,11 +398,11 @@ find_address_conf(const char *host, const char *sockhost, const char *user,
|
||||||
if(p)
|
if(p)
|
||||||
{
|
{
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
kconf = find_conf_by_address(p+1, NULL, NULL, ip, CONF_KILL, aftype, iconf->name, NULL);
|
kconf = find_conf_by_address(p+1, NULL, NULL, ip, CONF_KILL, aftype, iconf->info.name, NULL);
|
||||||
*p = '@';
|
*p = '@';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
kconf = find_conf_by_address(iconf->name, NULL, NULL, ip, CONF_KILL, aftype, vuser, NULL);
|
kconf = find_conf_by_address(iconf->info.name, NULL, NULL, ip, CONF_KILL, aftype, vuser, NULL);
|
||||||
|
|
||||||
if(kconf)
|
if(kconf)
|
||||||
return kconf;
|
return kconf;
|
||||||
|
|
|
@ -902,8 +902,8 @@ conf_end_auth(struct TopConf *tc)
|
||||||
rb_dlink_node *ptr;
|
rb_dlink_node *ptr;
|
||||||
rb_dlink_node *next_ptr;
|
rb_dlink_node *next_ptr;
|
||||||
|
|
||||||
if(EmptyString(yy_aconf->name))
|
if(EmptyString(yy_aconf->info.name))
|
||||||
yy_aconf->name = rb_strdup("NOMATCH");
|
yy_aconf->info.name = rb_strdup("NOMATCH");
|
||||||
|
|
||||||
/* didnt even get one ->host? */
|
/* didnt even get one ->host? */
|
||||||
if(EmptyString(yy_aconf->host))
|
if(EmptyString(yy_aconf->host))
|
||||||
|
@ -937,7 +937,7 @@ conf_end_auth(struct TopConf *tc)
|
||||||
yy_tmp->spasswd = rb_strdup(yy_aconf->spasswd);
|
yy_tmp->spasswd = rb_strdup(yy_aconf->spasswd);
|
||||||
|
|
||||||
/* this will always exist.. */
|
/* this will always exist.. */
|
||||||
yy_tmp->name = rb_strdup(yy_aconf->name);
|
yy_tmp->info.name = rb_strdup(yy_aconf->info.name);
|
||||||
|
|
||||||
if(yy_aconf->className)
|
if(yy_aconf->className)
|
||||||
yy_tmp->className = rb_strdup(yy_aconf->className);
|
yy_tmp->className = rb_strdup(yy_aconf->className);
|
||||||
|
@ -1070,8 +1070,8 @@ conf_set_auth_spoof(void *data)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rb_free(yy_aconf->name);
|
rb_free(yy_aconf->info.name);
|
||||||
yy_aconf->name = rb_strdup(data);
|
yy_aconf->info.name = rb_strdup(data);
|
||||||
yy_aconf->flags |= CONF_FLAGS_SPOOF_IP;
|
yy_aconf->flags |= CONF_FLAGS_SPOOF_IP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1087,8 +1087,8 @@ static void
|
||||||
conf_set_auth_redir_serv(void *data)
|
conf_set_auth_redir_serv(void *data)
|
||||||
{
|
{
|
||||||
yy_aconf->flags |= CONF_FLAGS_REDIR;
|
yy_aconf->flags |= CONF_FLAGS_REDIR;
|
||||||
rb_free(yy_aconf->name);
|
rb_free(yy_aconf->info.name);
|
||||||
yy_aconf->name = rb_strdup(data);
|
yy_aconf->info.name = rb_strdup(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
130
src/operhash.c
Normal file
130
src/operhash.c
Normal file
|
@ -0,0 +1,130 @@
|
||||||
|
/* ircd-ratbox: an advanced Internet Relay Chat Daemon(ircd).
|
||||||
|
* operhash.c - Hashes nick!user@host{oper}
|
||||||
|
*
|
||||||
|
* Copyright (C) 2005 Lee Hardy <lee -at- leeh.co.uk>
|
||||||
|
* Copyright (C) 2005 ircd-ratbox development team
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are
|
||||||
|
* met:
|
||||||
|
*
|
||||||
|
* 1.Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2.Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3.The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||||
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||||
|
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* $Id: operhash.c 26094 2008-09-19 15:33:46Z androsyn $
|
||||||
|
*/
|
||||||
|
#include <ratbox_lib.h>
|
||||||
|
#include "stdinc.h"
|
||||||
|
#include "match.h"
|
||||||
|
#include "hash.h"
|
||||||
|
#include "operhash.h"
|
||||||
|
|
||||||
|
#define OPERHASH_MAX_BITS 7
|
||||||
|
#define OPERHASH_MAX (1<<OPERHASH_MAX_BITS)
|
||||||
|
|
||||||
|
#define hash_opername(x) fnv_hash_upper((const unsigned char *)(x), OPERHASH_MAX_BITS)
|
||||||
|
|
||||||
|
static rb_dlink_list operhash_table[OPERHASH_MAX];
|
||||||
|
|
||||||
|
const char *
|
||||||
|
operhash_add(const char *name)
|
||||||
|
{
|
||||||
|
struct operhash_entry *ohash;
|
||||||
|
unsigned int hashv;
|
||||||
|
rb_dlink_node *ptr;
|
||||||
|
|
||||||
|
if(EmptyString(name))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
hashv = hash_opername(name);
|
||||||
|
|
||||||
|
RB_DLINK_FOREACH(ptr, operhash_table[hashv].head)
|
||||||
|
{
|
||||||
|
ohash = ptr->data;
|
||||||
|
|
||||||
|
if(!irccmp(ohash->name, name))
|
||||||
|
{
|
||||||
|
ohash->refcount++;
|
||||||
|
return ohash->name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ohash = rb_malloc(sizeof(struct operhash_entry));
|
||||||
|
ohash->refcount = 1;
|
||||||
|
ohash->name = rb_strdup(name);
|
||||||
|
|
||||||
|
rb_dlinkAddAlloc(ohash, &operhash_table[hashv]);
|
||||||
|
|
||||||
|
return ohash->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
operhash_find(const char *name)
|
||||||
|
{
|
||||||
|
struct operhash_entry *ohash;
|
||||||
|
unsigned int hashv;
|
||||||
|
rb_dlink_node *ptr;
|
||||||
|
|
||||||
|
if(EmptyString(name))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
hashv = hash_opername(name);
|
||||||
|
|
||||||
|
RB_DLINK_FOREACH(ptr, operhash_table[hashv].head)
|
||||||
|
{
|
||||||
|
ohash = ptr->data;
|
||||||
|
|
||||||
|
if(!irccmp(ohash->name, name))
|
||||||
|
return ohash->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
operhash_delete(const char *name)
|
||||||
|
{
|
||||||
|
struct operhash_entry *ohash;
|
||||||
|
unsigned int hashv;
|
||||||
|
rb_dlink_node *ptr;
|
||||||
|
|
||||||
|
if(EmptyString(name))
|
||||||
|
return;
|
||||||
|
|
||||||
|
hashv = hash_opername(name);
|
||||||
|
|
||||||
|
RB_DLINK_FOREACH(ptr, operhash_table[hashv].head)
|
||||||
|
{
|
||||||
|
ohash = ptr->data;
|
||||||
|
|
||||||
|
if(irccmp(ohash->name, name))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
ohash->refcount--;
|
||||||
|
|
||||||
|
if(ohash->refcount == 0)
|
||||||
|
{
|
||||||
|
rb_free(ohash->name);
|
||||||
|
rb_free(ohash);
|
||||||
|
rb_dlinkDestroy(ptr, &operhash_table[hashv]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
21
src/s_conf.c
21
src/s_conf.c
|
@ -50,6 +50,7 @@
|
||||||
#include "privilege.h"
|
#include "privilege.h"
|
||||||
#include "sslproc.h"
|
#include "sslproc.h"
|
||||||
#include "bandbi.h"
|
#include "bandbi.h"
|
||||||
|
#include "operhash.h"
|
||||||
|
|
||||||
struct config_server_hide ConfigServerHide;
|
struct config_server_hide ConfigServerHide;
|
||||||
|
|
||||||
|
@ -142,11 +143,15 @@ free_conf(struct ConfItem *aconf)
|
||||||
|
|
||||||
rb_free(aconf->passwd);
|
rb_free(aconf->passwd);
|
||||||
rb_free(aconf->spasswd);
|
rb_free(aconf->spasswd);
|
||||||
rb_free(aconf->name);
|
|
||||||
rb_free(aconf->className);
|
rb_free(aconf->className);
|
||||||
rb_free(aconf->user);
|
rb_free(aconf->user);
|
||||||
rb_free(aconf->host);
|
rb_free(aconf->host);
|
||||||
|
|
||||||
|
if(IsConfBan(aconf))
|
||||||
|
operhash_delete(aconf->info.oper);
|
||||||
|
else
|
||||||
|
rb_free(aconf->info.name);
|
||||||
|
|
||||||
rb_bh_free(confitem_heap, aconf);
|
rb_bh_free(confitem_heap, aconf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,7 +338,7 @@ verify_access(struct Client *client_p, const char *username)
|
||||||
if(aconf->flags & CONF_FLAGS_REDIR)
|
if(aconf->flags & CONF_FLAGS_REDIR)
|
||||||
{
|
{
|
||||||
sendto_one_numeric(client_p, RPL_REDIR, form_str(RPL_REDIR),
|
sendto_one_numeric(client_p, RPL_REDIR, form_str(RPL_REDIR),
|
||||||
aconf->name ? aconf->name : "", aconf->port);
|
aconf->info.name ? aconf->info.name : "", aconf->port);
|
||||||
return (NOT_AUTHORISED);
|
return (NOT_AUTHORISED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,24 +355,24 @@ verify_access(struct Client *client_p, const char *username)
|
||||||
sendto_realops_snomask(SNO_GENERAL, L_ALL,
|
sendto_realops_snomask(SNO_GENERAL, L_ALL,
|
||||||
"%s spoofing: %s as %s",
|
"%s spoofing: %s as %s",
|
||||||
client_p->name,
|
client_p->name,
|
||||||
show_ip(NULL, client_p) ? client_p->host : aconf->name,
|
show_ip(NULL, client_p) ? client_p->host : aconf->info.name,
|
||||||
aconf->name);
|
aconf->info.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* user@host spoof */
|
/* user@host spoof */
|
||||||
if((p = strchr(aconf->name, '@')) != NULL)
|
if((p = strchr(aconf->info.name, '@')) != NULL)
|
||||||
{
|
{
|
||||||
char *host = p+1;
|
char *host = p+1;
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
|
|
||||||
rb_strlcpy(client_p->username, aconf->name,
|
rb_strlcpy(client_p->username, aconf->info.name,
|
||||||
sizeof(client_p->username));
|
sizeof(client_p->username));
|
||||||
rb_strlcpy(client_p->host, host,
|
rb_strlcpy(client_p->host, host,
|
||||||
sizeof(client_p->host));
|
sizeof(client_p->host));
|
||||||
*p = '@';
|
*p = '@';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
rb_strlcpy(client_p->host, aconf->name, sizeof(client_p->host));
|
rb_strlcpy(client_p->host, aconf->info.name, sizeof(client_p->host));
|
||||||
}
|
}
|
||||||
return (attach_iline(client_p, aconf));
|
return (attach_iline(client_p, aconf));
|
||||||
}
|
}
|
||||||
|
@ -1046,7 +1051,7 @@ get_printable_conf(struct ConfItem *aconf, char **name, char **host,
|
||||||
static char null[] = "<NULL>";
|
static char null[] = "<NULL>";
|
||||||
static char zero[] = "default";
|
static char zero[] = "default";
|
||||||
|
|
||||||
*name = EmptyString(aconf->name) ? null : aconf->name;
|
*name = EmptyString(aconf->info.name) ? null : aconf->info.name;
|
||||||
*host = EmptyString(aconf->host) ? null : aconf->host;
|
*host = EmptyString(aconf->host) ? null : aconf->host;
|
||||||
*pass = EmptyString(aconf->passwd) ? null : aconf->passwd;
|
*pass = EmptyString(aconf->passwd) ? null : aconf->passwd;
|
||||||
*user = EmptyString(aconf->user) ? null : aconf->user;
|
*user = EmptyString(aconf->user) ? null : aconf->user;
|
||||||
|
|
|
@ -336,7 +336,7 @@ register_local_user(struct Client *client_p, struct Client *source_p, const char
|
||||||
}
|
}
|
||||||
|
|
||||||
/* dont replace username if its supposed to be spoofed --fl */
|
/* dont replace username if its supposed to be spoofed --fl */
|
||||||
if(!IsConfDoSpoofIp(aconf) || !strchr(aconf->name, '@'))
|
if(!IsConfDoSpoofIp(aconf) || !strchr(aconf->info.name, '@'))
|
||||||
{
|
{
|
||||||
p = username;
|
p = username;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue