summaryrefslogtreecommitdiffstats
path: root/source4/dsdb
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2014-05-15 09:46:21 +0200
committerGünther Deschner <gd@samba.org>2014-08-08 16:37:36 +0200
commitcef0ee28ecae9b7e3126b7f3739501c4c9802ca2 (patch)
treea98a48b6a2e5dfdca275e5377e80c24d151fcac0 /source4/dsdb
parentd9167c3044b9a4ebe0da3d4019eb9fa95242e3b9 (diff)
downloadsamba-cef0ee28ecae9b7e3126b7f3739501c4c9802ca2.tar.gz
samba-cef0ee28ecae9b7e3126b7f3739501c4c9802ca2.tar.xz
samba-cef0ee28ecae9b7e3126b7f3739501c4c9802ca2.zip
s4-dsdb/cracknames: free realm from smb_krb5_principal_get_realm().
Guenther Signed-off-by: Günther Deschner <gd@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/dsdb')
-rw-r--r--source4/dsdb/samdb/cracknames.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/source4/dsdb/samdb/cracknames.c b/source4/dsdb/samdb/cracknames.c
index 5e97efcee3..7c189d365f 100644
--- a/source4/dsdb/samdb/cracknames.c
+++ b/source4/dsdb/samdb/cracknames.c
@@ -56,7 +56,7 @@ static WERROR dns_domain_from_principal(TALLOC_CTX *mem_ctx, struct smb_krb5_con
krb5_error_code ret;
krb5_principal principal;
/* perhaps it's a principal with a realm, so return the right 'domain only' response */
- const char *realm;
+ char *realm;
ret = krb5_parse_name_flags(smb_krb5_context->krb5_context, name,
KRB5_PRINCIPAL_PARSE_REQUIRE_REALM, &principal);
if (ret) {
@@ -64,11 +64,11 @@ static WERROR dns_domain_from_principal(TALLOC_CTX *mem_ctx, struct smb_krb5_con
return WERR_OK;
}
- /* This isn't an allocation assignemnt, so it is free'ed with the krb5_free_principal */
realm = smb_krb5_principal_get_realm(smb_krb5_context->krb5_context, principal);
info1->dns_domain_name = talloc_strdup(mem_ctx, realm);
krb5_free_principal(smb_krb5_context->krb5_context, principal);
+ free(realm);
W_ERROR_HAVE_NO_MEMORY(info1->dns_domain_name);
@@ -271,7 +271,7 @@ static WERROR DsCrackNameUPN(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx,
const char *result_filter = NULL;
krb5_error_code ret;
krb5_principal principal;
- const char *realm;
+ char *realm;
char *unparsed_name_short;
const char *domain_attrs[] = { NULL };
struct ldb_result *domain_res = NULL;
@@ -301,6 +301,7 @@ static WERROR DsCrackNameUPN(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx,
ldb_binary_encode_string(mem_ctx, realm),
LDB_OID_COMPARATOR_AND,
SYSTEM_FLAG_CR_NTDS_DOMAIN);
+ free(realm);
if (ldb_ret != LDB_SUCCESS) {
DEBUG(2, ("DsCrackNameUPN domain ref search failed: %s\n", ldb_errstring(sam_ctx)));