summaryrefslogtreecommitdiff
blob: af9d6c57e68b99d45385f13a982a975a7f81fc7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
http://dev.mutt.org/trac/changeset/0a3de4d9a009

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).

http://dev.mutt.org/trac/changeset/f6c6066a5925

Make getuser/pass abort if input is required in batch mode.
Replaces [0a3de4d9a009]. See #3289.


Index: account.c
===================================================================
--- account.c (revision 5557:6c58b678d360)
+++ account.c (revision 5965:f6c6066a5925)
@@ -156,4 +156,6 @@
     strfcpy (account->user, PopUser, sizeof (account->user));
 #endif
+  else if (option (OPTNOCURSES))
+    return -1;
   /* prompt (defaults to unix username), copy into account->user */
   else
@@ -216,4 +218,6 @@
     strfcpy (account->pass, SmtpPass, sizeof (account->pass));
 #endif
+  else if (option (OPTNOCURSES))
+    return -1;
   else
   {
Index: mutt_sasl.c
===================================================================
--- mutt_sasl.c (revision 5711:6fac57b97bf1)
+++ mutt_sasl.c (revision 5965:f6c6066a5925)
@@ -305,5 +305,5 @@
     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;
 
Index: smtp.c
===================================================================
--- smtp.c (revision 5963:0a3de4d9a009)
+++ smtp.c (revision 5965:f6c6066a5925)
@@ -173,5 +173,5 @@
   struct stat st;
   int r, term = 0;
-  size_t buflen;
+  size_t buflen = 0;
 
   fp = fopen (msgfile, "r");
@@ -461,10 +455,4 @@
 
 #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
@@ -610,5 +598,5 @@
     }
     strfcpy (buf + len, "\r\n", sizeof (buf) - len);
-  } while (rc == smtp_ready);
+  } while (rc == smtp_ready && saslrc != SASL_FAIL);
 
   if (smtp_success (rc))