Commit c8b59a79 authored by Sam Varshavchik's avatar Sam Varshavchik

courier-authlib: set FD_CLOEXEC.

parent 813b52aa
2018-08-16 Sam Varshavchik <mrsam@courier-mta.com>
* authdaemond.c: set FD_CLOEXEC on socket file descriptors, to avoid
leaks to child processes.
2018-05-25 Sam Varshavchik <mrsam@courier-mta.com>
* authldaplib.cpp: improve automatic reconnection logic to the LDAP
......
/*
** Copyright 2000-2016 Double Precision, Inc. See COPYING for
** Copyright 2000-2018 Double Precision, Inc. See COPYING for
** distribution information.
*/
......@@ -56,10 +56,11 @@ struct sockaddr_un skun;
strcat(skun.sun_path, ".tmp");
unlink(skun.sun_path);
if (bind(fd, (const struct sockaddr *)&skun, sizeof(skun)) ||
listen(fd, SOMAXCONN) ||
chmod(skun.sun_path, 0777) ||
rename(skun.sun_path, AUTHDAEMONSOCK) ||
fcntl(fd, F_SETFL, O_NONBLOCK) < 0)
listen(fd, SOMAXCONN) ||
chmod(skun.sun_path, 0777) ||
rename(skun.sun_path, AUTHDAEMONSOCK) ||
fcntl(fd, F_SETFD, FD_CLOEXEC) < 0 ||
fcntl(fd, F_SETFL, O_NONBLOCK) < 0)
{
perror(AUTHDAEMONSOCK);
close(fd);
......@@ -1024,7 +1025,8 @@ int start()
saddr_len=sizeof(saddr);
if ((fd=accept(s, &saddr, &saddr_len)) < 0)
continue;
if (fcntl(fd, F_SETFL, 0) < 0)
if (fcntl(fd, F_SETFL, 0) < 0 ||
fcntl(fd, F_SETFD, FD_CLOEXEC) < 0)
{
perror("CRIT: fcntl() failed");
}
......
dnl Process this file with autoconf to produce a configure script.
dnl
dnl
dnl Copyright 1998 - 2016 Double Precision, Inc. See COPYING for
dnl Copyright 1998 - 2018 Double Precision, Inc. See COPYING for
dnl distribution information.
AC_PREREQ(2.63)
AC_INIT([courier-authlib],[0.68.0.20180427],[courier-users@lists.sourceforge.net])
AC_INIT([courier-authlib],[0.68.0.20180816],[courier-users@lists.sourceforge.net])
AC_CONFIG_SRCDIR([courierauth.h])
......
dnl Process this file with autoconf to produce a configure script.
dnl
dnl Copyright 1998 - 2017 Double Precision, Inc. See COPYING for
dnl Copyright 1998 - 2018 Double Precision, Inc. See COPYING for
dnl distribution information.
AC_PREREQ(2.59)
AC_INIT(courier, 0.78.3.20180801, [courier-users@lists.sourceforge.net])
AC_INIT(courier, 0.78.3.20180816, [courier-users@lists.sourceforge.net])
version=$PACKAGE_VERSION
AC_CONFIG_SRCDIR(courier/courier.c)
AM_INIT_AUTOMAKE
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment