From 4254af71803b122449887258ac0e721f67ed39a3 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 31 Jul 2007 07:57:33 +0000 Subject: r24088: Convert reply_unlink to the new API (This used to be commit fb0a1b7bd0a195dbedb3b0c02d8a4ec25c21b9bf) --- source3/smbd/process.c | 2 +- source3/smbd/reply.c | 52 ++++++++++++++++++++++++++++++-------------------- 2 files changed, 32 insertions(+), 22 deletions(-) (limited to 'source3') diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 70276293f8..e99d70f236 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -640,7 +640,7 @@ static const struct smb_message_struct { /* 0x03 */ { "SMBcreate",reply_mknew,NULL,AS_USER}, /* 0x04 */ { "SMBclose",NULL,reply_close,AS_USER | CAN_IPC }, /* 0x05 */ { "SMBflush",reply_flush,NULL,AS_USER}, -/* 0x06 */ { "SMBunlink",reply_unlink,NULL,AS_USER | NEED_WRITE }, +/* 0x06 */ { "SMBunlink",NULL,reply_unlink,AS_USER | NEED_WRITE }, /* 0x07 */ { "SMBmv",reply_mv,NULL,AS_USER | NEED_WRITE }, /* 0x08 */ { "SMBgetatr",reply_getatr,NULL,AS_USER}, /* 0x09 */ { "SMBsetatr",reply_setatr,NULL,AS_USER | NEED_WRITE}, diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 90f713a948..c703a4d72b 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -2222,56 +2222,66 @@ NTSTATUS unlink_internals(connection_struct *conn, struct smb_request *req, Reply to a unlink ****************************************************************************/ -int reply_unlink(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, - int dum_buffsize) +void reply_unlink(connection_struct *conn, struct smb_request *req) { - int outsize = 0; pstring name; uint32 dirtype; NTSTATUS status; BOOL path_contains_wcard = False; - struct smb_request req; START_PROFILE(SMBunlink); - init_smb_request(&req, (uint8 *)inbuf); + if (req->wct < 1) { + reply_nterror(req, NT_STATUS_INVALID_PARAMETER); + END_PROFILE(SMBunlink); + return; + } - dirtype = SVAL(inbuf,smb_vwv0); + dirtype = SVAL(req->inbuf,smb_vwv0); - srvstr_get_path_wcard(inbuf, SVAL(inbuf,smb_flg2), name, - smb_buf(inbuf) + 1, sizeof(name), 0, + srvstr_get_path_wcard((char *)req->inbuf, req->flags2, name, + smb_buf(req->inbuf) + 1, sizeof(name), 0, STR_TERMINATE, &status, &path_contains_wcard); if (!NT_STATUS_IS_OK(status)) { + reply_nterror(req, status); END_PROFILE(SMBunlink); - return ERROR_NT(status); + return; } - status = resolve_dfspath_wcard(conn, SVAL(inbuf,smb_flg2) & FLAGS2_DFS_PATHNAMES, name, &path_contains_wcard); + status = resolve_dfspath_wcard(conn, + req->flags2 & FLAGS2_DFS_PATHNAMES, + name, &path_contains_wcard); if (!NT_STATUS_IS_OK(status)) { - END_PROFILE(SMBunlink); 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(SMBunlink); + return; } - return ERROR_NT(status); + reply_nterror(req, status); + END_PROFILE(SMBunlink); + return; } DEBUG(3,("reply_unlink : %s\n",name)); - status = unlink_internals(conn, &req, dirtype, name, + status = unlink_internals(conn, req, dirtype, name, path_contains_wcard); if (!NT_STATUS_IS_OK(status)) { - END_PROFILE(SMBunlink); - if (open_was_deferred(SVAL(inbuf,smb_mid))) { + if (open_was_deferred(req->mid)) { /* We have re-scheduled this call. */ - return -1; + END_PROFILE(SMBunlink); + return; } - return ERROR_NT(status); + reply_nterror(req, status); + END_PROFILE(SMBunlink); + return; } - outsize = set_message(inbuf,outbuf,0,0,False); - + reply_outbuf(req, 0, 0); END_PROFILE(SMBunlink); - return outsize; + + return; } /**************************************************************************** -- cgit