#define SNO_NOISY (SNO_SERVKILL|SNO_UNAUTH)
/** Test whether a privilege has been granted to a client. */
-#define HasPriv(cli, priv) FlagHas(cli_privs(cli), priv)
+#define HasPriv(cli, priv) FlagHas(client_get_privs(cli), priv)
/** Grant a privilege to a client. */
#define SetPriv(cli, priv) FlagSet(cli_privs(cli), priv)
/** Revoke a privilege from a client. */
extern void client_set_privs(struct Client *client, struct ConfItem *oper);
extern int client_report_privs(struct Client* to, struct Client* client);
+extern int client_get_privs(struct Client* client);
+
#endif /* INCLUDED_client_h */
int dns_pending; /**< A dns request is pending. */
int flags; /**< Additional modifiers for item. */
int addrbits; /**< Number of bits valid in ConfItem::address. */
- struct Privs privs; /**< Privileges for opers. */
+ struct Privs privs; /**< Privileges for all users in this class. */
/** Used to detect if a privilege has been set by this ConfItem. */
struct Privs privs_dirty;
};
return 0;
}
+
+int client_get_privs(struct Client* client) {
+ int privs = cli_privs(client);
+
+ // add privs from class
+ struct SLink *list;
+
+ for (list = cli_confs(cptr); list != NULL; list = list->next) {
+ struct ConfItem *aconf;
+ aconf = list->value.aconf;
+ if (aconf->status & CONF_CLIENT)
+ privs |= aconf->privs;
+ }
+ return privs;
+}
+