2019-03-01 11:50:13 +00:00
|
|
|
From 26d34bc8e55c39ef84d580b6453c65b5cbeab8ff Mon Sep 17 00:00:00 2001
|
|
|
|
From: Pavel Zhukov <pzhukov@redhat.com>
|
|
|
|
Date: Thu, 21 Feb 2019 10:27:18 +0100
|
|
|
|
Subject: [PATCH 08/21] Make sure all open file descriptors are closed-on-exec
|
|
|
|
for SELinux
|
|
|
|
Cc: pzhukov@redhat.com
|
|
|
|
|
|
|
|
ISC-bug: #19148
|
|
|
|
---
|
|
|
|
client/clparse.c | 4 ++--
|
|
|
|
client/dhclient.c | 28 ++++++++++++++--------------
|
|
|
|
common/bpf.c | 2 +-
|
|
|
|
common/dlpi.c | 2 +-
|
|
|
|
common/nit.c | 2 +-
|
|
|
|
common/resolv.c | 2 +-
|
|
|
|
common/upf.c | 2 +-
|
|
|
|
omapip/trace.c | 6 +++---
|
|
|
|
relay/dhcrelay.c | 10 +++++-----
|
|
|
|
server/confpars.c | 2 +-
|
|
|
|
server/db.c | 4 ++--
|
|
|
|
server/dhcpd.c | 14 +++++++-------
|
|
|
|
server/ldap.c | 2 +-
|
|
|
|
13 files changed, 40 insertions(+), 40 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/client/clparse.c b/client/clparse.c
|
|
|
|
index 39b95a0..44387ed 100644
|
|
|
|
--- a/client/clparse.c
|
|
|
|
+++ b/client/clparse.c
|
|
|
|
@@ -288,7 +288,7 @@ int read_client_conf_file (const char *name, struct interface_info *ip,
|
2011-07-01 12:42:18 +00:00
|
|
|
int token;
|
|
|
|
isc_result_t status;
|
|
|
|
|
|
|
|
- if ((file = open (name, O_RDONLY)) < 0)
|
|
|
|
+ if ((file = open (name, O_RDONLY | O_CLOEXEC)) < 0)
|
|
|
|
return uerr2isc (errno);
|
|
|
|
|
|
|
|
cfile = NULL;
|
2019-03-01 11:50:13 +00:00
|
|
|
@@ -364,7 +364,7 @@ void read_client_leases ()
|
2011-07-01 12:42:18 +00:00
|
|
|
|
|
|
|
/* Open the lease file. If we can't open it, just return -
|
|
|
|
we can safely trust the server to remember our state. */
|
|
|
|
- if ((file = open (path_dhclient_db, O_RDONLY)) < 0)
|
|
|
|
+ if ((file = open (path_dhclient_db, O_RDONLY | O_CLOEXEC)) < 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
cfile = NULL;
|
2019-03-01 11:50:13 +00:00
|
|
|
diff --git a/client/dhclient.c b/client/dhclient.c
|
|
|
|
index 2a2e9e6..a86ab9e 100644
|
|
|
|
--- a/client/dhclient.c
|
|
|
|
+++ b/client/dhclient.c
|
|
|
|
@@ -273,11 +273,11 @@ main(int argc, char **argv) {
|
2011-07-01 12:42:18 +00:00
|
|
|
/* Make sure that file descriptors 0 (stdin), 1, (stdout), and
|
|
|
|
2 (stderr) are open. To do this, we assume that when we
|
|
|
|
open a file the lowest available file descriptor is used. */
|
|
|
|
- fd = open("/dev/null", O_RDWR);
|
|
|
|
+ fd = open("/dev/null", O_RDWR | O_CLOEXEC);
|
|
|
|
if (fd == 0)
|
|
|
|
- fd = open("/dev/null", O_RDWR);
|
|
|
|
+ fd = open("/dev/null", O_RDWR | O_CLOEXEC);
|
|
|
|
if (fd == 1)
|
|
|
|
- fd = open("/dev/null", O_RDWR);
|
|
|
|
+ fd = open("/dev/null", O_RDWR | O_CLOEXEC);
|
|
|
|
if (fd == 2)
|
|
|
|
log_perror = 0; /* No sense logging to /dev/null. */
|
|
|
|
else if (fd != -1)
|
2019-03-01 11:50:13 +00:00
|
|
|
@@ -765,7 +765,7 @@ main(int argc, char **argv) {
|
2013-12-20 15:13:52 +00:00
|
|
|
long temp;
|
2011-07-01 12:42:18 +00:00
|
|
|
int e;
|
|
|
|
|
|
|
|
- if ((pidfd = fopen(path_dhclient_pid, "r")) != NULL) {
|
|
|
|
+ if ((pidfd = fopen(path_dhclient_pid, "re")) != NULL) {
|
|
|
|
e = fscanf(pidfd, "%ld\n", &temp);
|
|
|
|
oldpid = (pid_t)temp;
|
|
|
|
|
2019-03-01 11:50:13 +00:00
|
|
|
@@ -820,7 +820,7 @@ main(int argc, char **argv) {
|
2011-07-01 12:42:18 +00:00
|
|
|
strncpy(new_path_dhclient_pid, path_dhclient_pid, pfx);
|
|
|
|
sprintf(new_path_dhclient_pid + pfx, "-%s.pid", ip->name);
|
|
|
|
|
|
|
|
- if ((pidfd = fopen(new_path_dhclient_pid, "r")) != NULL) {
|
|
|
|
+ if ((pidfd = fopen(new_path_dhclient_pid, "re")) != NULL) {
|
|
|
|
e = fscanf(pidfd, "%ld\n", &temp);
|
|
|
|
oldpid = (pid_t)temp;
|
|
|
|
|
2019-03-01 11:50:13 +00:00
|
|
|
@@ -845,7 +845,7 @@ main(int argc, char **argv) {
|
2011-07-01 12:42:18 +00:00
|
|
|
int dhc_running = 0;
|
|
|
|
char procfn[256] = "";
|
|
|
|
|
|
|
|
- if ((pidfp = fopen(path_dhclient_pid, "r")) != NULL) {
|
|
|
|
+ if ((pidfp = fopen(path_dhclient_pid, "re")) != NULL) {
|
|
|
|
if ((fscanf(pidfp, "%ld", &temp)==1) && ((dhcpid=(pid_t)temp) > 0)) {
|
|
|
|
snprintf(procfn,256,"/proc/%u",dhcpid);
|
|
|
|
dhc_running = (access(procfn, F_OK) == 0);
|
2019-03-01 11:50:13 +00:00
|
|
|
@@ -3808,7 +3808,7 @@ void rewrite_client_leases ()
|
2011-07-01 12:42:18 +00:00
|
|
|
|
|
|
|
if (leaseFile != NULL)
|
|
|
|
fclose (leaseFile);
|
|
|
|
- leaseFile = fopen (path_dhclient_db, "w");
|
|
|
|
+ leaseFile = fopen (path_dhclient_db, "we");
|
|
|
|
if (leaseFile == NULL) {
|
|
|
|
log_error ("can't create %s: %m", path_dhclient_db);
|
|
|
|
return;
|
2019-03-01 11:50:13 +00:00
|
|
|
@@ -4003,7 +4003,7 @@ write_duid(struct data_string *duid)
|
2011-07-01 12:42:18 +00:00
|
|
|
return DHCP_R_INVALIDARG;
|
|
|
|
|
|
|
|
if (leaseFile == NULL) { /* XXX? */
|
|
|
|
- leaseFile = fopen(path_dhclient_db, "w");
|
|
|
|
+ leaseFile = fopen(path_dhclient_db, "we");
|
|
|
|
if (leaseFile == NULL) {
|
|
|
|
log_error("can't create %s: %m", path_dhclient_db);
|
|
|
|
return ISC_R_IOERROR;
|
2019-03-01 11:50:13 +00:00
|
|
|
@@ -4207,7 +4207,7 @@ int write_client_lease (client, lease, rewrite, makesure)
|
2011-07-01 12:42:18 +00:00
|
|
|
return 1;
|
|
|
|
|
|
|
|
if (leaseFile == NULL) { /* XXX */
|
|
|
|
- leaseFile = fopen (path_dhclient_db, "w");
|
|
|
|
+ leaseFile = fopen (path_dhclient_db, "we");
|
|
|
|
if (leaseFile == NULL) {
|
|
|
|
log_error ("can't create %s: %m", path_dhclient_db);
|
|
|
|
return 0;
|
2019-03-01 11:50:13 +00:00
|
|
|
@@ -4786,9 +4786,9 @@ void detach ()
|
2013-12-20 15:13:52 +00:00
|
|
|
(void) close(2);
|
2011-07-01 12:42:18 +00:00
|
|
|
|
|
|
|
/* Reopen them on /dev/null. */
|
2013-12-20 15:13:52 +00:00
|
|
|
- (void) open("/dev/null", O_RDWR);
|
|
|
|
- (void) open("/dev/null", O_RDWR);
|
|
|
|
- (void) open("/dev/null", O_RDWR);
|
|
|
|
+ (void) open("/dev/null", O_RDWR | O_CLOEXEC);
|
|
|
|
+ (void) open("/dev/null", O_RDWR | O_CLOEXEC);
|
|
|
|
+ (void) open("/dev/null", O_RDWR | O_CLOEXEC);
|
2011-07-01 12:42:18 +00:00
|
|
|
|
|
|
|
write_client_pid_file ();
|
|
|
|
|
2019-03-01 11:50:13 +00:00
|
|
|
@@ -4806,14 +4806,14 @@ void write_client_pid_file ()
|
2011-07-01 12:42:18 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
- pfdesc = open (path_dhclient_pid, O_CREAT | O_TRUNC | O_WRONLY, 0644);
|
|
|
|
+ pfdesc = open (path_dhclient_pid, O_CREAT | O_TRUNC | O_WRONLY | O_CLOEXEC, 0644);
|
|
|
|
|
|
|
|
if (pfdesc < 0) {
|
|
|
|
log_error ("Can't create %s: %m", path_dhclient_pid);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
- pf = fdopen (pfdesc, "w");
|
|
|
|
+ pf = fdopen (pfdesc, "we");
|
|
|
|
if (!pf) {
|
|
|
|
close(pfdesc);
|
|
|
|
log_error ("Can't fdopen %s: %m", path_dhclient_pid);
|
2019-03-01 11:50:13 +00:00
|
|
|
diff --git a/common/bpf.c b/common/bpf.c
|
|
|
|
index 16076fe..67b6d64 100644
|
|
|
|
--- a/common/bpf.c
|
|
|
|
+++ b/common/bpf.c
|
|
|
|
@@ -94,7 +94,7 @@ int if_register_bpf (info)
|
2011-07-01 12:42:18 +00:00
|
|
|
for (b = 0; 1; b++) {
|
|
|
|
/* %Audit% 31 bytes max. %2004.06.17,Safe% */
|
|
|
|
sprintf(filename, BPF_FORMAT, b);
|
|
|
|
- sock = open (filename, O_RDWR, 0);
|
|
|
|
+ sock = open (filename, O_RDWR | O_CLOEXEC, 0);
|
|
|
|
if (sock < 0) {
|
|
|
|
if (errno == EBUSY) {
|
|
|
|
continue;
|
2019-03-01 11:50:13 +00:00
|
|
|
diff --git a/common/dlpi.c b/common/dlpi.c
|
|
|
|
index 3990bf1..a941258 100644
|
|
|
|
--- a/common/dlpi.c
|
|
|
|
+++ b/common/dlpi.c
|
|
|
|
@@ -817,7 +817,7 @@ dlpiopen(const char *ifname) {
|
2011-07-01 12:42:18 +00:00
|
|
|
}
|
|
|
|
*dp = '\0';
|
|
|
|
|
|
|
|
- return open (devname, O_RDWR, 0);
|
|
|
|
+ return open (devname, O_RDWR | O_CLOEXEC, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2019-03-01 11:50:13 +00:00
|
|
|
diff --git a/common/nit.c b/common/nit.c
|
|
|
|
index d822c15..a9132bc 100644
|
|
|
|
--- a/common/nit.c
|
|
|
|
+++ b/common/nit.c
|
2015-02-08 17:31:39 +00:00
|
|
|
@@ -75,7 +75,7 @@ int if_register_nit (info)
|
2011-07-01 12:42:18 +00:00
|
|
|
struct strioctl sio;
|
|
|
|
|
|
|
|
/* Open a NIT device */
|
|
|
|
- sock = open ("/dev/nit", O_RDWR);
|
|
|
|
+ sock = open ("/dev/nit", O_RDWR | O_CLOEXEC);
|
|
|
|
if (sock < 0)
|
|
|
|
log_fatal ("Can't open NIT device for %s: %m", info -> name);
|
|
|
|
|
2019-03-01 11:50:13 +00:00
|
|
|
diff --git a/common/resolv.c b/common/resolv.c
|
|
|
|
index a01f520..b209e3f 100644
|
|
|
|
--- a/common/resolv.c
|
|
|
|
+++ b/common/resolv.c
|
|
|
|
@@ -43,7 +43,7 @@ void read_resolv_conf (parse_time)
|
2011-07-01 12:42:18 +00:00
|
|
|
struct domain_search_list *dp, *dl, *nd;
|
|
|
|
isc_result_t status;
|
|
|
|
|
|
|
|
- if ((file = open (path_resolv_conf, O_RDONLY)) < 0) {
|
|
|
|
+ if ((file = open (path_resolv_conf, O_RDONLY | O_CLOEXEC)) < 0) {
|
|
|
|
log_error ("Can't open %s: %m", path_resolv_conf);
|
|
|
|
return;
|
|
|
|
}
|
2019-03-01 11:50:13 +00:00
|
|
|
diff --git a/common/upf.c b/common/upf.c
|
|
|
|
index 9785879..e0a524f 100644
|
|
|
|
--- a/common/upf.c
|
|
|
|
+++ b/common/upf.c
|
2015-02-08 17:31:39 +00:00
|
|
|
@@ -71,7 +71,7 @@ int if_register_upf (info)
|
2011-07-01 12:42:18 +00:00
|
|
|
/* %Audit% Cannot exceed 36 bytes. %2004.06.17,Safe% */
|
|
|
|
sprintf(filename, "/dev/pf/pfilt%d", b);
|
|
|
|
|
|
|
|
- sock = open (filename, O_RDWR, 0);
|
|
|
|
+ sock = open (filename, O_RDWR | O_CLOEXEC, 0);
|
|
|
|
if (sock < 0) {
|
|
|
|
if (errno == EBUSY) {
|
|
|
|
continue;
|
2019-03-01 11:50:13 +00:00
|
|
|
diff --git a/omapip/trace.c b/omapip/trace.c
|
|
|
|
index 45bd508..5ea7486 100644
|
|
|
|
--- a/omapip/trace.c
|
|
|
|
+++ b/omapip/trace.c
|
|
|
|
@@ -136,10 +136,10 @@ isc_result_t trace_begin (const char *filename,
|
2011-07-01 12:42:18 +00:00
|
|
|
return DHCP_R_INVALIDARG;
|
|
|
|
}
|
|
|
|
|
|
|
|
- traceoutfile = open (filename, O_CREAT | O_WRONLY | O_EXCL, 0600);
|
|
|
|
+ traceoutfile = open (filename, O_CREAT | O_WRONLY | O_EXCL | O_CLOEXEC, 0600);
|
|
|
|
if (traceoutfile < 0 && errno == EEXIST) {
|
|
|
|
log_error ("WARNING: Overwriting trace file \"%s\"", filename);
|
|
|
|
- traceoutfile = open (filename, O_WRONLY | O_EXCL | O_TRUNC,
|
|
|
|
+ traceoutfile = open (filename, O_WRONLY | O_EXCL | O_TRUNC | O_CLOEXEC,
|
|
|
|
0600);
|
|
|
|
}
|
|
|
|
|
2019-03-01 11:50:13 +00:00
|
|
|
@@ -427,7 +427,7 @@ void trace_file_replay (const char *filename)
|
2011-07-01 12:42:18 +00:00
|
|
|
isc_result_t result;
|
|
|
|
int len;
|
|
|
|
|
|
|
|
- traceinfile = fopen (filename, "r");
|
|
|
|
+ traceinfile = fopen (filename, "re");
|
|
|
|
if (!traceinfile) {
|
|
|
|
log_error("Can't open tracefile %s: %m", filename);
|
|
|
|
return;
|
2019-03-01 11:50:13 +00:00
|
|
|
diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c
|
|
|
|
index d8caaaf..ea1be18 100644
|
|
|
|
--- a/relay/dhcrelay.c
|
|
|
|
+++ b/relay/dhcrelay.c
|
|
|
|
@@ -296,11 +296,11 @@ main(int argc, char **argv) {
|
2011-07-01 12:42:18 +00:00
|
|
|
/* Make sure that file descriptors 0(stdin), 1,(stdout), and
|
|
|
|
2(stderr) are open. To do this, we assume that when we
|
|
|
|
open a file the lowest available file descriptor is used. */
|
|
|
|
- fd = open("/dev/null", O_RDWR);
|
|
|
|
+ fd = open("/dev/null", O_RDWR | O_CLOEXEC);
|
|
|
|
if (fd == 0)
|
|
|
|
- fd = open("/dev/null", O_RDWR);
|
|
|
|
+ fd = open("/dev/null", O_RDWR | O_CLOEXEC);
|
|
|
|
if (fd == 1)
|
|
|
|
- fd = open("/dev/null", O_RDWR);
|
|
|
|
+ fd = open("/dev/null", O_RDWR | O_CLOEXEC);
|
|
|
|
if (fd == 2)
|
|
|
|
log_perror = 0; /* No sense logging to /dev/null. */
|
|
|
|
else if (fd != -1)
|
2019-03-01 11:50:13 +00:00
|
|
|
@@ -776,13 +776,13 @@ main(int argc, char **argv) {
|
|
|
|
/* Create the pid file. */
|
2011-07-01 12:42:18 +00:00
|
|
|
if (no_pid_file == ISC_FALSE) {
|
|
|
|
pfdesc = open(path_dhcrelay_pid,
|
|
|
|
- O_CREAT | O_TRUNC | O_WRONLY, 0644);
|
|
|
|
+ O_CREAT | O_TRUNC | O_WRONLY | O_CLOEXEC, 0644);
|
|
|
|
|
|
|
|
if (pfdesc < 0) {
|
|
|
|
log_error("Can't create %s: %m",
|
|
|
|
path_dhcrelay_pid);
|
|
|
|
} else {
|
|
|
|
- pf = fdopen(pfdesc, "w");
|
|
|
|
+ pf = fdopen(pfdesc, "we");
|
|
|
|
if (!pf)
|
|
|
|
log_error("Can't fdopen %s: %m",
|
|
|
|
path_dhcrelay_pid);
|
2019-03-01 11:50:13 +00:00
|
|
|
diff --git a/server/confpars.c b/server/confpars.c
|
|
|
|
index d2cedfe..2743979 100644
|
|
|
|
--- a/server/confpars.c
|
|
|
|
+++ b/server/confpars.c
|
|
|
|
@@ -118,7 +118,7 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
|
2011-07-01 12:42:18 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
- if ((file = open (filename, O_RDONLY)) < 0) {
|
|
|
|
+ if ((file = open (filename, O_RDONLY | O_CLOEXEC)) < 0) {
|
|
|
|
if (leasep) {
|
|
|
|
log_error ("Can't open lease database %s: %m --",
|
|
|
|
path_dhcpd_db);
|
2019-03-01 11:50:13 +00:00
|
|
|
diff --git a/server/db.c b/server/db.c
|
|
|
|
index 67e6cc1..6181528 100644
|
|
|
|
--- a/server/db.c
|
|
|
|
+++ b/server/db.c
|
|
|
|
@@ -1154,7 +1154,7 @@ int new_lease_file (int test_mode)
|
2011-07-01 12:42:18 +00:00
|
|
|
path_dhcpd_db, (int)t) >= sizeof newfname)
|
|
|
|
log_fatal("new_lease_file: lease file path too long");
|
|
|
|
|
|
|
|
- db_fd = open (newfname, O_WRONLY | O_TRUNC | O_CREAT, 0664);
|
|
|
|
+ db_fd = open (newfname, O_WRONLY | O_TRUNC | O_CREAT | O_CLOEXEC, 0664);
|
|
|
|
if (db_fd < 0) {
|
|
|
|
log_error ("Can't create new lease file: %m");
|
|
|
|
return 0;
|
2019-03-01 11:50:13 +00:00
|
|
|
@@ -1175,7 +1175,7 @@ int new_lease_file (int test_mode)
|
2011-07-01 12:42:18 +00:00
|
|
|
}
|
2015-08-10 10:09:24 +00:00
|
|
|
#endif /* PARANOIA */
|
|
|
|
|
2011-07-01 12:42:18 +00:00
|
|
|
- if ((new_db_file = fdopen(db_fd, "w")) == NULL) {
|
|
|
|
+ if ((new_db_file = fdopen(db_fd, "we")) == NULL) {
|
|
|
|
log_error("Can't fdopen new lease file: %m");
|
|
|
|
close(db_fd);
|
|
|
|
goto fdfail;
|
2019-03-01 11:50:13 +00:00
|
|
|
diff --git a/server/dhcpd.c b/server/dhcpd.c
|
|
|
|
index 55ffae7..530a923 100644
|
|
|
|
--- a/server/dhcpd.c
|
|
|
|
+++ b/server/dhcpd.c
|
|
|
|
@@ -300,11 +300,11 @@ main(int argc, char **argv) {
|
2011-07-01 12:42:18 +00:00
|
|
|
/* Make sure that file descriptors 0 (stdin), 1, (stdout), and
|
|
|
|
2 (stderr) are open. To do this, we assume that when we
|
|
|
|
open a file the lowest available file descriptor is used. */
|
|
|
|
- fd = open("/dev/null", O_RDWR);
|
|
|
|
+ fd = open("/dev/null", O_RDWR | O_CLOEXEC);
|
|
|
|
if (fd == 0)
|
|
|
|
- fd = open("/dev/null", O_RDWR);
|
|
|
|
+ fd = open("/dev/null", O_RDWR | O_CLOEXEC);
|
|
|
|
if (fd == 1)
|
|
|
|
- fd = open("/dev/null", O_RDWR);
|
|
|
|
+ fd = open("/dev/null", O_RDWR | O_CLOEXEC);
|
|
|
|
if (fd == 2)
|
|
|
|
log_perror = 0; /* No sense logging to /dev/null. */
|
|
|
|
else if (fd != -1)
|
2019-03-01 11:50:13 +00:00
|
|
|
@@ -975,7 +975,7 @@ main(int argc, char **argv) {
|
2015-02-08 17:31:39 +00:00
|
|
|
* appropriate.
|
2011-07-01 12:42:18 +00:00
|
|
|
*/
|
|
|
|
if (no_pid_file == ISC_FALSE) {
|
|
|
|
- i = open(path_dhcpd_pid, O_WRONLY|O_CREAT|O_TRUNC, 0644);
|
|
|
|
+ i = open(path_dhcpd_pid, O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0644);
|
|
|
|
if (i >= 0) {
|
|
|
|
sprintf(pbuf, "%d\n", (int) getpid());
|
2015-02-08 17:31:39 +00:00
|
|
|
IGNORE_RET(write(i, pbuf, strlen(pbuf)));
|
2019-03-01 11:50:13 +00:00
|
|
|
@@ -1028,9 +1028,9 @@ main(int argc, char **argv) {
|
2013-12-20 15:13:52 +00:00
|
|
|
(void) close(2);
|
2011-07-01 12:42:18 +00:00
|
|
|
|
|
|
|
/* Reopen them on /dev/null. */
|
2013-12-20 15:13:52 +00:00
|
|
|
- (void) open("/dev/null", O_RDWR);
|
|
|
|
- (void) open("/dev/null", O_RDWR);
|
|
|
|
- (void) open("/dev/null", O_RDWR);
|
|
|
|
+ (void) open("/dev/null", O_RDWR | O_CLOEXEC);
|
|
|
|
+ (void) open("/dev/null", O_RDWR | O_CLOEXEC);
|
|
|
|
+ (void) open("/dev/null", O_RDWR | O_CLOEXEC);
|
2011-07-01 12:42:18 +00:00
|
|
|
log_perror = 0; /* No sense logging to /dev/null. */
|
|
|
|
|
|
|
|
IGNORE_RET (chdir("/"));
|
2019-03-01 11:50:13 +00:00
|
|
|
diff --git a/server/ldap.c b/server/ldap.c
|
|
|
|
index 5126d24..555545c 100644
|
|
|
|
--- a/server/ldap.c
|
|
|
|
+++ b/server/ldap.c
|
|
|
|
@@ -1446,7 +1446,7 @@ ldap_start (void)
|
2011-07-01 12:42:18 +00:00
|
|
|
|
|
|
|
if (ldap_debug_file != NULL && ldap_debug_fd == -1)
|
|
|
|
{
|
|
|
|
- if ((ldap_debug_fd = open (ldap_debug_file, O_CREAT | O_TRUNC | O_WRONLY,
|
|
|
|
+ if ((ldap_debug_fd = open (ldap_debug_file, O_CREAT | O_TRUNC | O_WRONLY | O_CLOEXEC,
|
|
|
|
S_IRUSR | S_IWUSR)) < 0)
|
|
|
|
log_error ("Error opening debug LDAP log file %s: %s", ldap_debug_file,
|
|
|
|
strerror (errno));
|
2019-03-01 11:50:13 +00:00
|
|
|
--
|
|
|
|
2.14.5
|
|
|
|
|