summaryrefslogtreecommitdiff
path: root/source3/auth
diff options
context:
space:
mode:
Diffstat (limited to 'source3/auth')
-rw-r--r--source3/auth/auth_util.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c
index 2c20beb33c..26d1eb710f 100644
--- a/source3/auth/auth_util.c
+++ b/source3/auth/auth_util.c
@@ -1988,16 +1988,19 @@ NT_USER_TOKEN *dup_nt_token(TALLOC_CTX *mem_ctx, NT_USER_TOKEN *ptoken)
return NULL;
}
- token->user_sids = (DOM_SID *)talloc_memdup(
- token, ptoken->user_sids, sizeof(DOM_SID) * ptoken->num_sids );
+ ZERO_STRUCTP(token);
- if ((ptoken->user_sids != NULL) && (token->user_sids == NULL)) {
- DEBUG(0, ("talloc_memdup failed\n"));
- TALLOC_FREE(token);
- return NULL;
- }
+ if (ptoken->user_sids && ptoken->num_sids) {
+ token->user_sids = (DOM_SID *)talloc_memdup(
+ token, ptoken->user_sids, sizeof(DOM_SID) * ptoken->num_sids );
- token->num_sids = ptoken->num_sids;
+ if (token->user_sids == NULL) {
+ DEBUG(0, ("talloc_memdup failed\n"));
+ TALLOC_FREE(token);
+ return NULL;
+ }
+ token->num_sids = ptoken->num_sids;
+ }
/* copy the privileges; don't consider failure to be critical here */