diff --git a/ircd/s_serv.c b/ircd/s_serv.c index 210ed8b1..7ce1daf2 100644 --- a/ircd/s_serv.c +++ b/ircd/s_serv.c @@ -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) - sendto_one(client_p, ":%s OPER %s %s", - use_id(target_p), - target_p->user->opername, - target_p->user->privset->name); + 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); diff --git a/modules/m_oper.c b/modules/m_oper.c index baafe070..4c734f7c 100644 --- a/modules/m_oper.c +++ b/modules/m_oper.c @@ -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,23 +185,31 @@ static void mc_oper(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { struct PrivilegeSet *privset; - 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]); - if(privset == NULL) + if (parc >= 3) { - /* if we don't have a matching privset, we'll create an empty one and - * mark it illegal, so it gets picked up on a rehash later */ - sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "Received OPER for %s with unknown privset %s", source_p->name, parv[2]); - privset = privilegeset_set_new(parv[2], "", 0); - privset->status |= CONF_ILLEGAL; + 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]); + if(privset == NULL) + { + /* if we don't have a matching privset, we'll create an empty one and + * mark it illegal, so it gets picked up on a rehash later */ + sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "Received OPER for %s with unknown privset %s", source_p->name, parv[2]); + privset = privilegeset_set_new(parv[2], "", 0); + privset->status |= CONF_ILLEGAL; + } + + privset = privilegeset_ref(privset); + if (source_p->user->privset != NULL) + 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]); } - - privset = privilegeset_ref(privset); - if (source_p->user->privset != NULL) - privilegeset_unref(source_p->user->privset); - - source_p->user->privset = privset; rb_free(source_p->user->opername); source_p->user->opername = rb_strdup(parv[1]);