Durk Strooisma
2009-Jan-12 17:31 UTC
[Dovecot] [checkpassword] I can't get a password from fd3
Hi all,
I'm trying to implement checkpassword authentication with a simple bash
script. In some way I can't get the password from file descriptor 3.
The start of script looks like this:
#!/bin/bash
read -d '\0' -r -u 3
USERNAME="${REPLY}"
read -d '\0' -r -u 3
PASSWORD="${REPLY}"
if [ -z "${USERNAME}" ] || [ -z "${PASSWORD}" ]
then
exit 111
fi
It always exits with 111, because PASSWORD is empty. In whatever way I try
to retrieve data from fd3, I never happen to get more data than the username.
Is this a known problem? Am I doing something silly? Replies are much
appreciated!
Durk
FYI: GSSAPI auth works perfect and PAM worked before switching to
checkpassword too.
OS version : Debian 5.0 lenny amd64
Dovecot version : 1.0.15 (Debian version 1.0.15-2.3)
Parts of /etc/dovecot/dovecot.conf:
protocols: imap
ssl_cert_file: /etc/ssl/certs/cert.pem
ssl_key_file: /etc/ssl/private/cert.key
ssl_cipher_list: ALL:!LOW:!SSLv2
login_dir: /var/run/dovecot/login
login_executable: /usr/lib/dovecot/imap-login
first_valid_uid: 998
last_valid_uid: 998
first_valid_gid: 998
last_valid_gid: 998
mail_privileged_group: mail
mail_location: maildir:/srv/vmail/%Ld/%n
lock_method: flock
maildir_copy_with_hardlinks: yes
auth default:
mechanisms: gssapi plain
krb5_keytab: /etc/dovecot/krb5.keytab
verbose: yes
debug: yes
passdb:
driver: checkpassword
args: /usr/bin/dovecot-checkpassword
userdb:
driver: ldap
args: /etc/dovecot/dovecot-ldap.conf
Timo Sirainen
2009-Jan-12 18:40 UTC
[Dovecot] [checkpassword] I can't get a password from fd3
On Mon, 2009-01-12 at 18:31 +0100, Durk Strooisma wrote:> #!/bin/bash > > read -d '\0' -r -u 3Are you sure this is supposed to work? \0 character is an end-of-string character in C language, and I wouldn't be surprised if read simply didn't support it as delimiter. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: This is a digitally signed message part URL: <http://dovecot.org/pipermail/dovecot/attachments/20090112/1c5bbcdd/attachment-0002.bin>
Durk Strooisma
2009-Jan-12 19:54 UTC
[Dovecot] [checkpassword] I can't get a password from fd3
> On Mon, 2009-01-12 at 18:31 +0100, Durk Strooisma wrote: >> #!/bin/bash >> >> read -d '\0' -r -u 3 > > Are you sure this is supposed to work? \0 character is an end-of-string > character in C language, and I wouldn't be surprised if read simply > didn't support it as delimiter.Well if I try to read everything, without delimiting using \0, I don't get more data... Durk
Lutz Preßler
2009-Jan-12 23:39 UTC
[Dovecot] [checkpassword] I can't get a password from fd3
Hello Durk, Am Montag, 12. Januar 2009 schrieb Durk Strooisma:> I'm trying to implement checkpassword authentication with a simple bash > script. In some way I can't get the password from file descriptor 3. > > The start of script looks like this: > > #!/bin/bash > > read -d '\0' -r -u 3You are missing the correct syntax to interpret backslash escapes here: read -d $'\0' -r -u 3 will work. Lutz