Qsmtp  0.30dev
Functions
getfile.c File Reference

functions to get information from filterconf files More...

#include <qsmtpd/userfilters.h>
#include <control.h>
#include <diropen.h>
#include <qsmtpd/userconf.h>
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
#include <unistd.h>

Functions

int getfile (const struct userconf *ds, const char *fn, enum config_domain *type, const unsigned int flags)
 
static long checkconfig (const char *const *config, const char *flag, const size_t l)
 
static long getsetting_internal (const struct userconf *ds, const char *flag, enum config_domain *type, const unsigned int flags)
 
long getsetting (const struct userconf *ds, const char *flag, enum config_domain *type)
 
long getsettingglobal (const struct userconf *ds, const char *flag, enum config_domain *type)
 

Detailed Description

functions to get information from filterconf files

Function Documentation

static long checkconfig ( const char *const *  config,
const char *  flag,
const size_t  l 
)
static

search a value in a given list of config values

Parameters
configlist of settings, last entry has to be NULL, list may be NULL
flagthe value to find
lstrlen(flag)
Returns
the value assotiated with flag
Return values
0no match
-1syntax error
int getfile ( const struct userconf ds,
const char *  fn,
enum config_domain type,
const unsigned int  flags 
)

check in user and domain directory if a file with given filename exists

Parameters
dsstrings of user and domain directory
fnfilename to search
typeif user, domain or global directory matched, undefined if result != 1
flagssearch flags
Returns
file descriptor of opened file
Return values
-1on error (errno is set)
See also
userconf_flags for values passed in flags
long getsetting ( const struct userconf ds,
const char *  flag,
enum config_domain type 
)

get setting from user or domain filterconf file

Parameters
dsstruct with the user/domain config info
flagname of the setting to find (case sensitive)
typeif user or domain directory matched, undefined if result != 1)
Returns
value of setting
Return values
1boolean setting or no number given
0setting not found
-1on syntax error
long getsettingglobal ( const struct userconf ds,
const char *  flag,
enum config_domain type 
)

use getsetting and fall back to /var/qmail/control if this finds nothing

Parameters
dsstruct with the user/domain config info
flagname of the setting to find (case sensitive)
typeif user, domain or global file matched, undefined if result != 1
Returns
value of setting
Return values
1boolean setting or no number given
0setting not found
-1on syntax error