# maildrop problem:  "authdaemon: s_connect() failed&quot

## -bm-

Hi forum.

I've got a strange problem with dropmail. I'm running my small rootserver with gentoo Linux and use the GPL'ed Adminpanel syscp to configure E-Mailaccounts, Subdomains etc. Everything works fine, E-Mails are delivered to the users maildirs - but only if postfix is doing the job. When I try to use dropmail, I get a strange error and the mail goes into nirvana.

Syscp uses a sql-Database to store all informations about e-Mailadresses etc. Postfix is configured to fetch this informations directly out of the database. That works fine. But not if dropmail schould deliver the mails. That is what I found in the mail.log:

```
Apr 6 18:11:15 ipx20245 postfix/pipe[490]: B14FD5020B: to=<mail@bastian-m.de>, relay=dropmail, delay=0, status=bounced (user unknown. Command output: ERR: authdaemon: s_connect() failed: No such file or directory Invalid user specified. )

Apr 6 18:11:15 ipx20245 postfix/qmgr[487]: B14FD5020B: removed 
```

Here is a jpeg that shows, how components work together on my server: http://www.bastian-m.de/tmp/schema.jpg

So I looked around in /etc. When I emerged dropmail, courier-authlib was installed as dependencie. What I dont'n understand: I already emerged courier-imap, I think it comes with it's own authlib included, doesn't it? In /etc there are "courier-imap" and "courier". The last one is there since courier-authlib was installed (the one that comes with dropmail as dependencie). In /etc/courier/authlib I found this files "authdaemond.conf" "authdaemonrc" "authmysqlrc". I know this files from /etc/courier-imap where I use them to make the imap/pop3-Server work. So I copied this working versions over to /etc/courier/authlib but nothing changed.

I don't know how debug this. 

Here are some of my config-files:

authdaemond.conf:

```

# Copyright 1999-2004 Gentoo Foundation

# Distributed under the terms of the GNU General Public License v2

# $Header: /var/cvsroot/gentoo-x86/net-mail/courier-imap/files/authdaemond.conf-3.0.4-r1,v 1.2 2004/06/26 23:30:58 robbat2 Exp $

AUTHDAEMOND="authdaemond.mysql"

```

authdaemonrc:

```

authmodulelist="authmysql authpam"

authmodulelistorig="authcustom authcram authuserdb authldap authmysql authpam"

daemons=5

version=""

authdaemonvar=/var/lib/courier-imap/authdaemon

```

authmysqlrc:

```

MYSQL_SERVER localhost

MYSQL_USERNAME %THE_USERNAME%

MYSQL_PASSWORD %THE_PASSWORD%

MYSQL_PORT 3136

MYSQL_DATABASE syscp

MYSQL_USER_TABLE mail_users

MYSQL_CRYPT_PWFIELD password_enc

MYSQL_UID_FIELD uid

MYSQL_GID_FIELD gid

MYSQL_LOGIN_FIELD username

MYSQL_HOME_FIELD homedir

MYSQL_MAILDIR_FIELD maildir

```

/etc/dropmail/maildropmysql.cf:

```

# hostname - host name of your mysql server

hostname        localhost

port            3306

socket          /var/run/mysqld/mysqld.sock

database        syscp

dbuser          %THE_USERNAME%

dbpw            %THE_PASSWORD%

dbtable         mail_users

#not used now

#timeout                5

# default_uid - default uid (number only) to use incase uidnumber attribute not

# found in users mysql entry

default_uidnumber       2000

# default_gid - default gid (number only) to use incase gidnumber attribute not

# found in users ldap entry

default_gidnumber       2000

# MySQL Field definitions

#

# This section allows you to specify the actual attributes you

# use in your Mysql record

#

# The example attribute mapping shown below is also the default

# mapping used by maildrop in the case that any are missing

# UID_FIELD - MySQL attribute which contains the users name (w or w/o domain)

uid_field               email

# UIDNUMBER_FIELD - MySQL attribute which contains the system uid to deliver

# mail as

uidnumber_field         uid

# GIDNUMBER_FIELD - MySQL attribute which contains the system gid to deliver

# mail as

gidnumber_field         gid

# MAILDIR_FIELD - MySQL attribute which contains the path to the users

# custom maildir

maildir_field           maildir

# HOMEDIRECTORY_FIELD - MySQL attribute which contains the path to the users

# home directory

homedirectory_field     homedir

# QUOTA_FIELD - MySQL attribute which contains the users quota

# set standard for all maildirs or use a new mysql field

quota_field             '50000000'

# MYSQL_DEFAULT_STATUS_FIELD - MySQL attribute which could be created in the

# MySQL entry to set whether or not the user is allowed to receive email on

# this box..

#               -- looks unused for now; but must be valid column ! (2001-11-03)

mailstatus_field        postfix

# MYSQL_DEFAULT_WHERE_CLAUSE - This is optional !

# It can be set to any fixed string starting with keyword 'AND'.

# It will then be appended to the WHERE clause of our query.

where_clause            AND postfix = "Y"

```

/etc/maildroprc

```

# Settings:

SYSCPBASEDIR="/var/www/syscp/syscp"

SCANSPAMSIZE="250000"   # mails, which are smaller will not be scanned

VSCANSIZE="2000000"

logfile "/var/log/maildrop.log"

MAILFILTERDIR="/var/benutzerdaten/mailfilter"

######################

# Let's start

EXTENSION="$1"

RECIPIENT="$2"

USER="$3"

HOST="$4"

SENDER="$5"

# the current users maildir is located in $DEFAULT

MAILDIR = $DEFAULT

DELIVERY = $DEFAULT     # where the mail will go at the end of the script

# Has the maildir already been created?

`test -d "$MAILDIR"`

if( $RETURNCODE == 1 )

{

        `mkdir -p $DELIVERY`

        `rmdir $DELIVERY`

        `/usr/bin/maildirmake "$MAILDIR"`

}

# Obtain settings from the mysql db

# first we have to init the vars

VSCAN=0

SPAMFILTER=0

# Run our script and get the values :)

`$SYSCPBASEDIR/scripts/modules/maildrop/getsettings.php "$LOGNAME"`

if ($RETURNCODE >= 2)

{       VSCAN=1;

        RETURNCODE= $RETURNCODE - 2;

}

if ($RETURNCODE >= 1)

{       SPAMFILTER=1;

}

exception {

        include $MAILFILTERDIR/$LOGNAME

}

#ok, let's filter

if ($VSCAN)

{       if($SIZE < $VSCANSIZE)

        {

                exception {

#                        xfilter "$SYSCPBASEDIR/scripts/modules/maildrop/clamscan.sh"

                }

        }

        if ((/^X-Virus-Status:.*INFECTED/))

        {

                DELIVERY = $MAILDIR.Infected

                SPAMFILTER=0

        }

}

if ( $SPAMFILTER )

{       # Is the mail already marked as spam?

        if (/^X-Bogosity: Yes/)

        {       DELIVERY = $MAILDIR.Spam

                SPAMFILTER=0

        }

        if ( $SIZE < $SCANSPAMSIZE )

        {       exception {

                #      xfilter "bogofilter -e -p -f -d /var/benutzerdaten/"

                }

                # Spam?

                if (/^X-Bogosity: Yes/)

                {       DELIVERY = $MAILDIR.Spam

                }

        }

}

# create needed sub-directory, if it doesn't exist

`test -d "$DELIVERY"`

if( $RETURNCODE == 1 )

{

        `mkdir -p $DELIVERY`

        `rmdir $DELIVERY`

        `/usr/bin/maildirmake "$DELIVERY"`

}

log "=========="

# finally, deliver the mail

to $DELIVERY/

```

Even if I comment the spamassassin and clamav-part out nothing works.

For courier-imap in /etc/courier-imap they work, for dropmail with courier-authlib in /etc/courier/authlib they fail.

One thing I forgot to say: I used this guide to set the system up: http://gentoo-wiki.com/HOWTO_SysCP

So what to do?

Thanks for any help and sorry for my english,

Bastian

----------

## Gatta

I have this problem too. I think it's something to do with maildrop/dropmail not being configured to check the username against an SQL database.

----------

## cudeso

 *-bm- wrote:*   

>  That is what I found in the mail.log:
> 
> ```
> Apr 6 18:11:15 ipx20245 postfix/pipe[490]: B14FD5020B: to=<mail@bastian-m.de>, relay=dropmail, delay=0, status=bounced (user unknown. Command output: ERR: authdaemon: s_connect() failed: No such file or directory Invalid user specified. )
> 
> ...

 

When I run maildrop with strace I see this : 

```

socket(PF_FILE, SOCK_STREAM, 0)         = 3

fcntl64(3, F_SETFL, O_RDONLY|O_NONBLOCK) = 0

connect(3, {sa_family=AF_FILE, path="/var/lib/courier/authdaemon/socket"}, 110) = -1 ENOENT (No such file or directory)

dup(2)                                  = 4

fcntl64(4, F_GETFL)                     = 0x8002 (flags O_RDWR|O_LARGEFILE)

fstat64(4, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 4), ...}) = 0

mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40017000

_llseek(4, 0, 0xbfffd030, SEEK_CUR)     = -1 ESPIPE (Illegal seek)

write(4, "ERR: authdaemon: s_connect() fai"..., 63ERR: authdaemon: s_connect() failed: No such file or directory

) = 63

close(4)                                = 0

```

There is no socket at [b] /var/lib/courier/authdaemon/socket  but at /var/lib/courier-imap/authdaemon/socket.

I've solved it by moving the existing /var/lib/courier to a temporary location and symlinking courier-imap to courier (just symlinking the socket to the puts maildrop in a loop). It seems to work for now but I guess it's only a workaround and not a final solution.

----------

## ldima24

 *cudeso wrote:*   

>  *-bm- wrote:*    That is what I found in the mail.log:
> 
> ```
> Apr 6 18:11:15 ipx20245 postfix/pipe[490]: B14FD5020B: to=<mail@bastian-m.de>, relay=dropmail, delay=0, status=bounced (user unknown. Command output: ERR: authdaemon: s_connect() failed: No such file or directory Invalid user specified. )
> 
> ...

 

If you emerged the latest maildrop, then you have got installed a new rc-script "courier-authlib". Run it instead of old "authdaemond" - it should solve the problem.

----------

