-# hcoop-change: Route mail for hosted domains
-
-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/exim.dat} \
- }}{|}{ }}}}
+# hcoop-change: Route mail for hosted domains
+
+virtual_user:
+ driver = accept
+ transport = virtual_delivery
+ # Look up the parameters for this email address, and store them in
+ # $address_data for later use. If no data exists for this address,
+ # then "fail", which causes Exim to move on to the next router.
+ # This allows us to access the contents of $address_data in the
+ # virtual_delivery transport later on, without having to do multiple
+ # accesses to exim.dat.
+ address_data = ${tr{${lookup{$local_part@$domain} \
+ dbm{/etc/courier/exim.dat}{$value} fail }} \
+ {|}{ }}
-# hcoop-change: This transport is used to deliver mail to virtual
-# mailboxes (i.e. email accounts which have been granted to non-hcoop
-# members by the owner of the domain)
-
-virtual_delivery:
- debug_print = "T: virtual_delivery for $local_part@$domain"
- driver = appendfile
- user = ${extract{uid}{${tr{${lookup{$local_part@$domain} \
- dbm{/etc/courier/exim.dat} \
- }}{|}{ }}}}
- group = mail
- mode = 0660
- mode_fail_narrower = false
- envelope_to_add
- return_path_add
- directory = ${extract{mail}{${tr{${lookup{$local_part@$domain} \
- dbm{/etc/courier/exim.dat} \
- }}{|}{ }}}}${run{/etc/exim4/get-token \
- ${extract{uid}{${tr{${lookup{$local_part@$domain} \
- dbm{/etc/courier/exim.dat} \
- }}{|}{ }}}}}{}}
- maildir_format
+# hcoop-change: This transport is used to deliver mail to virtual
+# mailboxes (i.e. email accounts which have been granted to non-hcoop
+# members by the owner of the domain)
+
+virtual_delivery:
+ debug_print = "T: virtual_delivery for $local_part@$domain"
+ driver = appendfile
+ user = ${extract{uid}{$address_data}}
+ group = nogroup
+ mode = 0600
+ mode_fail_narrower = false
+ envelope_to_add
+ return_path_add
+ directory = ${extract{mail}{$address_data}}${run{/etc/exim4/get-token \
+ ${extract{uid}{$address_data}}}{}}
+ maildir_format
LOGFILE=/tmp/exim4/get-token-log.$USER
if test "$REALUSER" = "root"; then
- if test -n "$2"; then
+ if test "$2" = "norecurse"; then
echo "Error: running as root even after trying to change to $USER" \
> $LOGFILE
exit 1
# Make sure USER exists, and resolve UIDs to a login name
USER=$(getent passwd "$USER" | cut -d':' -f 1)
+LOGFILE=/tmp/exim4/get-token-log.$USER
if test -z "$USER"; then
echo "$USER is not a local user, so ignoring them"
# print name of user
echo "Running as user $REALUSER"
+# debugging output
+if test "$2" = "debug"; then
+ shift; shift
+ echo "Debugging output: $*"
+fi
+
# set the credentials cache
export KRB5CCNAME=FILE:/tmp/exim4/krb5cc_$USER.email