Ticket #122: 0003-let-ssl-in-libpq-and-jabberd-coexist-peacefully.patch

File 0003-let-ssl-in-libpq-and-jabberd-coexist-peacefully.patch, 2.0 KB (added by hacker, 18 months ago)

a commit from my local git repo

  • storage/authreg_pgsql.c

    From 8579567d9d9f2d45ef9b6cf2e60fa6e175f97d74 Mon Sep 17 00:00:00 2001
    From: Michael Krelin <hacker@klever.net>
    Date: Sat, 28 Jul 2007 21:20:34 +0200
    Subject: [PATCH] let ssl in libpq and jabberd coexist peacefully.
    
     To let the two implementations coexist it's important to hint libpq on ssl
     being initialized already before establishing connection to the database. One
     possible fix is to raise appropriate flag in ssl module and check it in
     authreg_pgsql.
    
    Signed-off-by: Michael Krelin <hacker@klever.net>
    ---
     storage/authreg_pgsql.c |    8 ++++++++
     sx/ssl.c                |    4 ++++
     2 files changed, 12 insertions(+), 0 deletions(-)
    
    diff --git a/storage/authreg_pgsql.c b/storage/authreg_pgsql.c
    index cb68e7d..5f1583d 100644
    a b  
    302302  return 1; 
    303303} 
    304304 
     305#ifdef HAVE_SSL 
     306extern int sx_openssl_initialized; 
     307#endif 
     308 
    305309/** start me up */ 
    306310int ar_init(authreg_t ar) { 
    307311    char *host, *port, *dbname, *user, *pass, *conninfo; 
     
    391395    free(setpassword); 
    392396    free(delete); 
    393397 
     398#ifdef HAVE_SSL 
     399    if(sx_openssl_initialized) 
     400        PQinitSSL(0); 
     401#endif 
    394402    conninfo = config_get_one(ar->c2s->config,"authreg.pgsql.conninfo",0); 
    395403    if(conninfo) { 
    396404        /* don't log connection info for it can contain password */ 
  • sx/ssl.c

    diff --git a/sx/ssl.c b/sx/ssl.c
    index 62c4258..9359f4d 100644
    a b  
    628628    SSL_CTX_free((SSL_CTX *) p->private); 
    629629} 
    630630 
     631int sx_openssl_initialized = 0; 
     632 
    631633/** args: pemfile */ 
    632634int sx_ssl_init(sx_env_t env, sx_plugin_t p, va_list args) { 
    633635    char *pemfile, *cachain; 
     
    653655    SSL_library_init(); 
    654656    SSL_load_error_strings(); 
    655657 
     658    sx_openssl_initialized = 1; 
     659 
    656660    /* create the context */ 
    657661    ctx = SSL_CTX_new(SSLv23_method()); 
    658662    if(ctx == NULL) {