Changeset 356

Show
Ignore:
Timestamp:
30/08/07 22:04:56 (15 months ago)
Author:
smoku
Message:

Implemented XEP-0138 Stream Compression support

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/sx/ssl.c

    r141 r356  
    104104            } 
    105105 
     106            /* can't go on if we're on compressed stream */ 
     107            if(s->compressed > 0) { 
     108                _sx_debug(ZONE, "starttls requested on already compressed channel, dropping packet"); 
     109                return 0; 
     110            } 
     111 
    106112            _sx_debug(ZONE, "starttls requested, setting up"); 
    107113 
     
    175181    int ns; 
    176182 
    177     /* if the session is already encrypted, or the app told us not to, then we don't offer anything */ 
    178     if(s->state > state_STREAM || s->ssf > 0 || !(s->flags & SX_SSL_STARTTLS_OFFER)) 
     183    /* if the session is already encrypted, or the app told us not to, 
     184     * or session is compressed then we don't offer anything */ 
     185    if(s->state > state_STREAM || s->ssf > 0 || !(s->flags & SX_SSL_STARTTLS_OFFER) || s->compressed) 
    179186        return; 
    180187 
     
    629636} 
    630637 
    631 /** args: pemfile */ 
     638int sx_openssl_initialized = 0; 
     639 
     640/** args: pemfile, cachain, mode */ 
    632641int sx_ssl_init(sx_env_t env, sx_plugin_t p, va_list args) { 
    633642    char *pemfile, *cachain; 
     
    653662    SSL_library_init(); 
    654663    SSL_load_error_strings(); 
     664 
     665    sx_openssl_initialized = 1; 
    655666 
    656667    /* create the context */ 
     
    726737    } 
    727738 
    728     /* check if we're already encrypted */ 
    729     if(s->ssf > 0) { 
     739    /* check if we're already encrypted or compressed */ 
     740    if(s->ssf > 0 || s->compressed) { 
    730741        _sx_debug(ZONE, "encrypted channel already established"); 
    731742        return 1;