/* protocol-specific stuff to do on login */ static void plexus_on_login(user_t *u, myuser_t *account, const char *wantedhost) { if (!me.connected || u == NULL) return; /* Can only do this for nickserv, and can only record identified * state if logged in to correct nick, sorry -- jilles */ if (!should_reg_umode(u)) return; #ifdef USE_NETADMIN if (has_priv_user(u, PRIV_ADMIN)) sts(":%s ENCAP * SVSMODE %s %lu +rdN %lu", nicksvs.nick, u->nick, (unsigned long)u->ts, (unsigned long)CURRTIME); else #endif sts(":%s ENCAP * SVSMODE %s %lu +rd %lu", nicksvs.nick, u->nick, (unsigned long)u->ts, (unsigned long)CURRTIME); }
static void os_cmd_specs(sourceinfo_t *si, int parc, char *parv[]) { user_t *tu = NULL; operclass_t *cl = NULL; const char *targettype = parv[0]; const char *target = parv[1]; unsigned int i; int j, n; if (!has_any_privs(si)) { command_fail(si, fault_noprivs, _("You are not authorized to use %s."), si->service->nick); return; } if (targettype != NULL) { if (!has_priv(si, PRIV_VIEWPRIVS)) { command_fail(si, fault_noprivs, STR_NO_PRIVILEGE, PRIV_VIEWPRIVS); return; } if (target == NULL) target = "?"; if (!strcasecmp(targettype, "USER")) { tu = user_find_named(target); if (tu == NULL) { command_fail(si, fault_nosuch_target, _("\2%s\2 is not on IRC."), target); return; } if (!has_any_privs_user(tu)) { command_success_nodata(si, _("\2%s\2 is unprivileged."), tu->nick); return; } if (is_internal_client(tu)) { command_fail(si, fault_noprivs, _("\2%s\2 is an internal client."), tu->nick); return; } } else if (!strcasecmp(targettype, "OPERCLASS") || !strcasecmp(targettype, "CLASS")) { cl = operclass_find(target); if (cl == NULL) { command_fail(si, fault_nosuch_target, _("No such oper class \2%s\2."), target); return; } } else { command_fail(si, fault_badparams, _("Valid target types: USER, OPERCLASS.")); return; } } else tu = si->su; if (targettype == NULL) command_success_nodata(si, _("Privileges for \2%s\2:"), get_source_name(si)); else if (tu) command_success_nodata(si, _("Privileges for \2%s\2:"), tu->nick); else command_success_nodata(si, _("Privileges for oper class \2%s\2:"), cl->name); for (i = 0; i < ARRAY_SIZE(priv_categories); i++) { struct priv_category *cat = priv_categories[i]; command_success_nodata(si, "\2%s\2:", _(cat->name)); for (j = n = 0; cat->privs[j].priv != NULL; j++) { if (targettype == NULL ? has_priv(si, cat->privs[j].priv) : (tu ? has_priv_user(tu, cat->privs[j].priv) : has_priv_operclass(cl, cat->privs[j].priv))) { command_success_nodata(si, " %s (%s)", cat->privs[j].priv, _(cat->privs[j].desc)); ++n; } } if (!n) command_success_nodata(si, " %s", _("(no privileges held)")); } command_success_nodata(si, _("End of privileges")); if (targettype == NULL) logcommand(si, CMDLOG_ADMIN, "SPECS"); else if (tu) logcommand(si, CMDLOG_ADMIN, "SPECS:USER: \2%s!%s@%s\2", tu->nick, tu->user, tu->vhost); else logcommand(si, CMDLOG_ADMIN, "SPECS:OPERCLASS: \2%s\2", cl->name); }