summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Prouty <tprouty@samba.org>2009-07-21 13:57:56 -0700
committerTim Prouty <tprouty@samba.org>2009-07-22 09:51:17 -0700
commit4b42927ec31a0819b1e5ec415fd1a16061cff677 (patch)
tree7ecbd49439248ef8a91855761e8d053c1a7463de
parent84eced142551a1986ba727d4c57aed1296ac87b4 (diff)
downloadsamba-4b42927ec31a0819b1e5ec415fd1a16061cff677.tar.gz
samba-4b42927ec31a0819b1e5ec415fd1a16061cff677.tar.xz
samba-4b42927ec31a0819b1e5ec415fd1a16061cff677.zip
s3: Convert some callers of vfs_stat_smb_fname to SMB_VFS_STAT()
-rw-r--r--source3/smbd/globals.h1
-rw-r--r--source3/smbd/posix_acls.c24
-rw-r--r--source3/smbd/smb2_getinfo.c10
-rw-r--r--source3/smbd/trans2.c28
4 files changed, 37 insertions, 26 deletions
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h
index cd3e054d1a8..434204b60de 100644
--- a/source3/smbd/globals.h
+++ b/source3/smbd/globals.h
@@ -213,7 +213,6 @@ NTSTATUS smbd_do_setfilepathinfo(connection_struct *conn,
NTSTATUS smbd_do_qfsinfo(connection_struct *conn,
TALLOC_CTX *mem_ctx,
uint16_t info_level,
- SMB_STRUCT_STAT st,
uint16_t flags2,
unsigned int max_data_bytes,
char **ppdata,
diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c
index fb2cda40ce0..0a3b0dff759 100644
--- a/source3/smbd/posix_acls.c
+++ b/source3/smbd/posix_acls.c
@@ -3372,33 +3372,45 @@ NTSTATUS posix_fget_nt_acl(struct files_struct *fsp, uint32_t security_info,
NTSTATUS posix_get_nt_acl(struct connection_struct *conn, const char *name,
uint32_t security_info, SEC_DESC **ppdesc)
{
- SMB_STRUCT_STAT sbuf;
SMB_ACL_T posix_acl = NULL;
SMB_ACL_T def_acl = NULL;
struct pai_val *pal;
+ struct smb_filename *smb_fname = NULL;
+ NTSTATUS status;
*ppdesc = NULL;
DEBUG(10,("posix_get_nt_acl: called for file %s\n", name ));
+ status = create_synthetic_smb_fname(talloc_tos(), name, NULL, NULL,
+ &smb_fname);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
/* Get the stat struct for the owner info. */
- if(vfs_stat_smb_fname(conn, name, &sbuf) != 0) {
- return map_nt_error_from_unix(errno);
+ if(SMB_VFS_STAT(conn, smb_fname) != 0) {
+ status = map_nt_error_from_unix(errno);
+ goto out;
}
/* Get the ACL from the path. */
posix_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, name, SMB_ACL_TYPE_ACCESS);
/* If it's a directory get the default POSIX ACL. */
- if(S_ISDIR(sbuf.st_ex_mode)) {
+ if(S_ISDIR(smb_fname->st.st_ex_mode)) {
def_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, name, SMB_ACL_TYPE_DEFAULT);
def_acl = free_empty_sys_acl(conn, def_acl);
}
pal = load_inherited_info(conn, name);
- return posix_get_nt_acl_common(conn, name, &sbuf, pal, posix_acl,
- def_acl, security_info, ppdesc);
+ status = posix_get_nt_acl_common(conn, name, &smb_fname->st, pal,
+ posix_acl, def_acl, security_info,
+ ppdesc);
+ out:
+ TALLOC_FREE(smb_fname);
+ return status;
}
/****************************************************************************
diff --git a/source3/smbd/smb2_getinfo.c b/source3/smbd/smb2_getinfo.c
index dda79c209f3..5a6e3d7ecbf 100644
--- a/source3/smbd/smb2_getinfo.c
+++ b/source3/smbd/smb2_getinfo.c
@@ -367,22 +367,12 @@ static struct tevent_req *smbd_smb2_getinfo_send(TALLOC_CTX *mem_ctx,
char *data = NULL;
int data_size = 0;
NTSTATUS status;
- SMB_STRUCT_STAT st;
/* the levels directly map to the passthru levels */
file_info_level = in_file_info_class + 1000;
- if (vfs_stat_smb_fname(conn,".",&st)!=0) {
- DEBUG(2,("call_trans2qfsinfo: stat of . failed (%s)\n",
- strerror(errno)));
- status = map_nt_error_from_unix(errno);
- tevent_req_nterror(req, status);
- return tevent_req_post(req, ev);
- }
-
status = smbd_do_qfsinfo(conn, state,
file_info_level,
- st,
STR_UNICODE,
in_output_buffer_length,
&data,
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index cac0147c4d2..856fd9432d0 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -2682,7 +2682,6 @@ static void samba_extended_info_version(struct smb_extended_info *extended_info)
NTSTATUS smbd_do_qfsinfo(connection_struct *conn,
TALLOC_CTX *mem_ctx,
uint16_t info_level,
- SMB_STRUCT_STAT st,
uint16_t flags2,
unsigned int max_data_bytes,
char **ppdata,
@@ -2694,6 +2693,9 @@ NTSTATUS smbd_do_qfsinfo(connection_struct *conn,
int snum = SNUM(conn);
char *fstype = lp_fstype(SNUM(conn));
uint32 additional_flags = 0;
+ struct smb_filename *smb_fname_dot = NULL;
+ SMB_STRUCT_STAT st;
+ NTSTATUS status;
if (IS_IPC(conn)) {
if (info_level != SMB_QUERY_CIFS_UNIX_INFO) {
@@ -2706,6 +2708,21 @@ NTSTATUS smbd_do_qfsinfo(connection_struct *conn,
DEBUG(3,("smbd_do_qfsinfo: level = %d\n", info_level));
+ status = create_synthetic_smb_fname(talloc_tos(), ".", NULL, NULL,
+ &smb_fname_dot);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ if(SMB_VFS_STAT(conn, smb_fname_dot) != 0) {
+ DEBUG(2,("stat of . failed (%s)\n", strerror(errno)));
+ TALLOC_FREE(smb_fname_dot);
+ return map_nt_error_from_unix(errno);
+ }
+
+ st = smb_fname_dot->st;
+ TALLOC_FREE(smb_fname_dot);
+
*ppdata = (char *)SMB_REALLOC(
*ppdata, max_data_bytes + DIR_ENTRY_SAFETY_MARGIN);
if (*ppdata == NULL) {
@@ -3228,7 +3245,6 @@ static void call_trans2qfsinfo(connection_struct *conn,
char *params = *pparams;
uint16_t info_level;
int data_len = 0;
- SMB_STRUCT_STAT st;
NTSTATUS status;
if (total_params < 2) {
@@ -3251,14 +3267,8 @@ static void call_trans2qfsinfo(connection_struct *conn,
DEBUG(3,("call_trans2qfsinfo: level = %d\n", info_level));
- if(vfs_stat_smb_fname(conn,".",&st)!=0) {
- DEBUG(2,("call_trans2qfsinfo: stat of . failed (%s)\n", strerror(errno)));
- reply_doserror(req, ERRSRV, ERRinvdevice);
- return;
- }
-
status = smbd_do_qfsinfo(conn, req,
- info_level, st,
+ info_level,
req->flags2,
max_data_bytes,
ppdata, &data_len);