access.h File Reference

Go to the source code of this file.

Data Structures

struct  Access
struct  AccessFlag

Defines

#define ACC_FLAG_USER   "u"
#define ACC_FLAG_OPER   "o"
#define ACC_FLAG_ACCESS   "a"
#define ACC_FLAG_MODULE   "m"
#define ACC_FLAG_LIST   "l"
#define ACC_FLAG_JOIN   "j"
#define ACC_FLAG_SET   "s"
#define ACC_FLAG_DIE   "D"
#define ACC_FLAG_DEBUG   "d"
#define ACC_FLAG_REHASH   "r"
#define ACC_ROOT   "oamljsDdr"
#define ACC_ADMN   "roalmjsd"
#define ACC_OPER   "oal"
#define ACC_USER   "u"
#define ACC_STAFF   "osljr"

Functions

int DestAccList ()
int check_access (User *u, char *level)
Accessnew_access (char *)
Accessaccess_exists (char *)
int set_access_flag (Access *, char *)
int add_access_host (Access *, char *)
Accessfind_access (User *)
void refresh_access (void)
int setAccess (User *u)
AccessFlagfind_flag_byvalue (int)
AccessFlagfind_access_flag (char *)
int add_access_flag (char *, char *)
void init_access (void)
int del_acces_flag (char *)
void build_access_list ()

Variables

dlink_list accesslist
dlink_list access_flags

Define Documentation

#define ACC_ADMN   "roalmjsd"

Definition at line 29 of file access.h.

Referenced by init_access().

#define ACC_FLAG_ACCESS   "a"

Definition at line 19 of file access.h.

Referenced by init_access().

#define ACC_FLAG_DEBUG   "d"

Definition at line 25 of file access.h.

Referenced by init_access().

#define ACC_FLAG_DIE   "D"

Definition at line 24 of file access.h.

Referenced by init_access().

#define ACC_FLAG_JOIN   "j"

Definition at line 22 of file access.h.

Referenced by init_access().

#define ACC_FLAG_LIST   "l"

Definition at line 21 of file access.h.

Referenced by init_access().

#define ACC_FLAG_MODULE   "m"

Definition at line 20 of file access.h.

Referenced by init_access().

#define ACC_FLAG_OPER   "o"

Definition at line 18 of file access.h.

Referenced by init_access(), and setAccess().

#define ACC_FLAG_REHASH   "r"

Definition at line 26 of file access.h.

Referenced by init_access().

#define ACC_FLAG_SET   "s"

Definition at line 23 of file access.h.

Referenced by init_access().

#define ACC_FLAG_USER   "u"

Definition at line 17 of file access.h.

Referenced by setAccess().

#define ACC_OPER   "oal"

Definition at line 30 of file access.h.

Referenced by init_access().

#define ACC_ROOT   "oamljsDdr"

Definition at line 28 of file access.h.

Referenced by init_access().

#define ACC_STAFF   "osljr"

Definition at line 32 of file access.h.

Referenced by init_access().

#define ACC_USER   "u"

Definition at line 31 of file access.h.

Referenced by Module_Init(), new_access(), and set_access_flag().


Function Documentation

Access* access_exists ( char *   ) 

Definition at line 173 of file access.c.

References accesslist, DLINK_FOREACH, and Access::name.

Referenced by new_access().

int add_access_flag ( char *  ,
char *   
)
int add_access_host ( Access ,
char *   
)

Definition at line 220 of file access.c.

References alog(), dlink_add_tail(), dlink_create(), DLINK_FOREACH, Access::hosts, LOG_DEBUG, and Access::name.

Referenced by build_access_list().

void build_access_list (  ) 
int check_access ( User *  u,
char *  level 
)

Check a users access against the specified level.

Parameters:
u A pointer to the user structure which we are checking against.
level The level to check for.
Returns:
Return true if the access match, or return 0 if we fail for any other reason.

Definition at line 110 of file access.c.

Referenced by do_cmd().

int del_acces_flag ( char *   ) 

Definition at line 533 of file access.c.

References dlink_find_delete(), dlink_free(), find_access_flag(), and userlist.

int DestAccList (  ) 

Destroy all entries within the access list.

Note:
This destroyes all access list entries with that said, it shouldnt be called in any other circumstances besides rehash and shutdown, as it leaves us with no entries.

Definition at line 324 of file access.c.

References accesslist, dlink_find_delete(), DLINK_FOREACH_SAFE, dlink_free(), host, and Access::hosts.

Referenced by AtExit(), and evh_access_rehash().

Access* find_access ( User *  u  ) 

find_access() - Find the FIRST matching access access list entry for the given user and return the access list entry.

Parameters:
u - Pointer to the user struct that we are checking with.
Returns:
Access* - return a pointer to the access entry list that the user that the user belongs to, or NULL if no match is found.

Definition at line 50 of file access.c.

References accesslist, DLINK_FOREACH, host, Access::hosts, and match_wild().

Referenced by setAccess().

AccessFlag* find_access_flag ( char *  name  ) 

Return an access flag, both by name or by value

Parameters:
name string Name or value of the flag we are looking for
Returns:
AccessFlag* pointer to the flag structure.

Definition at line 487 of file access.c.

References access_flags, alog(), DLINK_FOREACH, AccessFlag::flag, LOG_DEBUG, LOG_DEBUG2, and AccessFlag::name.

Referenced by add_access_flag(), del_acces_flag(), and set_access_flag().

AccessFlag* find_flag_byvalue ( int   ) 

Definition at line 512 of file access.c.

References access_flags, DLINK_FOREACH, and AccessFlag::flag.

Referenced by set_access_flag().

void init_access ( void   ) 
Access* new_access ( char *   ) 
void refresh_access ( void   ) 

refresh_access() - Crawls our user list and checks access on each entries host.

Note:
This method can be slower on larger nets and is designed only to update access on special instances such as rehash.

Crawling this big of a list is rediculous... i think we should keep a master list somewere -Twitch

if there not an OPER or they are a SERVICE they have no access. so skip that entry :) this should give us back some speed and proformance here. Esp on networks with more Services and Users then IRCops (Which should be all of them imo)

  • Twitch

Definition at line 373 of file access.c.

References CfgSettings, DLINK_FOREACH, Conf::operonly, setAccess(), and userlist.

Referenced by evh_access_rehash().

int set_access_flag ( Access a,
char *  flags 
)

Use pointer logic in the future

Definition at line 250 of file access.c.

References ACC_USER, alog(), find_access_flag(), find_flag_byvalue(), AccessFlag::flag, Access::flags, LOG_DEBUG, Access::name, and strlcat().

Referenced by build_access_list().

int setAccess ( User *  u  ) 

setAccess() - finds then sets or removes access for a user, this will set the first matching access level on a user, as provided ' by find_access().

Parameters:
u - The user struct we are working with
Returns:
int - Returns true if access has been set or false if no record was found.

Definition at line 146 of file access.c.

References ACC_FLAG_OPER, ACC_FLAG_USER, CfgSettings, find_access(), Access::flags, Conf::operonly, and strlcpy().

Referenced by AddUser(), read_usermode_string(), and refresh_access().


Variable Documentation

dlink_list access_flags

Definition at line 74 of file access.h.

Referenced by add_access_flag(), find_access_flag(), find_flag_byvalue(), and init_lists().

dlink_list accesslist

Definition at line 73 of file access.h.

Referenced by access_exists(), DestAccList(), find_access(), init_lists(), and new_access().

Generated on Mon Jul 19 21:53:04 2010 for Omega Security Services by  doxygen 1.6.3