diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 70276293f8e..e99d70f2362 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 90f713a9484..c703a4d72b6 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); - - dirtype = SVAL(inbuf,smb_vwv0); - - srvstr_get_path_wcard(inbuf, SVAL(inbuf,smb_flg2), name, - smb_buf(inbuf) + 1, sizeof(name), 0, - STR_TERMINATE, &status, &path_contains_wcard); - if (!NT_STATUS_IS_OK(status)) { + if (req->wct < 1) { + reply_nterror(req, NT_STATUS_INVALID_PARAMETER); END_PROFILE(SMBunlink); - return ERROR_NT(status); + return; } - status = resolve_dfspath_wcard(conn, SVAL(inbuf,smb_flg2) & FLAGS2_DFS_PATHNAMES, name, &path_contains_wcard); + dirtype = SVAL(req->inbuf,smb_vwv0); + + 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; + } + + status = resolve_dfspath_wcard(conn, + req->flags2 & FLAGS2_DFS_PATHNAMES, + name, &path_contains_wcard); + if (!NT_STATUS_IS_OK(status)) { 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; } /****************************************************************************