areguera / rpms / ipa

Forked from rpms/ipa 5 years ago
Clone
6ec482
From 5cceb47667c0665629bb474f73be1d2d8f1e1b5b Mon Sep 17 00:00:00 2001
6ec482
From: Sumit Bose <sbose@redhat.com>
6ec482
Date: Tue, 19 Feb 2019 12:30:40 +0100
6ec482
Subject: [PATCH] ipa_sam: remove dependency to talloc_strackframe.h
6ec482
MIME-Version: 1.0
6ec482
Content-Type: text/plain; charset=UTF-8
6ec482
Content-Transfer-Encoding: 8bit
6ec482
6ec482
Recent Samba versions removed some header files which did include
6ec482
non-public APIs. As a result talloc_strackframe.h and memory.h (for
6ec482
SAFE_FREE) are not available anymore. This patch replaces the use of the
6ec482
non-public APIs with public ones.
6ec482
6ec482
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
6ec482
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
6ec482
Reviewed-By: François Cami <fcami@redhat.com>
6ec482
(cherry picked from commit d1f5ed64e16d65b9df45cc0eac7d2724dcae7b67)
6ec482
---
6ec482
 daemons/ipa-sam/ipa_sam.c | 16 ++++++++++++----
6ec482
 1 file changed, 12 insertions(+), 4 deletions(-)
6ec482
6ec482
diff --git a/daemons/ipa-sam/ipa_sam.c b/daemons/ipa-sam/ipa_sam.c
6ec482
index 2251f3ddc..755f44d68 100644
6ec482
--- a/daemons/ipa-sam/ipa_sam.c
6ec482
+++ b/daemons/ipa-sam/ipa_sam.c
6ec482
@@ -19,7 +19,6 @@
6ec482
 #include <util/data_blob.h>
6ec482
 #include <util/time.h>
6ec482
 #include <util/debug.h>
6ec482
-#include <util/talloc_stack.h>
6ec482
 
6ec482
 #ifndef _SAMBA_UTIL_H_
6ec482
 bool trim_string(char *s, const char *front, const char *back);
6ec482
@@ -881,9 +880,13 @@ static bool ipasam_uid_to_sid(struct pdb_methods *methods, uid_t uid,
6ec482
 	struct dom_sid *user_sid = NULL;
6ec482
 	int rc;
6ec482
 	enum idmap_error_code err;
6ec482
-	TALLOC_CTX *tmp_ctx = talloc_stackframe();
6ec482
 	struct unixid id;
6ec482
 
6ec482
+	TALLOC_CTX *tmp_ctx = talloc_new(priv);
6ec482
+	if (tmp_ctx == NULL) {
6ec482
+		goto done;
6ec482
+	}
6ec482
+
6ec482
 	/* Fast fail if we get a request for uidNumber=0 because it currently
6ec482
 	 * will never exist in the directory
6ec482
 	 * Saves an expensive LDAP call of which failure will never be cached
6ec482
@@ -968,9 +971,13 @@ static bool ipasam_gid_to_sid(struct pdb_methods *methods, gid_t gid,
6ec482
 	size_t c;
6ec482
 	int rc;
6ec482
 	enum idmap_error_code err;
6ec482
-	TALLOC_CTX *tmp_ctx = talloc_stackframe();
6ec482
 	struct unixid id;
6ec482
 
6ec482
+	TALLOC_CTX *tmp_ctx = talloc_new(priv);
6ec482
+	if (tmp_ctx == NULL) {
6ec482
+		goto done;
6ec482
+	}
6ec482
+
6ec482
 	filter = talloc_asprintf(tmp_ctx,
6ec482
 				 "(|(&(gidNumber=%u)"
6ec482
 				     "(objectClass=%s))"
6ec482
@@ -3749,7 +3756,8 @@ static void ipasam_free_private_data(void **vp)
6ec482
 		(*ipasam_state)->result = NULL;
6ec482
 	}
6ec482
 	if ((*ipasam_state)->domain_dn != NULL) {
6ec482
-		SAFE_FREE((*ipasam_state)->domain_dn);
6ec482
+		free((*ipasam_state)->domain_dn);
6ec482
+		(*ipasam_state)->domain_dn = NULL;
6ec482
 	}
6ec482
 
6ec482
 	*ipasam_state = NULL;
6ec482
-- 
6ec482
2.21.0
6ec482