summaryrefslogtreecommitdiff
path: root/source4/smb_server/smb/trans2.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-05-20 08:15:22 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:08:10 -0500
commit9ef33f5f5c786b83311ca088357fb2f0aa72fc9e (patch)
tree66335dced1641119f94e6c656dd1ccc673218d0c /source4/smb_server/smb/trans2.c
parent0dcecc314899b6f36e9215e0b3881220062ba4f9 (diff)
downloadsamba-9ef33f5f5c786b83311ca088357fb2f0aa72fc9e.tar.gz
samba-9ef33f5f5c786b83311ca088357fb2f0aa72fc9e.tar.bz2
samba-9ef33f5f5c786b83311ca088357fb2f0aa72fc9e.zip
r15734: This is a major change to the NTVFS subsystem:
- to use a struct ntvfs_handle instead of a uint16_t fnum. (to make it independend from the frontend protocol) - the allocation of handles now is provided by the frontend (smbsrv_*) via callbacks and not by each backend module - this also makes sure that file handles are only passed to the ntvfs subsystem when the tcon and session matches, so modules can rely on this and need to check this. - this allows multiple modules in the ntvfs module chain to allocate file handles. This can be used for virtual files like "\\$Extend\\$Quota:$Q:$INDEX_ALLOCATION"... - also this will make SMB2 with 128 bit file handles possible metze (This used to be commit 287fc1c22d670f6e568014b420f7f4cb31dc7958)
Diffstat (limited to 'source4/smb_server/smb/trans2.c')
-rw-r--r--source4/smb_server/smb/trans2.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/source4/smb_server/smb/trans2.c b/source4/smb_server/smb/trans2.c
index 1145a08426..69fa65010c 100644
--- a/source4/smb_server/smb/trans2.c
+++ b/source4/smb_server/smb/trans2.c
@@ -447,7 +447,7 @@ static NTSTATUS trans2_open_send(struct trans_op *op)
trans2_setup_reply(trans, 30, 0, 0);
- SSVAL(trans->out.params.data, VWV(0), io->t2open.out.file.fnum);
+ smbsrv_push_fnum(trans->out.params.data, VWV(0), io->t2open.out.file.ntvfs);
SSVAL(trans->out.params.data, VWV(1), io->t2open.out.attrib);
srv_push_dos_date3(req->smb_conn, trans->out.params.data,
VWV(2), io->t2open.out.write_time);
@@ -847,7 +847,8 @@ static NTSTATUS trans2_qfileinfo(struct smbsrv_request *req, struct trans_op *op
struct smb_trans2 *trans = op->trans;
union smb_fileinfo *st;
NTSTATUS status;
- uint16_t level, fnum;
+ uint16_t level;
+ struct ntvfs_handle *h;
/* make sure we got enough parameters */
if (trans->in.params.length < 4) {
@@ -857,10 +858,10 @@ static NTSTATUS trans2_qfileinfo(struct smbsrv_request *req, struct trans_op *op
st = talloc(op, union smb_fileinfo);
NT_STATUS_HAVE_NO_MEMORY(st);
- fnum = SVAL(trans->in.params.data, 0);
+ h = smbsrv_pull_fnum(req, trans->in.params.data, 0);
level = SVAL(trans->in.params.data, 2);
- st->generic.in.file.fnum = fnum;
+ st->generic.in.file.ntvfs = h;
/* work out the backend level - we make it 1-1 in the header */
st->generic.level = (enum smb_fileinfo_level)level;
if (st->generic.level >= RAW_FILEINFO_GENERIC) {
@@ -877,6 +878,7 @@ static NTSTATUS trans2_qfileinfo(struct smbsrv_request *req, struct trans_op *op
op->op_info = st;
op->send_fn = trans2_fileinfo_send;
+ SMBSRV_CHECK_FILE_HANDLE_NTSTATUS(st->generic.in.file.ntvfs);
return ntvfs_qfileinfo(req->ntvfs, st);
}
@@ -985,7 +987,8 @@ static NTSTATUS trans2_setfileinfo(struct smbsrv_request *req, struct trans_op *
struct smb_trans2 *trans = op->trans;
union smb_setfileinfo *st;
NTSTATUS status;
- uint16_t level, fnum;
+ uint16_t level;
+ struct ntvfs_handle *h;
/* make sure we got enough parameters */
if (trans->in.params.length < 4) {
@@ -995,10 +998,10 @@ static NTSTATUS trans2_setfileinfo(struct smbsrv_request *req, struct trans_op *
st = talloc(op, union smb_setfileinfo);
NT_STATUS_HAVE_NO_MEMORY(st);
- fnum = SVAL(trans->in.params.data, 0);
+ h = smbsrv_pull_fnum(req, trans->in.params.data, 0);
level = SVAL(trans->in.params.data, 2);
- st->generic.in.file.fnum = fnum;
+ st->generic.in.file.ntvfs = h;
/* work out the backend level - we make it 1-1 in the header */
st->generic.level = (enum smb_setfileinfo_level)level;
if (st->generic.level >= RAW_SFILEINFO_GENERIC) {
@@ -1011,6 +1014,7 @@ static NTSTATUS trans2_setfileinfo(struct smbsrv_request *req, struct trans_op *
op->op_info = st;
op->send_fn = trans2_simple_send;
+ SMBSRV_CHECK_FILE_HANDLE_NTSTATUS(st->generic.in.file.ntvfs);
return ntvfs_setfileinfo(req->ntvfs, st);
}