diff options
author | Tim Potter <tpot@samba.org> | 2003-09-10 06:58:41 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2003-09-10 06:58:41 +0000 |
commit | 4059dfcca2bda4d04c3277eea5bc67039a3fc6db (patch) | |
tree | 1ed14ac058c07e468de4a7dd9c543d5fb847f99c /source3 | |
parent | 51297321ba50e47d30179cf17713e1d205a33d22 (diff) | |
download | samba-4059dfcca2bda4d04c3277eea5bc67039a3fc6db.tar.gz samba-4059dfcca2bda4d04c3277eea5bc67039a3fc6db.tar.bz2 samba-4059dfcca2bda4d04c3277eea5bc67039a3fc6db.zip |
Fix error return path memory leaks in vampire code for creating users.
Display an error if we can't create a posix account for the user
(e.g no add user/machine script was specified; bug #323).
(This used to be commit 0c35ba2cd65ff64c5db2b20d5528a0d486cba51e)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/utils/net_rpc_samsync.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/source3/utils/net_rpc_samsync.c b/source3/utils/net_rpc_samsync.c index 4d8fa5e7e2..64f2d3f68f 100644 --- a/source3/utils/net_rpc_samsync.c +++ b/source3/utils/net_rpc_samsync.c @@ -428,9 +428,10 @@ static NTSTATUS fetch_account_info(uint32 rid, SAM_ACCOUNT_INFO *delta) (delta->acb_info & ACB_DOMTRUST) ) { pstrcpy(add_script, lp_addmachine_script()); } else { - *add_script = '\0'; DEBUG(1, ("Unknown user type: %s\n", smbpasswd_encode_acb_info(delta->acb_info))); + nt_ret = NT_STATUS_UNSUCCESSFUL; + goto done; } if (*add_script) { int add_ret; @@ -448,8 +449,11 @@ static NTSTATUS fetch_account_info(uint32 rid, SAM_ACCOUNT_INFO *delta) } /* try and find the possible unix account again */ - if ( !(passwd = Get_Pwnam(account)) ) - return NT_STATUS_NO_SUCH_USER; + if ( !(passwd = Get_Pwnam(account)) ) { + d_printf("Could not create posix account info for '%s'\n", account); + nt_ret = NT_STATUS_NO_SUCH_USER; + goto done; + } } @@ -499,6 +503,7 @@ static NTSTATUS fetch_account_info(uint32 rid, SAM_ACCOUNT_INFO *delta) pdb_get_username(sam_account))); } + done: pdb_free_sam(&sam_account); return nt_ret; } |