The %M smb.conf variable isn't returning hostnames. I used the following
parameter to test:
preexec = touch /tmp/logon-%M.txt
After logging on from a remote client called nessus.rodsbooks.com at
192.168.1.3, the file /tmp/logon-192.168.1.3.txt is present, but not
/tmp/logon-nessus.rodsbooks.com.txt. This parameter works correctly in Samba
2.2.8a. I've tested this with Samba 3.0.1 binaries delivered with Fedora 1 and
with a locally-built Samba 3.0.0 on a SUSE 8.1 system.
setting 'hostname lookups = yes' should resolve this. The default
is to avoid potentially expensive DNS reverse lookups.