MySQL authentication module
[Authentication and acls checking modules]

Collaboration diagram for MySQL authentication module:


Files

file  mysql_auth.c
 Core file for mysql authentication module.

Defines

#define SELECT_FIELDS   "username"

Functions

G_MODULE_EXPORT gboolean unload_module_with_params (gpointer params_p)
G_MODULE_EXPORT gboolean init_module_from_conf (module_t *module)
static MYSQL * mysql_conn_init (struct ipauth_mysql_params *params)
static char * quote_string (MYSQL *mysql, const char *text)
G_MODULE_EXPORT gchar * ip_authentication (tracking_t *header, struct ipauth_params *params)
G_MODULE_EXPORT int user_check (const char *username, const char *clientpass, unsigned passlen, user_session_t *session, struct ipauth_params *params)
G_MODULE_EXPORT uint32_t get_user_id (const char *username, struct ipauth_params *params)
G_MODULE_EXPORT GSList * get_user_groups (const char *username, struct ipauth_params *params)
static MYSQL * get_mysql_handler (struct ipauth_mysql_params *params)
const gchar * g_module_check_init (GModule *module)
void g_module_unload (GModule *module)
static int ipv6_to_sql (struct ipauth_mysql_params *params, struct in6_addr *addr, char *buffer, size_t buflen, int use_ntohl)
static void free_ipauth_user (gpointer)
static nu_error_t mysql_close_current (struct ipauth_mysql_params *params)

Define Documentation

#define SELECT_FIELDS   "username"

Definition at line 240 of file mysql_auth.c.

Referenced by ip_authentication().


Function Documentation

static void free_ipauth_user ( gpointer   )  [static]

Definition at line 636 of file mysql_auth.c.

References ipauth_user::groups, and ipauth_user::username.

Referenced by init_module_from_conf().

const gchar* g_module_check_init ( GModule *  module  ) 

Definition at line 554 of file mysql_auth.c.

References ipauth_mysql_conn_list.

void g_module_unload ( GModule *  module  ) 

Definition at line 562 of file mysql_auth.c.

References ipauth_mysql_conn_list.

static MYSQL * get_mysql_handler ( struct ipauth_mysql_params params  )  [static]

Definition at line 536 of file mysql_auth.c.

References DEBUG_AREA_MAIN, log_message, mysql_conn_init(), and ipauth_mysql_params::mysql_priv.

Referenced by destroy_user_connections(), get_user_groups(), get_user_id(), ip_authentication(), mysql_close_current(), user_check(), user_packet_logs(), and user_session_logs().

Here is the call graph for this function:

G_MODULE_EXPORT GSList* get_user_groups ( const char *  username,
struct ipauth_params params 
)

Definition at line 441 of file mysql_auth.c.

References DEBUG_AREA_MAIN, debug_log_message, ipauth_params::fallback_to_guest, get_mysql_handler(), ipauth_user::groups, ipauth_params::guest_gid, log_message, LONG_REQUEST_SIZE, ipauth_params::mysql, mysql_close_current(), ipauth_mysql_params::mysql_groupinfo_table_name, ipauth_mysql_params::mysql_userinfo_table_name, secure_snprintf(), ipauth_user::uid, ipauth_user::username, and ipauth_params::users.

Here is the call graph for this function:

G_MODULE_EXPORT uint32_t get_user_id ( const char *  username,
struct ipauth_params params 
)

Definition at line 375 of file mysql_auth.c.

References DEBUG_AREA_MAIN, debug_log_message, get_mysql_handler(), ipauth_params::guest_uid, log_message, LONG_REQUEST_SIZE, ipauth_params::mysql, mysql_close_current(), ipauth_mysql_params::mysql_userinfo_table_name, quote_string(), secure_snprintf(), ipauth_user::uid, ipauth_user::username, and ipauth_params::users.

Here is the call graph for this function:

G_MODULE_EXPORT gboolean init_module_from_conf ( module_t module  ) 

Definition at line 102 of file mysql_auth.c.

References AUTH_MYSQL_FALLBACK_TO_GUEST, AUTH_MYSQL_GUEST_GROUPID, AUTH_MYSQL_GUEST_USERID, AUTH_MYSQL_GUEST_USERNAME, DEBUG, DEBUG_AREA_MAIN, ipauth_params::fallback_to_guest, free_ipauth_user(), ipauth_params::guest_gid, ipauth_params::guest_uid, ipauth_params::guest_username, IPAUTH_REV, log_message, ipauth_params::mysql, MYSQL_DB_NAME, ipauth_mysql_params::mysql_db_name, MYSQL_GROUPINFO_TABLE_NAME, ipauth_mysql_params::mysql_groupinfo_table_name, MYSQL_GROUPS_TABLE_NAME, ipauth_mysql_params::mysql_groups_table_name, MYSQL_IPAUTH_CHECK_NETMASK, ipauth_mysql_params::mysql_ipauth_check_netmask, MYSQL_IPAUTH_TABLE_NAME, ipauth_mysql_params::mysql_ipauth_table_name, MYSQL_PASSWD, ipauth_mysql_params::mysql_passwd, ipauth_mysql_params::mysql_priv, MYSQL_REQUEST_TIMEOUT, ipauth_mysql_params::mysql_request_timeout, MYSQL_SERVER, ipauth_mysql_params::mysql_server, MYSQL_SERVER_PORT, ipauth_mysql_params::mysql_server_port, MYSQL_SSL_CA, ipauth_mysql_params::mysql_ssl_ca, MYSQL_SSL_CAPATH, ipauth_mysql_params::mysql_ssl_capath, MYSQL_SSL_CERTFILE, ipauth_mysql_params::mysql_ssl_certfile, MYSQL_SSL_CIPHER, ipauth_mysql_params::mysql_ssl_cipher, MYSQL_SSL_KEYFILE, ipauth_mysql_params::mysql_ssl_keyfile, MYSQL_USE_IPV4_SCHEMA, ipauth_mysql_params::mysql_use_ipv4_schema, MYSQL_USE_SSL, ipauth_mysql_params::mysql_use_ssl, MYSQL_USER, ipauth_mysql_params::mysql_user, MYSQL_USERINFO_TABLE_NAME, ipauth_mysql_params::mysql_userinfo_table_name, nubase_config_table_get_or_default(), nubase_config_table_get_or_default_int(), module_t::params, TRUE, and ipauth_params::users.

Here is the call graph for this function:

G_MODULE_EXPORT gchar* ip_authentication ( tracking_t header,
struct ipauth_params params 
)

Definition at line 242 of file mysql_auth.c.

References DEBUG_AREA_MAIN, ipauth_params::fallback_to_guest, get_mysql_handler(), ipauth_params::guest_username, IPV6_SQL_STRLEN, ipv6_to_sql(), log_message, LONG_REQUEST_SIZE, ipauth_params::mysql, mysql_close_current(), ipauth_mysql_params::mysql_ipauth_check_netmask, ipauth_mysql_params::mysql_ipauth_table_name, ipauth_mysql_params::mysql_use_ipv4_schema, tracking_t::saddr, secure_snprintf(), and SELECT_FIELDS.

Here is the call graph for this function:

static int ipv6_to_sql ( struct ipauth_mysql_params params,
struct in6_addr *  addr,
char *  buffer,
size_t  buflen,
int  use_ntohl 
) [static]

Convert an IPv6 address to SQL binary string. Eg. ::1 => "0x0000000000000001"

Returns:
Returns -1 if fails, 0 otherwise.

Definition at line 585 of file mysql_auth.c.

References DEBUG_AREA_MAIN, IPV6_SQL_STRLEN, is_ipv4(), log_message, ipauth_mysql_params::mysql_use_ipv4_schema, and secure_snprintf().

Referenced by build_insert_request(), destroy_user_connections(), ip_authentication(), log_state_close(), log_state_established(), log_state_open(), and user_session_logs().

Here is the call graph for this function:

static nu_error_t mysql_close_current ( struct ipauth_mysql_params params  )  [static]

Definition at line 644 of file mysql_auth.c.

References get_mysql_handler(), ipauth_mysql_params::mysql_priv, and NU_EXIT_OK.

Referenced by destroy_user_connections(), get_user_groups(), get_user_id(), ip_authentication(), log_state_close(), log_state_drop(), log_state_established(), log_state_open(), user_check(), and user_session_logs().

Here is the call graph for this function:

static MYSQL * mysql_conn_init ( struct ipauth_mysql_params params  )  [static]

Definition at line 169 of file mysql_auth.c.

References DEBUG_AREA_MAIN, ipauth_mysql_conn_list, log_message, ipauth_mysql_params::mysql_db_name, ipauth_mysql_params::mysql_passwd, ipauth_mysql_params::mysql_server, ipauth_mysql_params::mysql_server_port, ipauth_mysql_params::mysql_ssl_ca, ipauth_mysql_params::mysql_ssl_capath, ipauth_mysql_params::mysql_ssl_certfile, ipauth_mysql_params::mysql_ssl_cipher, ipauth_mysql_params::mysql_ssl_keyfile, ipauth_mysql_params::mysql_use_ssl, and ipauth_mysql_params::mysql_user.

Referenced by get_mysql_handler(), and mysql_close_open_user_sessions().

static char* quote_string ( MYSQL *  mysql,
const char *  text 
) [static]

Definition at line 226 of file mysql_auth.c.

Referenced by build_insert_request(), get_user_id(), user_check(), and user_session_logs().

G_MODULE_EXPORT gboolean unload_module_with_params ( gpointer  params_p  ) 

Definition at line 68 of file mysql_auth.c.

References ipauth_params::guest_username, ipauth_params::mysql, ipauth_mysql_params::mysql_db_name, ipauth_mysql_params::mysql_groupinfo_table_name, ipauth_mysql_params::mysql_groups_table_name, ipauth_mysql_params::mysql_ipauth_table_name, ipauth_mysql_params::mysql_passwd, ipauth_mysql_params::mysql_server, ipauth_mysql_params::mysql_ssl_ca, ipauth_mysql_params::mysql_ssl_capath, ipauth_mysql_params::mysql_ssl_certfile, ipauth_mysql_params::mysql_ssl_cipher, ipauth_mysql_params::mysql_ssl_keyfile, ipauth_mysql_params::mysql_user, ipauth_mysql_params::mysql_userinfo_table_name, TRUE, and ipauth_params::users.

G_MODULE_EXPORT int user_check ( const char *  username,
const char *  clientpass,
unsigned  passlen,
user_session_t session,
struct ipauth_params params 
)

Definition at line 318 of file mysql_auth.c.

References DEBUG_AREA_MAIN, get_mysql_handler(), log_message, LONG_REQUEST_SIZE, ipauth_params::mysql, mysql_close_current(), ipauth_mysql_params::mysql_userinfo_table_name, quote_string(), and secure_snprintf().

Here is the call graph for this function:


Generated on Sat Nov 22 04:01:01 2008 for NuFW by  doxygen 1.4.7