This is the mail archive of the
cygwin-developers@cygwin.com
mailing list for the Cygwin project.
handle protection - please comment
- To: <cygwin-developers at cygwin dot com>
- Subject: handle protection - please comment
- From: "Robert Collins" <robert dot collins at itdomain dot com dot au>
- Date: Wed, 18 Apr 2001 10:54:06 +1000
- Thread-Index: AcDHohHDfU+ilAThQiud4BodeY3jfA==
- Thread-Topic: handle protection - please comment
This is just a follow up to Egor's proposed server for handle control.
I have done some basic testing using
DWORD sd_size = 4096;
char sd_buf[4096];
PSECURITY_DESCRIPTOR psd = (PSECURITY_DESCRIPTOR) sd_buf;
psd = alloc_sd (getuid(), getgid(), cygheap->user.logsrv (), mode,
psd, &sd_size)
and then
SECURITY_ATTRIBUTES sa;
sa.nLength=sizeof(sa);
sa.lpSecurityDescriptor=psd;
sa.bInheritHandle= TRUE; //or FALSE as appropriate for the handle
This gives you an custom security attributes structure the appropriate
win32 style permissions to match the mode , user and group you passed to
alloc_sd.
if psd is NULL, (ie running on win95) the OS will operate correctly.
I'm currently building testcases for mutexs in shared memory, which is
how I got onto this.
security wise, on win9x, there is no security, but there isn't anyway -
any process can open any shared memory area and so forth (ie it doesn't
matter how many layers of abstraction you put on it, someone with the
source can iterate through all the publicly available structures).
On NT/2K, it should give exactly the desired permissions, no more, no
less.
Rob