summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/pinfo.cc
diff options
context:
space:
mode:
authorPierre Humblet <phumblet@phumblet.no-ip.org>2003-09-27 01:58:23 +0000
committerPierre Humblet <phumblet@phumblet.no-ip.org>2003-09-27 01:58:23 +0000
commit1eb451937a4b977e050ba7f2a6dd93e7a6baf23c (patch)
tree713d3ed3af6f38437218f33bb41cc38fc9fad460 /winsup/cygwin/pinfo.cc
parent6806a8b51f96d59cb6dadd86fab4ae7cdecca3ed (diff)
downloadcygnal-1eb451937a4b977e050ba7f2a6dd93e7a6baf23c.tar.gz
cygnal-1eb451937a4b977e050ba7f2a6dd93e7a6baf23c.tar.bz2
cygnal-1eb451937a4b977e050ba7f2a6dd93e7a6baf23c.zip
2003-09-26 Pierre Humblet <pierre.humblet@ieee.org>
* pinfo.h (pinfo::set_acl): Declare. * pinfo.cc (pinfo_fixup_after_fork): Duplicate with no rights. (pinfo::set_acl): New. * spawn.cc (spawn_guts): Call myself.set_acl.
Diffstat (limited to 'winsup/cygwin/pinfo.cc')
-rw-r--r--winsup/cygwin/pinfo.cc20
1 files changed, 18 insertions, 2 deletions
diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index 884b994a3..0967215e7 100644
--- a/winsup/cygwin/pinfo.cc
+++ b/winsup/cygwin/pinfo.cc
@@ -42,9 +42,9 @@ pinfo_fixup_after_fork ()
{
if (hexec_proc)
CloseHandle (hexec_proc);
-
+ /* Keeps the cygpid from being reused. No rights required */
if (!DuplicateHandle (hMainProc, hMainProc, hMainProc, &hexec_proc, 0,
- TRUE, DUPLICATE_SAME_ACCESS))
+ TRUE, 0))
{
system_printf ("couldn't save current process handle %p, %E", hMainProc);
hexec_proc = NULL;
@@ -238,6 +238,22 @@ pinfo::init (pid_t n, DWORD flag, HANDLE in_h)
destroy = 1;
}
+void
+pinfo::set_acl()
+{
+ char sa_buf[1024];
+ SECURITY_DESCRIPTOR sd;
+
+ sec_acl ((PACL) sa_buf, true, true, cygheap->user.sid (),
+ well_known_world_sid, FILE_MAP_READ);
+ if (!InitializeSecurityDescriptor( &sd, SECURITY_DESCRIPTOR_REVISION))
+ debug_printf("InitializeSecurityDescriptor %E");
+ else if (!SetSecurityDescriptorDacl(&sd, TRUE, (PACL) sa_buf, FALSE))
+ debug_printf("SetSecurityDescriptorDacl %E");
+ else if (!SetKernelObjectSecurity(h, DACL_SECURITY_INFORMATION, &sd))
+ debug_printf ("SetKernelObjectSecurity %E");
+}
+
bool
_pinfo::alive ()
{