From 9d5e0ef9515ca0cc962f1a4e2e9327466c57d041 Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Oct 01 2019 06:50:27 +0000 Subject: Fix compatibility with Samba 4.11 Fixes: rhbz#1757089 (cherry picked from commit 56d3eef1e205236e87b2e5d6275f942fe13da1e7) --- diff --git a/freeipa-samba-4.11-unixid-fixes.patch b/freeipa-samba-4.11-unixid-fixes.patch new file mode 100644 index 0000000..a6d8e25 --- /dev/null +++ b/freeipa-samba-4.11-unixid-fixes.patch @@ -0,0 +1,101 @@ +From 28113991463f81ab960b47264a2949a0d0857826 Mon Sep 17 00:00:00 2001 +From: Alexander Bokovoy +Date: Mon, 30 Sep 2019 17:43:12 +0300 +Subject: [PATCH] Add local helpers to handle unixid structure + +Samba did remove unixid_from_*() helpers in the upstream commit +c906153cc7af21abe508ddd30c447642327d6a5d (Samba 4.11). Since they are +very simple, make a local copy instead. + +Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1757089 +Signed-off-by: Alexander Bokovoy +--- + daemons/ipa-sam/ipa_sam.c | 27 +++++++++++++++++++++------ + 1 file changed, 21 insertions(+), 6 deletions(-) + +diff --git a/daemons/ipa-sam/ipa_sam.c b/daemons/ipa-sam/ipa_sam.c +index ba1f7f148..89ba16ee6 100644 +--- a/daemons/ipa-sam/ipa_sam.c ++++ b/daemons/ipa-sam/ipa_sam.c +@@ -498,9 +498,24 @@ done: + return unix_dn; + } + ++/* Samba removed unixid_* helpers in c906153cc7af21abe508ddd30c447642327d6a5d */ ++static void ipasam_unixid_from_uid(struct unixid *id, uint32_t some_uid) ++{ ++ if (id) { ++ id->id = some_uid; ++ id->type = ID_TYPE_UID; ++ } ++} + + + ++static void ipasam_unixid_from_gid(struct unixid *id, uint32_t some_gid) ++{ ++ if (id) { ++ id->id = some_gid; ++ id->type = ID_TYPE_GID; ++ } ++} + + static bool ldapsam_extract_rid_from_entry(LDAP *ldap_struct, + LDAPMessage *entry, +@@ -858,7 +873,7 @@ static bool ldapsam_sid_to_id(struct pdb_methods *methods, + goto done; + } + +- unixid_from_gid(id, strtoul(gid_str, NULL, 10)); ++ ipasam_unixid_from_gid(id, strtoul(gid_str, NULL, 10)); + + idmap_cache_set_sid2unixid(sid, id); + +@@ -876,7 +891,7 @@ static bool ldapsam_sid_to_id(struct pdb_methods *methods, + goto done; + } + +- unixid_from_uid(id, strtoul(value, NULL, 10)); ++ ipasam_unixid_from_uid(id, strtoul(value, NULL, 10)); + + idmap_cache_set_sid2unixid(sid, id); + +@@ -964,7 +979,7 @@ static bool ipasam_uid_to_sid(struct pdb_methods *methods, uid_t uid, + + sid_copy(sid, user_sid); + +- unixid_from_uid(&id, uid); ++ ipasam_unixid_from_uid(&id, uid); + + idmap_cache_set_sid2unixid(sid, &id); + +@@ -1080,7 +1095,7 @@ found: + + sid_copy(sid, group_sid); + +- unixid_from_gid(&id, gid); ++ ipasam_unixid_from_gid(&id, gid); + + idmap_cache_set_sid2unixid(sid, &id); + +@@ -3260,7 +3275,7 @@ static int ipasam_get_sid_by_gid(struct ipasam_private *ipasam_state, + } + sid_copy(_sid, sid); + +- unixid_from_gid(&id, gid); ++ ipasam_unixid_from_gid(&id, gid); + + idmap_cache_set_sid2unixid(sid, &id); + +@@ -3322,7 +3337,7 @@ static int ipasam_get_primary_group_sid(TALLOC_CTX *mem_ctx, + } + } + +- unixid_from_gid(&id, gid); ++ ipasam_unixid_from_gid(&id, gid); + + idmap_cache_set_sid2unixid(group_sid, &id); + +-- +2.21.0 + diff --git a/freeipa.spec b/freeipa.spec index c670880..c731cb0 100644 --- a/freeipa.spec +++ b/freeipa.spec @@ -135,13 +135,14 @@ Name: %{package_name} Version: %{IPA_VERSION} -Release: 1%{?dist} +Release: 2%{?dist} Summary: The Identity, Policy and Audit system License: GPLv3+ URL: http://www.freeipa.org/ Source0: https://releases.pagure.org/freeipa/freeipa-%{version}.tar.gz Source1: https://releases.pagure.org/freeipa/freeipa-%{version}.tar.gz.asc +Patch1: freeipa-samba-4.11-unixid-fixes.patch # For the timestamp trick in patch application BuildRequires: diffstat @@ -1333,6 +1334,10 @@ fi %changelog +* Tue Oct 1 2019 Alexander Bokovoy - 4.8.1-2 +- Fix ipasam for compatibility with Samba 4.11 +- Fixes: rhbz#1757089 + * Wed Aug 14 2019 Alexander Bokovoy - 4.8.1-1 - New upstream release 4.8.1 - Fixes: rhbz#1732528