[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-gnutls] Restore gnutls session after execvp - possible?

From: FlashCode
Subject: [Help-gnutls] Restore gnutls session after execvp - possible?
Date: Sun, 11 Dec 2005 16:58:41 +0100
User-agent: Mutt/1.5.11


I'm developing an IRC client called WeeChat
I'm adding a new feature: /upgrade command, which does an execvp() of
weechat, without closing connections to servers (sockets are still
open after execvp).

For some servers, user may connect thru gnutls (SSL), and I need to save
session in file when upgrading, then restore it when starting new

Is it possible to do that with gnutls today?

I saw an example in the doc, but situation is not exactly the same,
socket is reopen after close, then gnutls session reloaded.
In my case, socket is not closed.

I tried something like that :

1. quit weechat without closing sockets, and do that for gnutls:

 - for each gnutls server:
    gnutls_session_get_data (ptr_server->gnutls_sess, NULL,
    session_data = malloc (session_size);
    gnutls_session_get_data (server->gnutls_sess, session_data,
    /* save session data to session file */
    gnutls_bye (server->gnutls_sess, GNUTLS_SHUT_RDWR);
    gnutls_deinit (server->gnutls_sess);
 - global:
    gnutls_certificate_free_credentials (gnutls_xcred);

2. start new weechat via execvp (load session file):

 - global:
    gnutls_global_init ();
    gnutls_certificate_allocate_credentials (&gnutls_xcred);
    gnutls_certificate_set_x509_trust_file (gnutls_xcred,
        "ca.pem", GNUTLS_X509_FMT_PEM);
 - for each gnutls server:
    gnutls_set_default_priority (server->gnutls_sess);
    gnutls_certificate_type_set_priority  (server->gnutls_sess,
    gnutls_credentials_set (server->gnutls_sess,
    /* read session & size (internal stuff not shown here) */
    gnutls_session_set_data (server->gnutls_sess,
                             session_data, session_size);
    gnutls_transport_set_ptr (server->gnutls_sess,
    if (gnutls_handshake (server->gnutls_sess) < 0)
        printf ("handshake failed\n");

Problem: the handshake always failed when restoring weechat session.

Thank you in advance, any help appreciated.

Cordialement / Best regards

Web: - email: address@hidden
IRC: address@hidden - Jabber: address@hidden

Attachment: signature.asc
Description: Digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]