Changeset 7884


Ignore:
Timestamp:
Feb 12, 2009, 8:43:09 PM (13 years ago)
Author:
charles
Message:

(1.5x libT) #1810: DoS vulnerability wrt incoming connections

Location:
branches/1.5x/libtransmission
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/1.5x/libtransmission/handshake.c

    r7813 r7884  
    6060    KEY_LEN                        = 96,
    6161    CRYPTO_PROVIDE_PLAINTEXT       = 1,
    62     CRYPTO_PROVIDE_CRYPTO          = 2
     62    CRYPTO_PROVIDE_CRYPTO          = 2,
     63
     64    /* how long to wait before giving up on a handshake */
     65    HANDSHAKE_TIMEOUT_MSEC         = 60 * 1000
    6366};
    6467
     
    107110    handshakeDoneCB       doneCB;
    108111    void *                doneUserData;
     112    tr_timer *            timeout;
    109113};
    110114
     
    11001104        tr_peerIoUnref( handshake->io ); /* balanced by the ref in tr_handshakeNew */
    11011105
     1106    tr_timerFree( &handshake->timeout );
     1107
    11021108    tr_free( handshake );
    11031109}
     
    11611167**/
    11621168
     1169static int
     1170handshakeTimeout( void * handshake )
     1171{
     1172    tr_handshakeAbort( handshake );
     1173    return FALSE;
     1174}
     1175
    11631176tr_handshake*
    11641177tr_handshakeNew( tr_peerIo *        io,
     
    11761189    handshake->doneUserData = doneUserData;
    11771190    handshake->session = tr_peerIoGetSession( io );
     1191    handshake->timeout = tr_timerNew( handshake->session, handshakeTimeout, handshake, HANDSHAKE_TIMEOUT_MSEC );
    11781192
    11791193    tr_peerIoRef( io ); /* balanced by the unref in tr_handshakeFree */
  • branches/1.5x/libtransmission/port-forwarding.c

    r7847 r7884  
    166166incomingPeersPulse( tr_shared * s )
    167167{
    168     tr_bool allPaused;
    169    
    170168    if( s->shouldChange )
    171169    {
     
    176174    }
    177175   
    178     allPaused = tr_sessionGetActiveTorrentCount( s->session ) == 0;
    179    
    180     /* if we have any running torrents, check for new incoming peer connections */
    181176    /* (jhujhiti):
    182177     * This has been changed from a loop that will end when the listener queue
     
    186181     * I have increased the length of the listener queue from 5 to 10
    187182     * (see acceptCb() above). */
    188     if( !allPaused )
    189         tr_socketListForEach( s->bindSockets, &acceptCb, s );
     183    tr_socketListForEach( s->bindSockets, &acceptCb, s );
    190184}
    191185
Note: See TracChangeset for help on using the changeset viewer.