Hi,
in my setup i use virtual users with one userid for all, the problem i had
was that exim can not set $home for virtual users, because it only set it
while check_local_user.
So it's impossible to use something like
save .Exim/
in a filterfile, or
save $home/.Exim/
until now i used sg+readfile to modify the filter file with a regular
expression, to convert
save .Exim/
to
save /var/imap/DOMAIN/USER/.Exim/
that worked, but it's ugly, and it's not the full support like exim does,
with this patch, you can set home_directory in a router to set $home
directly, this will be carried over to the transport too, so you can
(SHOULD) use
create_file = belowhome
their too.
As usual, comments to the list, flames to me.
ciao
diff -uNr exim-snapshot/src/globals.c exim-snapshot.new/src/globals.c
--- exim-snapshot/src/globals.c Thu Aug 29 11:26:02 2002
+++ exim-snapshot.new/src/globals.c Fri Oct 25 15:12:53 2002
@@ -654,6 +654,7 @@
NULL, /* extra_headers */
NULL, /* fallback_hosts */
NULL, /* home_directory */
+ NULL, /* router_home_directory */
NULL, /* ignore_target_hosts */
NULL, /* local_parts */
NULL, /* pass_router_name */
diff -uNr exim-snapshot/src/route.c exim-snapshot.new/src/route.c
--- exim-snapshot/src/route.c Thu Aug 29 11:26:04 2002
+++ exim-snapshot.new/src/route.c Fri Oct 25 15:26:11 2002
@@ -56,6 +56,8 @@
(void *)offsetof(router_instance, extra_headers) },
{ "headers_remove", opt_stringptr|opt_public,
(void *)offsetof(router_instance, remove_headers) },
+ { "home_directory", opt_stringptr|opt_public,
+ (void *)offsetof(router_instance, router_home_directory) },
{ "ignore_target_hosts",opt_stringptr|opt_public,
(void *)offsetof(router_instance, ignore_target_hosts) },
{ "initgroups", opt_bool | opt_public,
@@ -811,6 +813,22 @@
deliver_home = string_copy(US (*pw)->pw_dir);
}
+/* Without check_local_user we set the home directory from the routers
+optionsblock */
+else if (r->router_home_directory)
+ {
+ uschar *home = expand_string(r->router_home_directory);
+
+ if (home == NULL)
+ {
+ *perror = string_sprintf("failed to expand \"%s\" for home_directory: %s",
+ r->router_home_directory, expand_string_message);
+ return DEFER;
+ }
+
+ deliver_home = string_copy(US home);
+ }
+
/* This is the point at which we print out the router's debugging string if it
is set. We wait till here so as to have $home available for local users (and
anyway, we don't want too much stuff for skipped routers). */
diff -uNr exim-snapshot/src/routers/redirect.c exim-snapshot.new/src/routers/redirect.c
--- exim-snapshot/src/routers/redirect.c Fri Oct 25 16:37:05 2002
+++ exim-snapshot.new/src/routers/redirect.c Fri Oct 25 16:38:59 2002
@@ -336,7 +336,9 @@
if (rblock->home_directory != NULL)
next->home_dir = rblock->home_directory;
else if (rblock->check_local_user)
- next->home_dir = string_sprintf("\\N%s\\N", pw->pw_dir)
+ next->home_dir = string_sprintf("\\N%s\\N", pw->pw_dir);
+ else if (rblock->router_home_directory != NULL)
+ next->home_dir = rblock->router_home_directory;
next->current_dir = rblock->current_directory;
diff -uNr exim-snapshot/src/structs.h exim-snapshot.new/src/structs.h
--- exim-snapshot/src/structs.h Thu Aug 29 11:26:05 2002
+++ exim-snapshot.new/src/structs.h Fri Oct 25 15:05:14 2002
@@ -220,6 +220,7 @@
uschar *extra_headers; /* Additional headers */
uschar *fallback_hosts; /* For remote transports (text list) */
uschar *home_directory; /* For use during delivery */
+ uschar *router_home_directory; /* For use during routing (emulate check_local_user) */
uschar *ignore_target_hosts; /* Target hosts to ignore */
uschar *local_parts; /* Specific local parts */
uschar *pass_router_name; /* Router for passed address */