From 2d388e433f7ec42fe63bf1f8accc59895e5e34f8 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 1 Apr 2003 17:17:46 +0000 Subject: [PATCH] * fhandler.cc (fhandler_base::fstat): Set the uid and gid fields from the current effective ids. * fhandler_socket.cc (fhandler_socket::fstat): Keep the uid and gid set by fhandler_base::fstat. * security.cc (get_nt_attribute): Do not test wincap.has_security (). (get_nt_object_attribute): Ditto. (get_file_attribute): Add test for wincap.has_security (). (get_object_attribute): Ditto. --- winsup/cygwin/ChangeLog | 11 +++++++++++ winsup/cygwin/fhandler.cc | 2 ++ winsup/cygwin/fhandler_socket.cc | 2 -- winsup/cygwin/security.cc | 10 ++-------- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 4eaf96f82..6f9109b9c 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,14 @@ +2003-04-01 Pierre Humblet + + * fhandler.cc (fhandler_base::fstat): Set the uid and gid fields + from the current effective ids. + * fhandler_socket.cc (fhandler_socket::fstat): Keep the uid and gid set + by fhandler_base::fstat. + * security.cc (get_nt_attribute): Do not test wincap.has_security (). + (get_nt_object_attribute): Ditto. + (get_file_attribute): Add test for wincap.has_security (). + (get_object_attribute): Ditto. + 2003-04-01 Corinna Vinschen * dir.cc: Change __off32_t to _off_t and __off64_t to _off64_t diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index f4f43e308..bdbe2883d 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -981,6 +981,8 @@ fhandler_base::fstat (struct __stat64 *buf, path_conv *) break; } + buf->st_uid = geteuid32 (); + buf->st_gid = getegid32 (); buf->st_nlink = 1; buf->st_blksize = S_BLKSIZE; time_as_timestruc_t (&buf->st_ctim); diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index a665c6cc5..127463757 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -444,8 +444,6 @@ fhandler_socket::fstat (struct __stat64 *buf, path_conv *pc) buf->st_dev = 0; buf->st_ino = (ino_t) get_handle (); buf->st_mode = S_IFSOCK | S_IRWXU | S_IRWXG | S_IRWXO; - buf->st_uid = geteuid32 (); - buf->st_gid = getegid32 (); } else { diff --git a/winsup/cygwin/security.cc b/winsup/cygwin/security.cc index f05fb39ef..82e8f96e2 100644 --- a/winsup/cygwin/security.cc +++ b/winsup/cygwin/security.cc @@ -1322,9 +1322,6 @@ static int get_nt_attribute (const char *file, mode_t *attribute, __uid32_t *uidret, __gid32_t *gidret) { - if (!wincap.has_security ()) - return 0; - syscall_printf ("file: %s", file); /* Yeah, sounds too much, but I've seen SDs of 2100 bytes! */ @@ -1391,7 +1388,7 @@ get_file_attribute (int use_ntsec, const char *file, { int res; - if (use_ntsec && allow_ntsec) + if (use_ntsec && allow_ntsec && wincap.has_security ()) { res = get_nt_attribute (file, attribute, uidret, gidret); if (res) @@ -1437,9 +1434,6 @@ static int get_nt_object_attribute (HANDLE handle, SE_OBJECT_TYPE object_type, mode_t *attribute, __uid32_t *uidret, __gid32_t *gidret) { - if (!wincap.has_security ()) - return 0; - PSECURITY_DESCRIPTOR psd = NULL; cygpsid owner_sid; cygpsid group_sid; @@ -1548,7 +1542,7 @@ int get_object_attribute (HANDLE handle, SE_OBJECT_TYPE object_type, mode_t *attribute, __uid32_t *uidret, __gid32_t *gidret) { - if (allow_ntsec) + if (allow_ntsec && wincap.has_security ()) { int res = get_nt_object_attribute (handle, object_type, attribute, uidret, gidret);