1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-01 15:26:37 +02:00

core: allow ctrl-C to exit WeeChat when the passphrase is asked on startup (closes #452)

This commit is contained in:
Sébastien Helleu
2015-06-28 09:16:24 +02:00
parent d9acb2b97a
commit 7fabe8c2a2
16 changed files with 90 additions and 32 deletions
+2
View File
@@ -19,6 +19,8 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
=== New features
* core: allow ctrl-C to exit WeeChat when the passphrase is asked on startup
(closes #452)
* core: allow pointer as list name in evaluation of hdata (closes #450)
* core: add signal "signal_sighup"
* api: add function string_eval_path_home()
+4 -1
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-06-27 16:44+0200\n"
"POT-Creation-Date: 2015-06-28 09:11+0200\n"
"PO-Revision-Date: 2015-03-21 08:41+0100\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3949,6 +3949,9 @@ msgid ""
"secured data!)"
msgstr ""
msgid "(press ctrl-C to exit WeeChat now)"
msgstr ""
msgid ""
"To recover your secured data, you can use /secure decrypt (see /help secure)"
msgstr ""
+4 -1
View File
@@ -24,7 +24,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-06-27 16:44+0200\n"
"POT-Creation-Date: 2015-06-28 09:11+0200\n"
"PO-Revision-Date: 2015-06-26 23:27+0100\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <>\n"
@@ -4691,6 +4691,9 @@ msgstr ""
"(um diese Abfrage zu überspringen, bitte ein Leerzeichen eingeben. Dies "
"DEAKTIVIERT die Nutzung der schutzwürdigen Daten!)"
msgid "(press ctrl-C to exit WeeChat now)"
msgstr ""
msgid ""
"To recover your secured data, you can use /secure decrypt (see /help secure)"
msgstr ""
+4 -1
View File
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-06-27 16:44+0200\n"
"POT-Creation-Date: 2015-06-28 09:11+0200\n"
"PO-Revision-Date: 2015-03-21 08:41+0100\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -4168,6 +4168,9 @@ msgid ""
"secured data!)"
msgstr ""
msgid "(press ctrl-C to exit WeeChat now)"
msgstr ""
msgid ""
"To recover your secured data, you can use /secure decrypt (see /help secure)"
msgstr ""
+5 -2
View File
@@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-06-27 16:44+0200\n"
"PO-Revision-Date: 2015-06-27 16:50+0200\n"
"POT-Creation-Date: 2015-06-28 09:11+0200\n"
"PO-Revision-Date: 2015-06-28 09:11+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@@ -4583,6 +4583,9 @@ msgstr ""
"(entrez juste un espace pour sauter la phrase de chiffrement, mais cela "
"DÉSACTIVERA toutes les données sécurisées !)"
msgid "(press ctrl-C to exit WeeChat now)"
msgstr "(appuyez sur ctrl-C pour quitter WeeChat maintenant)"
msgid ""
"To recover your secured data, you can use /secure decrypt (see /help secure)"
msgstr ""
+4 -1
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-06-27 16:44+0200\n"
"POT-Creation-Date: 2015-06-28 09:11+0200\n"
"PO-Revision-Date: 2015-03-21 08:41+0100\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3569,6 +3569,9 @@ msgid ""
"secured data!)"
msgstr ""
msgid "(press ctrl-C to exit WeeChat now)"
msgstr ""
msgid ""
"To recover your secured data, you can use /secure decrypt (see /help secure)"
msgstr ""
+4 -1
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-06-27 16:44+0200\n"
"POT-Creation-Date: 2015-06-28 09:11+0200\n"
"PO-Revision-Date: 2015-03-21 08:41+0100\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -4291,6 +4291,9 @@ msgstr ""
"(inserire uno spazio per ignorare la chiave di cifratura, ma ciò DISABILITA "
"tutti i dati messi al sicuro!)"
msgid "(press ctrl-C to exit WeeChat now)"
msgstr ""
msgid ""
"To recover your secured data, you can use /secure decrypt (see /help secure)"
msgstr ""
+4 -1
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-06-27 16:44+0200\n"
"POT-Creation-Date: 2015-06-28 09:11+0200\n"
"PO-Revision-Date: 2015-06-21 22:54+0900\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/translation_ja>\n"
@@ -4385,6 +4385,9 @@ msgstr ""
"(パスフレーズの入力をスキップするにはスペースをひとつだけ入力してください、こ"
"れにより全てのデータが安全ではなくなります!)"
msgid "(press ctrl-C to exit WeeChat now)"
msgstr ""
msgid ""
"To recover your secured data, you can use /secure decrypt (see /help secure)"
msgstr ""
+4 -1
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-06-27 16:44+0200\n"
"POT-Creation-Date: 2015-06-28 09:11+0200\n"
"PO-Revision-Date: 2015-05-09 14:00+0100\n"
"Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -4488,6 +4488,9 @@ msgstr ""
"(wprowadź tylko jedną spację, aby pominąć hasło, poskutkuje to BRAKIEM "
"DOSTĘPU do wszystkich zabezpieczonych danych!)"
msgid "(press ctrl-C to exit WeeChat now)"
msgstr ""
msgid ""
"To recover your secured data, you can use /secure decrypt (see /help secure)"
msgstr ""
+4 -1
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-06-27 16:44+0200\n"
"POT-Creation-Date: 2015-06-28 09:11+0200\n"
"PO-Revision-Date: 2015-03-21 08:41+0100\n"
"Last-Translator: Eduardo Elias <camponez@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -4159,6 +4159,9 @@ msgid ""
"secured data!)"
msgstr ""
msgid "(press ctrl-C to exit WeeChat now)"
msgstr ""
msgid ""
"To recover your secured data, you can use /secure decrypt (see /help secure)"
msgstr ""
+4 -1
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-06-27 16:44+0200\n"
"POT-Creation-Date: 2015-06-28 09:11+0200\n"
"PO-Revision-Date: 2015-03-21 08:41+0100\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3596,6 +3596,9 @@ msgid ""
"secured data!)"
msgstr ""
msgid "(press ctrl-C to exit WeeChat now)"
msgstr ""
msgid ""
"To recover your secured data, you can use /secure decrypt (see /help secure)"
msgstr ""
+4 -1
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-06-27 16:44+0200\n"
"POT-Creation-Date: 2015-06-28 09:11+0200\n"
"PO-Revision-Date: 2015-03-10 21:33+0100\n"
"Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3212,6 +3212,9 @@ msgid ""
"secured data!)"
msgstr ""
msgid "(press ctrl-C to exit WeeChat now)"
msgstr ""
msgid ""
"To recover your secured data, you can use /secure decrypt (see /help secure)"
msgstr ""
+4 -1
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-06-27 16:44+0200\n"
"POT-Creation-Date: 2015-06-28 09:11+0200\n"
"PO-Revision-Date: 2014-08-16 10:27+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3207,6 +3207,9 @@ msgid ""
"secured data!)"
msgstr ""
msgid "(press ctrl-C to exit WeeChat now)"
msgstr ""
msgid ""
"To recover your secured data, you can use /secure decrypt (see /help secure)"
msgstr ""
+15 -6
View File
@@ -566,16 +566,20 @@ secure_decrypt_data_not_decrypted (const char *passphrase)
void
secure_get_passphrase_from_user (const char *error)
{
const char *prompt[5];
char passphrase[1024];
prompt[0] = _("Please enter your passphrase to decrypt the data secured "
"by WeeChat:");
prompt[1] = _("(enter just one space to skip the passphrase, but this "
"will DISABLE all secured data!)");
prompt[2] = _("(press ctrl-C to exit WeeChat now)");
prompt[3] = error;
prompt[4] = NULL;
while (1)
{
gui_main_get_password (_("Please enter your passphrase to decrypt the "
"data secured by WeeChat:"),
_("(enter just one space to skip the passphrase, "
"but this will DISABLE all secured data!)"),
error,
passphrase, sizeof (passphrase));
gui_main_get_password (prompt, passphrase, sizeof (passphrase));
if (secure_passphrase)
{
free (secure_passphrase);
@@ -590,6 +594,11 @@ secure_get_passphrase_from_user (const char *error)
_("To recover your secured data, you can "
"use /secure decrypt (see /help secure)"));
}
else if (strcmp (passphrase, "\x03") == 0)
{
/* ctrl-C pressed, just exit now */
exit (1);
}
else
secure_passphrase = strdup (passphrase);
return;
+23 -11
View File
@@ -74,22 +74,26 @@ int gui_term_lines = 0; /* number of lines in terminal */
*/
void
gui_main_get_password (const char *prompt1, const char *prompt2,
const char *prompt3,
char *password, int size)
gui_main_get_password (const char **prompt, char *password, int size)
{
int i, ch;
int line, i, ch;
initscr ();
cbreak ();
noecho ();
raw ();
clear();
mvaddstr (0, 0, prompt1);
mvaddstr (1, 0, prompt2);
mvaddstr (2, 0, prompt3);
mvaddstr (3, 0, "=> ");
line = 0;
while (prompt[line])
{
mvaddstr (line, 0, prompt[line]);
line++;
}
mvaddstr (line, 0, "=> ");
refresh ();
memset (password, '\0', size);
@@ -97,22 +101,30 @@ gui_main_get_password (const char *prompt1, const char *prompt2,
while (i < size - 1)
{
ch = getch ();
/* enter */
if (ch == '\n')
break;
/* ctrl-C */
if (ch == 3)
{
password[0] = 3;
i = 1;
break;
}
if (ch == 127)
{
if (i > 0)
{
i--;
password[i] = '\0';
mvaddstr (3, 3 + i, " ");
move (3, 3 + i);
mvaddstr (line, 3 + i, " ");
move (line, 3 + i);
}
}
else
{
password[i] = ch;
mvaddstr (3, 3 + i, "*");
mvaddstr (line, 3 + i, "*");
i++;
}
refresh ();
+1 -2
View File
@@ -22,8 +22,7 @@
/* main functions (GUI dependent) */
extern void gui_main_get_password (const char *prompt1, const char *prompt2,
const char *prompt3,
extern void gui_main_get_password (const char **prompt,
char *password, int size);
extern void gui_main_debug_libs ();
extern void gui_main_end (int clean_exit);