diff options
Diffstat (limited to 'source3/rpc_server/srv_srvsvc_nt.c')
-rw-r--r-- | source3/rpc_server/srv_srvsvc_nt.c | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/source3/rpc_server/srv_srvsvc_nt.c b/source3/rpc_server/srv_srvsvc_nt.c index bb9c3687fb..b99c77c9b8 100644 --- a/source3/rpc_server/srv_srvsvc_nt.c +++ b/source3/rpc_server/srv_srvsvc_nt.c @@ -1700,7 +1700,9 @@ WERROR _srvsvc_NetShareAdd(pipes_struct *p, DEBUG(5,("_srvsvc_NetShareAdd: %d\n", __LINE__)); - *r->out.parm_error = 0; + if (r->out.parm_error) { + *r->out.parm_error = 0; + } get_current_user(&user,p); @@ -2110,7 +2112,7 @@ WERROR _srvsvc_NetGetFileSecurity(pipes_struct *p, psd->dacl->revision = NT4_ACL_REVISION; - close_file(fsp, NORMAL_CLOSE); + close_file(NULL, fsp, NORMAL_CLOSE); vfs_ChDir(conn, oldcwd); conn_free_internal(conn); return WERR_OK; @@ -2118,7 +2120,7 @@ WERROR _srvsvc_NetGetFileSecurity(pipes_struct *p, error_exit: if (fsp) { - close_file(fsp, NORMAL_CLOSE); + close_file(NULL, fsp, NORMAL_CLOSE); } if (oldcwd) { @@ -2148,6 +2150,8 @@ WERROR _srvsvc_NetSetFileSecurity(pipes_struct *p, connection_struct *conn = NULL; int snum; char *oldcwd = NULL; + struct security_descriptor *psd = NULL; + uint32_t security_info_sent = 0; ZERO_STRUCT(st); @@ -2196,9 +2200,29 @@ WERROR _srvsvc_NetSetFileSecurity(pipes_struct *p, goto error_exit; } + psd = r->in.sd_buf->sd; + security_info_sent = r->in.securityinformation; + + if (psd->owner_sid==0) { + security_info_sent &= ~OWNER_SECURITY_INFORMATION; + } + if (psd->group_sid==0) { + security_info_sent &= ~GROUP_SECURITY_INFORMATION; + } + if (psd->sacl==0) { + security_info_sent &= ~SACL_SECURITY_INFORMATION; + } + if (psd->dacl==0) { + security_info_sent &= ~DACL_SECURITY_INFORMATION; + } + + /* Convert all the generic bits. */ + security_acl_map_generic(psd->dacl, &file_generic_mapping); + security_acl_map_generic(psd->sacl, &file_generic_mapping); + nt_status = SMB_VFS_FSET_NT_ACL(fsp, - r->in.securityinformation, - r->in.sd_buf->sd); + security_info_sent, + psd); if (!NT_STATUS_IS_OK(nt_status) ) { DEBUG(3,("_srvsvc_NetSetFileSecurity: Unable to set NT ACL " @@ -2207,7 +2231,7 @@ WERROR _srvsvc_NetSetFileSecurity(pipes_struct *p, goto error_exit; } - close_file(fsp, NORMAL_CLOSE); + close_file(NULL, fsp, NORMAL_CLOSE); vfs_ChDir(conn, oldcwd); conn_free_internal(conn); return WERR_OK; @@ -2215,7 +2239,7 @@ WERROR _srvsvc_NetSetFileSecurity(pipes_struct *p, error_exit: if (fsp) { - close_file(fsp, NORMAL_CLOSE); + close_file(NULL, fsp, NORMAL_CLOSE); } if (oldcwd) { |