Sophie

Sophie

distrib > Mandriva > 2009.1 > x86_64 > by-pkgid > ec59eebcb2085800d0a9d9164aa98487 > files > 19

bincimap-1.2.13-2mdv2008.1.x86_64.rpm

multichkpwds v2.0

Date: Thu Sep 23 19:58:00 CEST 2004

Author: Andreas Aardal Hanssen
        <qmail@andreas.hanssen.name>

Use this utility to check user,pass pairs against multiple DjB
checkpassword-style programs. See http://cr.yp.to/checkpwd.html for
a description of how checkpassword works. This utility allows for
instance both virtual (vpopmail) and local users to use the same
pop3 and smtp services.

multichkpwds reads the user,pass data from fd 3, and stores it
temporarily. It then forks off one tester at a time, and writes the
user,pass data to that child. If the child rejects the password,
then the next child is tested.

multichkpwds assumes that when the child's exit code is 0, then the
password was accepted.

multichkpwds takes n + 1 arguments, where n is the number of
checkpassword-style programs (testers) you wish to test the
password with. The first argument is the number of testers.

For instance, if you wish to test the user,pass pair against vchkpw
(from vpopmail), and then, if it fails, against Dan's standard
checkpassword, with qmail-pop3d, the run command could be something
like this:

/usr/bin/tcpserver \
  -H -R -P -D \
  -l host.org \
  -c 30 -b 50 \
  0 110\
  /var/qmail/bin/qmail-popup host.org \
  /var/qmail/bin/tcp-env \
  /usr/local/bin/multichkpwds 2 \
  /bin/checkpassword \
  /home/vpopmail/bin/vchkpw \
  /var/qmail/bin/qmail-pop3d Maildir

Notice that multichkpwd's first argument, 2, tells that the next
two arguments are testers, and the rest of the argument list
continues as normal.  

To compile:

gcc -o multichkpwds multichkpwds2.c