Created
July 27, 2013 00:58
-
-
Save mariushoch/6093199 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: network-openssl.c | |
=================================================================== | |
--- network-openssl.c (revision 5224) | |
+++ network-openssl.c (working copy) | |
@@ -50,6 +50,19 @@ | |
int port; | |
} GIOSSLChannel; | |
+void irssi_redraw(void); | |
+ | |
+static int getpass_cb(char *buf, int size, int rwflag, void *keyname) | |
+{ | |
+ char *pp, prompt[256]; | |
+ snprintf(prompt, 256, "Enter Passphrase for %s:", keyname); | |
+ pp = getpass(prompt); | |
+ strncpy(buf, pp, size); | |
+ buf[size - 1] = '\0'; | |
+ irssi_redraw(); | |
+ return(strlen(buf)); | |
+} | |
+ | |
static int ssl_inited = FALSE; | |
static void irssi_ssl_free(GIOChannel *handle) | |
@@ -463,6 +476,8 @@ | |
scert = convert_home(mycert); | |
if (mypkey && *mypkey) | |
spkey = convert_home(mypkey); | |
+ SSL_CTX_set_default_passwd_cb(ctx, getpass_cb); | |
+ SSL_CTX_set_default_passwd_cb_userdata(ctx, spkey); | |
if (! SSL_CTX_use_certificate_file(ctx, scert, SSL_FILETYPE_PEM)) | |
g_warning("Loading of client certificate '%s' failed", mycert); | |
else if (! SSL_CTX_use_PrivateKey_file(ctx, spkey ? spkey : scert, SSL_FILETYPE_PEM)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment