*** /var/tmp/postfix-2.2.12/src/smtpd/smtpd_sasl_proto.c	Fri Dec 10 20:16:39 2004
--- src/smtpd/smtpd_sasl_proto.c	Tue Apr 19 18:42:50 2011
***************
*** 166,171 ****
--- 166,182 ----
  	msg_warn("%s[%s]: SASL %s authentication failed",
  		 state->name, state->addr, auth_mechanism);
  	smtpd_chat_reply(state, "%s", err);
+ 
+ 	/* Don't reuse the SASL handle after authentication failure. */
+ 	smtpd_sasl_disconnect(state);
+ #ifdef USE_TLS
+ 	if (state->tls_context != 0)
+ 	    smtpd_sasl_connect(state, VAR_SMTPD_SASL_TLS_OPTS,
+ 			       var_smtpd_sasl_tls_opts);
+ 	else
+ #endif
+ 	    smtpd_sasl_connect(state, VAR_SMTPD_SASL_OPTS,
+ 			       var_smtpd_sasl_opts);
  	return (-1);
      }
      smtpd_chat_reply(state, "235 Authentication successful");