* external.cc (cygwin_internal): Add CW_GET_POSIX_SECURITY_ATTRIBUTE

handling.
	* include/cygwin/version.h: Bump API minor number.
	* include/sys/cygwin.h (cygwin_getinfo_types): Add
	CW_GET_POSIX_SECURITY_ATTRIBUTE.

	* exceptions.cc (init_global_security): Move from here...
	* sec_helper.cc (init_global_security): ...to here.
This commit is contained in:
Corinna Vinschen 2003-11-04 15:48:19 +00:00
parent c35391d0d2
commit bcd06214e1
6 changed files with 42 additions and 16 deletions

View File

@ -1,3 +1,14 @@
2003-11-04 Corinna Vinschen <corinna@vinschen.de>
* external.cc (cygwin_internal): Add CW_GET_POSIX_SECURITY_ATTRIBUTE
handling.
* include/cygwin/version.h: Bump API minor number.
* include/sys/cygwin.h (cygwin_getinfo_types): Add
CW_GET_POSIX_SECURITY_ATTRIBUTE.
* exceptions.cc (init_global_security): Move from here...
* sec_helper.cc (init_global_security): ...to here.
2003-11-04 Christopher Faylor <cgf@redhat.com>
* net.cc (dup_ent): Use IsBadStringPtr for alignment checks. Don't use

View File

@ -126,20 +126,6 @@ init_console_handler ()
system_printf ("SetConsoleCtrlHandler failed, %E");
}
void
init_global_security ()
{
/* Initialize global security attribute stuff */
sec_none.nLength = sec_none_nih.nLength =
sec_all.nLength = sec_all_nih.nLength = sizeof (SECURITY_ATTRIBUTES);
sec_none.bInheritHandle = sec_all.bInheritHandle = TRUE;
sec_none_nih.bInheritHandle = sec_all_nih.bInheritHandle = FALSE;
sec_none.lpSecurityDescriptor = sec_none_nih.lpSecurityDescriptor = NULL;
sec_all.lpSecurityDescriptor = sec_all_nih.lpSecurityDescriptor =
get_null_sd ();
}
extern "C" void
init_exceptions (exception_list *el)
{

View File

@ -265,6 +265,15 @@ cygwin_internal (cygwin_getinfo_types t, ...)
int deferrno = va_arg (arg, int);
return geterrno_from_win_error (error, deferrno);
}
case CW_GET_POSIX_SECURITY_ATTRIBUTE:
{
int attribute = va_arg (arg, int);
PSECURITY_ATTRIBUTES psa = va_arg (arg, PSECURITY_ATTRIBUTES);
void *sd_buf = va_arg (arg, void *);
DWORD sd_buf_size = va_arg (arg, DWORD);
set_security_attribute (attribute, psa, sd_buf, sd_buf_size);
return psa->lpSecurityDescriptor ? 0 : -1;
}
default:
return (DWORD) -1;
}

View File

@ -223,13 +223,14 @@ details. */
96: CW_GET_ERRNO_FROM_WINERROR addition to external.cc
97: Export sem_open, sem_close, sem_timedwait, sem_getvalue.
98: Export _tmpfile64.
99: CW_GET_POSIX_SECURITY_ATTRIBUTE addition to external.cc.
*/
/* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
#define CYGWIN_VERSION_API_MAJOR 0
#define CYGWIN_VERSION_API_MINOR 98
#define CYGWIN_VERSION_API_MINOR 99
/* There is also a compatibity version number associated with the
shared memory regions. It is incremented when incompatible

View File

@ -73,7 +73,8 @@ typedef enum
CW_EXTRACT_DOMAIN_AND_USER,
CW_CMDLINE,
CW_CHECK_NTSEC,
CW_GET_ERRNO_FROM_WINERROR
CW_GET_ERRNO_FROM_WINERROR,
CW_GET_POSIX_SECURITY_ATTRIBUTE
} cygwin_getinfo_types;
#define CW_NEXTPID 0x80000000 /* or with pid to get next one */

View File

@ -371,6 +371,24 @@ get_null_sd ()
return null_sdp;
}
/*
* Initialize global security attributes.
*
* Called from dcrt0.cc (_dll_crt0).
*/
void
init_global_security ()
{
sec_none.nLength = sec_none_nih.nLength =
sec_all.nLength = sec_all_nih.nLength = sizeof (SECURITY_ATTRIBUTES);
sec_none.bInheritHandle = sec_all.bInheritHandle = TRUE;
sec_none_nih.bInheritHandle = sec_all_nih.bInheritHandle = FALSE;
sec_none.lpSecurityDescriptor = sec_none_nih.lpSecurityDescriptor = NULL;
sec_all.lpSecurityDescriptor = sec_all_nih.lpSecurityDescriptor =
get_null_sd ();
}
BOOL
sec_acl (PACL acl, bool original, bool admins, PSID sid1, PSID sid2, DWORD access2)
{