summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-10-09 15:38:53 +0200
committerVolker Lendecke <vl@samba.org>2008-10-13 19:32:38 +0200
commitc3fedcddd5e79c60f5fcc0219752c27277a4d9f7 (patch)
tree8248641a0fbedb7d87072cfc2e852683b2da3267 /source3
parent3bbe5e88e55a92a177260310daffd6deae551ba3 (diff)
downloadsamba-c3fedcddd5e79c60f5fcc0219752c27277a4d9f7.tar.gz
samba-c3fedcddd5e79c60f5fcc0219752c27277a4d9f7.tar.bz2
samba-c3fedcddd5e79c60f5fcc0219752c27277a4d9f7.zip
Pass struct smb_request to file_new
Goal is to remove the chain_fsp global variable
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h19
-rw-r--r--source3/printing/printfsp.c5
-rw-r--r--source3/smbd/dosmode.c6
-rw-r--r--source3/smbd/fake_file.c4
-rw-r--r--source3/smbd/files.c13
-rw-r--r--source3/smbd/open.c20
-rw-r--r--source3/smbd/posix_acls.c2
-rw-r--r--source3/smbd/reply.c2
8 files changed, 38 insertions, 33 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index a36a725b4f..db6130ce91 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -6573,7 +6573,8 @@ bool sysv_cache_reload(void);
/* The following definitions come from printing/printfsp.c */
-NTSTATUS print_fsp_open(connection_struct *conn, const char *fname,
+NTSTATUS print_fsp_open(struct smb_request *req, connection_struct *conn,
+ const char *fname,
uint16_t current_vuid, files_struct **result);
void print_fsp_end(files_struct *fsp, enum file_close_type close_type);
@@ -9528,7 +9529,7 @@ void reply_unix_error(struct smb_request *req, uint8 defclass, uint32 defcode,
/* The following definitions come from smbd/fake_file.c */
enum FAKE_FILE_TYPE is_fake_file(const char *fname);
-NTSTATUS open_fake_file(connection_struct *conn,
+NTSTATUS open_fake_file(struct smb_request *req, connection_struct *conn,
uint16_t current_vuid,
enum FAKE_FILE_TYPE fake_file_type,
const char *fname,
@@ -9575,7 +9576,8 @@ NTSTATUS check_name(connection_struct *conn, const char *name);
/* The following definitions come from smbd/files.c */
-NTSTATUS file_new(connection_struct *conn, files_struct **result);
+NTSTATUS file_new(struct smb_request *req, connection_struct *conn,
+ files_struct **result);
void file_close_conn(connection_struct *conn);
void file_close_pid(uint16 smbpid, int vuid);
void file_init(void);
@@ -9592,11 +9594,9 @@ void file_free(files_struct *fsp);
files_struct *file_fnum(uint16 fnum);
files_struct *file_fsp(struct smb_request *req, uint16 fid);
void file_chain_reset(void);
-NTSTATUS dup_file_fsp(files_struct *fsp,
- uint32 access_mask,
- uint32 share_access,
- uint32 create_options,
- files_struct **result);
+NTSTATUS dup_file_fsp(struct smb_request *req, files_struct *fsp,
+ uint32 access_mask, uint32 share_access,
+ uint32 create_options, files_struct **result);
/* The following definitions come from smbd/ipc.c */
@@ -9788,7 +9788,8 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
/* Information (FILE_EXISTS etc.) */
int *pinfo,
files_struct **result);
-NTSTATUS open_file_fchmod(connection_struct *conn, const char *fname,
+NTSTATUS open_file_fchmod(struct smb_request *req, connection_struct *conn,
+ const char *fname,
SMB_STRUCT_STAT *psbuf, files_struct **result);
NTSTATUS close_file_fchmod(files_struct *fsp);
NTSTATUS open_directory(connection_struct *conn,
diff --git a/source3/printing/printfsp.c b/source3/printing/printfsp.c
index c6749226fd..02122e8a6b 100644
--- a/source3/printing/printfsp.c
+++ b/source3/printing/printfsp.c
@@ -25,7 +25,8 @@ open a print file and setup a fsp for it. This is a wrapper around
print_job_start().
***************************************************************************/
-NTSTATUS print_fsp_open(connection_struct *conn, const char *fname,
+NTSTATUS print_fsp_open(struct smb_request *req, connection_struct *conn,
+ const char *fname,
uint16_t current_vuid, files_struct **result)
{
int jobid;
@@ -34,7 +35,7 @@ NTSTATUS print_fsp_open(connection_struct *conn, const char *fname,
fstring name;
NTSTATUS status;
- status = file_new(conn, &fsp);
+ status = file_new(req, conn, &fsp);
if(!NT_STATUS_IS_OK(status)) {
return status;
}
diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c
index 88c6a51770..a5cca53bc7 100644
--- a/source3/smbd/dosmode.c
+++ b/source3/smbd/dosmode.c
@@ -277,7 +277,8 @@ static bool set_ea_dos_attribute(connection_struct *conn, const char *path, SMB_
* are not violating security in doing the setxattr.
*/
- if (!NT_STATUS_IS_OK(open_file_fchmod(conn,path,sbuf,&fsp)))
+ if (!NT_STATUS_IS_OK(open_file_fchmod(NULL, conn, path, sbuf,
+ &fsp)))
return ret;
become_root();
if (SMB_VFS_SETXATTR(conn, path, SAMBA_XATTR_DOS_ATTRIB, attrstr, strlen(attrstr), 0) == 0) {
@@ -540,7 +541,8 @@ int file_set_dosmode(connection_struct *conn, const char *fname,
* break batch oplocks open by others. JRA.
*/
files_struct *fsp;
- if (!NT_STATUS_IS_OK(open_file_fchmod(conn,fname,st,&fsp)))
+ if (!NT_STATUS_IS_OK(open_file_fchmod(NULL, conn, fname, st,
+ &fsp)))
return -1;
become_root();
ret = SMB_VFS_FCHMOD(fsp, unixmode);
diff --git a/source3/smbd/fake_file.c b/source3/smbd/fake_file.c
index 1761cb66a8..3887483507 100644
--- a/source3/smbd/fake_file.c
+++ b/source3/smbd/fake_file.c
@@ -98,7 +98,7 @@ enum FAKE_FILE_TYPE is_fake_file(const char *fname)
Open a fake quota file with a share mode.
****************************************************************************/
-NTSTATUS open_fake_file(connection_struct *conn,
+NTSTATUS open_fake_file(struct smb_request *req, connection_struct *conn,
uint16_t current_vuid,
enum FAKE_FILE_TYPE fake_file_type,
const char *fname,
@@ -118,7 +118,7 @@ NTSTATUS open_fake_file(connection_struct *conn,
}
- status = file_new(conn, &fsp);
+ status = file_new(req, conn, &fsp);
if(!NT_STATUS_IS_OK(status)) {
return status;
}
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index ee3b6f520c..33c43356c6 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -57,7 +57,8 @@ static unsigned long get_gen_count(void)
Find first available file slot.
****************************************************************************/
-NTSTATUS file_new(connection_struct *conn, files_struct **result)
+NTSTATUS file_new(struct smb_request *req, connection_struct *conn,
+ files_struct **result)
{
int i;
static int first_file;
@@ -498,16 +499,14 @@ void file_chain_reset(void)
Duplicate the file handle part for a DOS or FCB open.
****************************************************************************/
-NTSTATUS dup_file_fsp(files_struct *fsp,
- uint32 access_mask,
- uint32 share_access,
- uint32 create_options,
- files_struct **result)
+NTSTATUS dup_file_fsp(struct smb_request *req, files_struct *fsp,
+ uint32 access_mask, uint32 share_access,
+ uint32 create_options, files_struct **result)
{
NTSTATUS status;
files_struct *dup_fsp;
- status = file_new(fsp->conn, &dup_fsp);
+ status = file_new(NULL, fsp->conn, &dup_fsp);
if (!NT_STATUS_IS_OK(status)) {
return status;
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 6edbe5ab92..0ae444b3d8 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -890,7 +890,8 @@ static bool open_match_attributes(connection_struct *conn,
Try and find a duplicated file handle.
****************************************************************************/
-static files_struct *fcb_or_dos_open(connection_struct *conn,
+static files_struct *fcb_or_dos_open(struct smb_request *req,
+ connection_struct *conn,
const char *fname,
struct file_id id,
uint16 file_pid,
@@ -940,7 +941,7 @@ static files_struct *fcb_or_dos_open(connection_struct *conn,
}
/* We need to duplicate this fsp. */
- if (!NT_STATUS_IS_OK(dup_file_fsp(fsp, access_mask, share_access,
+ if (!NT_STATUS_IS_OK(dup_file_fsp(req, fsp, access_mask, share_access,
create_options, &dup_fsp))) {
return NULL;
}
@@ -1178,7 +1179,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
DEBUG(10, ("open_file_ntcreate: printer open fname=%s\n", fname));
- return print_fsp_open(conn, fname, req->vuid, result);
+ return print_fsp_open(req, conn, fname, req->vuid, result);
}
if (!parent_dirname_talloc(talloc_tos(), fname, &parent_dir,
@@ -1435,7 +1436,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
return NT_STATUS_ACCESS_DENIED;
}
- status = file_new(conn, &fsp);
+ status = file_new(req, conn, &fsp);
if(!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -1530,7 +1531,7 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
/* Use the client requested access mask here,
* not the one we open with. */
- fsp_dup = fcb_or_dos_open(conn, fname, id,
+ fsp_dup = fcb_or_dos_open(req, conn, fname, id,
req->smbpid,
req->vuid,
access_mask,
@@ -1948,7 +1949,8 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
Open a file for for write to ensure that we can fchmod it.
****************************************************************************/
-NTSTATUS open_file_fchmod(connection_struct *conn, const char *fname,
+NTSTATUS open_file_fchmod(struct smb_request *req, connection_struct *conn,
+ const char *fname,
SMB_STRUCT_STAT *psbuf, files_struct **result)
{
files_struct *fsp = NULL;
@@ -1958,7 +1960,7 @@ NTSTATUS open_file_fchmod(connection_struct *conn, const char *fname,
return NT_STATUS_INVALID_PARAMETER;
}
- status = file_new(conn, &fsp);
+ status = file_new(req, conn, &fsp);
if(!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -2198,7 +2200,7 @@ NTSTATUS open_directory(connection_struct *conn,
return NT_STATUS_NOT_A_DIRECTORY;
}
- status = file_new(conn, &fsp);
+ status = file_new(req, conn, &fsp);
if(!NT_STATUS_IS_OK(status)) {
return status;
}
@@ -3000,7 +3002,7 @@ NTSTATUS create_file(connection_struct *conn,
* also tries a QUERY_FILE_INFO on the file and then
* close it
*/
- status = open_fake_file(conn, req->vuid,
+ status = open_fake_file(req, conn, req->vuid,
fake_file_type, fname,
access_mask, &fsp);
if (!NT_STATUS_IS_OK(status)) {
diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c
index 4e35e9deaa..c151e57e4c 100644
--- a/source3/smbd/posix_acls.c
+++ b/source3/smbd/posix_acls.c
@@ -3191,7 +3191,7 @@ int try_chown(connection_struct *conn, const char *fname, uid_t uid, gid_t gid)
return -1;
}
- if (!NT_STATUS_IS_OK(open_file_fchmod(conn,fname,&st,&fsp))) {
+ if (!NT_STATUS_IS_OK(open_file_fchmod(NULL, conn, fname, &st, &fsp))) {
return -1;
}
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 976611cc37..fd37371ed0 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -4638,7 +4638,7 @@ void reply_printopen(struct smb_request *req)
}
/* Open for exclusive use, write only. */
- status = print_fsp_open(conn, NULL, req->vuid, &fsp);
+ status = print_fsp_open(req, conn, NULL, req->vuid, &fsp);
if (!NT_STATUS_IS_OK(status)) {
reply_nterror(req, status);