[exim] getpwuid equivalent for username lookup?

Pàgina inicial
Delete this message
Reply to this message
Autor: John Robinson
Data:  
A: Exim Users
Assumpte: [exim] getpwuid equivalent for username lookup?
I'm trying to get the name of the owner of a file, because I want to run
spamassassin as that user (one real user per domain, basically). I
started with
address_data = ${extract{uid}
{${stat:/etc/mail/domains/$domain/mailboxes}} {$value} fail}
but of course that gets me the uid, not the user name. I've looked and I
don't see any expansion method of turning a uid into a username, and a
grep of the source doesn't point up any calls to getpwuid() in
likely-looking places. So then I've tried
address_data = ${run{stat -c %U /etc/mail/domains/$domain/mailboxes}
{$value} fail}
which seems to fail, then in desperation
address_data = ${run{bash -c "stat -c %U
/etc/mail/domains/$domain/mailboxes"} {$value} fail}
which is no better. The following is the result of testing with `exim -v
-d+all -bv`, firstly without bash:

13:58:54 18522 processing address_data
13:58:54 18522 expanding: stat -c %U /etc/mail/domains/$domain/mailboxes
13:58:54 18522    result: stat -c %U 
/etc/mail/domains/test.yuiop.co.uk/mailboxes
13:58:54 18522 direct command:
13:58:54 18522   argv[0] = stat
13:58:54 18522   argv[1] = -c
13:58:54 18522   argv[2] = %U
13:58:54 18522   argv[3] = /etc/mail/domains/test.yuiop.co.uk/mailboxes
13:58:54 18522 expanding: $value
13:58:54 18522    result:
13:58:54 18522 skipping: result is not used
13:58:54 18522 failed to expand: ${run{stat -c %U 
/etc/mail/domains/$domain/mailboxes} {$value} fail}
13:58:54 18522    error message: "run" failed and "fail" requested
13:58:54 18522 failure was forced
13:58:54 18522 forced failure in expansion of "${run{stat -c %U 
/etc/mail/domains/$domain/mailboxes} {$value} fail}" (address_data): 
decline action taken


and then with bash, very similar:

14:18:14 18646 processing address_data
14:18:14 18646 expanding: bash -c "stat -c %U 
/etc/mail/domains/$domain/mailboxes"
14:18:14 18646    result: bash -c "stat -c %U 
/etc/mail/domains/test.yuiop.co.uk/mailboxes"
14:18:14 18646 direct command:
14:18:14 18646   argv[0] = bash
14:18:14 18646   argv[1] = -c
14:18:14 18646   argv[2] = stat -c %U 
/etc/mail/domains/test.yuiop.co.uk/mailboxes
14:18:14 18646 expanding: $value
14:18:14 18646    result:
14:18:14 18646 skipping: result is not used
14:18:14 18646 failed to expand: ${run{bash -c "stat -c %U 
/etc/mail/domains/$domain/mailboxes"} {$value} fail}
14:18:14 18646    error message: "run" failed and "fail" requested
14:18:14 18646 failure was forced
14:18:14 18646 forced failure in expansion of "${run{bash -c "stat -c %U 
/etc/mail/domains/$domain/mailboxes"} {$value} fail}" (address_data): 
decline action taken


I'm running exim from ATrpms on CentOS 4, here's my exim -bV:
Exim version 4.66 #1 built 17-Jan-2007 15:33:04
Copyright (c) University of Cambridge 2006
Berkeley DB: Sleepycat Software: Berkeley DB 4.2.52: (December 11, 2004)
Support for: crypteq iconv() IPv6 PAM Perl TCPwrappers OpenSSL
Content_Scanning Old_Demime Experimental_SPF Experimental_SRS
Experimental_DomainKeys
Lookups: lsearch wildlsearch nwildlsearch iplsearch cdb dbm dbmnz dnsdb
dsearch ldap ldapdn ldapm mysql nis nis0 nisplus passwd pgsql sqlite
Authenticators: cram_md5 cyrus_sasl dovecot plaintext spa
Routers: accept dnslookup ipliteral manualroute queryprogram redirect
Transports: appendfile/maildir/mailstore/mbx autoreply lmtp pipe smtp
Fixed never_users: 0
Size of off_t: 4
Configuration file is /etc/exim/exim.conf

Of course I'd rather not use ${run} at all... can anybody point out my
foolish mistake?

Cheers,

John.