X-Git-Url: https://jfr.im/git/solanum.git/blobdiff_plain/7b7e1640ded40f58f8d6242e35edbc5deb2bc924..b2c208be091670e3c5259eba77187bae6ac6eece:/modules/m_privs.c diff --git a/modules/m_privs.c b/modules/m_privs.c index 35c2f10e..f6a32891 100644 --- a/modules/m_privs.c +++ b/modules/m_privs.c @@ -40,12 +40,13 @@ #include "s_conf.h" #include "s_newconf.h" +static int m_privs(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static int me_privs(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); static int mo_privs(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]); struct Message privs_msgtab = { "PRIVS", 0, 0, 0, MFLG_SLOW, - {mg_unreg, mg_not_oper, mg_ignore, mg_ignore, {me_privs, 0}, {mo_privs, 0}} + {mg_unreg, {m_privs, 0}, mg_ignore, mg_ignore, {me_privs, 0}, {mo_privs, 0}} }; mapi_clist_av1 privs_clist[] = { @@ -60,33 +61,9 @@ struct mode_table int mode; }; -static struct mode_table oper_table[] = { - /*{"encrypted", OPER_ENCRYPTED },*/ - {"local_kill", OPER_LOCKILL }, - {"global_kill", OPER_GLOBKILL/*|OPER_LOCKILL*/ }, - {"remote", OPER_REMOTE }, - {"kline", OPER_KLINE }, - {"unkline", OPER_UNKLINE }, - {"gline", OPER_GLINE }, - {"nick_changes", OPER_NICKS }, - {"rehash", OPER_REHASH }, - {"die", OPER_DIE }, - {"admin", OPER_ADMIN }, - {"hidden_admin", OPER_HADMIN }, - {"xline", OPER_XLINE }, - {"resv", OPER_RESV }, - {"operwall", OPER_OPERWALL }, - {"oper_spy", OPER_SPY }, - {"hidden_oper", OPER_INVIS }, - {"remoteban", OPER_REMOTEBAN }, - {"mass_notice", OPER_MASSNOTICE }, - {NULL, 0} -}; - /* there is no such table like this anywhere else */ static struct mode_table auth_client_table[] = { {"resv_exempt", FLAGS2_EXEMPTRESV }, - {"gline_exempt", FLAGS2_EXEMPTGLINE }, {"kline_exempt", FLAGS2_EXEMPTKLINE }, {"flood_exempt", FLAGS2_EXEMPTFLOOD }, {"spambot_exempt", FLAGS2_EXEMPTSPAMBOT }, @@ -103,23 +80,22 @@ static void show_privs(struct Client *source_p, struct Client *target_p) struct mode_table *p; buf[0] = '\0'; - p = &oper_table[0]; - while (p->name != NULL) + if (target_p->localClient->privset) + rb_strlcat(buf, target_p->localClient->privset->privs, sizeof buf); + if (IsOper(target_p)) { - if (target_p->flags2 & p->mode) + if (buf[0] != '\0') + rb_strlcat(buf, " ", sizeof buf); + rb_strlcat(buf, "operator:", sizeof buf); + rb_strlcat(buf, target_p->localClient->opername, sizeof buf); + + if (target_p->localClient->privset) { if (buf[0] != '\0') - strlcat(buf, " ", sizeof buf); - strlcat(buf, p->name, sizeof buf); + rb_strlcat(buf, " ", sizeof buf); + rb_strlcat(buf, "privset:", sizeof buf); + rb_strlcat(buf, target_p->localClient->privset->name, sizeof buf); } - p++; - } - if (IsOper(target_p)) - { - if (buf[0] != '\0') - strlcat(buf, " ", sizeof buf); - strlcat(buf, "operator:", sizeof buf); - strlcat(buf, target_p->localClient->opername, sizeof buf); } p = &auth_client_table[0]; while (p->name != NULL) @@ -127,8 +103,8 @@ static void show_privs(struct Client *source_p, struct Client *target_p) if (target_p->flags2 & p->mode) { if (buf[0] != '\0') - strlcat(buf, " ", sizeof buf); - strlcat(buf, p->name, sizeof buf); + rb_strlcat(buf, " ", sizeof buf); + rb_strlcat(buf, p->name, sizeof buf); } p++; } @@ -176,3 +152,16 @@ static int mo_privs(struct Client *client_p, struct Client *source_p, int parc, use_id(target_p)); return 0; } + +static int m_privs(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) +{ + if (parc >= 2 && !EmptyString(parv[1]) && + irccmp(parv[1], source_p->name)) { + sendto_one_numeric(source_p, ERR_NOPRIVILEGES, + form_str(ERR_NOPRIVILEGES)); + return 0; + } + + show_privs(source_p, source_p); + return 0; +}