From 887dcd4d51c1f475dd3c52ca1ee5670bae5a4c2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 29 Jun 2004 09:47:41 +0000 Subject: Disable SMTP AUTH if no username is given. --- smtp.c | 14 ++++++++++---- 1 file 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. */ -- cgit v1.2.3