Esme Povirk : sechost: SID strings are case-insensitive.

Alexandre Julliard julliard at winehq.org
Mon Jun 14 16:00:35 CDT 2021


Module: wine
Branch: master
Commit: f3b4e1695ffc1f3d05cee434ff045ee49efffebd
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=f3b4e1695ffc1f3d05cee434ff045ee49efffebd

Author: Esme Povirk <esme at codeweavers.com>
Date:   Fri Jun 11 15:10:49 2021 -0500

sechost: SID strings are case-insensitive.

Signed-off-by: Esme Povirk <esme at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/advapi32/tests/security.c |  2 ++
 dlls/sechost/security.c        | 12 ++++++------
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
index 9231c0243bf..6037ddb2165 100644
--- a/dlls/advapi32/tests/security.c
+++ b/dlls/advapi32/tests/security.c
@@ -265,6 +265,7 @@ static void test_ConvertStringSidToSid(void)
     str_to_sid_tests[] =
     {
         { "WD", "S-1-1-0" },
+        { "wD", "S-1-1-0" },
         { "CO", "S-1-3-0" },
         { "CG", "S-1-3-1" },
         { "OW", "S-1-3-4", 1 }, /* Vista+ */
@@ -304,6 +305,7 @@ static void test_ConvertStringSidToSid(void)
         { "PA", "", 1 },
         { "RS", "", 1 },
         { "SA", "", 1 },
+        { "s-1-12-1", "S-1-12-1" },
     };
 
     const char noSubAuthStr[] = "S-1-5";
diff --git a/dlls/sechost/security.c b/dlls/sechost/security.c
index 940561cce79..b4f00f5bdf5 100644
--- a/dlls/sechost/security.c
+++ b/dlls/sechost/security.c
@@ -596,7 +596,7 @@ static BOOL get_computer_sid( PSID sid )
 
 static DWORD get_sid_size( const WCHAR *string, const WCHAR **end )
 {
-    if (string[0] == 'S' && string[1] == '-') /* S-R-I(-S)+ */
+    if ((string[0] == 'S' || string[0] == 's') && string[1] == '-') /* S-R-I(-S)+ */
     {
         int token_count = 0;
         string++;
@@ -622,13 +622,13 @@ static DWORD get_sid_size( const WCHAR *string, const WCHAR **end )
 
         for (i = 0; i < ARRAY_SIZE(well_known_sids); i++)
         {
-            if (!wcsncmp( well_known_sids[i].str, string, 2 ))
+            if (!wcsnicmp( well_known_sids[i].str, string, 2 ))
                 return GetSidLengthRequired( well_known_sids[i].sid.SubAuthorityCount );
         }
 
         for (i = 0; i < ARRAY_SIZE(well_known_rids); i++)
         {
-            if (!wcsncmp( well_known_rids[i].str, string, 2 ))
+            if (!wcsnicmp( well_known_rids[i].str, string, 2 ))
             {
                 struct max_sid local;
                 get_computer_sid(&local);
@@ -649,7 +649,7 @@ static BOOL parse_sid( const WCHAR *string, const WCHAR **end, SID *pisid, DWORD
     if (!pisid) /* Simply compute the size */
         return TRUE;
 
-    if (string[0] == 'S' && string[1] == '-') /* S-R-I-S-S */
+    if ((string[0] == 'S' || string[0] == 's') && string[1] == '-') /* S-R-I-S-S */
     {
         DWORD i = 0, identAuth;
         DWORD csubauth = ((*size - GetSidLengthRequired(0)) / sizeof(DWORD));
@@ -717,7 +717,7 @@ static BOOL parse_sid( const WCHAR *string, const WCHAR **end, SID *pisid, DWORD
 
         for (i = 0; i < ARRAY_SIZE(well_known_sids); i++)
         {
-            if (!wcsncmp(well_known_sids[i].str, string, 2))
+            if (!wcsnicmp(well_known_sids[i].str, string, 2))
             {
                 DWORD j;
                 pisid->SubAuthorityCount = well_known_sids[i].sid.SubAuthorityCount;
@@ -730,7 +730,7 @@ static BOOL parse_sid( const WCHAR *string, const WCHAR **end, SID *pisid, DWORD
 
         for (i = 0; i < ARRAY_SIZE(well_known_rids); i++)
         {
-            if (!wcsncmp(well_known_rids[i].str, string, 2))
+            if (!wcsnicmp(well_known_rids[i].str, string, 2))
             {
                 get_computer_sid(pisid);
                 pisid->SubAuthority[pisid->SubAuthorityCount] = well_known_rids[i].rid;




More information about the wine-cvs mailing list