delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2000/01/09/19:11:38

Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-developers-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-developers-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin-developers AT sourceware DOT cygnus DOT com
Message-ID: <3879240E.804355F@vinschen.de>
Date: Mon, 10 Jan 2000 01:13:02 +0100
From: Corinna Vinschen <corinna AT vinschen DOT de>
X-Mailer: Mozilla 4.7 [en] (WinNT; I)
X-Accept-Language: de,en
MIME-Version: 1.0
To: Chris Faylor <cgf AT cygnus DOT com>
CC: cygdev <cygwin-developers AT sourceware DOT cygnus DOT com>
Subject: umlaut-patch

This is a multi-part message in MIME format.
--------------4B12451F2669DD2588FDC7A6
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi,

I suddenly found out that the NT function GetFileSecurity() failes,
if the filename contains german umlauts. This will apparently happen
in other native NT versions as well. So I have patched get_file_owner()
and get_file_group() which historically use this function. they will
use the ReadSD() function from security.cc now.

Corinna


ChangeLog:
==========

Mon Jan 10 01:11:00 2000  Corinna Vinschen  <corinna AT vinschen DOT de>

	* fhandler.cc (get_file_owner): Use of ReadSD() instead of
	GetFileSecurity().
	(get_file_group): Ditto.
--------------4B12451F2669DD2588FDC7A6
Content-Type: text/plain; charset=us-ascii;
 name="umlaut-patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="umlaut-patch"

Index: cygwin/fhandler.cc
===================================================================
RCS file: /src/cvsroot/winsup-000108/cygwin/fhandler.cc,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 fhandler.cc
--- cygwin/fhandler.cc	2000/01/09 10:50:51	1.1.1.1
+++ cygwin/fhandler.cc	2000/01/09 23:50:53
@@ -101,18 +101,18 @@ get_file_owner (int use_ntsec, const cha
 {
   if (use_ntsec && allow_ntsec)
     {
-      char psd_buffer[1024];
+      extern LONG ReadSD(const char *, PSECURITY_DESCRIPTOR, LPDWORD);
+      DWORD sd_size = 4096;
+      char psd_buffer[4096];
       PSECURITY_DESCRIPTOR psd = (PSECURITY_DESCRIPTOR) psd_buffer;
-      DWORD requested_length;
       PSID psid;
       BOOL bOwnerDefaulted = TRUE;
 
-      if (!GetFileSecurity (filename, OWNER_SECURITY_INFORMATION,
-			   psd, 1024, &requested_length))
-	return getuid();
+      if (ReadSD (filename, psd, &sd_size) <= 0)
+        return getuid();
 
       if (!GetSecurityDescriptorOwner (psd, &psid, &bOwnerDefaulted))
-	return getuid ();
+        return getuid ();
 
       return psid ? get_uid_from_sid (psid) : getuid ();
     }
@@ -125,20 +125,18 @@ get_file_group (int use_ntsec, const cha
 {
   if (use_ntsec && allow_ntsec)
     {
-      char psd_buffer[1024];
+      extern LONG ReadSD(const char *, PSECURITY_DESCRIPTOR, LPDWORD);
+      DWORD sd_size = 4096;
+      char psd_buffer[4096];
       PSECURITY_DESCRIPTOR psd = (PSECURITY_DESCRIPTOR) psd_buffer;
-      DWORD requested_length;
       PSID psid;
       BOOL bGroupDefaulted = TRUE;
 
-      /* obtain the file's group information */
-      if (!GetFileSecurity (filename, GROUP_SECURITY_INFORMATION, psd,
-			    1024, &requested_length))
-	return getgid();
-
-      /* extract the group sid from the security descriptor */
-      if(!GetSecurityDescriptorGroup (psd, &psid, &bGroupDefaulted))
-	return getgid ();
+      if (ReadSD (filename, psd, &sd_size) <= 0)
+        return getgid();
+
+      if (!GetSecurityDescriptorGroup (psd, &psid, &bGroupDefaulted))
+        return getgid ();
 
       return psid ? get_gid_from_sid (psid) : getuid ();
     }

--------------4B12451F2669DD2588FDC7A6--


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019