diff options
author | Jeremy Allison <jra@samba.org> | 2007-09-07 20:57:01 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:30:32 -0500 |
commit | 132ee3990af5d31573978f5a3abf43db2303880b (patch) | |
tree | 2ce69566fb9a4ecb0f8ce19261c60e4ad3d8593a /source3/rpc_server | |
parent | c5d8fd3772706a469484df8a16abf10547d1c7a4 (diff) | |
download | samba-132ee3990af5d31573978f5a3abf43db2303880b.tar.gz samba-132ee3990af5d31573978f5a3abf43db2303880b.tar.xz samba-132ee3990af5d31573978f5a3abf43db2303880b.zip |
r25009: Large patch discussed with Volker. Move unix_convert to a talloc-based
interface. More development will come on top of this. Remove the
"mangled map" parameter.
Jeremy.
(This used to be commit dee8beba7a92b8a3f68bbcc59fd0a827f68c7736)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r-- | source3/rpc_server/srv_srvsvc_nt.c | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/source3/rpc_server/srv_srvsvc_nt.c b/source3/rpc_server/srv_srvsvc_nt.c index 22eaac51a75..4be519a9a3f 100644 --- a/source3/rpc_server/srv_srvsvc_nt.c +++ b/source3/rpc_server/srv_srvsvc_nt.c @@ -2047,7 +2047,7 @@ WERROR _srvsvc_NetGetFileSecurity(pipes_struct *p, struct srvsvc_NetGetFileSecur connection_struct *conn = NULL; BOOL became_user = False; WERROR status = WERR_OK; - pstring tmp_file; + char *tmp_file = NULL; ZERO_STRUCT(st); @@ -2072,26 +2072,29 @@ WERROR _srvsvc_NetGetFileSecurity(pipes_struct *p, struct srvsvc_NetGetFileSecur } became_user = True; - pstrcpy(tmp_file, r->in.file); - nt_status = unix_convert(conn, tmp_file, False, NULL, &st); + if (!r->in.file) { + status = WERR_INVALID_PARAM; + goto error_exit; + } + nt_status = unix_convert(conn, r->in.file, False, &tmp_file, NULL, &st); if (!NT_STATUS_IS_OK(nt_status)) { DEBUG(3,("_srv_net_file_query_secdesc: bad pathname %s\n", r->in.file)); status = WERR_ACCESS_DENIED; goto error_exit; } - nt_status = check_name(conn, r->in.file); + nt_status = check_name(conn, tmp_file); if (!NT_STATUS_IS_OK(nt_status)) { - DEBUG(3,("_srv_net_file_query_secdesc: can't access %s\n", r->in.file)); + DEBUG(3,("_srv_net_file_query_secdesc: can't access %s\n", tmp_file)); status = WERR_ACCESS_DENIED; goto error_exit; } - nt_status = open_file_stat(conn, NULL, r->in.file, &st, &fsp); + nt_status = open_file_stat(conn, NULL, tmp_file, &st, &fsp); if (!NT_STATUS_IS_OK(nt_status)) { /* Perhaps it is a directory */ if (NT_STATUS_EQUAL(nt_status, NT_STATUS_FILE_IS_A_DIRECTORY)) - nt_status = open_directory(conn, NULL, r->in.file, &st, + nt_status = open_directory(conn, NULL, tmp_file, &st, READ_CONTROL_ACCESS, FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN, @@ -2100,7 +2103,7 @@ WERROR _srvsvc_NetGetFileSecurity(pipes_struct *p, struct srvsvc_NetGetFileSecur NULL, &fsp); if (!NT_STATUS_IS_OK(nt_status)) { - DEBUG(3,("_srv_net_file_query_secdesc: Unable to open file %s\n", r->in.file)); + DEBUG(3,("_srv_net_file_query_secdesc: Unable to open file %s\n", tmp_file)); status = WERR_ACCESS_DENIED; goto error_exit; } @@ -2109,7 +2112,7 @@ WERROR _srvsvc_NetGetFileSecurity(pipes_struct *p, struct srvsvc_NetGetFileSecur sd_size = SMB_VFS_GET_NT_ACL(fsp, fsp->fsp_name, (OWNER_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|DACL_SECURITY_INFORMATION), &psd); if (sd_size == 0) { - DEBUG(3,("_srv_net_file_query_secdesc: Unable to get NT ACL for file %s\n", r->in.file)); + DEBUG(3,("_srv_net_file_query_secdesc: Unable to get NT ACL for file %s\n", tmp_file)); status = WERR_ACCESS_DENIED; goto error_exit; } @@ -2152,7 +2155,7 @@ WERROR _srvsvc_NetSetFileSecurity(pipes_struct *p, struct srvsvc_NetSetFileSecur connection_struct *conn = NULL; BOOL became_user = False; WERROR status = WERR_OK; - pstring tmp_file; + char *tmp_file = NULL; ZERO_STRUCT(st); @@ -2176,28 +2179,31 @@ WERROR _srvsvc_NetSetFileSecurity(pipes_struct *p, struct srvsvc_NetSetFileSecur } became_user = True; - pstrcpy(tmp_file, r->in.file); - nt_status = unix_convert(conn, tmp_file, False, NULL, &st); + if (!r->in.file) { + status = WERR_INVALID_PARAM; + goto error_exit; + } + nt_status = unix_convert(conn, r->in.file, False, &tmp_file, NULL, &st); if (!NT_STATUS_IS_OK(nt_status)) { DEBUG(3,("_srv_net_file_set_secdesc: bad pathname %s\n", r->in.file)); status = WERR_ACCESS_DENIED; goto error_exit; } - nt_status = check_name(conn, r->in.file); + nt_status = check_name(conn, tmp_file); if (!NT_STATUS_IS_OK(nt_status)) { - DEBUG(3,("_srv_net_file_set_secdesc: can't access %s\n", r->in.file)); + DEBUG(3,("_srv_net_file_set_secdesc: can't access %s\n", tmp_file)); status = WERR_ACCESS_DENIED; goto error_exit; } - nt_status = open_file_stat(conn, NULL, r->in.file, &st, &fsp); + nt_status = open_file_stat(conn, NULL, tmp_file, &st, &fsp); if (!NT_STATUS_IS_OK(nt_status)) { /* Perhaps it is a directory */ if (NT_STATUS_EQUAL(nt_status, NT_STATUS_FILE_IS_A_DIRECTORY)) - nt_status = open_directory(conn, NULL, r->in.file, &st, + nt_status = open_directory(conn, NULL, tmp_file, &st, FILE_READ_ATTRIBUTES, FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN, @@ -2206,7 +2212,7 @@ WERROR _srvsvc_NetSetFileSecurity(pipes_struct *p, struct srvsvc_NetSetFileSecur NULL, &fsp); if (!NT_STATUS_IS_OK(nt_status)) { - DEBUG(3,("_srv_net_file_set_secdesc: Unable to open file %s\n", r->in.file)); + DEBUG(3,("_srv_net_file_set_secdesc: Unable to open file %s\n", tmp_file)); status = WERR_ACCESS_DENIED; goto error_exit; } @@ -2215,7 +2221,7 @@ WERROR _srvsvc_NetSetFileSecurity(pipes_struct *p, struct srvsvc_NetSetFileSecur nt_status = SMB_VFS_SET_NT_ACL(fsp, fsp->fsp_name, r->in.securityinformation, r->in.sd_buf.sd); if (!NT_STATUS_IS_OK(nt_status)) { - DEBUG(3,("_srv_net_file_set_secdesc: Unable to set NT ACL on file %s\n", r->in.file)); + DEBUG(3,("_srv_net_file_set_secdesc: Unable to set NT ACL on file %s\n", tmp_file)); status = WERR_ACCESS_DENIED; goto error_exit; } |