Throughout, reorganize header file inclusion to put security.h prior to

fhandler.h.
* fhandler.h (fhandler_base::get_inheritance): New method.
* fhandler_socket.cc (fhandler_socket::create_secret_event): Use proper
close-on-exec inheritance when creating.
(fhandler_socket::check_peer_secret_event): Create handle as non-inheritable.
This commit is contained in:
Christopher Faylor 2001-07-26 19:22:24 +00:00
parent c784c833aa
commit 6b91b8d53b
51 changed files with 75 additions and 33 deletions

View File

@ -1,3 +1,13 @@
Thu Jul 26 15:19:50 2001 Christopher Faylor <cgf@cygnus.com>
Throughout, reorganize header file inclusion to put security.h prior to
fhandler.h.
* fhandler.h (fhandler_base::get_inheritance): New method.
* fhandler_socket.cc (fhandler_socket::create_secret_event): Use proper
close-on-exec inheritance when creating.
(fhandler_socket::check_peer_secret_event): Create handle as
non-inheritable.
2001-07-25 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
* syscalls.cc (setsid): Detach process from its console if the current

View File

@ -11,9 +11,9 @@
#include "winsup.h"
#include <string.h>
#include <errno.h>
#include <fhandler.h>
#include <assert.h>
#include <stdlib.h>
#include "security.h"
#include "fhandler.h"
#include "dtable.h"
#include "cygheap.h"
@ -22,7 +22,6 @@
#include "cygerrno.h"
#include "sync.h"
#include "shared_info.h"
#include "security.h"
init_cygheap NO_COPY *cygheap;
void NO_COPY *cygheap_max = NULL;

View File

@ -24,6 +24,7 @@ details. */
#include "cygerrno.h"
#define NEED_VFORK
#include "perprocess.h"
#include "security.h"
#include "fhandler.h"
#include "dtable.h"
#include "path.h"
@ -34,7 +35,6 @@ details. */
#include "cygwin_version.h"
#include "dll_init.h"
#include "host_dependent.h"
#include "security.h"
#define MAX_AT_FILE_LEVEL 10

View File

@ -21,10 +21,10 @@ details. */
#include "sigproc.h"
#include "pinfo.h"
#include "cygerrno.h"
#include "security.h"
#include "fhandler.h"
#include "perprocess.h"
#include "path.h"
#include "security.h"
#include "dtable.h"
#include "cygheap.h"

View File

@ -13,6 +13,7 @@ details. */
#include <stdlib.h>
#include <unistd.h>
#include <ctype.h>
#include "security.h"
#include "fhandler.h"
#include "perprocess.h"
#include "path.h"

View File

@ -26,6 +26,7 @@ details. */
#include "pinfo.h"
#include "cygerrno.h"
#include "perprocess.h"
#include "security.h"
#include "fhandler.h"
#include "path.h"
#include "dtable.h"

View File

@ -19,6 +19,7 @@ details. */
#include "sigproc.h"
#include "pinfo.h"
#include "perprocess.h"
#include "security.h"
#include "fhandler.h"
#include "path.h"
#include "cygerrno.h"

View File

@ -14,6 +14,7 @@ details. */
#include <errno.h>
#include <process.h>
#include "perprocess.h"
#include "security.h"
#include "fhandler.h"
#include "path.h"
#include "sync.h"

View File

@ -11,6 +11,7 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
#include "winsup.h"
#include "security.h"
#include "fhandler.h"
#include "sync.h"
#include "sigproc.h"

View File

@ -13,6 +13,7 @@ details. */
#include <stdarg.h>
#include <errno.h>
#include <unistd.h>
#include "security.h"
#include "fhandler.h"
#include "dtable.h"
#include "cygheap.h"

View File

@ -17,13 +17,13 @@ details. */
#include <signal.h>
#include "cygerrno.h"
#include "perprocess.h"
#include "security.h"
#include "fhandler.h"
#include "dtable.h"
#include "cygheap.h"
#include "path.h"
#include "shared_info.h"
#include "host_dependent.h"
#include "security.h"
static NO_COPY const int CHUNK_SIZE = 1024; /* Used for crlf conversions */

View File

@ -221,6 +221,14 @@ public:
int get_close_on_exec () { return FHISSETF (CLOEXEC); }
int set_close_on_exec_flag (int b) { return FHCONDSETF (b, CLOEXEC); }
LPSECURITY_ATTRIBUTES get_inheritance (bool all = 0)
{
if (all)
return get_close_on_exec () ? &sec_all_nih : &sec_all;
else
return get_close_on_exec () ? &sec_none_nih : &sec_none;
}
void set_check_win95_lseek_bug (int b = 1) { FHCONDSETF (b, W95LSBUG); }
int get_check_win95_lseek_bug () { return FHISSETF (W95LSBUG); }

View File

@ -15,11 +15,12 @@ details. */
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
#include "cygerrno.h"
#include "fhandler.h"
#include <windows.h>
#include <wingdi.h>
#include <winuser.h>
#include "cygerrno.h"
#include "security.h"
#include "fhandler.h"
/*
* Robert Collins:

View File

@ -22,6 +22,7 @@ details. */
#include <ctype.h>
#include <sys/cygwin.h>
#include "cygerrno.h"
#include "security.h"
#include "fhandler.h"
#include "dtable.h"
#include "cygheap.h"
@ -29,7 +30,6 @@ details. */
#include "sigproc.h"
#include "pinfo.h"
#include "shared_info.h"
#include "security.h"
#define CONVERT_LIMIT 4096

View File

@ -13,12 +13,13 @@ details. */
#include "winsup.h"
#include <stdio.h>
#include <errno.h>
#include "cygerrno.h"
#include "fhandler.h"
#include <windows.h>
#include <sys/soundcard.h>
#include <sys/fcntl.h>
#include <mmsystem.h>
#include "cygerrno.h"
#include "security.h"
#include "fhandler.h"
//------------------------------------------------------------------------
// Simple encapsulation of the win32 audio device.

View File

@ -14,9 +14,10 @@ details. */
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include <winioctl.h>
#include "security.h"
#include "fhandler.h"
#include "cygerrno.h"
#include <winioctl.h>
/**********************************************************************/
/* fhandler_dev_floppy */

View File

@ -16,6 +16,7 @@
#include <ntdef.h>
#include "cygerrno.h"
#include "security.h"
#include "fhandler.h"
#include "ntdll.h"

View File

@ -14,6 +14,7 @@ details. */
#include <errno.h>
#include <limits.h>
#include "cygerrno.h"
#include "security.h"
#include "fhandler.h"
#define RANDOM 8

View File

@ -18,6 +18,7 @@
#include <sys/mtio.h>
#include "cygerrno.h"
#include "perprocess.h"
#include "security.h"
#include "fhandler.h"
#include "dtable.h"
#include "cygheap.h"

View File

@ -14,11 +14,11 @@ details. */
#include <unistd.h>
#include <stdlib.h>
#include "cygerrno.h"
#include "security.h"
#include "fhandler.h"
#include "sync.h"
#include "sigproc.h"
#include "pinfo.h"
#include "security.h"
#include <sys/termios.h>
/**********************************************************************/

View File

@ -23,6 +23,7 @@
#define USE_SYS_TYPES_FD_SET
#include <winsock2.h>
#include "cygerrno.h"
#include "security.h"
#include "fhandler.h"
#include "dtable.h"
#include "cygheap.h"
@ -98,7 +99,7 @@ fhandler_socket::create_secret_event (int* secret)
__small_sprintf (buf, SECRET_EVENT_NAME, sin.sin_port,
secret_ptr [0], secret_ptr [1],
secret_ptr [2], secret_ptr [3]);
secret_event = CreateEvent ( NULL, FALSE, FALSE, buf);
secret_event = CreateEvent (get_inheritance (), FALSE, FALSE, buf);
if (!secret_event && GetLastError () == ERROR_ALREADY_EXISTS)
secret_event = OpenEvent (EVENT_ALL_ACCESS, FALSE, buf);
@ -133,7 +134,7 @@ fhandler_socket::check_peer_secret_event (struct sockaddr_in* peer, int* secret)
__small_sprintf (buf, SECRET_EVENT_NAME, peer->sin_port,
secret_ptr [0], secret_ptr [1],
secret_ptr [2], secret_ptr [3]);
ev = CreateEvent (NULL, FALSE, FALSE, buf);
ev = CreateEvent (&sec_none_nih, FALSE, FALSE, buf);
if (!ev && GetLastError () == ERROR_ALREADY_EXISTS)
{
debug_printf ("%s event already exist");

View File

@ -14,10 +14,10 @@ details. */
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include <sys/mtio.h>
#include "cygerrno.h"
#include "perprocess.h"
#include "security.h"
#include "fhandler.h"
#include "dtable.h"
#include "cygheap.h"

View File

@ -15,6 +15,7 @@ details. */
#include <errno.h>
#include <ctype.h>
#include "cygerrno.h"
#include "security.h"
#include "fhandler.h"
#include "sync.h"
#include "sigproc.h"

View File

@ -17,6 +17,7 @@ details. */
#include <ctype.h>
#include <limits.h>
#include "cygerrno.h"
#include "security.h"
#include "fhandler.h"
#include "dtable.h"
#include "sync.h"

View File

@ -16,6 +16,7 @@ details. */
#include <wingdi.h>
#include <winuser.h>
#include "cygerrno.h"
#include "security.h"
#include "fhandler.h"
/*

View File

@ -12,6 +12,7 @@ details. */
#include "winsup.h"
#include <errno.h>
#include "security.h"
#include "fhandler.h"
fhandler_dev_zero::fhandler_dev_zero (const char *name)

View File

@ -15,6 +15,7 @@ details. */
#include <fcntl.h>
#include <stdarg.h>
#include <errno.h>
#include "security.h"
#include "fhandler.h"
#include "dtable.h"
#include "cygerrno.h"
@ -27,7 +28,6 @@ details. */
#include "perthread.h"
#include "perprocess.h"
#include "dll_init.h"
#include "security.h"
#ifdef DEBUGGING
static int npid = 0;

View File

@ -20,11 +20,11 @@ details. */
#include "sync.h"
#include "sigproc.h"
#include "pinfo.h"
#include "security.h"
#include "fhandler.h"
#include "dtable.h"
#include "cygheap.h"
#include "cygerrno.h"
#include "security.h"
/* Read /etc/group only once for better performance. This is done
on the first call that needs information from it. */

View File

@ -15,6 +15,7 @@ details. */
#include <sys/ioctl.h>
#include <errno.h>
#include "cygerrno.h"
#include "security.h"
#include "fhandler.h"
#include "dtable.h"
#include "cygheap.h"

View File

@ -14,6 +14,7 @@ details. */
#include "winsup.h"
#include <stdlib.h>
#include <assert.h>
#include "security.h"
#include "fhandler.h"
#include "dtable.h"
#include "cygheap.h"

View File

@ -14,6 +14,7 @@ details. */
#include <stddef.h>
#include <sys/mman.h>
#include <errno.h>
#include "security.h"
#include "fhandler.h"
#include "dtable.h"
#include "cygerrno.h"
@ -21,7 +22,6 @@ details. */
#include "sync.h"
#include "sigproc.h"
#include "pinfo.h"
#include "security.h"
#include "sys/cygwin.h"
#define PAGE_CNT(bytes) howmany(bytes,getpagesize())

View File

@ -26,6 +26,7 @@ details. */
#include <winsock2.h>
#include "cygerrno.h"
#include "perprocess.h"
#include "security.h"
#include "fhandler.h"
#include "path.h"
#include "dtable.h"

View File

@ -14,13 +14,13 @@ details. */
#include <stdio.h>
#include <errno.h>
#include "cygerrno.h"
#include "security.h"
#include "fhandler.h"
#include "dtable.h"
#include "sync.h"
#include "sigproc.h"
#include "pinfo.h"
#include "cygheap.h"
#include "security.h"
#include <sys/termios.h>
/* Read /etc/passwd only once for better performance. This is done

View File

@ -65,6 +65,7 @@ details. */
#include <cygwin/version.h>
#include "cygerrno.h"
#include "perprocess.h"
#include "security.h"
#include "fhandler.h"
#include "path.h"
#include "sync.h"
@ -74,7 +75,6 @@ details. */
#include "cygheap.h"
#include "shared_info.h"
#include "registry.h"
#include "security.h"
#include <assert.h>
#include "shortcut.h"

View File

@ -13,6 +13,7 @@ details. */
#include <time.h>
#include <errno.h>
#include <limits.h>
#include "security.h"
#include "fhandler.h"
#include "dtable.h"
#include "cygerrno.h"
@ -22,7 +23,6 @@ details. */
#include "cygwin_version.h"
#include "perprocess.h"
#include "environ.h"
#include "security.h"
#include <assert.h>
#include <ntdef.h>
#include "ntdll.h"

View File

@ -13,11 +13,11 @@ details. */
#include <sys/fcntl.h>
#include <errno.h>
#include "cygerrno.h"
#include "security.h"
#include "fhandler.h"
#include "dtable.h"
#include "cygheap.h"
#include "thread.h"
#include "security.h"
static int
make_pipe (int fildes[2], unsigned int psize, int mode)

View File

@ -12,6 +12,7 @@
#include <sys/time.h>
#include <sys/poll.h>
#include <errno.h>
#include "security.h"
#include "fhandler.h"
#include "dtable.h"
#include "cygheap.h"

View File

@ -25,6 +25,7 @@ details. */
#include <winuser.h>
#include "cygerrno.h"
#include "perprocess.h"
#include "security.h"
#include "fhandler.h"
#include "path.h"
#include "dtable.h"
@ -32,7 +33,6 @@ details. */
#include "sigproc.h"
#include "pinfo.h"
#include "cygheap.h"
#include "security.h"
static int
searchace (aclent_t *aclp, int nentries, int type, int id = -1)

View File

@ -26,6 +26,7 @@ details. */
#include <wininet.h>
#include "cygerrno.h"
#include "perprocess.h"
#include "security.h"
#include "fhandler.h"
#include "path.h"
#include "dtable.h"
@ -33,7 +34,6 @@ details. */
#include "sigproc.h"
#include "pinfo.h"
#include "cygheap.h"
#include "security.h"
SID_IDENTIFIER_AUTHORITY sid_auth[] = {
{SECURITY_NULL_SID_AUTHORITY},

View File

@ -30,6 +30,7 @@ details. */
#include <subauth.h>
#include "cygerrno.h"
#include "perprocess.h"
#include "security.h"
#include "fhandler.h"
#include "path.h"
#include "dtable.h"
@ -37,7 +38,6 @@ details. */
#include "sigproc.h"
#include "pinfo.h"
#include "cygheap.h"
#include "security.h"
#include <ntdef.h>
#include "ntdll.h"
#include "lm.h"

View File

@ -34,6 +34,7 @@ details. */
#include <winsock.h>
#include "select.h"
#include "cygerrno.h"
#include "security.h"
#include "fhandler.h"
#include "dtable.h"
#include "cygheap.h"

View File

@ -17,6 +17,7 @@ details. */
#include "sync.h"
#include "sigproc.h"
#include "pinfo.h"
#include "security.h"
#include "fhandler.h"
#include "dtable.h"
#include "cygheap.h"
@ -24,7 +25,6 @@ details. */
#include "shared_info.h"
#include "registry.h"
#include "cygwin_version.h"
#include "security.h"
#define SHAREDVER (unsigned)(cygwin_version.api_major << 16 | \
cygwin_version.api_minor)

View File

@ -21,6 +21,7 @@ details. */
#include "sync.h"
#include "sigproc.h"
#include "pinfo.h"
#include "security.h"
#include "fhandler.h"
#include "dtable.h"
#include "cygheap.h"
@ -28,7 +29,6 @@ details. */
#include "perthread.h"
#include <assert.h>
#include "shared_info.h"
#include "security.h"
/*
* Convenience defines

View File

@ -22,6 +22,7 @@ details. */
#include "cygerrno.h"
#include <sys/cygwin.h>
#include "perprocess.h"
#include "security.h"
#include "fhandler.h"
#include "path.h"
#include "dtable.h"
@ -35,7 +36,6 @@ details. */
#include "perthread.h"
#include "registry.h"
#include "environ.h"
#include "security.h"
#define LINE_BUF_CHUNK (MAX_PATH * 2)

View File

@ -28,6 +28,7 @@ details. */
#include <sys/cygwin.h>
#include "cygerrno.h"
#include "perprocess.h"
#include "security.h"
#include "fhandler.h"
#include "path.h"
#include "dtable.h"
@ -36,7 +37,6 @@ details. */
#include "pinfo.h"
#include <unistd.h>
#include "shared_info.h"
#include "security.h"
#include "cygheap.h"
extern int normalize_posix_path (const char *, char *);

View File

@ -14,6 +14,7 @@ details. */
#include <time.h>
#include <limits.h>
#include <ntdef.h>
#include "security.h"
#include "fhandler.h"
#include "dtable.h"
#include "cygheap.h"

View File

@ -14,6 +14,7 @@ details. */
#include <syslog.h>
#include <stdarg.h>
#include <unistd.h>
#include "security.h"
#include "fhandler.h"
#include "dtable.h"
#include "cygerrno.h"

View File

@ -15,10 +15,11 @@ details. */
#include <errno.h>
#include <signal.h>
#include "cygerrno.h"
#include "security.h"
#include "fhandler.h"
#include "dtable.h"
#include "cygheap.h"
#include <cygwin/version.h>
#include "cygwin/version.h"
#include "perprocess.h"
#include <sys/termios.h>

View File

@ -18,12 +18,12 @@ details. */
#include <errno.h>
#include "cygerrno.h"
#include "perprocess.h"
#include "security.h"
#include "fhandler.h"
#include "path.h"
#include "sync.h"
#include "sigproc.h"
#include "pinfo.h"
#include "security.h"
#define FACTOR (0x19db1ded53e8000LL)
#define NSPERSEC 10000000LL

View File

@ -16,6 +16,7 @@ details. */
#include <winuser.h>
#include <sys/cygwin.h>
#include "cygerrno.h"
#include "security.h"
#include "fhandler.h"
#include "dtable.h"
#include "cygheap.h"
@ -23,7 +24,6 @@ details. */
#include "sigproc.h"
#include "pinfo.h"
#include "shared_info.h"
#include "security.h"
extern fhandler_tty_master *tty_master;

View File

@ -21,11 +21,11 @@ details. */
#include "sync.h"
#include "sigproc.h"
#include "pinfo.h"
#include "security.h"
#include "fhandler.h"
#include "dtable.h"
#include "cygheap.h"
#include "registry.h"
#include "security.h"
struct passwd *
internal_getlogin (cygheap_user &user)