Commit c4ef62a7 authored by Brendan Cully's avatar Brendan Cully

The attached patch prevents mutt from reading the push buffer when

asking for passwords. This is a proper fix for bug 1312. I think
it's uncontroversial.
parent a68a6737
...@@ -172,7 +172,7 @@ int mutt_account_getpass (ACCOUNT* account) ...@@ -172,7 +172,7 @@ int mutt_account_getpass (ACCOUNT* account)
snprintf (prompt, sizeof (prompt), _("Password for %s@%s: "), snprintf (prompt, sizeof (prompt), _("Password for %s@%s: "),
account->user, account->host); account->user, account->host);
account->pass[0] = '\0'; account->pass[0] = '\0';
if (mutt_get_field (prompt, account->pass, sizeof (account->pass), M_PASS)) if (mutt_get_password (prompt, account->pass, sizeof (account->pass)))
return -1; return -1;
} }
......
...@@ -57,12 +57,12 @@ void mutt_refresh (void) ...@@ -57,12 +57,12 @@ void mutt_refresh (void)
refresh (); refresh ();
} }
event_t mutt_getch (void) event_t _mutt_getch (int flags)
{ {
int ch; int ch;
event_t err = {-1, OP_NULL }, ret; event_t err = {-1, OP_NULL }, ret;
if (UngetCount) if (!(flags & M_KM_UNBUFFERED) && UngetCount)
return (KeyEvent[--UngetCount]); return (KeyEvent[--UngetCount]);
SigInt = 0; SigInt = 0;
......
...@@ -256,7 +256,7 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x, ...@@ -256,7 +256,7 @@ int _mutt_enter_string (char *buf, size_t buflen, int y, int x,
} }
mutt_refresh (); mutt_refresh ();
if ((ch = km_dokey (MENU_EDITOR)) == -1) if ((ch = _km_dokey (MENU_EDITOR, pass ? M_KM_UNBUFFERED : 0)) == -1)
{ {
rv = -1; rv = -1;
goto bye; goto bye;
......
...@@ -357,7 +357,7 @@ static int retry_generic (int menu, keycode_t *keys, int keyslen, int lastkey) ...@@ -357,7 +357,7 @@ static int retry_generic (int menu, keycode_t *keys, int keyslen, int lastkey)
* OP_NULL no function bound to key sequence * OP_NULL no function bound to key sequence
* -1 error occured while reading input * -1 error occured while reading input
*/ */
int km_dokey (int menu) int _km_dokey (int menu, int flags)
{ {
event_t tmp; event_t tmp;
struct keymap_t *map = Keymaps[menu]; struct keymap_t *map = Keymaps[menu];
...@@ -374,7 +374,7 @@ int km_dokey (int menu) ...@@ -374,7 +374,7 @@ int km_dokey (int menu)
if (menu != MENU_EDITOR) if (menu != MENU_EDITOR)
timeout ((Timeout > 0 ? Timeout : 60) * 1000); timeout ((Timeout > 0 ? Timeout : 60) * 1000);
tmp = mutt_getch(); tmp = _mutt_getch(flags);
if (menu != MENU_EDITOR) if (menu != MENU_EDITOR)
timeout (-1); /* restore blocking operation */ timeout (-1); /* restore blocking operation */
......
...@@ -27,7 +27,8 @@ typedef short keycode_t; ...@@ -27,7 +27,8 @@ typedef short keycode_t;
void km_bind (char *, int, int, char *, char *); void km_bind (char *, int, int, char *, char *);
void km_bindkey (char *, int, int); void km_bindkey (char *, int, int);
int km_dokey (int); #define km_dokey(menu) _km_dokey(menu, 0)
int _km_dokey (int, int);
/* entry in the keymap tree */ /* entry in the keymap tree */
struct keymap_t struct keymap_t
......
...@@ -112,6 +112,9 @@ ...@@ -112,6 +112,9 @@
#define M_TOKEN_COMMENT (1<<5) /* don't reap comments */ #define M_TOKEN_COMMENT (1<<5) /* don't reap comments */
#define M_TOKEN_SEMICOLON (1<<6) /* don't treat ; as special */ #define M_TOKEN_SEMICOLON (1<<6) /* don't treat ; as special */
/* flags for km_dokey() */
#define M_KM_UNBUFFERED 1 /* don't read from the key buffer */
typedef struct typedef struct
{ {
char *data; /* pointer to data */ char *data; /* pointer to data */
......
...@@ -87,7 +87,8 @@ void mutt_curs_set (int); ...@@ -87,7 +87,8 @@ void mutt_curs_set (int);
#define CI_is_return(c) ((c) == '\r' || (c) == '\n') #define CI_is_return(c) ((c) == '\r' || (c) == '\n')
#endif #endif
event_t mutt_getch (void); #define mutt_getch() _mutt_getch(0)
event_t _mutt_getch (int);
void mutt_endwin (const char *); void mutt_endwin (const char *);
void mutt_flushinp (void); void mutt_flushinp (void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment