diff options
author | Gerald Carter <jerry@samba.org> | 2006-02-21 14:34:11 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:10:16 -0500 |
commit | cd559192633d78a9f06e239c6a448955f6ea0842 (patch) | |
tree | 9b91416a493d3f9ca1d8c65666184539ce8919de /source3/rpc_server | |
parent | 87ef96e6be75fb4988fac48b2e21892720c20426 (diff) | |
download | samba-cd559192633d78a9f06e239c6a448955f6ea0842.tar.gz samba-cd559192633d78a9f06e239c6a448955f6ea0842.tar.bz2 samba-cd559192633d78a9f06e239c6a448955f6ea0842.zip |
r13590: * replace all pdb_init_sam[_talloc]() calls with samu_new()
* replace all pdb_{init,fill}_sam_pw() calls with samu_set_unix()
(This used to be commit 6f1afa4acc93a07d0ee9940822d7715acaae634f)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r-- | source3/rpc_server/srv_netlog_nt.c | 11 | ||||
-rw-r--r-- | source3/rpc_server/srv_samr_nt.c | 69 |
2 files changed, 41 insertions, 39 deletions
diff --git a/source3/rpc_server/srv_netlog_nt.c b/source3/rpc_server/srv_netlog_nt.c index ea0685f41b..a71d97ada7 100644 --- a/source3/rpc_server/srv_netlog_nt.c +++ b/source3/rpc_server/srv_netlog_nt.c @@ -229,8 +229,9 @@ static BOOL get_md4pw(char *md4pw, char *mach_acct) } #endif /* 0 */ - if(!NT_STATUS_IS_OK(pdb_init_sam(&sampass))) + if ( !(sampass = samu_new( NULL )) ) { return False; + } /* JRA. This is ok as it is only used for generating the challenge. */ become_root(); @@ -517,10 +518,14 @@ NTSTATUS _net_srv_pwset(pipes_struct *p, NET_Q_SRV_PWSET *q_u, NET_R_SRV_PWSET * secrets_store_schannel_session_info(p->pipe_state_mem_ctx, remote_machine, p->dc); - pdb_init_sam(&sampass); - ret=pdb_getsampwnam(sampass, p->dc->mach_acct); + if ( (sampass = samu_new( NULL )) != NULL ) { + ret = pdb_getsampwnam(sampass, p->dc->mach_acct); + } unbecome_root(); + if ( !sampass ) + return NT_STATUS_NO_MEMORY; + /* Ensure the account exists and is a machine account. */ acct_ctrl = pdb_get_acct_ctrl(sampass); diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c index f9a28f1272..5c2950b491 100644 --- a/source3/rpc_server/srv_samr_nt.c +++ b/source3/rpc_server/srv_samr_nt.c @@ -1693,10 +1693,9 @@ NTSTATUS _samr_open_user(pipes_struct *p, SAMR_Q_OPEN_USER *q_u, SAMR_R_OPEN_USE if ( !NT_STATUS_IS_OK(nt_status) ) return nt_status; - nt_status = pdb_init_sam_talloc(p->mem_ctx, &sampass); - - if (!NT_STATUS_IS_OK(nt_status)) - return nt_status; + if ( !(sampass = samu_new( p->mem_ctx )) ) { + return NT_STATUS_NO_MEMORY; + } /* append the user's RID to it */ @@ -1749,19 +1748,16 @@ static NTSTATUS get_user_info_7(TALLOC_CTX *mem_ctx, SAM_USER_INFO_7 *id7, DOM_S { struct samu *smbpass=NULL; BOOL ret; - NTSTATUS nt_status; - nt_status = pdb_init_sam_talloc(mem_ctx, &smbpass); - - if (!NT_STATUS_IS_OK(nt_status)) { - return nt_status; + if ( !(smbpass = samu_new( mem_ctx )) ) { + return NT_STATUS_NO_MEMORY; } - + become_root(); ret = pdb_getsampwsid(smbpass, user_sid); unbecome_root(); - if (ret==False) { + if ( !ret ) { DEBUG(4,("User %s not found\n", sid_string_static(user_sid))); return NT_STATUS_NO_SUCH_USER; } @@ -1783,12 +1779,9 @@ static NTSTATUS get_user_info_9(TALLOC_CTX *mem_ctx, SAM_USER_INFO_9 * id9, DOM_ { struct samu *smbpass=NULL; BOOL ret; - NTSTATUS nt_status; - - nt_status = pdb_init_sam_talloc(mem_ctx, &smbpass); - if (!NT_STATUS_IS_OK(nt_status)) { - return nt_status; + if ( !(smbpass = samu_new( mem_ctx )) ) { + return NT_STATUS_NO_MEMORY; } become_root(); @@ -1818,12 +1811,9 @@ static NTSTATUS get_user_info_16(TALLOC_CTX *mem_ctx, SAM_USER_INFO_16 *id16, DO { struct samu *smbpass=NULL; BOOL ret; - NTSTATUS nt_status; - nt_status = pdb_init_sam_talloc(mem_ctx, &smbpass); - - if (!NT_STATUS_IS_OK(nt_status)) { - return nt_status; + if ( !(smbpass = samu_new( mem_ctx )) ) { + return NT_STATUS_NO_MEMORY; } become_root(); @@ -1855,7 +1845,6 @@ static NTSTATUS get_user_info_18(pipes_struct *p, TALLOC_CTX *mem_ctx, SAM_USER_ { struct samu *smbpass=NULL; BOOL ret; - NTSTATUS nt_status; if (p->auth.auth_type != PIPE_AUTH_TYPE_NTLMSSP || p->auth.auth_type != PIPE_AUTH_TYPE_SPNEGO_NTLMSSP) { return NT_STATUS_ACCESS_DENIED; @@ -1869,10 +1858,8 @@ static NTSTATUS get_user_info_18(pipes_struct *p, TALLOC_CTX *mem_ctx, SAM_USER_ * Do *NOT* do become_root()/unbecome_root() here ! JRA. */ - nt_status = pdb_init_sam_talloc(mem_ctx, &smbpass); - - if (!NT_STATUS_IS_OK(nt_status)) { - return nt_status; + if ( !(smbpass = samu_new( mem_ctx )) ) { + return NT_STATUS_NO_MEMORY; } ret = pdb_getsampwsid(smbpass, user_sid); @@ -1907,7 +1894,9 @@ static NTSTATUS get_user_info_20(TALLOC_CTX *mem_ctx, SAM_USER_INFO_20 *id20, DO struct samu *sampass=NULL; BOOL ret; - pdb_init_sam_talloc(mem_ctx, &sampass); + if ( !(sampass = samu_new( mem_ctx )) ) { + return NT_STATUS_NO_MEMORY; + } become_root(); ret = pdb_getsampwsid(sampass, user_sid); @@ -1941,9 +1930,8 @@ static NTSTATUS get_user_info_21(TALLOC_CTX *mem_ctx, SAM_USER_INFO_21 *id21, BOOL ret; NTSTATUS nt_status; - nt_status = pdb_init_sam_talloc(mem_ctx, &sampass); - if (!NT_STATUS_IS_OK(nt_status)) { - return nt_status; + if ( !(sampass = samu_new( mem_ctx )) ) { + return NT_STATUS_NO_MEMORY; } become_root(); @@ -2113,8 +2101,10 @@ NTSTATUS _samr_query_usergroups(pipes_struct *p, SAMR_Q_QUERY_USERGROUPS *q_u, S if (!sid_check_is_in_our_domain(&sid)) return NT_STATUS_OBJECT_TYPE_MISMATCH; - pdb_init_sam_talloc(p->mem_ctx, &sam_pass); - + if ( !(sam_pass = samu_new( p->mem_ctx )) ) { + return NT_STATUS_NO_MEMORY; + } + become_root(); ret = pdb_getsampwsid(sam_pass, &sid); unbecome_root(); @@ -3290,7 +3280,9 @@ NTSTATUS _samr_set_userinfo(pipes_struct *p, SAMR_Q_SET_USERINFO *q_u, SAMR_R_SE return NT_STATUS_INVALID_INFO_CLASS; } - pdb_init_sam(&pwd); + if ( !(pwd = samu_new( NULL )) ) { + return NT_STATUS_NO_MEMORY; + } become_root(); ret = pdb_getsampwsid(pwd, &sid); @@ -3438,8 +3430,10 @@ NTSTATUS _samr_set_userinfo2(pipes_struct *p, SAMR_Q_SET_USERINFO2 *q_u, SAMR_R_ switch_value=ctr->switch_value; - pdb_init_sam(&pwd); - + if ( !(pwd = samu_new( NULL )) ) { + return NT_STATUS_NO_MEMORY; + } + become_root(); ret = pdb_getsampwsid(pwd, &sid); unbecome_root(); @@ -3916,7 +3910,10 @@ NTSTATUS _samr_delete_dom_user(pipes_struct *p, SAMR_Q_DELETE_DOM_USER *q_u, SAM return NT_STATUS_CANNOT_DELETE; /* check if the user exists before trying to delete */ - pdb_init_sam(&sam_pass); + if ( !(sam_pass = samu_new( NULL )) ) { + return NT_STATUS_NO_MEMORY; + } + if(!pdb_getsampwsid(sam_pass, &user_sid)) { DEBUG(5,("_samr_delete_dom_user:User %s doesn't exist.\n", sid_string_static(&user_sid))); |