Changeset 8e33f2d in mod_gnutls


Ignore:
Timestamp:
Sep 25, 2005, 2:27:08 PM (14 years ago)
Author:
Paul Querna <chip@…>
Branches:
debian/master, debian/stretch-backports, jessie-backports, master, msva, upstream
Children:
7bebb42
Parents:
740a39e
Message:

Put a limit on the number of times we try to handshake.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/gnutls_io.c

    r740a39e r8e33f2d  
    354354}
    355355
     356#define HANDSHAKE_MAX_TRIES 100
    356357static int gnutls_do_handshake(mgs_handle_t * ctxt)
    357358{
    358359    int ret;
    359360    int errcode;
     361    int maxtries = HANDSHAKE_MAX_TRIES;
     362
    360363    if (ctxt->status != 0) {
    361364        return -1;
     
    365368    do {
    366369        ret = gnutls_handshake(ctxt->session);
    367     } while (ret == GNUTLS_E_AGAIN);
    368    
     370        maxtries--;
     371    } while (ret == GNUTLS_E_AGAIN && maxtries > 0);
     372
     373    if (maxtries < 1) {
     374        ctxt->status = -1;
     375#if USING_2_1_RECENT
     376        ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, ctxt->c,
     377                     "GnuTLS: Handshake Failed. Hit Maximum Attempts");
     378#else
     379        ap_log_error(APLOG_MARK, APLOG_ERR, 0, ctxt->c->base_server,
     380                     "GnuTLS: Handshake Failed. Hit Maximum Attempts");
     381#endif
     382        gnutls_alert_send(ctxt->session, GNUTLS_AL_FATAL,
     383                          gnutls_error_to_alert(ret, NULL));
     384        gnutls_deinit(ctxt->session);
     385        return -1;
     386    }
     387
    369388    if (ret < 0) {
    370389        if (ret == GNUTLS_E_WARNING_ALERT_RECEIVED
Note: See TracChangeset for help on using the changeset viewer.