pydspam
1.4
|
Classes | |
class | ctx |
Hold context for a DSPAM message operation Each context creates a new DSPAM_CTX struct within libdspam. More... | |
class | error |
Functions | |
def | userdir (home, user, ext=None) |
Return path of user or group specific file. More... | |
def | get_fcntl_lock (fd) |
Get fnctl lock for open file using libdspam conventions. More... | |
def | free_fcntl_lock (fd) |
Free the fnctl lock for an open file using libdspam conventions. More... | |
def | set_debug (mode) |
Set debugging output mode. More... | |
def | set_verified_user (flag) |
Set verified_user flag. More... | |
def | libdspam_init (driver) |
Initialize libdspam. More... | |
def | libdspam_shutdown () |
Shutdown libdspam. More... | |
Variables | |
tuple | LIBDSPAM_VERSION = (3,6,0) |
The compile time libdspam version. More... | |
string | CONFIGURE_ARGS = " '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--target=x86_64-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--enable-long-usernames' '--enable-syslog' '--enable-large-scale' '--enable-clamav' '--disable-domain-scale' '--disable-homedir' '--enable-virtual-users' '--enable-preferences-extension' '--with-mysql-includes=/usr/include/mysql' '--with-mysql-libraries=/usr/lib64/mysql' '--with-pgsql-includes=/usr/include/pgsql' '--with-pgsql-libraries=/usr/lib64' '--enable-daemon' '--enable-external-lookup' '--with-storage-driver=hash_drv,mysql_drv,pgsql_drv,sqlite3_drv' '--with-dspam-home=/var/lib/dspam' '--with-dspam-owner=dspam' '--with-dspam-group=mail' '--with-dspam-home-group=mail' '--with-dspam-mode=2511' '--with-logdir=/var/log/dspam' '--sysconfdir=/etc' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'target_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic'" |
Arguments passed to configure when building libdspam. More... | |
A thin wrapper around libdspam. Most users will not import dspam directly, but will instead import Dspam. This module gives you ultimate low level control from python.
def dspam.free_fcntl_lock | ( | fd | ) |
Free the fnctl lock for an open file using libdspam conventions.
fd | the fileno of an open file |
def dspam.get_fcntl_lock | ( | fd | ) |
Get fnctl lock for open file using libdspam conventions.
fd | the fileno of an open file |
def dspam.libdspam_init | ( | driver | ) |
Initialize libdspam.
Currently this just means dynamically loading the storage driver. The driver path can be None only if it was statically configured when libdspam was compiled.
libdspam_init calls dspam_init_driver(NULL)
, and will actually pass a DRIVER_CTX *
when I figure out the multi-threading API.
driver | str pathname to storage driver |
def dspam.libdspam_shutdown | ( | ) |
Shutdown libdspam.
Currently this just means unloading the storage driver, unless statically configured at libdspam compile time.
libdspam_shutdown calls dspam_shutdown_driver(NULL)
, with the DRIVER_CTX *
used in libdspam_init.
def dspam.set_debug | ( | mode | ) |
Set debugging output mode.
Mode 2 is more efficient, but mode 1 ensures that you see all the output. This only works if libdspam was configured with –enable-debug when compiled, and pydspam has DEBUG uncommented at the top. I will recommend to upstream that DO_DEBUG be always exported - or perhaps dspam_set_debug(int).
def dspam.set_verified_user | ( | flag | ) |
Set verified_user flag.
Set to true for libdspam to autocreate user directories, and other behaviour I haven't speced out yet. I defaulted this to True, since that is the dspam default when external lookup is not configured.
def dspam.userdir | ( | home, | |
user, | |||
ext = None |
|||
) |
Return path of user or group specific file.
This calls the internal libdspam function _ds_userdir_path()
, which has compile time options for how the path name is computed (for example LARGEFILE, HOMEDIR, DOMAINSCALE). If the extension is None, the user directory is returned, otherwise the path of a user file is returned. For a user file with no extension, use an empty string for the extension.
Referenced by Dspam.DSpamDirectory.user_files(), and Dspam.DSpamDirectory.write_web_stats().
string dspam.CONFIGURE_ARGS = " '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--target=x86_64-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--enable-long-usernames' '--enable-syslog' '--enable-large-scale' '--enable-clamav' '--disable-domain-scale' '--disable-homedir' '--enable-virtual-users' '--enable-preferences-extension' '--with-mysql-includes=/usr/include/mysql' '--with-mysql-libraries=/usr/lib64/mysql' '--with-pgsql-includes=/usr/include/pgsql' '--with-pgsql-libraries=/usr/lib64' '--enable-daemon' '--enable-external-lookup' '--with-storage-driver=hash_drv,mysql_drv,pgsql_drv,sqlite3_drv' '--with-dspam-home=/var/lib/dspam' '--with-dspam-owner=dspam' '--with-dspam-group=mail' '--with-dspam-home-group=mail' '--with-dspam-mode=2511' '--with-logdir=/var/log/dspam' '--sysconfdir=/etc' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'target_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic'" |
Arguments passed to configure when building libdspam.
The format is a space separated list of quoted strings. The example is a build for x86_64-redhat-linux-gnu.
tuple dspam.LIBDSPAM_VERSION = (3,6,0) |
The compile time libdspam version.
Python code might need to deal with several iterations of the libdspam API. This module constant is a tuple with the major, minor, and patch level of the library API at the time pydspam was compiled. This is not necessarily the same as the version of dspam running.