| 1 |
pippijn |
1.4 |
/** |
| 2 |
|
|
* privs.h: Fine grained services operator privileges |
| 3 |
|
|
* |
| 4 |
|
|
* Copyright © 2007 Pippijn van Steenhoven / The Ermyth Team |
| 5 |
|
|
* Rights to this code are as documented in COPYING. |
| 6 |
|
|
* |
| 7 |
|
|
* |
| 8 |
|
|
* Portions of this file were derived from sources bearing the following license: |
| 9 |
pippijn |
1.3 |
* Copyright © 2005 Jilles Tjoelker, et al. |
| 10 |
pippijn |
1.2 |
* Rights to this code are as documented in doc/pod/license.pod. |
| 11 |
pippijn |
1.1 |
* |
| 12 |
pippijn |
1.5 |
* $Id: privs.h,v 1.4 2007-09-16 18:54:42 pippijn Exp $ |
| 13 |
pippijn |
1.1 |
*/ |
| 14 |
|
|
|
| 15 |
|
|
#ifndef PRIVS_H |
| 16 |
|
|
#define PRIVS_H |
| 17 |
|
|
|
| 18 |
pippijn |
1.5 |
#include <util/containers.h> |
| 19 |
|
|
|
| 20 |
pippijn |
1.1 |
#define PRIV_NONE NULL |
| 21 |
|
|
|
| 22 |
|
|
/* nickserv/userserv */ |
| 23 |
|
|
#define PRIV_USER_AUSPEX "user:auspex" |
| 24 |
|
|
#define PRIV_USER_ADMIN "user:admin" |
| 25 |
|
|
#define PRIV_USER_SENDPASS "user:sendpass" |
| 26 |
|
|
#define PRIV_USER_VHOST "user:vhost" |
| 27 |
|
|
#define PRIV_USER_FREGISTER "user:fregister" |
| 28 |
|
|
/* chanserv */ |
| 29 |
|
|
#define PRIV_CHAN_AUSPEX "chan:auspex" |
| 30 |
|
|
#define PRIV_CHAN_ADMIN "chan:admin" |
| 31 |
|
|
#define PRIV_CHAN_CMODES "chan:cmodes" |
| 32 |
|
|
#define PRIV_JOIN_STAFFONLY "chan:joinstaffonly" |
| 33 |
|
|
/* nickserv/userserv+chanserv */ |
| 34 |
|
|
#define PRIV_MARK "user:mark" |
| 35 |
|
|
#define PRIV_HOLD "user:hold" |
| 36 |
|
|
#define PRIV_REG_NOLIMIT "user:regnolimit" |
| 37 |
|
|
/* generic */ |
| 38 |
|
|
#define PRIV_SERVER_AUSPEX "general:auspex" |
| 39 |
|
|
#define PRIV_VIEWPRIVS "general:viewprivs" |
| 40 |
|
|
#define PRIV_FLOOD "general:flood" |
| 41 |
|
|
#define PRIV_METADATA "general:metadata" |
| 42 |
|
|
#define PRIV_ADMIN "general:admin" |
| 43 |
|
|
/* operserv */ |
| 44 |
|
|
#define PRIV_OMODE "operserv:omode" |
| 45 |
|
|
#define PRIV_AKILL "operserv:akill" |
| 46 |
|
|
#define PRIV_MASS_AKILL "operserv:massakill" |
| 47 |
pippijn |
1.3 |
#define PRIV_AKILL_ANYMASK "operserv:akill-anymask" |
| 48 |
pippijn |
1.1 |
#define PRIV_JUPE "operserv:jupe" |
| 49 |
|
|
#define PRIV_NOOP "operserv:noop" |
| 50 |
|
|
#define PRIV_GLOBAL "operserv:global" |
| 51 |
|
|
#define PRIV_GRANT "operserv:grant" |
| 52 |
|
|
|
| 53 |
|
|
/* obsolete access levels */ |
| 54 |
|
|
#define AC_NONE NULL |
| 55 |
|
|
/* please do not use the following anymore */ |
| 56 |
|
|
#define AC_IRCOP "special:ircop" |
| 57 |
|
|
#define AC_SRA "general:admin" |
| 58 |
|
|
|
| 59 |
pippijn |
1.3 |
struct operclass_t : zero_initialised |
| 60 |
pippijn |
1.1 |
{ |
| 61 |
pippijn |
1.5 |
unsigned index; |
| 62 |
|
|
typedef indexing_vector<operclass_t> list_type; |
| 63 |
|
|
/* privs.c */ |
| 64 |
|
|
static list_type list; |
| 65 |
|
|
|
| 66 |
pippijn |
1.1 |
char *name; |
| 67 |
|
|
char *privs; /* priv1 priv2 priv3... */ |
| 68 |
|
|
int flags; |
| 69 |
|
|
}; |
| 70 |
|
|
|
| 71 |
|
|
#define OPERCLASS_NEEDOPER 0x1 /* only give privs to IRCops */ |
| 72 |
|
|
|
| 73 |
|
|
/* soper list struct */ |
| 74 |
pippijn |
1.3 |
struct soper_t : zero_initialised |
| 75 |
pippijn |
1.1 |
{ |
| 76 |
pippijn |
1.5 |
unsigned index; |
| 77 |
|
|
typedef indexing_vector<soper_t> list_type; |
| 78 |
|
|
/* privs.c */ |
| 79 |
|
|
static list_type list; |
| 80 |
|
|
|
| 81 |
pippijn |
1.1 |
myuser_t *myuser; |
| 82 |
|
|
char *name; |
| 83 |
|
|
operclass_t *operclass; |
| 84 |
|
|
char *classname; |
| 85 |
|
|
int flags; |
| 86 |
|
|
}; |
| 87 |
|
|
|
| 88 |
|
|
#define SOPER_CONF 0x1 /* oper is listed in atheme.conf */ |
| 89 |
|
|
|
| 90 |
|
|
E void init_privs (void); |
| 91 |
|
|
|
| 92 |
|
|
E operclass_t *operclass_add (char *name, char const *privs); |
| 93 |
|
|
E void operclass_delete (operclass_t *operclass); |
| 94 |
pippijn |
1.3 |
E operclass_t *operclass_find (char const * const name); |
| 95 |
pippijn |
1.5 |
E void operclass_cleanup (); |
| 96 |
pippijn |
1.1 |
|
| 97 |
|
|
E soper_t *soper_add (char *name, char *classname, int flags); |
| 98 |
|
|
E void soper_delete (soper_t *soper); |
| 99 |
|
|
E soper_t *soper_find (myuser_t *myuser); |
| 100 |
|
|
E soper_t *soper_find_named (char *name); |
| 101 |
pippijn |
1.5 |
E void soper_cleanup (); |
| 102 |
pippijn |
1.1 |
|
| 103 |
|
|
E bool is_soper (myuser_t *myuser); |
| 104 |
|
|
E bool is_conf_soper (myuser_t *myuser); |
| 105 |
|
|
|
| 106 |
|
|
/* has_any_privs(): used to determine whether we should give detailed |
| 107 |
|
|
* messages about disallowed things |
| 108 |
|
|
* warning: do not use this for any kind of real privilege! */ |
| 109 |
pippijn |
1.3 |
E bool has_any_privs (sourceinfo_t *si); |
| 110 |
|
|
E bool has_any_privs_user (user_t *u); |
| 111 |
pippijn |
1.1 |
/* has_priv(): for sources of commands */ |
| 112 |
pippijn |
1.3 |
E bool has_priv (sourceinfo_t *si, char const * const priv); |
| 113 |
pippijn |
1.1 |
/* has_priv_user(): for online users */ |
| 114 |
pippijn |
1.3 |
E bool has_priv_user (user_t *u, char const * const priv); |
| 115 |
pippijn |
1.1 |
/* has_priv_myuser(): channel succession etc */ |
| 116 |
pippijn |
1.3 |
E bool has_priv_myuser (myuser_t *mu, char const * const priv); |
| 117 |
pippijn |
1.1 |
/* has_priv_operclass(): /os specs etc */ |
| 118 |
pippijn |
1.3 |
E bool has_priv_operclass (operclass_t *oc, char const * const priv); |
| 119 |
pippijn |
1.1 |
/* has_all_operclass(): checks if source has all privs in operclass */ |
| 120 |
pippijn |
1.3 |
E bool has_all_operclass (sourceinfo_t *si, operclass_t *oc); |
| 121 |
pippijn |
1.1 |
|
| 122 |
|
|
#endif /* PRIVS_H */ |