Hi all,
I need to use maildrop 1.8.1 with postfix 2.2.5, and need to make the
homeDirectory of the user auto, then i have changed some lines in
maildrop/main.C code to this. It work half, it read the maildroprc
before check the directory, then i include this lines in the
maildroprc:
SHELL=/bin/sh
DIR = `dirname $HOME`
`/usr/bin/test -d $HOME`
if( $RETURNCODE != 0)
{
`mkdir -p $DIR`
`maildirmake $HOME`
`chown virtual.virtual -R $DIR`
}
I have user and group "virtual" to virtual users.
While it receive it check if the home directory exists, then execute
this commands. It work, but message not delivery "maildrop: Home
directory owned by wrong user." in maillog. But if look into
maildroprc it set the correct owner.
If postqueue -f then the message is delivery fine.
Anyone have a idea to fix this?
Why by default it don't run the maildroprc? So is more easy to make
the default homeDirectory.
A lot of explains :)
I'm not a master C language, sorry if break the code.
Sorry my english.
--
Fernando Ribeiro - GPG-KEY: 0x8D7255F4
Linux Counter: #273768 - ICQ: 175630330
RHCE - Red Hat Certified Engineer
LPIC-2 - Advanced Linux
CCSA - CheckPoint Cert. Security Admin.
Death the graph! Death the mouse
Death patents! Death closed standards!
http://www.nerdgroup.org
http://musb.nerdgroup.org
--------------------------------------
"Grandes mentes discutem idéias;
Mentes medianas discutem eventos;
Mentes pequenas discutem pessoas."
--------------------------------------
"A mente que se abre a uma nova idéia
jamais volta ao seu tamanho original."
Albert Einstein
--- maildrop-1.8.1-new/maildrop/main.C 2005-08-20 15:02:03.000000000 -0300
+++ maildrop-1.8.1/maildrop/main.C 2005-08-20 16:38:55.000000000 -0300
@@ -656,34 +656,33 @@
if (VerboseLevel() > 1)
merr << "maildrop: Changing to " << h << "\n";
-int fd;
-//
-// if (!embedded_filter && deliverymode)
-// {
- Recipe r;
- Lexer in;
-
- fd=in.Open(ETCDIR "/maildroprc");
- if (fd < 0)
- {
- if (errno != ENOENT)
- {
- errexit=EX_TEMPFAIL;
- throw "Error opening " ETCDIR "/maildroprc.";
- }
- }
- else
- {
- if (r.ParseRecipe(in) < 0)
- return (EX_TEMPFAIL);
- r.ExecuteRecipe();
- }
-// }
if (chdir(h) < 0)
{
- errexit=EX_TEMPFAIL;
- throw "Unable to change to home directory.";
+ int fd;
+ Recipe r;
+ Lexer in;
+
+ name="HOME";
+ SetVar(name, maildrop.init_home);
+
+ fd=in.Open(ETCDIR "/maildroprc");
+ if (fd < 0)
+ {
+ if (errno != ENOENT)
+ {
+ errexit=EX_TEMPFAIL;
+ throw "Error opening " ETCDIR "/maildroprc.";
+ }
+ }
+ else
+ {
+ if (r.ParseRecipe(in) < 0)
+ return (EX_TEMPFAIL);
+ r.ExecuteRecipe();
+ }
+// errexit=EX_TEMPFAIL;
+// throw "Unable to change to home directory.";
}
recipe=".mailfilter";