summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2007-08-14 06:52:30 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:29:39 -0500
commitbba684f2c0c40c58fcc263eb6794c389760d0d44 (patch)
tree4a23105fc78b95bcc85fa79eb50f124dcca4def9 /source3/smbd
parent4f111b6e784c404cb8b11ae975b88caabb441ccc (diff)
downloadsamba-bba684f2c0c40c58fcc263eb6794c389760d0d44.tar.gz
samba-bba684f2c0c40c58fcc263eb6794c389760d0d44.tar.bz2
samba-bba684f2c0c40c58fcc263eb6794c389760d0d44.zip
r24394: Convert call_nt_transact_rename to the new API
(This used to be commit 189876a664efcfb601a8b14c21f272ed7d9f6b41)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/nttrans.c65
1 files changed, 27 insertions, 38 deletions
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 1ca8e01802..970703a2d6 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -2167,10 +2167,12 @@ static int call_nt_transact_notify_change(connection_struct *conn, char *inbuf,
Reply to an NT transact rename command.
****************************************************************************/
-static int call_nt_transact_rename(connection_struct *conn, char *inbuf, char *outbuf, int length, int bufsize,
- uint16 **ppsetup, uint32 setup_count,
- char **ppparams, uint32 parameter_count,
- char **ppdata, uint32 data_count, uint32 max_data_count)
+static void call_nt_transact_rename(connection_struct *conn,
+ struct smb_request *req,
+ uint16 **ppsetup, uint32 setup_count,
+ char **ppparams, uint32 parameter_count,
+ char **ppdata, uint32 data_count,
+ uint32 max_data_count)
{
char *params = *ppparams;
pstring new_name;
@@ -2178,44 +2180,46 @@ static int call_nt_transact_rename(connection_struct *conn, char *inbuf, char *o
BOOL replace_if_exists = False;
BOOL dest_has_wcard = False;
NTSTATUS status;
- struct smb_request req;
-
- init_smb_request(&req, (uint8 *)inbuf);
if(parameter_count < 5) {
- return ERROR_DOS(ERRDOS,ERRbadfunc);
+ reply_doserror(req, ERRDOS, ERRbadfunc);
+ return;
}
fsp = file_fsp(SVAL(params, 0));
replace_if_exists = (SVAL(params,2) & RENAME_REPLACE_IF_EXISTS) ? True : False;
- CHECK_FSP(fsp, conn);
- srvstr_get_path_wcard(inbuf, SVAL(inbuf,smb_flg2), new_name, params+4,
+ if (!check_fsp(conn, req, fsp, &current_user)) {
+ return;
+ }
+ srvstr_get_path_wcard(params, req->flags2, new_name, params+4,
sizeof(new_name), parameter_count - 4,
STR_TERMINATE, &status, &dest_has_wcard);
if (!NT_STATUS_IS_OK(status)) {
- return ERROR_NT(status);
+ reply_nterror(req, status);
+ return;
}
- status = rename_internals(conn, &req, fsp->fsp_name,
+ status = rename_internals(conn, req, fsp->fsp_name,
new_name, 0, replace_if_exists, False, dest_has_wcard);
if (!NT_STATUS_IS_OK(status)) {
- if (open_was_deferred(SVAL(inbuf,smb_mid))) {
+ if (open_was_deferred(req->mid)) {
/* We have re-scheduled this call. */
- return -1;
+ return;
}
- return ERROR_NT(status);
+ reply_nterror(req, status);
+ return;
}
/*
* Rename was successful.
*/
- send_nt_replies(inbuf, outbuf, bufsize, NT_STATUS_OK, NULL, 0, NULL, 0);
+ send_nt_replies_new(req, NT_STATUS_OK, NULL, 0, NULL, 0);
DEBUG(3,("nt transact rename from = %s, to = %s succeeded.\n",
fsp->fsp_name, new_name));
- return -1;
+ return;
}
/******************************************************************************
@@ -3190,28 +3194,13 @@ static void handle_nttrans(connection_struct *conn,
case NT_TRANSACT_RENAME:
{
- char *inbuf, *outbuf;
- int size, bufsize;
-
START_PROFILE(NT_transact_rename);
-
- if (!reply_prep_legacy(req, &inbuf, &outbuf, &size,
- &bufsize)) {
- reply_nterror(req, NT_STATUS_NO_MEMORY);
- END_PROFILE(SMBnttrans);
- return;
- }
-
- reply_post_legacy(
- req,
- call_nt_transact_rename(
- conn, inbuf, outbuf,
- size, bufsize,
- &state->setup, state->setup_count,
- &state->param, state->total_param,
- &state->data, state->total_data,
- state->max_data_return));
-
+ call_nt_transact_rename(
+ conn, req,
+ &state->setup, state->setup_count,
+ &state->param, state->total_param,
+ &state->data, state->total_data,
+ state->max_data_return);
END_PROFILE(NT_transact_rename);
break;
}