From 2ecfc9948547f669d09833d4040b4f7db41ef17c Mon Sep 17 00:00:00 2001 From: Rocco Rutte Date: Wed, 1 Jul 2009 18:13:34 -0700 Subject: [PATCH] Make getuser/pass abort if input is required in batch mode. Replaces [0a3de4d9a009]. See #3289. --- ChangeLog | 17 +++++++++++------ account.c | 4 ++++ mutt_sasl.c | 2 +- smtp.c | 14 +------------- 4 files changed, 17 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 68bf4cf36..6d817a337 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2009-07-01 23:24 +0200 Rocco Rutte (9a5f4364c166) + + * doc/manual.xml.head: Manual: Add detailed section on charset + handling + + * smtp.c: SMTP: use $smtp_pass in batch mode. Closes #3289. + + mutt_account_getpass() copying the password from $smtp_pass into the + account structure is only called from the SASL callback we only use + if we're sure we don't need curses (i.e. have the pass already). + 2009-06-30 17:32 +0200 Rocco Rutte (f4baa2f1251a) * pgpewrap.c: Add missing config.h include to pgpewrap.c @@ -5,8 +16,6 @@ It technically doesn't need it, but pgpewrap should be rebuilt after configure ran, too. -2009-06-30 17:31 +0200 Rocco Rutte (7c8f018d33a5) - * doc/Makefile.am: Manual: Run lynx with --display_charset =us-ascii, see #3286. @@ -31,12 +40,8 @@ * configure.ac, curs_lib.c: Allow tabs in index subject. Closes #3270. -2009-06-28 20:21 -0700 Brendan Cully (ecea9568202f) - * imap/util.c: Allow ImapDelimChars to be unset -2009-06-28 19:21 -0700 Brendan Cully (ef6523d11f24) - * mutt.h: Rename struct thread to struct mutt_thread. Closes #3279. * imap/command.c: Not being able to start an IMAP command diff --git a/account.c b/account.c index b305f788b..f7389914e 100644 --- a/account.c +++ b/account.c @@ -155,6 +155,8 @@ int mutt_account_getuser (ACCOUNT* account) else if ((account->type == M_ACCT_TYPE_POP) && PopUser) strfcpy (account->user, PopUser, sizeof (account->user)); #endif + else if (option (OPTNOCURSES)) + return -1; /* prompt (defaults to unix username), copy into account->user */ else { @@ -215,6 +217,8 @@ int mutt_account_getpass (ACCOUNT* account) else if ((account->type == M_ACCT_TYPE_SMTP) && SmtpPass) strfcpy (account->pass, SmtpPass, sizeof (account->pass)); #endif + else if (option (OPTNOCURSES)) + return -1; else { snprintf (prompt, sizeof (prompt), _("Password for %s@%s: "), diff --git a/mutt_sasl.c b/mutt_sasl.c index 0f4454cb4..e85970dbb 100644 --- a/mutt_sasl.c +++ b/mutt_sasl.c @@ -304,7 +304,7 @@ int mutt_sasl_interact (sasl_interact_t* interaction) snprintf (prompt, sizeof (prompt), "%s: ", interaction->prompt); resp[0] = '\0'; - if (mutt_get_field (prompt, resp, sizeof (resp), 0)) + if (option (OPTNOCURSES) || mutt_get_field (prompt, resp, sizeof (resp), 0)) return SASL_FAIL; interaction->len = mutt_strlen (resp)+1; diff --git a/smtp.c b/smtp.c index d0b2eb50b..a718006bd 100644 --- a/smtp.c +++ b/smtp.c @@ -347,12 +347,6 @@ static int smtp_fill_account (ACCOUNT* account) if (url.scheme == U_SMTPS) account->flags |= M_ACCT_SSL; - if (!(account->flags & M_ACCT_PASS) && SmtpPass && *SmtpPass) - { - strfcpy (account->pass, SmtpPass, sizeof (account->pass)); - account->flags |= M_ACCT_PASS; - } - if (!account->port) { if (account->flags & M_ACCT_SSL) @@ -460,12 +454,6 @@ static int smtp_open (CONNECTION* conn) } #ifdef USE_SASL - if (!(conn->account.flags & M_ACCT_PASS) && option (OPTNOCURSES)) - { - mutt_error (_("Interactive SMTP authentication not supported")); - mutt_sleep (1); - return -1; - } return smtp_auth (conn); #else mutt_error (_("SMTP authentication requires SASL")); @@ -609,7 +597,7 @@ static int smtp_auth_sasl (CONNECTION* conn, const char* mechlist) } } strfcpy (buf + len, "\r\n", sizeof (buf) - len); - } while (rc == smtp_ready); + } while (rc == smtp_ready && saslrc != SASL_FAIL); if (smtp_success (rc)) { -- 2.40.0