diff options
author | Volker Lendecke <vlendec@samba.org> | 2007-08-14 14:50:49 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:29:42 -0500 |
commit | 5fe4384cd98237c7e426de8508dfb2b7b29f757f (patch) | |
tree | 3f7016553f760c6e842650f3ea3d8f61e694a058 /source3/smbd | |
parent | 444fd1e8481ae4ec971c4cac5996e47a751b8a17 (diff) | |
download | samba-5fe4384cd98237c7e426de8508dfb2b7b29f757f.tar.gz samba-5fe4384cd98237c7e426de8508dfb2b7b29f757f.tar.bz2 samba-5fe4384cd98237c7e426de8508dfb2b7b29f757f.zip |
r24414: Convert reply_mv to the new API
(This used to be commit fa341e4840d422cee389c06112e0b2df43a31f45)
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/process.c | 2 | ||||
-rw-r--r-- | source3/smbd/reply.c | 71 |
2 files changed, 46 insertions, 27 deletions
diff --git a/source3/smbd/process.c b/source3/smbd/process.c index f0d1c56e90..a03529ed0d 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -697,7 +697,7 @@ static const struct smb_message_struct { /* 0x04 */ { "SMBclose",NULL,reply_close,AS_USER | CAN_IPC }, /* 0x05 */ { "SMBflush",NULL,reply_flush,AS_USER}, /* 0x06 */ { "SMBunlink",NULL,reply_unlink,AS_USER | NEED_WRITE }, -/* 0x07 */ { "SMBmv",reply_mv,NULL,AS_USER | NEED_WRITE }, +/* 0x07 */ { "SMBmv",NULL,reply_mv,AS_USER | NEED_WRITE }, /* 0x08 */ { "SMBgetatr",reply_getatr,NULL,AS_USER}, /* 0x09 */ { "SMBsetatr",reply_setatr,NULL,AS_USER | NEED_WRITE}, /* 0x0a */ { "SMBread",reply_read,NULL,AS_USER}, diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 40b9630ecf..a6d06cfa7e 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -5173,75 +5173,94 @@ NTSTATUS rename_internals(connection_struct *conn, struct smb_request *req, Reply to a mv. ****************************************************************************/ -int reply_mv(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, - int dum_buffsize) +void reply_mv(connection_struct *conn, struct smb_request *req) { - int outsize = 0; pstring name; pstring newname; char *p; - uint32 attrs = SVAL(inbuf,smb_vwv0); + uint32 attrs; NTSTATUS status; BOOL src_has_wcard = False; BOOL dest_has_wcard = False; - struct smb_request req; START_PROFILE(SMBmv); - init_smb_request(&req, (uint8 *)inbuf); + if (req->wct < 1) { + reply_nterror(req, NT_STATUS_INVALID_PARAMETER); + END_PROFILE(SMBmv); + return; + } - p = smb_buf(inbuf) + 1; - p += srvstr_get_path_wcard(inbuf, SVAL(inbuf,smb_flg2), name, p, + attrs = SVAL(req->inbuf,smb_vwv0); + + p = smb_buf(req->inbuf) + 1; + p += srvstr_get_path_wcard((char *)req->inbuf, req->flags2, name, p, sizeof(name), 0, STR_TERMINATE, &status, &src_has_wcard); if (!NT_STATUS_IS_OK(status)) { + reply_nterror(req, status); END_PROFILE(SMBmv); - return ERROR_NT(status); + return; } p++; - p += srvstr_get_path_wcard(inbuf, SVAL(inbuf,smb_flg2), newname, p, + p += srvstr_get_path_wcard((char *)req->inbuf, req->flags2, newname, p, sizeof(newname), 0, STR_TERMINATE, &status, &dest_has_wcard); if (!NT_STATUS_IS_OK(status)) { + reply_nterror(req, status); END_PROFILE(SMBmv); - return ERROR_NT(status); + return; } - status = resolve_dfspath_wcard(conn, SVAL(inbuf,smb_flg2) & FLAGS2_DFS_PATHNAMES, name, &src_has_wcard); + status = resolve_dfspath_wcard(conn, + req->flags2 & FLAGS2_DFS_PATHNAMES, + name, &src_has_wcard); if (!NT_STATUS_IS_OK(status)) { - END_PROFILE(SMBmv); if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) { - return ERROR_BOTH(NT_STATUS_PATH_NOT_COVERED, ERRSRV, ERRbadpath); + reply_botherror(req, NT_STATUS_PATH_NOT_COVERED, + ERRSRV, ERRbadpath); + END_PROFILE(SMBmv); + return; } - return ERROR_NT(status); + reply_nterror(req, status); + END_PROFILE(SMBmv); + return; } - status = resolve_dfspath_wcard(conn, SVAL(inbuf,smb_flg2) & FLAGS2_DFS_PATHNAMES, newname, &dest_has_wcard); + status = resolve_dfspath_wcard(conn, + req->flags2 & FLAGS2_DFS_PATHNAMES, + newname, &dest_has_wcard); if (!NT_STATUS_IS_OK(status)) { - END_PROFILE(SMBmv); if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) { - return ERROR_BOTH(NT_STATUS_PATH_NOT_COVERED, ERRSRV, ERRbadpath); + reply_botherror(req, NT_STATUS_PATH_NOT_COVERED, + ERRSRV, ERRbadpath); + END_PROFILE(SMBmv); + return; } - return ERROR_NT(status); + reply_nterror(req, status); + END_PROFILE(SMBmv); + return; } DEBUG(3,("reply_mv : %s -> %s\n",name,newname)); - status = rename_internals(conn, &req, name, newname, attrs, False, + status = rename_internals(conn, req, name, newname, attrs, False, src_has_wcard, dest_has_wcard); if (!NT_STATUS_IS_OK(status)) { - END_PROFILE(SMBmv); - if (open_was_deferred(SVAL(inbuf,smb_mid))) { + if (open_was_deferred(req->mid)) { /* We have re-scheduled this call. */ - return -1; + END_PROFILE(SMBmv); + return; } - return ERROR_NT(status); + reply_nterror(req, status); + END_PROFILE(SMBmv); + return; } - outsize = set_message(inbuf,outbuf,0,0,False); + reply_outbuf(req, 0, 0); END_PROFILE(SMBmv); - return(outsize); + return; } /******************************************************************* |