[PATCH] Fix a CID
Volker Lendecke
Volker.Lendecke at SerNet.DE
Fri Apr 6 13:51:32 UTC 2018
Hi!
Review appreciated!
Thanks, Volker
--
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
-------------- next part --------------
From a09b7d66afbfcd1af9aa0cfe048754145cc68ad9 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Fri, 6 Apr 2018 11:02:48 +0200
Subject: [PATCH 1/2] idmap: Use TALLOC_FREE instead of explicit code
Signed-off-by: Volker Lendecke <vl at samba.org>
---
source3/winbindd/idmap_ad_nss.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/source3/winbindd/idmap_ad_nss.c b/source3/winbindd/idmap_ad_nss.c
index d65e1e9de8d..8e960b8a21e 100644
--- a/source3/winbindd/idmap_ad_nss.c
+++ b/source3/winbindd/idmap_ad_nss.c
@@ -353,9 +353,7 @@ static NTSTATUS nss_ad_map_from_alias( TALLOC_CTX *mem_ctx,
nt_status = NT_STATUS_OK;
done:
- if (filter) {
- talloc_destroy(filter);
- }
+ TALLOC_FREE(filter);
if (msg) {
ads_msgfree(ctx->ads, msg);
}
--
2.11.0
From c79e1c8bc1ba6cfee67a20ae95d42fac7d7789ee Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Fri, 6 Apr 2018 11:04:24 +0200
Subject: [PATCH 2/2] idmap: Fix CID 1363261 Resource leak
Signed-off-by: Volker Lendecke <vl at samba.org>
---
source3/winbindd/idmap_ad_nss.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/source3/winbindd/idmap_ad_nss.c b/source3/winbindd/idmap_ad_nss.c
index 8e960b8a21e..0fd2b51e156 100644
--- a/source3/winbindd/idmap_ad_nss.c
+++ b/source3/winbindd/idmap_ad_nss.c
@@ -290,7 +290,7 @@ static NTSTATUS nss_ad_map_from_alias( TALLOC_CTX *mem_ctx,
LDAPMessage *msg = NULL;
ADS_STATUS ads_status = ADS_ERROR_NT(NT_STATUS_UNSUCCESSFUL);
NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
- char *username;
+ char *username = NULL;
struct idmap_domain *dom;
struct idmap_ad_context *ctx = NULL;
@@ -339,7 +339,8 @@ static NTSTATUS nss_ad_map_from_alias( TALLOC_CTX *mem_ctx,
username = ads_pull_string(ctx->ads, mem_ctx, msg,
"sAMAccountName");
if (!username) {
- return NT_STATUS_OBJECT_NAME_NOT_FOUND;
+ nt_status = NT_STATUS_OBJECT_NAME_NOT_FOUND;
+ goto done;
}
*name = talloc_asprintf(mem_ctx, "%s\\%s",
@@ -353,6 +354,7 @@ static NTSTATUS nss_ad_map_from_alias( TALLOC_CTX *mem_ctx,
nt_status = NT_STATUS_OK;
done:
+ TALLOC_FREE(username);
TALLOC_FREE(filter);
if (msg) {
ads_msgfree(ctx->ads, msg);
--
2.11.0
More information about the samba-technical
mailing list