Qsmtp  0.30dev
Data Structures | Enumerations | Functions
userconf.h File Reference

definition of the helper functions around the user configuration More...

#include <control.h>
#include <sstring.h>

Go to the source code of this file.

Data Structures

struct  userconf
 

Enumerations

enum  userconf_flags { userconf_none = 0, userconf_global = 1, userconf_inherit = 2 }
 

Functions

void userconf_init (struct userconf *ds)
 initialize the struct userconf More...
 
void userconf_free (struct userconf *ds)
 free all information in a struct userconf More...
 
int userconf_load_configs (struct userconf *ds)
 load the filter settings for user and domain More...
 
int userconf_get_buffer (const struct userconf *ds, const char *key, char ***values, checkfunc cf, const unsigned int flags)
 get a config buffer for a given user or domain More...
 
int userconf_find_domain (const struct userconf *ds, const char *key, const char *domain, const unsigned int flags)
 find a domain in the user configuration key More...
 
int userbackend_init (void)
 initialize the backend to query for local users More...
 
void userbackend_free (void)
 free the resources needed by the user backend
 

Detailed Description

definition of the helper functions around the user configuration

Enumeration Type Documentation

Enumerator
userconf_none 

no special search options to use

userconf_global 

global configuration lookup should be performed

userconf_inherit 

allow "!inherit" command to merge with domain/global settings

Function Documentation

int userbackend_init ( void  )

initialize the backend to query for local users

Returns
if initialization was successful
Return values
0backend was successfully initialized
>0error code
int userconf_find_domain ( const struct userconf ds,
const char *  key,
const char *  domain,
const unsigned int  flags 
)

find a domain in the user configuration key

Parameters
dsthe userconf buffer
keythe key name for lookup
domainthe domain name to search for
flagssearch flags
Returns
the type of the configuration entry returned
Return values
CONFIG_NONEthe domain was not found in the configuration
>0the domain was found in the configuration
<0negative error code
void userconf_free ( struct userconf ds)

free all information in a struct userconf

Parameters
dsthe struct to clear

This will not free the struct itself so it is safe to use a static or stack allocated struct. It will reset all values to a safe value so the struct can be reused.

int userconf_get_buffer ( const struct userconf ds,
const char *  key,
char ***  values,
checkfunc  cf,
const unsigned int  flags 
)

get a config buffer for a given user or domain

Parameters
dsthe userconf buffer
keythe key name to load the information for
valuesthe result array
cfa function to filter the entries (may be NULL)
flagssearch flags
Returns
the type of the configuration entry returned
Return values
<0negative error code
void userconf_init ( struct userconf ds)

initialize the struct userconf

Parameters
dsthe struct to initialize

All fields of the struct are reset to a safe invalid value.

int userconf_load_configs ( struct userconf ds)

load the filter settings for user and domain

Parameters
dsthe userconf buffer to hold the information
Returns
if filters were successfully loaded or error code
Return values
0filters were loaded (or no configuration is present)
>0error code