Main Page   Compound List   File List   Compound Members   File Members  

userent.c File Reference

#include <grp.h>
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../include/libuser/user_private.h"

Defines

#define DEFAULT_ID   500

Typedefs

typedef GList* get_fn (struct lu_ent *, const char *)

Functions

struct lu_ent* lu_ent_new ()
void lu_ent_set_source_auth (struct lu_ent *ent, const char *source)
void lu_ent_set_source_info (struct lu_ent *ent, const char *source)
void lu_ent_revert (struct lu_ent *source)
void lu_ent_copy (struct lu_ent *source, struct lu_ent *dest)
void lu_user_default (struct lu_context *context, const char *name, gboolean system, struct lu_ent *ent)
void lu_group_default (struct lu_context *context, const char *name, gboolean system, struct lu_ent *ent)
void lu_ent_free (struct lu_ent *ent)
void lu_ent_set_original (struct lu_ent *ent, const char *attr, const char *val)
void lu_ent_set_numeric_original (struct lu_ent *ent, const char *attr, long val)
void lu_ent_set (struct lu_ent *ent, const char *attr, const char *val)
void lu_ent_set_numeric (struct lu_ent *ent, const char *attr, long val)
gboolean lu_ent_has (struct lu_ent *ent, const char *attribute)
GList* lu_ent_get_attributes (struct lu_ent *ent)
void lu_ent_clear_all (struct lu_ent *ent)
GList* lu_ent_get (struct lu_ent *ent, const char *attr)
GList* lu_ent_get_original (struct lu_ent *ent, const char *attr)
void lu_ent_add (struct lu_ent *ent, const char *attr, const char *val)
void lu_ent_add_original (struct lu_ent *ent, const char *attr, const char *val)
void lu_ent_del (struct lu_ent *ent, const char *attr, const char *val)
void lu_ent_clear (struct lu_ent *ent, const char *attr)
void lu_ent_clear_original (struct lu_ent *ent, const char *attr)

Detailed Description


Define Documentation

#define DEFAULT_ID   500
 

The default user and group ID to use if none is given in the configuration file.


Function Documentation

void lu_ent_add ( struct lu_ent * ent,
const char * attr,
const char * val )
 

lu_ent_add:

Parameters:
ent   An entity structure which will be queried.
attr   The attribute of the structure which will be modified.
val   The value which will be added to the structure's list of values for the named attribute.

This function adds a single value to the list of the values of the named attribute contained in the entity structure.

Returns:
TRUE on success, FALSE on failure.

void lu_ent_add_original ( struct lu_ent * ent,
const char * attr,
const char * val )
 

lu_ent_add_original:

Parameters:
ent   An entity structure which will be queried.
attr   The attribute of the structure which will be modified.
val   The value which will be added to the structure's list of original values for the named attribute.

This function adds a single value to the list of original values of the named attribute contained in the entity structure.

Returns:
TRUE on success, FALSE on failure.

void lu_ent_clear ( struct lu_ent * ent,
const char * attr )
 

lu_ent_clear:

Parameters:
ent   An entity structure which will be queried.
attr   The attribute of the structure which will be removed.

This function removes all values of the named attribute contained in the entity structure.

Returns:
TRUE on success, FALSE on failure.

void lu_ent_clear_all ( struct lu_ent * ent )
 

lu_ent_clear_all:

Parameters:
ent   An entity structure which will be reset to a blank state, as it was when it was first allocated.

This function clears all values for all attributes this entity structure has.

Returns:
nothing.

void lu_ent_clear_original ( struct lu_ent * ent,
const char * attr )
 

lu_ent_clear_original:

Parameters:
ent   An entity structure which will be queried.
attr   The attribute of the structure which will be removed.

This function removes all original values for a given attribute from the entity structure.

Returns:
nothing.

void lu_ent_copy ( struct lu_ent * source,
struct lu_ent * dest )
 

lu_ent_copy:

Parameters:
source   An entity object, the contents of which should be copied to @dest.
dest   An entity object which will be modified to resemble the @source object.

This function can be used to create a temporary copy of an entity structure which can be manipulated without changes being made the an original.

Returns:
void

void lu_ent_del ( struct lu_ent * ent,
const char * attr,
const char * val )
 

lu_ent_del:

Parameters:
ent   An entity structure which will be queried.
attr   The attribute of the structure which will be modified.
val   The value which will be removed from the structure's list of values for the named attribute.

This function removes a single value from the list of the values of the named attribute contained in the entity structure.

Returns:
TRUE on success, FALSE on failure.

void lu_ent_free ( struct lu_ent * ent )
 

lu_ent_free:

Parameters:
ent   An entity structure which will be destroyed.

This function destroys an entity structure.

Returns:
TRUE on success, FALSE on failure.

GList* lu_ent_get ( struct lu_ent * ent,
const char * attr )
 

lu_ent_get:

Parameters:
ent   An entity structure which will be queried.
attr   The attribute of the structure which will be queried.

This function returns a list of the values for the named attribute of the entity structure.

Returns:
A GList which must not be freed.

GList* lu_ent_get_attributes ( struct lu_ent * ent )
 

lu_ent_get_attributes:

Parameters:
ent   An entity structure which will be queried.

This function returns a list of the attributes for which the entity structure has values defined.

Returns:
A GList which should be freed with g_list_free().

GList* lu_ent_get_original ( struct lu_ent * ent,
const char * attr )
 

lu_ent_get_original:

Parameters:
ent   An entity structure which will be queried.
attr   The attribute of the structure which will be queried.

This function returns a list of the original values for the named attribute of the entity structure.

Returns:
A GList which must not be freed.

gboolean lu_ent_has ( struct lu_ent * ent,
const char * attribute )
 

lu_ent_has:

Parameters:
ent   An entity structure which will be queried.
attribute   The attribute which we are checking the entity for values for.

This function returns a boolean indicating whether or not the entity has values for a particular attribute.

Returns:
TRUE if there is a value, FALSE if there is not.

struct lu_ent* lu_ent_new ( void )
 

lu_ent_new:

This function creates and returns a new entity structure, suitable for passing into other functions provided by the library.

Returns:
a new entity structure.

void lu_ent_revert ( struct lu_ent * source )
 

lu_ent_revert:

Parameters:
source   An entity whose attribute values should be reset to those returned by the last lookup performed with the structure or when the structure was first created.

This function can be used to undo changes to the in-memory structure which is used for storing information about users and groups.

Returns:
void

void lu_ent_set ( struct lu_ent * ent,
const char * attr,
const char * val )
 

lu_ent_set:

Parameters:
ent   An entity structure which will be modified.
attr   The attribute of the entity structure which will be replaced.
val   A new value for the attribute.

This function modifies the given attribute of a structure so that it is equal to val.

Returns:
TRUE on success, FALSE on failure.

void lu_ent_set_numeric ( struct lu_ent * ent,
const char * attr,
long val )
 

lu_ent_set_numeric:

Parameters:
ent   An entity structure which will be modified.
attr   The attribute of the entity structure which will be replaced.
val   A new value for the attribute.

This function modifies the given attribute of a structure so that it is equal to
Parameters:
val.  
Returns:
TRUE on success, FALSE on failure.

void lu_ent_set_numeric_original ( struct lu_ent * ent,
const char * attr,
long val )
 

lu_ent_set_numeric_original:

Parameters:
ent   An entity structure which will be modified.
attr   The attribute of the entity structure whose original value will be replaced.
val   A new value for the attribute.

This function modifies the original value of the given attribute of a structure so that it is equal to val.

Returns:
TRUE on success, FALSE on failure.

void lu_ent_set_original ( struct lu_ent * ent,
const char * attr,
const char * val )
 

lu_ent_set_original:

Parameters:
ent   An entity structure which will be modified.
attr   The attribute of the entity structure which will have its original value replaced.
val   A new value for the attribute.

This function modifies original copy of the given attribute of a structure so that it is equal to val.

Returns:
TRUE on success, FALSE on failure.

void lu_ent_set_source_auth ( struct lu_ent * ent,
const char * source )
 

lu_ent_set_source_auth:

Parameters:
ent   An entity structure.
source   The name of a module which should be taken as authoritative for authentication information pertaining to the user or group described by the entity structure.

This function can be used to override the data store where authentication information for a user or group will subsequently be recorded. This function should only be used with great care, for careless use will disrupt the integrity of data stores.

Returns:
void

void lu_ent_set_source_info ( struct lu_ent * ent,
const char * source )
 

lu_ent_set_source_info:

Parameters:
ent   An entity structure.
source   The name of a module which should be taken as authoritative for information pertaining to the user or group described by the entity structure.

This function can be used to override the data store where information for a user or group will subsequently be recorded. This function should only be used with great care, for careless use will disrupt the integrity of data stores.

Returns:
void

void lu_group_default ( struct lu_context * context,
const char * name,
gboolean system,
struct lu_ent * ent )
 

lu_group_default:

Parameters:
context   A library context.
name   A name for the new group.
system   Specifies whether or not this will be a "system" account.
ent   An entity structure which will contain information suitable for passing to lu_group_add().

This function seeds an entity structure with the given name, allocates an unused GID using lu_get_free_id(), and sets defaults necessary to create a well-formed group account.

Returns:
TRUE on success, FALSE on failure.

void lu_user_default ( struct lu_context * context,
const char * name,
gboolean system,
struct lu_ent * ent )
 

lu_user_default:

Parameters:
context   A library context.
name   A name for the new user.
system   Specifies whether or not this will be a "system" account.
ent   An entity structure which will contain information suitable for passing to lu_user_add().

This function seeds an entity structure with the given name, allocates an unused UID using lu_get_free_id(), and sets defaults necessary to create a well-formed user account.

Returns:
TRUE on success, FALSE on failure.


Generated at Wed Oct 12 09:20:53 2005 for libuser by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001