Use opernames not servernames for remote opers
This commit is contained in:
parent
99b8e2feea
commit
e5e814b3db
3 changed files with 12 additions and 39 deletions
|
@ -397,7 +397,7 @@ extern void conf_add_class(struct ConfItem *, int);
|
|||
extern void conf_add_d_conf(struct ConfItem *);
|
||||
extern void flush_expired_ips(void *);
|
||||
|
||||
extern char *get_oper_name(struct Client *client_p);
|
||||
extern const char *get_oper_name(struct Client *client_p);
|
||||
|
||||
extern int yylex(void);
|
||||
|
||||
|
|
|
@ -1288,26 +1288,22 @@ reorganise_temp_kd(void *list)
|
|||
/* const char* get_oper_name(struct Client *client_p)
|
||||
* Input: A client to find the active oper{} name for.
|
||||
* Output: The nick!user@host{oper} of the oper.
|
||||
* "oper" is server name for remote opers
|
||||
* "oper" is server name for unknown opers
|
||||
* Side effects: None.
|
||||
*/
|
||||
char *
|
||||
const char *
|
||||
get_oper_name(struct Client *client_p)
|
||||
{
|
||||
/* +5 for !,@,{,} and null */
|
||||
static char buffer[NAMELEN + USERLEN + HOSTLEN + HOSTLEN + 5];
|
||||
static char buffer[NAMELEN + USERLEN + HOSTLEN + MAX(HOSTLEN, OPERNICKLEN) + 5];
|
||||
|
||||
if(MyOper(client_p))
|
||||
{
|
||||
snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}",
|
||||
client_p->name, client_p->username,
|
||||
client_p->host, client_p->user->opername);
|
||||
return buffer;
|
||||
}
|
||||
const char *opername = EmptyString(client_p->user->opername)
|
||||
? client_p->servptr->name
|
||||
: client_p->user->opername;
|
||||
|
||||
snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}",
|
||||
client_p->name, client_p->username,
|
||||
client_p->host, client_p->servptr->name);
|
||||
snprintf(buffer, sizeof buffer, "%s!%s@%s{%s}",
|
||||
client_p->name, client_p->username,
|
||||
client_p->host, opername);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
|
|
@ -474,13 +474,8 @@ burst_ban(struct Client *client_p)
|
|||
{
|
||||
rb_dlink_node *ptr;
|
||||
struct ConfItem *aconf;
|
||||
const char *type, *oper;
|
||||
/* +5 for !,@,{,} and null */
|
||||
char operbuf[NICKLEN + USERLEN + HOSTLEN + HOSTLEN + 5];
|
||||
char *p;
|
||||
size_t melen;
|
||||
const char *type;
|
||||
|
||||
melen = strlen(me.name);
|
||||
RB_DLINK_FOREACH(ptr, prop_bans.head)
|
||||
{
|
||||
aconf = ptr->data;
|
||||
|
@ -498,24 +493,6 @@ burst_ban(struct Client *client_p)
|
|||
default:
|
||||
continue;
|
||||
}
|
||||
oper = aconf->info.oper;
|
||||
if(aconf->flags & CONF_FLAGS_MYOPER)
|
||||
{
|
||||
/* Our operator{} names may not be meaningful
|
||||
* to other servers, so rewrite to our server
|
||||
* name.
|
||||
*/
|
||||
rb_strlcpy(operbuf, aconf->info.oper, sizeof operbuf);
|
||||
p = strrchr(operbuf, '{');
|
||||
if (p != NULL &&
|
||||
operbuf + sizeof operbuf - p > (ptrdiff_t)(melen + 2))
|
||||
{
|
||||
memcpy(p + 1, me.name, melen);
|
||||
p[melen + 1] = '}';
|
||||
p[melen + 2] = '\0';
|
||||
oper = operbuf;
|
||||
}
|
||||
}
|
||||
sendto_one(client_p, ":%s BAN %s %s %s %lu %d %d %s :%s%s%s",
|
||||
me.id,
|
||||
type,
|
||||
|
@ -523,7 +500,7 @@ burst_ban(struct Client *client_p)
|
|||
(unsigned long)aconf->created,
|
||||
(int)(aconf->hold - aconf->created),
|
||||
(int)(aconf->lifetime - aconf->created),
|
||||
oper,
|
||||
aconf->info.oper,
|
||||
aconf->passwd,
|
||||
aconf->spasswd ? "|" : "",
|
||||
aconf->spasswd ? aconf->spasswd : "");
|
||||
|
|
Loading…
Reference in a new issue