The ConfDB API

The ConfDB is an interface for data providers to access the configuration information provided in the sssd.conf. More...

Data Structures

struct  sss_domain_info
 Data structure storing all of the basic features of a domain. More...

Functions

int confdb_init (TALLOC_CTX *mem_ctx, struct confdb_ctx **cdb_ctx, char *confdb_location)
 Initialize the connection to the ConfDB.
int confdb_get_domain (struct confdb_ctx *cdb, const char *name, struct sss_domain_info **domain)
 Get a domain object for the named domain.
int confdb_get_domains (struct confdb_ctx *cdb, struct sss_domain_info **domains)
 Get a null-terminated linked-list of active domain objects.
int confdb_add_param (struct confdb_ctx *cdb, bool replace, const char *section, const char *attribute, const char **values)
 Add an arbitrary parameter to the confdb.
int confdb_get_param (struct confdb_ctx *cdb, TALLOC_CTX *mem_ctx, const char *section, const char *attribute, char ***values)
 Retrieve all values for an attribute.
int confdb_get_string (struct confdb_ctx *cdb, TALLOC_CTX *ctx, const char *section, const char *attribute, const char *defstr, char **result)
 Convenience function to retrieve a single-valued attribute as a string.
int confdb_get_int (struct confdb_ctx *cdb, TALLOC_CTX *ctx, const char *section, const char *attribute, int defval, int *result)
 Convenience function to retrieve a single-valued attribute as an integer.
int confdb_get_bool (struct confdb_ctx *cdb, TALLOC_CTX *ctx, const char *section, const char *attribute, bool defval, bool *result)
 Convenience function to retrieve a single-valued attribute as a boolean.
int confdb_get_string_as_list (struct confdb_ctx *cdb, TALLOC_CTX *ctx, const char *section, const char *attribute, char ***result)
 Convenience function to retrieve a single-valued attribute as a null-terminated array of strings.

Detailed Description

The ConfDB is an interface for data providers to access the configuration information provided in the sssd.conf.


Function Documentation

int confdb_add_param ( struct confdb_ctx *  cdb,
bool  replace,
const char *  section,
const char *  attribute,
const char **  values 
)

Add an arbitrary parameter to the confdb.

This is mostly useful for testing, as they will not persist between SSSD restarts. For persistence, make changes to the sssd.conf file.

Parameters:
[in] cdb The connection object to the confdb
[in] replace If replace is set to true, pre-existing values will be overwritten. If it is false, the provided values will be added to the attribute.
[in] section The ConfDB section to update. This is constructed from the format of the sssd.conf file. All sections start with 'config/'. Subsections are separated by slashes. e.g. [domain/LDAP] in sssd.conf would translate to config/domain/LDAP
[in] attribute The name of the attribute to update
[in] values A null-terminated array of values to add to the attribute
Returns:
0 - Successfully added the provided value(s)
ENOMEM - There was insufficient memory to complete the operation
EINVAL - The section could not be parsed
EIO - An I/O error occurred communicating with the ConfDB
int confdb_get_bool ( struct confdb_ctx *  cdb,
TALLOC_CTX *  ctx,
const char *  section,
const char *  attribute,
bool  defval,
bool *  result 
)

Convenience function to retrieve a single-valued attribute as a boolean.

This function will read (in a case-insensitive manner) a "true" or "false" value from the ConfDB and convert it to an integral bool value.

Parameters:
[in] cdb The connection object to the confdb
[in] ctx The parent memory context for the returned string
[in] section The ConfDB section to update. This is constructed from the format of the sssd.conf file. All sections start with 'config/'. Subsections are separated by slashes. e.g. [domain/LDAP] in sssd.conf would translate to config/domain/LDAP
[in] attribute The name of the attribute to update
[in] defval If not NULL, the boolean state to use if the attribute does not exist in the ConfDB
[out] result A pointer to the retrieved (or default) bool
Returns:
0 - Successfully retrieved the entry (or used the default)
ENOMEM - There was insufficient memory to complete the operation
EINVAL - The section could not be parsed, the attribute was not single-valued, or the value was not a boolean.
EIO - An I/O error occurred while communicating with the ConfDB
int confdb_get_domain ( struct confdb_ctx *  cdb,
const char *  name,
struct sss_domain_info **  domain 
)

Get a domain object for the named domain.

Parameters:
[in] cdb The connection object to the confdb
[in] name The name of the domain to retrieve
[out] domain A pointer to a domain object for the domain given by name
Returns:
0 - Lookup succeeded and domain was populated
ENOMEM - There was insufficient memory to complete the operation
ENOENT - The named domain does not exist or is not set active
int confdb_get_domains ( struct confdb_ctx *  cdb,
struct sss_domain_info **  domains 
)

Get a null-terminated linked-list of active domain objects.

Parameters:
[in] cdb The connection object to the confdb
[out] domains A pointer to the first entry of a linked-list of domain objects
Returns:
0 - Lookup succeeded and all active domains are in the list
ENOMEM - There was insufficient memory to complete the operation
ENOENT - No active domains are configured
int confdb_get_int ( struct confdb_ctx *  cdb,
TALLOC_CTX *  ctx,
const char *  section,
const char *  attribute,
int  defval,
int *  result 
)

Convenience function to retrieve a single-valued attribute as an integer.

Parameters:
[in] cdb The connection object to the confdb
[in] ctx The parent memory context for the returned string
[in] section The ConfDB section to update. This is constructed from the format of the sssd.conf file. All sections start with 'config/'. Subsections are separated by slashes. e.g. [domain/LDAP] in sssd.conf would translate to config/domain/LDAP
[in] attribute The name of the attribute to update
[in] defval If not NULL, the integer to use if the attribute does not exist in the ConfDB
[out] result A pointer to the retrieved (or default) integer
Returns:
0 - Successfully retrieved the entry (or used the default)
ENOMEM - There was insufficient memory to complete the operation
EINVAL - The section could not be parsed, or the attribute was not single-valued.
EIO - An I/O error occurred while communicating with the ConfDB
ERANGE - The value stored in the ConfDB was outside the range [INT_MIN..INT_MAX]
int confdb_get_param ( struct confdb_ctx *  cdb,
TALLOC_CTX *  mem_ctx,
const char *  section,
const char *  attribute,
char ***  values 
)

Retrieve all values for an attribute.

Parameters:
[in] cdb The connection object to the confdb
[in] mem_ctx The parent memory context for the value list
[in] section The ConfDB section to update. This is constructed from the format of the sssd.conf file. All sections start with 'config/'. Subsections are separated by slashes. e.g. [domain/LDAP] in sssd.conf would translate to config/domain/LDAP
[in] attribute The name of the attribute to update
[out] values A null-terminated array of cstrings containing all values for this attribute
Returns:
0 - Successfully retrieved the value(s)
ENOMEM - There was insufficient memory to complete the operation
EINVAL - The section could not be parsed
EIO - An I/O error occurred while communicating with the ConfDB
int confdb_get_string ( struct confdb_ctx *  cdb,
TALLOC_CTX *  ctx,
const char *  section,
const char *  attribute,
const char *  defstr,
char **  result 
)

Convenience function to retrieve a single-valued attribute as a string.

Parameters:
[in] cdb The connection object to the confdb
[in] ctx The parent memory context for the returned string
[in] section The ConfDB section to update. This is constructed from the format of the sssd.conf file. All sections start with 'config/'. Subsections are separated by slashes. e.g. [domain/LDAP] in sssd.conf would translate to config/domain/LDAP
[in] attribute The name of the attribute to update
[in] defstr If not NULL, the string to use if the attribute does not exist in the ConfDB
[out] result A pointer to the retrieved (or default) string
Returns:
0 - Successfully retrieved the entry (or used the default)
ENOMEM - There was insufficient memory to complete the operation
EINVAL - The section could not be parsed, or the attribute was not single-valued.
EIO - An I/O error occurred while communicating with the ConfDB
int confdb_get_string_as_list ( struct confdb_ctx *  cdb,
TALLOC_CTX *  ctx,
const char *  section,
const char *  attribute,
char ***  result 
)

Convenience function to retrieve a single-valued attribute as a null-terminated array of strings.

This function will automatically split a comma-separated string in an attribute into a null-terminated array of strings. This is useful for storing and retrieving ordered lists, as ConfDB multivalued attributes do not guarantee retrieval order.

Parameters:
[in] cdb The connection object to the confdb
[in] ctx The parent memory context for the returned string
[in] section The ConfDB section to update. This is constructed from the format of the sssd.conf file. All sections start with 'config/'. Subsections are separated by slashes. e.g. [domain/LDAP] in sssd.conf would translate to config/domain/LDAP
[in] attribute The name of the attribute to update
[out] result A pointer to the retrieved array of strings
Returns:
0 - Successfully retrieved the entry (or used the default)
ENOMEM - There was insufficient memory to complete the operation
EINVAL - The section could not be parsed, or the attribute was not single-valued.
ENOENT - The attribute was not found.
EIO - An I/O error occurred while communicating with the ConfDB
int confdb_init ( TALLOC_CTX *  mem_ctx,
struct confdb_ctx **  cdb_ctx,
char *  confdb_location 
)

Initialize the connection to the ConfDB.

Parameters:
[in] mem_ctx The parent memory context for the confdb_ctx
[out] cdb_ctx The newly-created connection object
[in] confdb_location The absolute path to the ConfDB file on the filesystem
Returns:
0 - Connection succeeded and cdb_ctx was populated
ENOMEM - There was not enough memory to create the cdb_ctx
EIO - There was an I/O error communicating with the ConfDB file

Generated on 28 Jan 2010 for sss_confdb by  doxygen 1.6.1