# qmail + vpopmail problems with smtp auth using vchkpw

## kahlotus

I've search through the other messages but still have not found something that will fix this.

emerged qmail and vpopmail (1.03r10 +ssl and 5.2.1-r5) 

POP is working fine but smtp is not.  I need to have remote individuals using MS Office send mail but it isn't working.  It doesn't even seem that it is even getting to the point where it can check the username/password.  

Using information I found on http://www.ornl.gov/cts/archives/mailing-lists/qmail/2003/05/msg00312.html I changed the /service/qmail-smtpd/run script to

```
#!/bin/sh

QMAILDUID=`id -u vpopmail`

NOFILESGID=`id -g vpopmail`

exec /usr/bin/softlimit -m 8000000 \

        /usr/bin/tcpserver -H -R -v -p -x /etc/tcp.smtp.cdb \

        -u $QMAILDUID -g $NOFILESGID 0 smtp strace /var/qmail/bin/qmail-smtpd \

  localhost /var/vpopmail/bin/vchkpw /bin/true 2>&1

```

Attempting to send an email using MS Office where the client is set to use SMTP authentication generates the following

 *Quote:*   

> select(2, NULL, [1], NULL, {1200, 0})   = 1 (out [1], left {1200, 0})
> 
> write(1, "220 xxxxxxx.org ESMTP\r\n", 23) = 23
> 
> select(1, [0], NULL, NULL, {1200, 0})   = 1 (in [0], left {1200, 0})
> ...

 

According to the above url this would appear to indicate a problem with the amount of memory assigned.  So I bumped it up to 10M, 15M, and then 25M with the same results.

The user name and password are correct according to the vpasswd line 

```

user:$1$Psvzn$T9KdjGkphRFH4n6Kikp6l0:1:0:user:/var/vpopmail/domains/mydomain.com/user:30000000,1000C:myuser

```

I am running out of ideas and am hoping someone else may have some.

----------

## kahlotus

As an additional piece of information I changed the /service/qmail-smtpd/run to 

```

#!/bin/sh

QMAILDUID=`id -u vpopmail`

NOFILESGID=`id -g vpopmail`

exec /usr/bin/softlimit -m 25000000 \

        /usr/bin/tcpserver -H -R -v -p -x /etc/tcp.smtp.cdb \

        -u $QMAILDUID -g $NOFILESGID 0 smtp strace -f -s 4096 -o /tmp/smtpd.log /var/qmail/bin/qmail-smtpd \

  localhost /var/vpopmail/bin/vchkpw /bin/true 2>&1

r
```

and am now seeing some additional information.

 *Quote:*   

> 
> 
> 6178  read(0, "dXNlckBteWRvbWFpbi5jb20=\r\n", 1024) = 26
> 
> 6178  select(2, NULL, [1], NULL, {1200, 0}) = 1 (out [1], left {1200, 0})
> ...

 

If I am reading this correctly the problem appears to be when qmail attempts to start the vchkpw around the (Bad file descriptor).  Any ideas

----------

## benow

I also ran into this issue... but, have not yet solved it.  By throwing in a bit of debug code into authenticate() within qmail-smtpd.c

```
sprintf( ssoutbuf, "DEBUG: %d\n\rTrying to execute %s\n\r", child, childargs[0]);

out( ssoutbuf );

```

I found it was trying to execute argv[1], which in your example is localhost.  I've hacked the run script to be:

```
exec /usr/bin/softlimit -m 25000000 \

        /usr/bin/tcpserver -H -R -v -p -x /etc/tcp.smtp.cdb \

        -u $QMAILDUID -g $NOFILESGID 0 smtp strace -f -s 4096 -o /tmp/smtpd.log /var/qmail/bin/qmail-smtpd \

  /var/vpopmail/bin/vchkpw /var/vpopmail/bin/vchkpw /bin/true 2>&1 

```

It then didn't die on the pipe, but the auth still fails.  By tailing the mysql log, I can tell vchkpw it is not being called (properly).  I even tried disabling #define CRAM_MD5, which made auth fall back to AUTH LOGIN, the simplest of the simple and it also fails. Grr.

EDIT: I managed to make it go by dropping the hostname from the smtpd run cmd and by re-emerging vpopmail

----------

