Ticket #785: deferred_ssl_init.patch

File deferred_ssl_init.patch, 1.6 KB (added by dskulinska@…, at 2011-04-24T02:44:37Z)

deferred call to ssl_init() and otr_init() until after fork()

  • unix.c

    === modified file 'unix.c'
     
    8080        nogaim_init();
    8181#endif
    8282       
    83         /* Ugly Note: libotr and gnutls both use libgcrypt. libgcrypt
    84            has a process-global config state whose initialization happpens
    85            twice if libotr and gnutls are used together. libotr installs custom
    86            memory management functions for libgcrypt while our gnutls module
    87            uses the defaults. Therefore we initialize OTR after SSL. *sigh* */
    88         ssl_init();
    89 #ifdef OTR_BI
    90         otr_init();
    91 #endif
    92         /* And in case OTR is loaded as a plugin, it'll also get loaded after
    93            this point. */
    94        
     83        // bug ticket #785: ssl_init() and otr_init() moved further down until
     84        // after fork()
     85        // FIXME: any side-effects esp. regarding running in "forking daemon" mode
     86        // have NOT been investigated
    9587        srand( time( NULL ) ^ getpid() );
    9688       
    9789        global.helpfile = g_strdup( HELP_FILE );
     
    155147                        setuid( pw->pw_uid );
    156148                }
    157149        }
     150
     151        /* Ugly Note: libotr and gnutls both use libgcrypt. libgcrypt
     152           has a process-global config state whose initialization happpens
     153           twice if libotr and gnutls are used together. libotr installs custom
     154           memory management functions for libgcrypt while our gnutls module
     155           uses the defaults. Therefore we initialize OTR after SSL. *sigh* */
     156        ssl_init();
     157#ifdef OTR_BI
     158        otr_init();
     159#endif
     160        /* And in case OTR is loaded as a plugin, it'll also get loaded after
     161           this point. */
    158162       
    159163        /* Catch some signals to tell the user what's happening before quitting */
    160164        memset( &sig, 0, sizeof( sig ) );