Ignore:
Timestamp:
Jul 1, 2008 3:31:59 PM (12 years ago)
Author:
bennylp
Message:

Ticket #552: Added TLS server name extension to support connecting to multi-hosted SIP TLS server (thanks Klaus Darilion for the suggestion)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip/sip_transport_tls_ossl.c

    r2039 r2094  
    165165    /* TLS settings, copied from listener */ 
    166166    struct { 
     167        pj_str_t             server_name; 
    167168        pj_time_val          timeout; 
    168169    } setting; 
     
    513514    if (!SSL_in_connect_init(ssl)) 
    514515        SSL_set_connect_state(ssl); 
     516 
     517#ifdef SSL_set_tlsext_host_name 
     518    if (tls->setting.server_name.slen) { 
     519        char server_name[PJ_MAX_HOSTNAME]; 
     520 
     521        if (tls->setting.server_name.slen >= PJ_MAX_HOSTNAME) 
     522            return PJ_ENAMETOOLONG; 
     523 
     524        pj_memcpy(server_name, tls->setting.server_name.ptr,  
     525                  tls->setting.server_name.slen); 
     526        server_name[tls->setting.server_name.slen] = '\0'; 
     527 
     528        if (!SSL_set_tlsext_host_name(ssl, server_name)) { 
     529            PJ_LOG(4,(tls->base.obj_name,  
     530                      "SSL_set_tlsext_host_name() failed")); 
     531        } 
     532    } 
     533#endif 
    515534 
    516535    PJ_LOG(5,(tls->base.obj_name, "Starting SSL_connect() negotiation")); 
     
    12321251    tls->base.pool = pool; 
    12331252    tls->setting.timeout = listener->setting.timeout; 
     1253    pj_strdup(pool, &tls->setting.server_name,  
     1254              &listener->setting.server_name); 
    12341255 
    12351256    pj_ansi_snprintf(tls->base.obj_name, PJ_MAX_OBJ_NAME,  
Note: See TracChangeset for help on using the changeset viewer.