LDAP authentication and acl module
[Authentication and acls checking modules]

Collaboration diagram for LDAP authentication and acl module:


Files

file  ldap.c
 Contains all LDAP modules functions.

Data Structures

struct  weighted_acl

Functions

void number_multiply (number_t number, digit_t factor)
int number_add (number_t number, digit_t value)
char * number_to_decimal (number_t number)
int decimal_to_number (const char *orig_decimal, number_t number)
static void ldap_conn_destroy (void *connection)
G_MODULE_EXPORT gboolean unload_module_with_params (gpointer params_p)
G_MODULE_EXPORT gboolean init_module_from_conf (module_t *module)
G_MODULE_EXPORT gchar * g_module_unload (void)
static LDAP * ldap_conn_init (struct ldap_params *params)
static char * ipv6_to_base10 (struct in6_addr *addr)
gchar * escape_string_for_ldap (const gchar *basestring)
 Escape character to protect them in query.
gint compare_acl_weight (gconstpointer data1, gconstpointer data2)
static void local_free (gpointer data, gpointer userdata)
static nu_error_t field_match_pattern (gchar *value, LDAP *ld, LDAPMessage *result, gchar *attribute)
G_MODULE_EXPORT GSList * acl_check (connection_t *element, gpointer params_p)
 Acl check function.

Function Documentation

G_MODULE_EXPORT GSList* acl_check ( connection_t element,
gpointer  params_p 
)

Acl check function.

This function realise the matching of a packet against the set of rules. It is exported by the modules and called by nuauth core.

Parameters:
element A pointer to a connection_t which contains all informations available about the packet
params_p A pointer to the parameters of the module instance we're working for
Returns:
A chained list of struct acl_group which is the set of acl that match the given packet
The returned GSList has to be ordered because take_decision() will do a interative loop on the chained list. This can be used to achieve complicated setup.

Definition at line 439 of file ldap.c.

References ACL_FLAGS_NONE, acl_group::answer, connection_t::app_name, acl_group::auth_quality, tracking_t::code, compare_acl_weight(), tracking_t::daddr, DEBUG, DEBUG_AREA_AUTH, DEBUG_AREA_MAIN, DEBUG_AREA_PERF, nuauth_params::debug_areas, debug_log_message, tracking_t::dest, err, FALSE, acl_group::flags, acl_group::groups, connection_t::iface_nfo, iface_nfo_t::indev, ipv6_to_base10(), ipv6_to_ipv4(), is_ipv4(), ldap_params::ldap_acls_base_dn, ldap_conn_init(), ldap_params::ldap_filter_type, LDAP_MAX_TRY, ldap_params::ldap_priv, LDAP_QUERY_SIZE, ldap_params::ldap_request_timeout, ldap_params::ldap_use_ipv4_schema, local_free(), log_message, acl_group::log_prefix, nuauthconf, connection_t::os_release, connection_t::os_sysname, connection_t::os_version, iface_nfo_t::outdev, acl_group::period, iface_nfo_t::physindev, iface_nfo_t::physoutdev, nuauth_params::prio_to_nok, tracking_t::protocol, tracking_t::saddr, secure_snprintf(), TEST_PATTERN, connection_t::tracking, tracking_t::type, and acl_group::users.

Here is the call graph for this function:

gint compare_acl_weight ( gconstpointer  data1,
gconstpointer  data2 
)

Definition at line 384 of file ldap.c.

Referenced by acl_check().

int decimal_to_number ( const char *  orig_decimal,
number_t  number 
)

Convert a decimal string to a "Base 10^n" number.

Returns:
Returns 0 on error, 1 otherwise

Definition at line 137 of file ldap.c.

References BASE_LOG10, DIGIT_COUNT, and err.

gchar* escape_string_for_ldap ( const gchar *  basestring  ) 

Escape character to protect them in query.

Abstract from RFC 2254
	Character       ASCII value
	---------------------------
	*               0x2a
	(               0x28
	)               0x29
	\               0x5c
	NUL             0x00
For example * is coded \2a

Parameters:
basestring the string to convert
Returns:
a newly allocated string

Definition at line 336 of file ldap.c.

static nu_error_t field_match_pattern ( gchar *  value,
LDAP *  ld,
LDAPMessage *  result,
gchar *  attribute 
) [static]

Returns:
A nu_error_t::, NU_EXIT_CONTINUE if filter did not match, NU_EXIT_OK if filter did match.

Definition at line 399 of file ldap.c.

References NU_EXIT_CONTINUE, and NU_EXIT_OK.

G_MODULE_EXPORT gchar* g_module_unload ( void   ) 

unload function.

Definition at line 229 of file ldap.c.

G_MODULE_EXPORT gboolean init_module_from_conf ( module_t module  ) 

Init ldap system.

Definition at line 191 of file ldap.c.

References ldap_params::binddn, ldap_params::bindpasswd, DEBUG_AREA_MAIN, ldap_params::ldap_acls_base_dn, LDAP_BASE, ldap_conn_destroy(), LDAP_CRED, ldap_params::ldap_filter_type, ldap_params::ldap_priv, LDAP_REQUEST_TIMEOUT, ldap_params::ldap_request_timeout, LDAP_SERVER, ldap_params::ldap_server, LDAP_SERVER_PORT, ldap_params::ldap_server_port, ldap_params::ldap_use_ipv4_schema, LDAP_USER, ldap_params::ldap_users_base_dn, log_message, nubase_config_table_get_or_default(), nubase_config_table_get_or_default_int(), module_t::params, and TRUE.

Here is the call graph for this function:

static char* ipv6_to_base10 ( struct in6_addr *  addr  )  [static]

Definition at line 302 of file ldap.c.

References INIT_NUMBER, number_add(), number_multiply(), and number_to_decimal().

Referenced by acl_check().

Here is the call graph for this function:

static void ldap_conn_destroy ( void *  connection  )  [static]

Definition at line 166 of file ldap.c.

Referenced by init_module_from_conf().

static LDAP* ldap_conn_init ( struct ldap_params params  )  [static]

Initialize connection to ldap server.

Definition at line 238 of file ldap.c.

References ldap_params::binddn, ldap_params::bindpasswd, DEBUG_AREA_AUTH, DEBUG_AREA_MAIN, err, ldap_params::ldap_priv, ldap_params::ldap_server, ldap_params::ldap_server_port, log_message, and secure_snprintf().

Referenced by acl_check().

Here is the call graph for this function:

static void local_free ( gpointer  data,
gpointer  userdata 
) [static]

Definition at line 390 of file ldap.c.

Referenced by acl_check().

int number_add ( number_t  number,
digit_t  value 
)

Add a value to a "Base 10^n" number

Returns:
Returns 0 on error, 1 otherwise

Definition at line 98 of file ldap.c.

References BASE, and DIGIT_COUNT.

Referenced by ipv6_to_base10().

void number_multiply ( number_t  number,
digit_t  factor 
)

Multiply a "Base 10^n" number by a factor

Definition at line 76 of file ldap.c.

References BASE, and DIGIT_COUNT.

Referenced by ipv6_to_base10().

char* number_to_decimal ( number_t  number  ) 

Convert a "Base 10^n" number to decimal string.

Returns:
Returns new allocated string

Definition at line 117 of file ldap.c.

References BASE2STR, BASE_LOG10, and DIGIT_COUNT.

Referenced by ipv6_to_base10().

G_MODULE_EXPORT gboolean unload_module_with_params ( gpointer  params_p  ) 

Definition at line 174 of file ldap.c.

References TRUE.


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