Blame SOURCES/0027-winbind-idmap-plugin-update-struct-idmap_domain-to-l.patch

5fca41
From e6734785fd1970c4b63d0dd021074003e35d7137 Mon Sep 17 00:00:00 2001
5fca41
From: Sumit Bose <sbose@redhat.com>
5fca41
Date: Fri, 5 Apr 2019 18:05:08 +0200
5fca41
Subject: [PATCH] winbind idmap plugin: update struct idmap_domain to latest
5fca41
 version
5fca41
5fca41
While updating to interface version 6 we forgot to add the query_user
5fca41
member.
5fca41
5fca41
Recent version of Samba added a new member dom_sid. Unfortunately the
5fca41
interface version was not update for this change so we have to enable
5fca41
the member based on the Samba version.
5fca41
5fca41
Related to https://pagure.io/SSSD/sssd/issue/4005
5fca41
5fca41
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
5fca41
(cherry picked from commit 30734e5f213f4bd2984e632d497d7cbfc16495db)
5fca41
---
5fca41
 src/external/samba.m4                         | 13 +++++++++++++
5fca41
 src/lib/winbind_idmap_sss/winbind_idmap_sss.c |  4 ++++
5fca41
 src/lib/winbind_idmap_sss/winbind_idmap_sss.h | 15 +++++++++++++++
5fca41
 3 files changed, 32 insertions(+)
5fca41
5fca41
diff --git a/src/external/samba.m4 b/src/external/samba.m4
5fca41
index 7a8c1eb7b..e68f064b3 100644
5fca41
--- a/src/external/samba.m4
5fca41
+++ b/src/external/samba.m4
5fca41
@@ -121,6 +121,19 @@ int main(void)
5fca41
     AC_MSG_NOTICE([Samba's idmap interface version: $idmap_version])
5fca41
     AC_DEFINE_UNQUOTED(SMB_IDMAP_INTERFACE_VERSION, $idmap_version,
5fca41
                        [Detected version of Samba's idmap plugin interface])
5fca41
+
5fca41
+    samba_major_version=`echo -e '#include <samba/version.h>\nSAMBA_VERSION_MAJOR' | $CPP $SMBCLIENT_CFLAGS -P -`
5fca41
+    samba_minor_version=`echo -e '#include <samba/version.h>\nSAMBA_VERSION_MINOR' | $CPP $SMBCLIENT_CFLAGS -P -`
5fca41
+    samba_release_version=`echo -e '#include <samba/version.h>\nSAMBA_VERSION_RELEASE' | $CPP $SMBCLIENT_CFLAGS -P -`
5fca41
+    AC_MSG_NOTICE([Samba version: $samba_major_version $samba_minor_version $samba_release_version])
5fca41
+    if test $samba_major_version -ge 4 -a $samba_minor_version -ge 8 ; then
5fca41
+        AC_DEFINE_UNQUOTED(SMB_IDMAP_DOMAIN_HAS_DOM_SID, 1,
5fca41
+                           [Samba's struct idmap_domain has dom_sid member])
5fca41
+        AC_MSG_NOTICE([Samba's struct idmap_domain has dom_sid member])
5fca41
+    else
5fca41
+        AC_MSG_NOTICE([Samba's struct idmap_domain does not have dom_sid member])
5fca41
+    fi
5fca41
+
5fca41
 fi
5fca41
 
5fca41
 SAVE_CFLAGS=$CFLAGS
5fca41
diff --git a/src/lib/winbind_idmap_sss/winbind_idmap_sss.c b/src/lib/winbind_idmap_sss/winbind_idmap_sss.c
5fca41
index 0d9109455..58375322a 100644
5fca41
--- a/src/lib/winbind_idmap_sss/winbind_idmap_sss.c
5fca41
+++ b/src/lib/winbind_idmap_sss/winbind_idmap_sss.c
5fca41
@@ -55,6 +55,10 @@ static NTSTATUS idmap_sss_initialize(struct idmap_domain *dom)
5fca41
         return NT_STATUS_NO_MEMORY;
5fca41
     }
5fca41
 
5fca41
+#if SMB_IDMAP_INTERFACE_VERSION == 6
5fca41
+    dom->query_user = NULL;
5fca41
+#endif
5fca41
+
5fca41
     dom->private_data = ctx;
5fca41
 
5fca41
     return NT_STATUS_OK;
5fca41
diff --git a/src/lib/winbind_idmap_sss/winbind_idmap_sss.h b/src/lib/winbind_idmap_sss/winbind_idmap_sss.h
5fca41
index 868049fff..78800838e 100644
5fca41
--- a/src/lib/winbind_idmap_sss/winbind_idmap_sss.h
5fca41
+++ b/src/lib/winbind_idmap_sss/winbind_idmap_sss.h
5fca41
@@ -70,9 +70,24 @@ struct id_map {
5fca41
 #error Missing Samba idmap interface version
5fca41
 #endif
5fca41
 
5fca41
+#if SMB_IDMAP_INTERFACE_VERSION == 6
5fca41
+struct wbint_userinfo;
5fca41
+#endif
5fca41
+
5fca41
 struct idmap_domain {
5fca41
     const char *name;
5fca41
+#if SMB_IDMAP_INTERFACE_VERSION == 6 && defined(SMB_IDMAP_DOMAIN_HAS_DOM_SID)
5fca41
+    /*
5fca41
+     * dom_sid is currently only initialized in the unixids_to_sids request,
5fca41
+     * so don't rely on this being filled out everywhere!
5fca41
+     */
5fca41
+    struct dom_sid dom_sid;
5fca41
+#endif
5fca41
     struct idmap_methods *methods;
5fca41
+#if SMB_IDMAP_INTERFACE_VERSION == 6
5fca41
+    NTSTATUS (*query_user)(struct idmap_domain *domain,
5fca41
+                           struct wbint_userinfo *info);
5fca41
+#endif
5fca41
     uint32_t low_id;
5fca41
     uint32_t high_id;
5fca41
     bool read_only;
5fca41
-- 
5fca41
2.19.1
5fca41