Re: Virtual home-directories
"Matthias Andree" <[email protected]>
| Newsgroups | gmane.mail.bogofilter.general |
|---|---|
| Message-ID | <[email protected]> |
Am 16.09.2009, 14:00 Uhr, schrieb RW <[email protected]>: > On Tue, 15 Sep 2009 21:11:50 -0400 > David Relson <[email protected]> wrote: > >> Bogofilter looks for a system config file in /etc/ and for the user >> config file in ~/.bogofilter/ > > ~/.bogofilter.cf according to the manpage > >> Since you're looking for per-user >> configuration, you can use the user config file directory. > > I'm talking about virtual user configuration rather than unix users. > > As I understand it, a login shell sets HOME to the home directory set in > the password file and thereafter the shell treats ~ as the current > value of HOME. SpamAssassin follows this convention by keeping its > user data under HOME. So if you use some kind of script to fetch the > mail, you can set HOME to something like: "/var/db/mailhome/${USER}" > for virtual users. > > When I tried this with Bogofilter I found that it only half works, it > uses HOME for wordlist.db, but ignores it for .bogofilter.cf While I cannot currently state (for lack of research) how shells *would* behave, I can say that bogofilter uses the passwd database (through libc functions such as getpwent(3)) to determine the home directory. If you want the $HOME variable to take precedence, find this section in src/find_home_tildeexpand.c (the line numbers are not in the file) and change line 70 from the "false" to "true", then recompile and reinstall: 57 if (l > 0) { 58 /* got a parameter to the tilde */ 59 tmp = xmalloc(l + 1); 60 memcpy(tmp, &name[1], l); 61 /* we want exactly the first l characters but as C string, 62 * so stuff the NUL byte */ 63 tmp[l] = '\0'; 64 65 home = find_home_user(tmp); 66 67 xfree(tmp); 68 } else { 69 /* plain tilde */ 70 home = find_home(false); 71 } after modification, l. 70 should read: home = find_home(true); I'm not sure if this is sufficient, so I will appreciate feedback. HTH -- Matthias Andree _______________________________________________ Bogofilter mailing list [email protected] http://www.bogofilter.org/mailman/listinfo/bogofilter