summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2017-01-11 11:52:44 -0800
committerKarolin Seeger <kseeger@samba.org>2017-01-25 20:32:13 +0100
commit6a8764730d0b8e0f1bcadea2d2df96d712969abb (patch)
treeb8c31fda8b8b3d959a4aeeb7e4cb6660b209a2f4
parent8c49f5421ff76bdd25cdba73bd8dda844895b609 (diff)
downloadsamba-6a8764730d0b8e0f1bcadea2d2df96d712969abb.tar.gz
winbind: Fix CID 1398534 Dereference before null check
Make all query_user_list backends consistent. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Fri Jan 13 13:33:37 CET 2017 on sn-devel-144
-rw-r--r--source3/winbindd/winbindd_ads.c8
-rw-r--r--source3/winbindd/winbindd_samr.c6
2 files changed, 6 insertions, 8 deletions
diff --git a/source3/winbindd/winbindd_ads.c b/source3/winbindd/winbindd_ads.c
index b14f21e3644..077c6ec7b7c 100644
--- a/source3/winbindd/winbindd_ads.c
+++ b/source3/winbindd/winbindd_ads.c
@@ -293,14 +293,12 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain,
ADS_STRUCT *ads = NULL;
const char *attrs[] = { "sAMAccountType", "objectSid", NULL };
int count;
- uint32_t *rids;
+ uint32_t *rids = NULL;
ADS_STATUS rc;
LDAPMessage *res = NULL;
LDAPMessage *msg = NULL;
NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
- *prids = NULL;
-
DEBUG(3,("ads: query_user_list\n"));
if ( !winbindd_can_contact_domain( domain ) ) {
@@ -375,7 +373,9 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain,
}
rids = talloc_realloc(mem_ctx, rids, uint32_t, count);
- *prids = rids;
+ if (prids != NULL) {
+ *prids = rids;
+ }
status = NT_STATUS_OK;
diff --git a/source3/winbindd/winbindd_samr.c b/source3/winbindd/winbindd_samr.c
index 224f1058348..1a73fc4fcc6 100644
--- a/source3/winbindd/winbindd_samr.c
+++ b/source3/winbindd/winbindd_samr.c
@@ -169,15 +169,13 @@ static NTSTATUS sam_query_user_list(struct winbindd_domain *domain,
{
struct rpc_pipe_client *samr_pipe = NULL;
struct policy_handle dom_pol = { 0 };
- uint32_t *rids;
+ uint32_t *rids = NULL;
TALLOC_CTX *tmp_ctx;
NTSTATUS status, result;
struct dcerpc_binding_handle *b = NULL;
DEBUG(3,("samr_query_user_list\n"));
- *prids = NULL;
-
tmp_ctx = talloc_stackframe();
if (tmp_ctx == NULL) {
return NT_STATUS_NO_MEMORY;
@@ -199,7 +197,7 @@ static NTSTATUS sam_query_user_list(struct winbindd_domain *domain,
goto done;
}
- if (prids) {
+ if (prids != NULL) {
*prids = talloc_move(mem_ctx, &rids);
}