Hello, Stock qmail-ldap hardcode bin/auth_smtp as the application to be used for SMTP AUTH.
This python script can be used to replace it to allow more than one
backend to be checked (the same way the multiple POP python script I
posted to the list done).
I am not an SMTP AUTH expert but AFAICS this will only work for auth
plain, but a EHLO on my qmail server does not seem to allow any other
type.
Regards,
Thomas Mangin
---
#!/usr/bin/env python
# For some information about the interface used, see :
# http://cr.yp.to/checkpwd/interface.html
import os
import sys
INPUT_FD = 0
OUTPUT_FD = 1
CHECK_PW = 0
AUTH_SMTP = 1
data = ""
if len(sys.argv) == 1:
try:
file = os.fdopen(INPUT_FD)
# The maximum is 512, so we use the double for BASE64
data = os.read(file.fileno(),1024)
file.close()
except:
sys.exit(111)
else:
sys.exit(111)
for type,check in \
[(CHECK_PW,'/usr/bin/checkvpw'),(AUTH_SMTP,'/var/qmail/bin/auth_smtp.org')]:
sys.argv[0] = check.split('/')[-1]
(r,w) = os.pipe()
pid = os.fork()
if type == AUTH_SMTP:
# Remove "login\0"
info = data[6:]
else:
info = data
if pid:
os.write(w,info)
os.close(w)
(pid, res) = os.waitpid(pid,0)
res = res >> 8
if res == 0:
break
else:
os.close(w)
os.dup2(r,INPUT_FD)
os.close(r)
os.execve(check,sys.argv,os.environ)
sys.exit(res)
signature.asc
Description: This is a digitally signed message part
