Changes On Branch dmitry-fixes
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch dmitry-fixes Excluding Merge-Ins

This is equivalent to a diff from 339a0f49d2 to 132dbcedbc

2011-12-17
15:18
Merge the SSL SNI fix from the dmitry-fixes branch. check-in: 074767b730 user: drh tags: trunk
13:19
Add the "test-date-format" command and the date_override option to tickets. check-in: 44f028c9f8 user: drh tags: trunk
2011-12-16
22:00
Add SSL SNI support (suggested by BohwaZ on mailing list). Simplify setting of port for SSL connection. Closed-Leaf check-in: 132dbcedbc user: dmitry tags: dmitry-fixes
15:10
Reorder some #includes for OpenBSD. check-in: 339a0f49d2 user: drh tags: trunk
2011-12-13
14:05
Update the release date on the change log. check-in: 489c67ae46 user: drh tags: trunk

Changes to src/http_ssl.c.

191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
...
208
209
210
211
212
213
214






215
216
217
218
219
220
221
222
223
224

225
226
227
228
229
230
231
**
** Return the number of errors.
*/
int ssl_open(void){
  X509 *cert;
  int hasSavedCertificate = 0;
  int trusted = 0;
  char *connStr ;
  unsigned long e;

  ssl_global_init();

  /* Get certificate for current server from global config and
   * (if we have it in config) add it to certificate store.
   */
................................................................................
    X509_STORE_add_cert(SSL_CTX_get_cert_store(sslCtx), cert);
    X509_free(cert);
    hasSavedCertificate = 1;
  }

  iBio = BIO_new_ssl_connect(sslCtx);
  BIO_get_ssl(iBio, &ssl);






  SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY);
  if( iBio==NULL ) {
    ssl_set_errmsg("SSL: cannot open SSL (%s)", 
                    ERR_reason_error_string(ERR_get_error()));
    return 1;    
  }
  
  connStr = mprintf("%s:%d", g.urlName, g.urlPort);
  BIO_set_conn_hostname(iBio, connStr);
  free(connStr);

  
  if( BIO_do_connect(iBio)<=0 ){
    ssl_set_errmsg("SSL: cannot connect to host %s:%d (%s)", 
        g.urlName, g.urlPort, ERR_reason_error_string(ERR_get_error()));
    ssl_close();
    return 1;
  }






<







 







>
>
>
>
>
>




|

|
<
|
<
>







191
192
193
194
195
196
197

198
199
200
201
202
203
204
...
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226

227

228
229
230
231
232
233
234
235
**
** Return the number of errors.
*/
int ssl_open(void){
  X509 *cert;
  int hasSavedCertificate = 0;
  int trusted = 0;

  unsigned long e;

  ssl_global_init();

  /* Get certificate for current server from global config and
   * (if we have it in config) add it to certificate store.
   */
................................................................................
    X509_STORE_add_cert(SSL_CTX_get_cert_store(sslCtx), cert);
    X509_free(cert);
    hasSavedCertificate = 1;
  }

  iBio = BIO_new_ssl_connect(sslCtx);
  BIO_get_ssl(iBio, &ssl);

  if( !SSL_set_tlsext_host_name(ssl, g.urlName) ){
    fossil_warning("WARNING: failed to set server name indication (SNI), "
                  "continuing without it.\n");
  }

  SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY);
  if( iBio==NULL ) {
    ssl_set_errmsg("SSL: cannot open SSL (%s)", 
                    ERR_reason_error_string(ERR_get_error()));
    return 1;
  }


  BIO_set_conn_hostname(iBio, g.urlName);

  BIO_set_conn_int_port(iBio, &g.urlPort);
  
  if( BIO_do_connect(iBio)<=0 ){
    ssl_set_errmsg("SSL: cannot connect to host %s:%d (%s)", 
        g.urlName, g.urlPort, ERR_reason_error_string(ERR_get_error()));
    ssl_close();
    return 1;
  }