URL: https://github.com/freeipa/freeipa/pull/2846 Author: sumit-bose Title: #2846: ipa_sam: remove dependency to talloc_strackframe.h Action: opened
PR body: """ Recent Samba versions removed some header files which did include non-public APIs. As a result talloc_strackframe.h and memory.h (for SAFE_FREE) are not available anymore. This patch replaces the use of the non-public APIs with public ones. """ To pull the PR as Git branch: git remote add ghfreeipa https://github.com/freeipa/freeipa git fetch ghfreeipa pull/2846/head:pr2846 git checkout pr2846
From dcc855ee5745ba0e265bf355d76b6941ce2cc439 Mon Sep 17 00:00:00 2001 From: Sumit Bose <sb...@redhat.com> Date: Tue, 19 Feb 2019 12:30:40 +0100 Subject: [PATCH] ipa_sam: remove dependency to talloc_strackframe.h Recent Samba versions removed some header files which did include non-public APIs. As a result talloc_strackframe.h and memory.h (for SAFE_FREE) are not available anymore. This patch replaces the use of the non-public APIs with public ones. --- daemons/ipa-sam/ipa_sam.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/daemons/ipa-sam/ipa_sam.c b/daemons/ipa-sam/ipa_sam.c index b1e0294e34..ac0aa48f18 100644 --- a/daemons/ipa-sam/ipa_sam.c +++ b/daemons/ipa-sam/ipa_sam.c @@ -19,7 +19,6 @@ #include <util/data_blob.h> #include <util/time.h> #include <util/debug.h> -#include <util/talloc_stack.h> #ifndef _SAMBA_UTIL_H_ bool trim_string(char *s, const char *front, const char *back); @@ -880,9 +879,13 @@ static bool ipasam_uid_to_sid(struct pdb_methods *methods, uid_t uid, struct dom_sid *user_sid = NULL; int rc; enum idmap_error_code err; - TALLOC_CTX *tmp_ctx = talloc_stackframe(); struct unixid id; + TALLOC_CTX *tmp_ctx = talloc_new(NULL); + if (tmp_ctx == NULL) { + goto done; + } + /* Fast fail if we get a request for uidNumber=0 because it currently * will never exist in the directory * Saves an expensive LDAP call of which failure will never be cached @@ -967,9 +970,13 @@ static bool ipasam_gid_to_sid(struct pdb_methods *methods, gid_t gid, size_t c; int rc; enum idmap_error_code err; - TALLOC_CTX *tmp_ctx = talloc_stackframe(); struct unixid id; + TALLOC_CTX *tmp_ctx = talloc_new(NULL); + if (tmp_ctx == NULL) { + goto done; + } + filter = talloc_asprintf(tmp_ctx, "(|(&(gidNumber=%u)" "(objectClass=%s))" @@ -3620,7 +3627,8 @@ static void ipasam_free_private_data(void **vp) (*ipasam_state)->result = NULL; } if ((*ipasam_state)->domain_dn != NULL) { - SAFE_FREE((*ipasam_state)->domain_dn); + free((*ipasam_state)->domain_dn); + (*ipasam_state)->domain_dn = NULL; } *ipasam_state = NULL;
_______________________________________________ FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedorahosted.org/archives/list/freeipa-devel@lists.fedorahosted.org