Changeset ba5add7 for otr.c


Ignore:
Timestamp:
2008-02-17T01:39:39Z (16 years ago)
Author:
Sven Moritz Hallberg <sm@…>
Branches:
master
Children:
82e8fe8
Parents:
fd9fa52
Message:

explicitly initialize ssl in order to avoid gnutls and libotr fighting over the global state of libgcrypt

File:
1 edited

Legend:

Unmodified
Added
Removed
  • otr.c

    rfd9fa52 rba5add7  
    112112
    113113/* main function for the forked keygen slave */
    114 void keygen_child_main(OtrlUserState us, int infd, int outfd);
     114void keygen_child_main(const char *nick, int infd, int outfd);
    115115
    116116/* mainloop handler for when a keygen finishes */
     
    15271527                        /* child process */
    15281528                        signal(SIGTERM, exit);
    1529                         keygen_child_main(irc->otr->us, to[0], from[1]);
     1529                        keygen_child_main(irc->nick, to[0], from[1]);
    15301530                        exit(0);
    15311531                }
     
    15481548                        kg=&((*kg)->next);
    15491549                *kg = g_new0(kg_t, 1);
    1550                 (*kg)->accountname = handle;
    1551                 (*kg)->protocol = protocol;
     1550                (*kg)->accountname = g_strdup(handle);
     1551                (*kg)->protocol = g_strdup(protocol);
    15521552        } else {
    15531553                /* send our job over and remember it */
     
    15551555                fprintf(irc->otr->to, "%s\n%s\n", handle, protocol);
    15561556                fflush(irc->otr->to);
    1557                 irc->otr->sent_accountname = handle;
    1558                 irc->otr->sent_protocol = protocol;
    1559         }
    1560 }
    1561 
    1562 void keygen_child_main(OtrlUserState us, int infd, int outfd)
    1563 {
     1557                irc->otr->sent_accountname = g_strdup(handle);
     1558                irc->otr->sent_protocol = g_strdup(protocol);
     1559        }
     1560}
     1561
     1562void keygen_child_main(const char *nick, int infd, int outfd)
     1563{
     1564        OtrlUserState us;
     1565        char *kf;
    15641566        FILE *input, *output;
    15651567        char filename[128], accountname[512], protocol[512];
    15661568        gcry_error_t e;
    15671569        int tempfd;
     1570       
     1571        us = otrl_userstate_create();
     1572        kf = g_strdup_printf("%s%s.otr_keys", global.conf->configdir, nick);
     1573        otrl_privkey_read(us, kf);
     1574        g_free(kf);
    15681575       
    15691576        input = fdopen(infd, "r");
     
    16201627       
    16211628        /* forget this job */
     1629        g_free(irc->otr->sent_accountname);
     1630        g_free(irc->otr->sent_protocol);
    16221631        irc->otr->sent_accountname = NULL;
    16231632        irc->otr->sent_protocol = NULL;
Note: See TracChangeset for help on using the changeset viewer.