From 9ce616e33d36b195c6c5e3e00d2dc1c208a824dd Mon Sep 17 00:00:00 2001 From: root Date: Thu, 1 Nov 2007 03:09:50 -0400 Subject: [PATCH] Go back to exim.dat for Exim, get virtual delivery almost working --- conf.d/auth/30_exim4-config_examples | 6 +++--- conf.d/router/310_exim4-config_virtual_user | 8 ++++---- conf.d/transport/40_exim4-config_virtual_delivery | 6 +++--- get-token | 14 +++++++++++--- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/conf.d/auth/30_exim4-config_examples b/conf.d/auth/30_exim4-config_examples index f844199..b228b4c 100644 --- a/conf.d/auth/30_exim4-config_examples +++ b/conf.d/auth/30_exim4-config_examples @@ -210,7 +210,7 @@ cram_md5: client_name = ${extract{1}{:}{${lookup{$host}nwildlsearch{CONFDIR/passwd.client}{$value}fail}}} client_secret = ${extract{2}{:}{${lookup{$host}nwildlsearch{CONFDIR/passwd.client}{$value}fail}}} -# hcoop-change: Authenticate against /etc/courier/userdb.dat for plain +# hcoop-change: Authenticate against /etc/courier/exim.dat for plain # and login authenticators userdb_plain: @@ -220,7 +220,7 @@ userdb_plain: ${if \ crypteq {$3} \ {${extract{systempw}{${tr{${lookup{$2} \ - dbm{/etc/courier/userdb.dat} \ + dbm{/etc/courier/exim.dat} \ }}{|}{ }}}}} \ {yes} \ {no} \ @@ -235,7 +235,7 @@ userdb_login: ${if \ crypteq {$2} \ {${extract{systempw}{${tr{${lookup{$1} \ - dbm{/etc/courier/userdb.dat} \ + dbm{/etc/courier/exim.dat} \ }}{|}{ }}}}} \ {yes} \ {no} \ diff --git a/conf.d/router/310_exim4-config_virtual_user b/conf.d/router/310_exim4-config_virtual_user index 8491201..6ff2d33 100644 --- a/conf.d/router/310_exim4-config_virtual_user +++ b/conf.d/router/310_exim4-config_virtual_user @@ -3,7 +3,7 @@ virtual_user: driver = accept transport = virtual_delivery - require_files = /home/vmail/${domain}/${local_part} -# condition = ${extract{mail}{${tr{${lookup{$local_part@$domain} \ -# dbm{/etc/courier/userdb.dat} \ -# }}{|}{ }}}} +# require_files = /home/vmail/${domain}/${local_part} + condition = ${extract{mail}{${tr{${lookup{$local_part@$domain} \ + dbm{/etc/courier/exim.dat} \ + }}{|}{ }}}} diff --git a/conf.d/transport/40_exim4-config_virtual_delivery b/conf.d/transport/40_exim4-config_virtual_delivery index 8dce1f9..49a27ef 100644 --- a/conf.d/transport/40_exim4-config_virtual_delivery +++ b/conf.d/transport/40_exim4-config_virtual_delivery @@ -6,7 +6,7 @@ virtual_delivery: debug_print = "T: virtual_delivery for $local_part@$domain" driver = appendfile user = ${extract{uid}{${tr{${lookup{$local_part@$domain} \ - dbm{/etc/courier/userdb.dat} \ + dbm{/etc/courier/exim.dat} \ }}{|}{ }}}} group = mail mode = 0660 @@ -14,9 +14,9 @@ virtual_delivery: envelope_to_add return_path_add directory = ${extract{mail}{${tr{${lookup{$local_part@$domain} \ - dbm{/etc/courier/userdb.dat} \ + dbm{/etc/courier/exim.dat} \ }}{|}{ }}}}${run{/etc/exim4/get-token \ ${extract{uid}{${tr{${lookup{$local_part@$domain} \ - dbm{/etc/courier/userdb.dat} \ + dbm{/etc/courier/exim.dat} \ }}{|}{ }}}}}{}} maildir_format diff --git a/get-token b/get-token index 3a28140..4d6f282 100755 --- a/get-token +++ b/get-token @@ -15,8 +15,8 @@ REALUSER=$(whoami) USER=$1 LOGFILE=/tmp/exim4/get-token-log.$USER -if [ "$REALUSER" = "root" ]; then - if [ -n "$2" ]; then +if test "$REALUSER" = "root"; then + if test -n "$2"; then echo "Error: running as root even after trying to change to $USER" \ > $LOGFILE exit 1 @@ -24,7 +24,7 @@ if [ "$REALUSER" = "root" ]; then # Decide whether the user exists: getent returns 0 error code if so getent passwd "$USER" >/dev/null - if [ $? -ne 0 ]; then + if test $? -ne 0; then echo "$USER is not a local user, so ignoring them" exit 1 else @@ -32,6 +32,14 @@ if [ "$REALUSER" = "root" ]; then fi fi +# Make sure USER exists, and resolve UIDs to a login name +USER=$(getent passwd "$USER" | cut -d':' -f 1) + +if test -z "$USER"; then + echo "$USER is not a local user, so ignoring them" + exit 1 +fi + # fuse stdin and stderr exec 2>&1 -- 2.20.1