mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-02-11 01:06:59 +08:00
set close-on-exec flag in sec-mod fds
This commit is contained in:
committed by
Nikos Mavrogiannopoulos
parent
45d380ccd9
commit
cc04bad753
@@ -633,11 +633,13 @@ int run_sec_mod(main_server_st * s)
|
||||
#endif
|
||||
setproctitle(PACKAGE_NAME "-secmod");
|
||||
close(fd[1]);
|
||||
set_cloexec_flag (fd[0], 1);
|
||||
sec_mod_server(s->main_pool, s->perm_config, p, s->cookie_key, fd[0]);
|
||||
exit(0);
|
||||
} else if (pid > 0) { /* parent */
|
||||
close(fd[0]);
|
||||
s->sec_mod_pid = pid;
|
||||
set_cloexec_flag (fd[1], 1);
|
||||
return fd[1];
|
||||
} else {
|
||||
e = errno;
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include <tlslib.h>
|
||||
#include <ipc.pb-c.h>
|
||||
#include <sec-mod-sup-config.h>
|
||||
#include <cloexec.h>
|
||||
|
||||
#include <gnutls/gnutls.h>
|
||||
#include <gnutls/abstract.h>
|
||||
@@ -750,6 +751,7 @@ void sec_mod_server(void *main_pool, struct perm_cfg_st *perm_config, const char
|
||||
continue;
|
||||
}
|
||||
}
|
||||
set_cloexec_flag (cfd, 1);
|
||||
|
||||
/* do not allow unauthorized processes to issue commands
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user