Commit 802150a1 802150a165325d9d7a2824765c32852afc6e7797 by Sergey Poznyakoff

Do not ask for ESMTP credentials if unable to handle them.

* libproto/mailer/smtp.c (smtp_open): Disable ESTMP AUTH if
GSASL support is not compiled.
* libproto/mailer/smtp_auth.c (mu_smtp_auth): If compiled
without GSASL, don't attempt to obtain user credentials.
1 parent d1e34b1a
...@@ -134,6 +134,16 @@ smtp_mailer_add_auth_mech (struct _smtp_mailer *smtp_mailer, const char *str) ...@@ -134,6 +134,16 @@ smtp_mailer_add_auth_mech (struct _smtp_mailer *smtp_mailer, const char *str)
134 } 134 }
135 } 135 }
136 136
137 /* FIXME: So far, ESMTP AUTH support is available only if MU is compiled
138 with GNU SASL. Should this change, the define below must be changed
139 as well. See also smtp_auth.c.
140 */
141 #ifdef WITH_GSASL
142 # define DFLNOAUTH 0
143 #else
144 # define DFLNOAUTH 1
145 #endif
146
137 static int 147 static int
138 smtp_open (mu_mailer_t mailer, int flags) 148 smtp_open (mu_mailer_t mailer, int flags)
139 { 149 {
...@@ -144,7 +154,7 @@ smtp_open (mu_mailer_t mailer, int flags) ...@@ -144,7 +154,7 @@ smtp_open (mu_mailer_t mailer, int flags)
144 char **parmv = NULL; 154 char **parmv = NULL;
145 int tls = 0; 155 int tls = 0;
146 int nostarttls = 0; 156 int nostarttls = 0;
147 int noauth = 0; 157 int noauth = DFLNOAUTH;
148 158
149 rc = mu_url_sget_scheme (mailer->url, &scheme); 159 rc = mu_url_sget_scheme (mailer->url, &scheme);
150 if (rc == 0) 160 if (rc == 0)
......
...@@ -112,6 +112,7 @@ mu_smtp_auth (mu_smtp_t smtp) ...@@ -112,6 +112,7 @@ mu_smtp_auth (mu_smtp_t smtp)
112 if (smtp->state != MU_SMTP_MAIL) 112 if (smtp->state != MU_SMTP_MAIL)
113 return MU_ERR_SEQ; 113 return MU_ERR_SEQ;
114 114
115 #if defined(WITH_GSASL)
115 /* Obtain missing authentication credentials either from the 116 /* Obtain missing authentication credentials either from the
116 URL (when supplied) or from the user ticket file, or by 117 URL (when supplied) or from the user ticket file, or by
117 asking the user, if anything else fails. 118 asking the user, if anything else fails.
...@@ -126,10 +127,11 @@ mu_smtp_auth (mu_smtp_t smtp) ...@@ -126,10 +127,11 @@ mu_smtp_auth (mu_smtp_t smtp)
126 _mu_smtp_fixup_params (smtp); 127 _mu_smtp_fixup_params (smtp);
127 if (!smtp->param[MU_SMTP_PARAM_USERNAME] && !smtp->secret) 128 if (!smtp->param[MU_SMTP_PARAM_USERNAME] && !smtp->secret)
128 return MU_ERR_AUTH_NO_CRED; 129 return MU_ERR_AUTH_NO_CRED;
129 #if defined(WITH_GSASL)
130 return _mu_smtp_gsasl_auth (smtp); 130 return _mu_smtp_gsasl_auth (smtp);
131 #else 131 #else
132 /* FIXME: Provide support for some basic authentication methods */ 132 /* FIXME: Provide support for some basic authentication methods.
133 Once done, make sure _mu_smtp_fixup_params is called for this
134 branc as well (though see the fixme above). */
133 return ENOSYS; 135 return ENOSYS;
134 #endif 136 #endif
135 } 137 }
......