Allow privset-less OPER bursting
This commit is contained in:
parent
53b209c748
commit
eeaea74616
2 changed files with 35 additions and 20 deletions
|
@ -622,11 +622,18 @@ burst_TS6(struct Client *client_p)
|
|||
use_id(target_p),
|
||||
target_p->user->away);
|
||||
|
||||
if(IsOper(target_p) && target_p->user && target_p->user->opername && target_p->user->privset)
|
||||
if (IsOper(target_p) && target_p->user && target_p->user->opername)
|
||||
{
|
||||
if (target_p->user->privset)
|
||||
sendto_one(client_p, ":%s OPER %s %s",
|
||||
use_id(target_p),
|
||||
target_p->user->opername,
|
||||
target_p->user->privset->name);
|
||||
else
|
||||
sendto_one(client_p, ":%s OPER %s",
|
||||
use_id(target_p),
|
||||
target_p->user->opername);
|
||||
}
|
||||
|
||||
hclientinfo.target = target_p;
|
||||
call_hook(h_burst_client, &hclientinfo);
|
||||
|
|
|
@ -49,7 +49,7 @@ static bool match_oper_password(const char *password, struct oper_conf *oper_p);
|
|||
|
||||
struct Message oper_msgtab = {
|
||||
"OPER", 0, 0, 0, 0,
|
||||
{mg_unreg, {m_oper, 3}, {mc_oper, 3}, mg_ignore, {me_oper, 2}, {m_oper, 3}}
|
||||
{mg_unreg, {m_oper, 3}, {mc_oper, 2}, mg_ignore, {me_oper, 2}, {m_oper, 3}}
|
||||
};
|
||||
|
||||
mapi_clist_av1 oper_clist[] = { &oper_msgtab, NULL };
|
||||
|
@ -185,6 +185,9 @@ static void
|
|||
mc_oper(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||
{
|
||||
struct PrivilegeSet *privset;
|
||||
|
||||
if (parc >= 3)
|
||||
{
|
||||
sendto_server(client_p, NULL, CAP_TS6, NOCAPS, ":%s OPER %s %s", use_id(source_p), parv[1], parv[2]);
|
||||
|
||||
privset = privilegeset_get(parv[2]);
|
||||
|
@ -202,6 +205,11 @@ mc_oper(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
|||
privilegeset_unref(source_p->user->privset);
|
||||
|
||||
source_p->user->privset = privset;
|
||||
}
|
||||
else
|
||||
{
|
||||
sendto_server(client_p, NULL, CAP_TS6, NOCAPS, ":%s OPER %s", use_id(source_p), parv[1]);
|
||||
}
|
||||
|
||||
rb_free(source_p->user->opername);
|
||||
source_p->user->opername = rb_strdup(parv[1]);
|
||||
|
|
Loading…
Reference in a new issue