Commit 2815a8ae authored by Bill Stoddard's avatar Bill Stoddard
Browse files

Finally, back working on the MPM... Eliminate DOS hole. I can see no easy way

to time out AcceptEx (a.k.a., accept_and_receive) when a connection is received
but no data is sent. So, make AcceptEx just do an accept and leave the receive
to the other Apache code.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@84550 13f79535-47bb-0310-9956-ffa450edef68
parent 377a0cbb
Loading
Loading
Loading
Loading
+6 −5
Changes for server/mpm/winnt/mpm_winnt.c: 6 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -971,7 +971,8 @@ static int create_acceptex_context(ap_context_t *_pconf, ap_listen_rec *lr)
    /* AcceptEx on the completion context. The completion context will be signaled
     * when a connection is accepted. */
    if (!AcceptEx(nsd, context->accept_socket,
                  context->recv_buf, context->recv_buf_size,
                  context->recv_buf, 
                  0, //context->recv_buf_size,
                  PADDED_ADDR_SIZE, PADDED_ADDR_SIZE,
                  &BytesRead,
                  (LPOVERLAPPED) context)) {
@@ -1011,7 +1012,8 @@ static ap_inline int reset_acceptex_context(PCOMP_CONTEXT context)
    ap_get_os_sock(&nsd, context->lr->sd);

    if (!AcceptEx(nsd, context->accept_socket, 
                  context->recv_buf, context->recv_buf_size,
                  context->recv_buf, 
                  0, //context->recv_buf_size,
                  PADDED_ADDR_SIZE, PADDED_ADDR_SIZE,
                  &BytesRead, (LPOVERLAPPED) context)) {
        lasterror = WSAGetLastError();
@@ -1031,7 +1033,6 @@ static PCOMP_CONTEXT winnt_get_connection(PCOMP_CONTEXT context)
    LPOVERLAPPED pol;
    DWORD CompKey;
    DWORD BytesRead;
    int lastError;

    if (context != NULL) {
        /* If child shutdown has been signaled, clean-up the completion context */
@@ -1057,7 +1058,7 @@ static PCOMP_CONTEXT winnt_get_connection(PCOMP_CONTEXT context)
                                       &pol,
                                       INFINITE);
        if (!rc) {
            ap_log_error(APLOG_MARK,APLOG_ERR, lastError, server_conf,
            ap_log_error(APLOG_MARK,APLOG_ERR, GetLastError(), server_conf,
                         "Child: %d - GetQueuedCompletionStatus() failed", my_pid);
            continue;
        }
@@ -1086,7 +1087,7 @@ static PCOMP_CONTEXT winnt_get_connection(PCOMP_CONTEXT context)
    /* Received a connection */
    context->conn_io->incnt = BytesRead;
    GetAcceptExSockaddrs(context->recv_buf, 
                         context->recv_buf_size,
                         0, //context->recv_buf_size,
                         PADDED_ADDR_SIZE,
                         PADDED_ADDR_SIZE,
                         &context->sa_server,