summaryrefslogtreecommitdiff
path: root/source4/smbd
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-12-04 02:03:06 +0000
committerAndrew Tridgell <tridge@samba.org>2003-12-04 02:03:06 +0000
commit926240428c0646aabb13539745940b61a7cf44a9 (patch)
tree102988d47fab4a56b59161409dddc9c9dfa86ed5 /source4/smbd
parentb8cbd9181efabbc360ef335e214a696011839b41 (diff)
downloadsamba-926240428c0646aabb13539745940b61a7cf44a9.tar.gz
samba-926240428c0646aabb13539745940b61a7cf44a9.tar.bz2
samba-926240428c0646aabb13539745940b61a7cf44a9.zip
* patch based on work by Jim Myers to unify the ioctl handling to be
more like the other major SMB functions * added SMBntrename code (This used to be commit f2d3dc9893fa0e089c407fa16ce9ff13587e70cd)
Diffstat (limited to 'source4/smbd')
-rw-r--r--source4/smbd/process.c2
-rw-r--r--source4/smbd/reply.c52
2 files changed, 45 insertions, 9 deletions
diff --git a/source4/smbd/process.c b/source4/smbd/process.c
index cf357ef547..81c658af06 100644
--- a/source4/smbd/process.c
+++ b/source4/smbd/process.c
@@ -320,7 +320,7 @@ static const struct smb_message_struct
/* 0xa2 */ { "SMBntcreateX", reply_ntcreate_and_X, AS_USER | CAN_IPC },
/* 0xa3 */ { NULL, NULL, 0 },
/* 0xa4 */ { "SMBntcancel", reply_ntcancel, 0 },
-/* 0xa5 */ { NULL, NULL, 0 },
+/* 0xa5 */ { "SMBntrename", reply_ntrename, 0 },
/* 0xa6 */ { NULL, NULL, 0 },
/* 0xa7 */ { NULL, NULL, 0 },
/* 0xa8 */ { NULL, NULL, 0 },
diff --git a/source4/smbd/reply.c b/source4/smbd/reply.c
index f4dd4cb50a..3d237d964d 100644
--- a/source4/smbd/reply.c
+++ b/source4/smbd/reply.c
@@ -2,6 +2,7 @@
Unix SMB/CIFS implementation.
Main SMB reply routines
Copyright (C) Andrew Tridgell 1992-2003
+ Copyright (C) James J Myers 2003 <myersjj@samba.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -226,17 +227,17 @@ void reply_unknown(struct request_context *req)
****************************************************************************/
static void reply_ioctl_send(struct request_context *req)
{
- struct smb_ioctl *io = req->async.private;
+ union smb_ioctl *io = req->async.private;
CHECK_ASYNC_STATUS;
/* the +1 is for nicer alignment */
- req_setup_reply(req, 8, io->out.blob.length+1);
- SSVAL(req->out.vwv, VWV(1), io->out.blob.length);
- SSVAL(req->out.vwv, VWV(5), io->out.blob.length);
+ req_setup_reply(req, 8, io->ioctl.out.blob.length+1);
+ SSVAL(req->out.vwv, VWV(1), io->ioctl.out.blob.length);
+ SSVAL(req->out.vwv, VWV(5), io->ioctl.out.blob.length);
SSVAL(req->out.vwv, VWV(6), PTR_DIFF(req->out.data, req->out.hdr) + 1);
- memcpy(req->out.data+1, io->out.blob.data, io->out.blob.length);
+ memcpy(req->out.data+1, io->ioctl.out.blob.data, io->ioctl.out.blob.length);
req_send_reply(req);
}
@@ -246,14 +247,15 @@ static void reply_ioctl_send(struct request_context *req)
****************************************************************************/
void reply_ioctl(struct request_context *req)
{
- struct smb_ioctl *io;
+ union smb_ioctl *io;
/* parse requst */
REQ_CHECK_WCT(req, 3);
REQ_TALLOC(io, sizeof(*io));
- io->in.fnum = req_fnum(req, req->in.vwv, VWV(0));
- io->in.request = IVAL(req->in.vwv, VWV(1));
+ io->ioctl.level = RAW_IOCTL_IOCTL;
+ io->ioctl.in.fnum = req_fnum(req, req->in.vwv, VWV(0));
+ io->ioctl.in.request = IVAL(req->in.vwv, VWV(1));
req->async.send_fn = reply_ioctl_send;
req->async.private = io;
@@ -1629,6 +1631,40 @@ void reply_mv(struct request_context *req)
/****************************************************************************
+ Reply to an NT rename.
+****************************************************************************/
+void reply_ntrename(struct request_context *req)
+{
+ union smb_rename *io;
+ char *p;
+
+ /* parse the request */
+ REQ_CHECK_WCT(req, 4);
+ REQ_TALLOC(io, sizeof(*io));
+
+ io->generic.level = RAW_RENAME_NTRENAME;
+ io->ntrename.in.attrib = SVAL(req->in.vwv, VWV(0));
+ io->ntrename.in.flags = SVAL(req->in.vwv, VWV(1));
+ io->ntrename.in.cluster_size = IVAL(req->in.vwv, VWV(2));
+
+ p = req->in.data;
+ p += req_pull_ascii4(req, &io->ntrename.in.old_name, p, STR_TERMINATE);
+ p += req_pull_ascii4(req, &io->ntrename.in.new_name, p, STR_TERMINATE);
+
+ if (!io->ntrename.in.old_name || !io->ntrename.in.new_name) {
+ req_reply_error(req, NT_STATUS_FOOBAR);
+ return;
+ }
+
+ req->async.send_fn = reply_simple_send;
+
+ /* call backend */
+ req->async.status = req->conn->ntvfs_ops->rename(req, io);
+
+ REQ_ASYNC_TAIL;
+}
+
+/****************************************************************************
Reply to a file copy (async reply)
****************************************************************************/
static void reply_copy_send(struct request_context *req)