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 conf_add_d_conf(struct ConfItem *);
|
||||||
extern void flush_expired_ips(void *);
|
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);
|
extern int yylex(void);
|
||||||
|
|
||||||
|
|
|
@ -1288,26 +1288,22 @@ reorganise_temp_kd(void *list)
|
||||||
/* const char* get_oper_name(struct Client *client_p)
|
/* const char* get_oper_name(struct Client *client_p)
|
||||||
* Input: A client to find the active oper{} name for.
|
* Input: A client to find the active oper{} name for.
|
||||||
* Output: The nick!user@host{oper} of the oper.
|
* 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.
|
* Side effects: None.
|
||||||
*/
|
*/
|
||||||
char *
|
const char *
|
||||||
get_oper_name(struct Client *client_p)
|
get_oper_name(struct Client *client_p)
|
||||||
{
|
{
|
||||||
/* +5 for !,@,{,} and null */
|
/* +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))
|
const char *opername = EmptyString(client_p->user->opername)
|
||||||
{
|
? client_p->servptr->name
|
||||||
snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}",
|
: client_p->user->opername;
|
||||||
client_p->name, client_p->username,
|
|
||||||
client_p->host, client_p->user->opername);
|
|
||||||
return buffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}",
|
snprintf(buffer, sizeof buffer, "%s!%s@%s{%s}",
|
||||||
client_p->name, client_p->username,
|
client_p->name, client_p->username,
|
||||||
client_p->host, client_p->servptr->name);
|
client_p->host, opername);
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -474,13 +474,8 @@ burst_ban(struct Client *client_p)
|
||||||
{
|
{
|
||||||
rb_dlink_node *ptr;
|
rb_dlink_node *ptr;
|
||||||
struct ConfItem *aconf;
|
struct ConfItem *aconf;
|
||||||
const char *type, *oper;
|
const char *type;
|
||||||
/* +5 for !,@,{,} and null */
|
|
||||||
char operbuf[NICKLEN + USERLEN + HOSTLEN + HOSTLEN + 5];
|
|
||||||
char *p;
|
|
||||||
size_t melen;
|
|
||||||
|
|
||||||
melen = strlen(me.name);
|
|
||||||
RB_DLINK_FOREACH(ptr, prop_bans.head)
|
RB_DLINK_FOREACH(ptr, prop_bans.head)
|
||||||
{
|
{
|
||||||
aconf = ptr->data;
|
aconf = ptr->data;
|
||||||
|
@ -498,24 +493,6 @@ burst_ban(struct Client *client_p)
|
||||||
default:
|
default:
|
||||||
continue;
|
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",
|
sendto_one(client_p, ":%s BAN %s %s %s %lu %d %d %s :%s%s%s",
|
||||||
me.id,
|
me.id,
|
||||||
type,
|
type,
|
||||||
|
@ -523,7 +500,7 @@ burst_ban(struct Client *client_p)
|
||||||
(unsigned long)aconf->created,
|
(unsigned long)aconf->created,
|
||||||
(int)(aconf->hold - aconf->created),
|
(int)(aconf->hold - aconf->created),
|
||||||
(int)(aconf->lifetime - aconf->created),
|
(int)(aconf->lifetime - aconf->created),
|
||||||
oper,
|
aconf->info.oper,
|
||||||
aconf->passwd,
|
aconf->passwd,
|
||||||
aconf->spasswd ? "|" : "",
|
aconf->spasswd ? "|" : "",
|
||||||
aconf->spasswd ? aconf->spasswd : "");
|
aconf->spasswd ? aconf->spasswd : "");
|
||||||
|
|
Loading…
Reference in a new issue