--=_phoenix.buildlink.org-31105-1191962680-0001-2
Content-Type: text/plain; charset=iso-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Richard Valk wrote:
>
> Recently tried to upgrade to the latest version of the courier-auth
> daemon on my Mac OS X 10.4 and noticed a (I hope) small problem with the
> latest 2 releases.
>
> I compiled using:
>
> ./configure --with-authmysql --without-authpam
> --with-mysql-libs=/usr/local/mysql/lib/mysql
> --with-mysql-includes=/usr/local/mysql/include
>
> As I did always with previous version succesfully, but when trying to
> run I got the following error.
>
> richard$ sudo /usr/local/sbin/authdaemond start
> /usr/local/var/spool/authdaemon/pid.lock: Bad file descriptor
> ll_daemon_start: Resource temporarily unavailable
>
> I reverted to 0.59.3, compiled that with the same settings and
> everything works again.
>
> I'm unable to determine what has changed to cause this issue.
>
> Does someone have any ideas ?
OPEN_MAX is the value used in ll_daemon_start() to figure out an
available file descriptor. I've heard that Mac OS X may have some
absurdly high value which may actually be larger than the actual file
descriptor table size. Can you try the attached patch?
Cheers,
-- Johnny C. Lam
--=_phoenix.buildlink.org-31105-1191962680-0001-2
Content-Type: text/plain; name="lockdaemon.c.diff"; charset=iso-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="lockdaemon.c.diff"
$NetBSD$
--- liblock/lockdaemon.c.orig Wed Sep 26 02:44:34 2007
+++ liblock/lockdaemon.c
@@ -31,10 +31,21 @@
#include <sys/ioctl.h>
#endif
-#ifndef OPEN_MAX
-#ifdef HAVE_SYSCONF
-#ifdef _SC_OPEN_MAX
-#define OPEN_MAX (my_open_max())
+/*
+** XXX This should be replaced by an autoconf test, e.g.
+** XXX AC_FUNCS([getdtablesize]).
+*/
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
+ defined(__APPLE__)
+#define HAVE_GETDTABLESIZE 1
+#endif
+
+#if HAVE_GETDTABLESIZE
+#define MAX_FD (getdtablesize()-1)
+#elif defined(OPEN_MAX)
+#define MAX_FD (OPEN_MAX-1)
+#elif HAVE_SYSCONF && defined(_SC_OPEN_MAX)
+#define MAX_FD (my_open_max()-1)
static int my_open_max()
{
@@ -45,12 +56,8 @@ static int my_open_max()
return n;
}
-#endif
-#endif
-#endif
-
-#ifndef OPEN_MAX
-#define OPEN_MAX 64
+#else
+#define MAX_FD 63
#endif
#define exit(_a_) _exit(_a_)
@@ -168,14 +175,14 @@ int lockfd;
lockfd=open(lockfile, O_RDWR|O_CREAT, 0600);
}
- if (lockfd < 0 || dup2(lockfd, OPEN_MAX-1) != OPEN_MAX-1)
+ if (lockfd < 0 || dup2(lockfd, MAX_FD) != MAX_FD)
{
perror(lockfile);
exit(1);
}
close(lockfd);
- lockfd=OPEN_MAX-1;
+ lockfd=MAX_FD;
#ifdef FD_CLOEXEC
if (fcntl(lockfd, F_SETFD, FD_CLOEXEC) < 0)
--=_phoenix.buildlink.org-31105-1191962680-0001-2
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
--=_phoenix.buildlink.org-31105-1191962680-0001-2
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
courier-users mailing list
courie...@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users
--=_phoenix.buildlink.org-31105-1191962680-0001-2--
--===============0006118771==
Content-Type: multipart/signed;
boundary="=_mimegpg-commodore.email-scan.com-518-1191969078-0004";
micalg=pgp-sha1; protocol="application/pgp-signature"
This is a MIME GnuPG-signed message. If you see this text, it means that
your E-mail or Usenet software does not support MIME signed messages.
The Internet standard for MIME PGP messages, RFC 2015, was published in 1996.
To open this message correctly you will need to install E-mail or Usenet
software that supports modern Internet standards.
--=_mimegpg-commodore.email-scan.com-518-1191969078-0004
Content-Type: text/plain; format=flowed; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Richard Valk writes:
> Hi,
>=20
> Recently tried to upgrade to the latest version of the courier-auth
> daemon on my Mac OS X 10.4 and noticed a (I hope) small problem with th=
e
> latest 2 releases.
>=20
> I compiled using:
>=20
> ./configure --with-authmysql --without-authpam
> --with-mysql-libs=3D/usr/local/mysql/lib/mysql
> --with-mysql-includes=3D/usr/local/mysql/include
>=20
> As I did always with previous version succesfully, but when trying to
> run I got the following error.
>=20
> richard$ sudo /usr/local/sbin/authdaemond start
> /usr/local/var/spool/authdaemon/pid.lock: Bad file descriptor
> ll_daemon_start: Resource temporarily unavailable
>=20
> I reverted to 0.59.3, compiled that with the same settings and
> everything works again.
>=20
> I'm unable to determine what has changed to cause this issue.
That would probably be this:
2007-09-25 "Johnny C. Lam" <jlam-c...@buildlink.org>
=E2=80=A2liblock/lockdaemon.c (OPEN_MAX): Use OPEN_MAX, instead of =
hardcoded
99
This code may not be working correctly on OS X. Someone with OS X will ne=
ed=20
to figure out what's not working right. As a random guess, try passing
CPPFLAGS=3D"-DOPEN_MAX=3D64" to configure.
--=_mimegpg-commodore.email-scan.com-518-1191969078-0004
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
iD8DBQBHDAE2x9p3GYHlUOIRArouAJ45zm/a4QuGOJ+OGVtMiRtkq34QTACdECtP
9/9SKWAEzNRjASTLaZGZd64=
=BLY8
-----END PGP SIGNATURE-----
--=_mimegpg-commodore.email-scan.com-518-1191969078-0004--
--===============0006118771==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
--===============0006118771==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
courier-users mailing list
courie...@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users
--===============0006118771==--
--=_phoenix.buildlink.org-32277-1191969254-0001-2
Content-Type: text/plain; charset=iso-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Johnny C. Lam wrote:
> Richard Valk wrote:
>>
>> Recently tried to upgrade to the latest version of the courier-auth
>> daemon on my Mac OS X 10.4 and noticed a (I hope) small problem with the
>> latest 2 releases.
>>
>> I compiled using:
>>
>> ./configure --with-authmysql --without-authpam
>> --with-mysql-libs=/usr/local/mysql/lib/mysql
>> --with-mysql-includes=/usr/local/mysql/include
>>
>> As I did always with previous version succesfully, but when trying to
>> run I got the following error.
>>
>> richard$ sudo /usr/local/sbin/authdaemond start
>> /usr/local/var/spool/authdaemon/pid.lock: Bad file descriptor
>> ll_daemon_start: Resource temporarily unavailable
>>
>> I reverted to 0.59.3, compiled that with the same settings and
>> everything works again.
>>
>> I'm unable to determine what has changed to cause this issue.
>>
>> Does someone have any ideas ?
>
> OPEN_MAX is the value used in ll_daemon_start() to figure out an
> available file descriptor. I've heard that Mac OS X may have some
> absurdly high value which may actually be larger than the actual file
> descriptor table size. Can you try the attached patch?
I've cleaned up the patch so that it's more appropriate for inclusion
into the Courier sources. It adds a check to configure.in (config.h.in
needs to be regenerated), and patches lockdaemon.c in a more direct way.
Cheers,
-- Johnny C. Lam
--=_phoenix.buildlink.org-32277-1191969254-0001-2
Content-Type: text/plain; name="liblock.diff"; charset=iso-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="liblock.diff"
--- liblock/configure.in.orig Wed Sep 26 02:44:34 2007
+++ liblock/configure.in
@@ -80,7 +80,7 @@ fi
dnl Checks for library functions.
-AC_CHECK_FUNCS(setpgrp sysconf)
+AC_CHECK_FUNCS(getdtablesize setpgrp sysconf)
AC_CHECK_FUNC(setpgrp,
[
AC_FUNC_SETPGRP
--- liblock/lockdaemon.c.orig Wed Sep 26 02:44:34 2007
+++ liblock/lockdaemon.c
@@ -32,26 +32,4 @@
#endif
-#ifndef OPEN_MAX
-#ifdef HAVE_SYSCONF
-#ifdef _SC_OPEN_MAX
-#define OPEN_MAX (my_open_max())
-
-static int my_open_max()
-{
- long n=sysconf(_SC_OPEN_MAX);
-
- if (n == -1)
- n=64;
- return n;
-}
-
-#endif
-#endif
-#endif
-
-#ifndef OPEN_MAX
-#define OPEN_MAX 64
-#endif
-
#define exit(_a_) _exit(_a_)
@@ -134,5 +112,5 @@ int i;
static int start1(const char *lockfile, int fd)
{
-int lockfd;
+int lockfd, maxfd;
#if HAVE_SETPGRP
@@ -169,5 +147,18 @@ int lockfd;
}
- if (lockfd < 0 || dup2(lockfd, OPEN_MAX-1) != OPEN_MAX-1)
+#if HAVE_GETDTABLESIZE
+ maxfd=getdtablesize()-1;
+#elif defined(OPEN_MAX)
+ maxfd=OPEN_MAX-1;
+#elif HAVE_SYSCONF && defined(_SC_OPEN_MAX)
+ if ((maxfd=sysconf(_SC_OPEN_MAX)) < 0)
+ maxfd=63;
+ else if (maxfd > 0)
+ maxfd--;
+#else
+ maxfd=63;
+#endif
+
+ if (lockfd < 0 || dup2(lockfd, maxfd) != maxfd)
{
perror(lockfile);
@@ -176,5 +167,5 @@ int lockfd;
close(lockfd);
- lockfd=OPEN_MAX-1;
+ lockfd=maxfd;
#ifdef FD_CLOEXEC
--=_phoenix.buildlink.org-32277-1191969254-0001-2
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
--=_phoenix.buildlink.org-32277-1191969254-0001-2
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
courier-users mailing list
courie...@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users
--=_phoenix.buildlink.org-32277-1191969254-0001-2--
Johnny, I'll give it a try later today and will let you know what happens.
Richard
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
Johnny,
The patch worked wonderfully. All issues solved and I've got a patched
version of 0.6.0.1 running on my mailserver.
I would like to thank you and Sam for the quick response and solution!
Regards,