server: Return an error for invalid requests instead of killing the client process.

This commit is contained in:
Alexandre Julliard 2006-05-28 18:27:02 +02:00
parent ee48e1e3d5
commit 4ec9e110b0
1 changed files with 15 additions and 13 deletions

View File

@ -52,9 +52,12 @@
#include <poll.h> #include <poll.h>
#endif #endif
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "wincon.h" #include "wincon.h"
#include "winternl.h"
#include "wine/library.h" #include "wine/library.h"
#include "file.h" #include "file.h"
@ -277,23 +280,22 @@ static void call_req_handler( struct thread *thread )
if (debug_level) trace_request(); if (debug_level) trace_request();
if (req < REQ_NB_REQUESTS) if (req < REQ_NB_REQUESTS)
{
req_handlers[req]( &current->req, &reply ); req_handlers[req]( &current->req, &reply );
if (current) else
set_error( STATUS_NOT_IMPLEMENTED );
if (current)
{
if (current->reply_fd)
{ {
if (current->reply_fd) reply.reply_header.error = current->error;
{ reply.reply_header.reply_size = current->reply_size;
reply.reply_header.error = current->error; if (debug_level) trace_reply( req, &reply );
reply.reply_header.reply_size = current->reply_size; send_reply( &reply );
if (debug_level) trace_reply( req, &reply );
send_reply( &reply );
}
else fatal_protocol_error( current, "no reply fd for request %d\n", req );
} }
current = NULL; else fatal_protocol_error( current, "no reply fd for request %d\n", req );
return;
} }
fatal_protocol_error( current, "bad request %d\n", req ); current = NULL;
} }
/* read a request from a thread */ /* read a request from a thread */