[Pkg-dspam-misc] Include with ~ expansion

Johannes Berg johannes at sipsolutions.net
Sat Dec 16 16:10:04 CET 2006


Hi,

Due to the way I run dspam from each user I want each user to obviously
only have access to their own data. I figured I can solve this using
views, but mysql doesn't allow identification based on ident or such.

Hence, I'm thinking of simply giving each user an own mysql user and
doing some mapping within the database. But in order to have dspam use
this, I need to have per-user dspam config with the mysql user/password.
This isn't hard, I can simply drop a new .dspam-password.conf file into
each users home directory.

For that, however, I need a patch like this (applies on top of the
debian patches).

If I can make this work with views and such, what's the chance you will
ship this patch? I'll add proper documentation for it if you want.

--- dspam-3.6.8.orig/src/read_config.c	2006-12-16 15:58:16.100489960 +0100
+++ dspam-3.6.8/src/read_config.c	2006-12-16 16:05:02.180489960 +0100
@@ -181,8 +181,15 @@ long fileread(const char *path, config_t
     while ((v = tokenize(NULL, &bufptr)) != NULL) {
       // Check for include directive
       if (strcmp(a, "Include") == 0) {
-        // Give v (value) to dirraed
-        num_root = dirread(v, attrib, num_root);
+        // Give v (value) to dirread, but expand ~ first if it comes first
+        if (*v == '~') {
+          strncpy(buffer, getenv("HOME"), sizeof(buffer));
+          buffer[sizeof(buffer)-1] = '\0';
+          strncat(buffer, v+1, sizeof(buffer)-1);
+          num_root = dirread(buffer, attrib, num_root);
+        } else {
+          num_root = dirread(v, attrib, num_root);
+        }
       } else {
         if (_ds_find_attribute((*attrib), a)!=NULL) { 
           _ds_add_attribute((*attrib), a, v);

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part
Url : http://lists.alioth.debian.org/pipermail/pkg-dspam-misc/attachments/20061216/4d40b1b9/attachment.pgp


More information about the Pkg-dspam-misc mailing list