Blame SOURCES/0087-gpo-gPCMachineExtensionNames-with-just-whitespaces.patch

b2d430
From 662af3eaefdb11aff02947c0d34d31ba37c7b09c Mon Sep 17 00:00:00 2001
b2d430
From: =?UTF-8?q?Michal=20=C5=BDidek?= <mzidek@redhat.com>
b2d430
Date: Fri, 29 Jul 2016 16:09:16 +0200
b2d430
Subject: [PATCH 87/87] gpo: gPCMachineExtensionNames with just whitespaces
b2d430
b2d430
Resolves:
b2d430
https://fedorahosted.org/sssd/ticket/3114
b2d430
b2d430
We failed GPO procesing if the gPCMachineExtensionNames
b2d430
attribute contained just whitespaces. This coused
b2d430
failures in some server settings.
b2d430
b2d430
Comment from Alexander Bokovoy quoting:
b2d430
b2d430
You should use MS-GPOL spec. 2.2.4 'GPO Search' section says that when
b2d430
processing gPCMachineExtensionNames, "Group Policy processing terminates
b2d430
at the first <CSE GUIDn> out of sequence."
b2d430
Since ' ' (space only) does not fall into defined syntax for
b2d430
gPCMachineExtensionNames, this Group Policy processing is stopped and
b2d430
its CSE GUIDs are set to 'empty list'.
b2d430
b2d430
Because of the 3.2.5.1.10 'Extension Protocol Sequences' language
b2d430
------------------------------------------------------------------------
b2d430
The Group Policy client MUST evaluate the subset of the abstract element
b2d430
Filtered GPO list separately for each Group Policy extension by
b2d430
including in the subset only those GPOs whose gPCUserExtensionNames (for
b2d430
user policy mode) or gPCMachineExtensionNames (for computer policy mode)
b2d430
attributes contain CSE GUID that correspond to the Group Policy
b2d430
extension. If the CSE GUID corresponding to the Group Policy extension
b2d430
is present in Extension List, it is invoked using the
b2d430
Implementation Identifier field. Applicability is determined as
b2d430
specified in section 3.2.1.5. The Group Policy Registry Extension MUST
b2d430
always execute first. All other applicable Group Policy extensions in
b2d430
the Extension List MUST be loaded and executed in Extension List order.
b2d430
A failure in any Group Policy extension sequence MUST NOT affect the
b2d430
execution of other Group Policy extensions.
b2d430
-------------------------------------------------------------------------
b2d430
b2d430
I think we can practically treat wrong content of
b2d430
gPCMachineExtensionNames (and gPCUserExtensionNames) as inability of the
b2d430
GPO to pass through the Filtered GPO list. Thus, the GPO would be
b2d430
ignored.
b2d430
b2d430
Reviewed-by: Alexander Bokovoy <abokovoy@redhat.com>
b2d430
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
b2d430
---
b2d430
 src/providers/ad/ad_gpo.c | 21 ++++++++++++++++++++-
b2d430
 1 file changed, 20 insertions(+), 1 deletion(-)
b2d430
b2d430
diff --git a/src/providers/ad/ad_gpo.c b/src/providers/ad/ad_gpo.c
b2d430
index f609d28136918adfe6a8d5e95319b27ffcab79c0..63c68ce35922ca0407ae6ea32c0a78100e14504b 100644
b2d430
--- a/src/providers/ad/ad_gpo.c
b2d430
+++ b/src/providers/ad/ad_gpo.c
b2d430
@@ -3765,6 +3765,24 @@ done:
b2d430
    }
b2d430
 }
b2d430
 
b2d430
+static bool machine_ext_names_is_blank(char *attr_value)
b2d430
+{
b2d430
+    char *ptr;
b2d430
+
b2d430
+    if (attr_value == NULL) {
b2d430
+        return true;
b2d430
+    }
b2d430
+
b2d430
+    ptr = attr_value;
b2d430
+    for (; *ptr != '\0'; ptr++) {
b2d430
+        if (!isspace(*ptr)) {
b2d430
+            return false;
b2d430
+        }
b2d430
+    }
b2d430
+
b2d430
+    return true;
b2d430
+}
b2d430
+
b2d430
 static errno_t
b2d430
 ad_gpo_sd_process_attrs(struct tevent_req *req,
b2d430
                         char *smb_host,
b2d430
@@ -3880,7 +3898,8 @@ ad_gpo_sd_process_attrs(struct tevent_req *req,
b2d430
         goto done;
b2d430
     }
b2d430
 
b2d430
-    if ((ret == ENOENT) || (el->num_values == 0)) {
b2d430
+    if ((ret == ENOENT) || (el->num_values == 0)
b2d430
+            || machine_ext_names_is_blank((char *) el[0].values[0].data)) {
b2d430
         /*
b2d430
          * if gpo has no machine_ext_names (which is perfectly valid: it could
b2d430
          * have only user_ext_names, for example), we continue to next gpo
b2d430
-- 
b2d430
2.4.11
b2d430