summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--smtp.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/smtp.c b/smtp.c
index 2ca96bb..116c5a1 100644
--- a/smtp.c
+++ b/smtp.c
@@ -432,9 +432,14 @@ void smtp_send(message_t *msg)
goto failure;
/* Do what's needed at application level to use authentication. */
- authctx = auth_create_context ();
- auth_set_mechanism_flags (authctx, AUTH_PLUGIN_PLAIN, 0);
- auth_set_interact_cb (authctx, authinteract, identity);
+ if(identity->user || identity->pass)
+ {
+ authctx = auth_create_context ();
+ auth_set_mechanism_flags (authctx, AUTH_PLUGIN_PLAIN, 0);
+ auth_set_interact_cb (authctx, authinteract, identity);
+ }
+ else
+ authctx = NULL;
/* Use our callback for X.509 certificate passwords. If STARTTLS is not in
* use or disabled in configure, the following is harmless.
@@ -566,7 +571,8 @@ void smtp_send(message_t *msg)
fputc('\n', log_fp);
smtp_destroy_session (session);
- auth_destroy_context (authctx);
+ if(authctx)
+ auth_destroy_context (authctx);
auth_client_exit ();
/* Execute post-connect command if one was specified. */