diff options
author | Jeremy Allison <jra@samba.org> | 2006-06-13 21:21:44 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:17:25 -0500 |
commit | d4a80fdf38428c7a0e6cda6da838c8ccc5d8f2ab (patch) | |
tree | 46c752202e21c8fd042868d11889c4cf14c9cb4d /source3/auth | |
parent | 069397c63ead319d5e237fa1ce16714bb86fc7f7 (diff) | |
download | samba-d4a80fdf38428c7a0e6cda6da838c8ccc5d8f2ab.tar.gz samba-d4a80fdf38428c7a0e6cda6da838c8ccc5d8f2ab.tar.bz2 samba-d4a80fdf38428c7a0e6cda6da838c8ccc5d8f2ab.zip |
r16209: Klocwork bug #66, ensure no null deref.
Jeremy.
(This used to be commit 79e693798cf322071ea64a4014a01ad9eaba73e8)
Diffstat (limited to 'source3/auth')
-rw-r--r-- | source3/auth/auth_util.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c index 43ae5c1af6..fb21d424c5 100644 --- a/source3/auth/auth_util.c +++ b/source3/auth/auth_util.c @@ -1082,6 +1082,7 @@ NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username, /* This is a passdb user, so ask passdb */ struct samu *sam_acct = NULL; + const DOM_SID *gr_sid = NULL; if ( !(sam_acct = samu_new( tmp_ctx )) ) { goto done; @@ -1094,7 +1095,13 @@ NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username, goto done; } - sid_copy(&primary_group_sid, pdb_get_group_sid(sam_acct)); + gr_sid = pdb_get_group_sid(sam_acct); + if (!gr_sid) { + result = NT_STATUS_NO_MEMORY; + goto done; + } + + sid_copy(&primary_group_sid, gr_sid); if (!sid_to_gid(&primary_group_sid, gid)) { DEBUG(1, ("sid_to_gid(%s) failed\n", |