This commit is contained in:
Luis R. Rodriguez 2014-10-11 18:54:21 +00:00
commit 93c127d73d
5 changed files with 116 additions and 2 deletions

49
CONTRIBUTING Normal file
View file

@ -0,0 +1,49 @@
This project embraces the Developer Certificate of Origin (DCO) for
contributions. This means you must agree to the following prior to submitting
patches, if you agree with this developer certificate you acknowledge this by
adding a Signed-off-by tag to your patch commit log. Every submitted patch
must have this.
The source for the DCO:
http://developercertificate.org/
-----------------------------------------------------------------------
Developer Certificate of Origin
Version 1.1
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
660 York Street, Suite 102,
San Francisco, CA 94110 USA
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.

View file

@ -37,6 +37,8 @@
#include <validator/val_dane.h> #include <validator/val_dane.h>
#endif #endif
void window_console(void);
/* ssl i/o channel object */ /* ssl i/o channel object */
typedef struct typedef struct
{ {
@ -434,6 +436,7 @@ static int get_pem_password_callback(char *buffer, int max_length, int rwflag, v
char *password; char *password;
size_t length; size_t length;
/* should not happen but better leave it */
if (pass == NULL) if (pass == NULL)
return 0; return 0;
@ -447,6 +450,35 @@ static int get_pem_password_callback(char *buffer, int max_length, int rwflag, v
return length; return length;
} }
static int prompt_pem_password_callback(char *buffer, int max_length, int rwflag, void *pem_cert)
{
char *password, prompt[256];
size_t length;
window_console();
/* should not happen but better leave it */
if (pem_cert == NULL)
return 0;
snprintf(prompt, 256, "Enter Passphrase for %s:", (char *) pem_cert);
password = getpass(prompt);
if (!password)
return 0;
length = strlen(password);
if (length > max_length)
return 0;
strncpy(buffer, password, length);
irssi_redraw();
return length;
}
static GIOChannel *irssi_ssl_get_iochannel(GIOChannel *handle, int port, SERVER_REC *server) static GIOChannel *irssi_ssl_get_iochannel(GIOChannel *handle, int port, SERVER_REC *server)
{ {
GIOSSLChannel *chan; GIOSSLChannel *chan;
@ -476,8 +508,13 @@ static GIOChannel *irssi_ssl_get_iochannel(GIOChannel *handle, int port, SERVER_
return NULL; return NULL;
} }
SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv2); SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv2);
if (mypass) {
SSL_CTX_set_default_passwd_cb(ctx, get_pem_password_callback); SSL_CTX_set_default_passwd_cb(ctx, get_pem_password_callback);
SSL_CTX_set_default_passwd_cb_userdata(ctx, (void *)mypass); SSL_CTX_set_default_passwd_cb_userdata(ctx, (void *)mypass);
} else if (mycert && *mycert) {
SSL_CTX_set_default_passwd_cb(ctx, prompt_pem_password_callback);
SSL_CTX_set_default_passwd_cb_userdata(ctx, (void *)mycert);
}
if (mycert && *mycert) { if (mycert && *mycert) {
char *scert = NULL, *spkey = NULL; char *scert = NULL, *spkey = NULL;

View file

@ -70,6 +70,8 @@ WINDOW_REC *window_create(WI_ITEM_REC *item, int automatic)
rec = g_new0(WINDOW_REC, 1); rec = g_new0(WINDOW_REC, 1);
rec->refnum = window_get_new_refnum(); rec->refnum = window_get_new_refnum();
if (rec->refnum == 1)
rec->console = 1;
rec->level = settings_get_level("window_default_level"); rec->level = settings_get_level("window_default_level");
windows = g_slist_prepend(windows, rec); windows = g_slist_prepend(windows, rec);
@ -353,6 +355,20 @@ WINDOW_REC *window_find_refnum(int refnum)
return NULL; return NULL;
} }
WINDOW_REC *window_find_console(void)
{
GSList *tmp;
for (tmp = windows; tmp != NULL; tmp = tmp->next) {
WINDOW_REC *rec = tmp->data;
if (rec->console)
return rec;
}
return NULL;
}
WINDOW_REC *window_find_name(const char *name) WINDOW_REC *window_find_name(const char *name)
{ {
GSList *tmp; GSList *tmp;

View file

@ -35,6 +35,7 @@ struct _WINDOW_REC {
unsigned int immortal:1; unsigned int immortal:1;
unsigned int sticky_refnum:1; unsigned int sticky_refnum:1;
unsigned int destroying:1; unsigned int destroying:1;
unsigned int console:1;
/* window-specific command line history */ /* window-specific command line history */
HISTORY_REC *history; HISTORY_REC *history;
@ -75,6 +76,7 @@ const char *window_get_active_name(WINDOW_REC *window);
WINDOW_REC *window_find_level(void *server, int level); WINDOW_REC *window_find_level(void *server, int level);
WINDOW_REC *window_find_closest(void *server, const char *name, int level); WINDOW_REC *window_find_closest(void *server, const char *name, int level);
WINDOW_REC *window_find_refnum(int refnum); WINDOW_REC *window_find_refnum(int refnum);
WINDOW_REC *window_find_console(void);
WINDOW_REC *window_find_name(const char *name); WINDOW_REC *window_find_name(const char *name);
WINDOW_REC *window_find_item(SERVER_REC *server, const char *name); WINDOW_REC *window_find_item(SERVER_REC *server, const char *name);

View file

@ -842,6 +842,16 @@ static void cmd_foreach_window(const char *data)
active_win = old; active_win = old;
} }
void window_console(void)
{
WINDOW_REC *window;
window = window_find_console();
if (!window)
return;
window_set_active(window);
}
void window_commands_init(void) void window_commands_init(void)
{ {
settings_add_bool("lookandfeel", "active_window_ignore_refnum", TRUE); settings_add_bool("lookandfeel", "active_window_ignore_refnum", TRUE);