summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Fonseca <jrfonseca@users.sourceforge.net>2004-06-29 09:47:41 +0000
committerJosé Fonseca <jrfonseca@users.sourceforge.net>2004-06-29 09:47:41 +0000
commit887dcd4d51c1f475dd3c52ca1ee5670bae5a4c2b (patch)
treedb1afe75b4e483ecb1a0c86b099dc1ed435fe3d8
parent06c05d2db8241365e8d76c46435c12ce3f67f1d1 (diff)
Disable SMTP AUTH if no username is given.
-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. */