Testing checkpassword on FreeBSD

Jarrad <[email protected]> Mon, 12 Jan 2004 21:18:08 +0000
Newsgroups gmane.comp.djb.checkpassword
Message-ID <[email protected]>
Hello all,

I posted the following to the qmail list earlier today, but now realize 
it should've gone here since I'm not at the point of incorporating it 
into my qmail-smtpd/run script... Any help is appreciated, as I'm at a 
complete loss on how to proceed.

--

I'm having some trouble getting checkpassword to work; tests indicate 
it's not working. I'm running FreeBSD 4.9-RELEASE, and installed 
checkpassword from the ports collection.

Permissions for checkpassword are:

-rwxr-xr-x   1 root  wheel     7676 Jan 11 11:37 checkpassword

I've run the following tests (from 
http://www.qmail.org/top.html#checkpassword):

post# sh
# printf "%s\0%s\0%s\0" username password 1073898264 | 
/usr/local/bin/checkpassword id 3<&0
# perl -e 'printf "%s\0%s\0%s\0", "username", "password", "1073898264"' 
| /usr/local/bin/checkpassword id 3<&0
# echo "username\0password\01073898264\0" | 
/usr/local/bin/checkpassword id 3<&0
# exit

(I've replaced my actual username and password with "username" and 
"password" above, but did use them during the actual tests. 1073898264 
is the timestamp for January 12th 2004, 9:04:24 [GMT])

id isn't run, which indicates checkpassword isn't working.

FreeBSD stores encrypted passwords in /etc/master.passwd, rather than 
/etc/passwd, so I thought that might be a problem as the checkpassword 
documentation indicates that it uses the latter. But a search of the 
archives turned up 
http://www.ornl.gov/lists/mailing-lists/qmail/1998/02/msg00444.html 
which says it shouldn't matter, as FreeBSD supports the getpwnam 
function used by checkpassword. Another post indicates that the FreeBSD 
version of printf drops the "\0" from output, which is why I tried the 
third test.

Any idea what I'm doing wrong here?