1275719SgshapiroPatch from John Marshall (slightly modified).
2275719Sgshapiro
3275719Sgshapirodiff --git a/sendmail/srvrsmtp.c b/sendmail/srvrsmtp.c
4275719Sgshapiroindex 7dba983..bf804ab 100644
5275719Sgshapiro--- a/sendmail/srvrsmtp.c
6275719Sgshapiro+++ b/sendmail/srvrsmtp.c
7275719Sgshapiro@@ -84,7 +84,7 @@ static int reset_saslconn __P((sasl_conn_t **_conn, char *_hostname,
8275719Sgshapiro # define RESET_SASLCONN	\
9275719Sgshapiro 	do							\
10275719Sgshapiro 	{							\
11275719Sgshapiro-		result = reset_saslconn(&conn, AuthRealm, remoteip, \
12275719Sgshapiro+		result = reset_saslconn(&conn, hostname, remoteip, \
13275719Sgshapiro 					localip, auth_id, &ext_ssf); \
14275719Sgshapiro 		if (result != SASL_OK)				\
15275719Sgshapiro 			sasl_ok = false;			\
16275719Sgshapiro@@ -938,8 +938,6 @@ smtp(nullserver, d_flags, e)
17275719Sgshapiro 	e->e_features = features;
18275719Sgshapiro 	hostname = macvalue('j', e);
19275719Sgshapiro #if SASL
20275719Sgshapiro-	if (AuthRealm == NULL)
21275719Sgshapiro-		AuthRealm = hostname;
22275719Sgshapiro 	sasl_ok = bitset(SRV_OFFER_AUTH, features);
23275719Sgshapiro 	n_mechs = 0;
24275719Sgshapiro 	authenticating = SASL_NOT_AUTH;
25275719Sgshapiro@@ -948,8 +946,8 @@ smtp(nullserver, d_flags, e)
26275719Sgshapiro 	if (sasl_ok)
27275719Sgshapiro 	{
28275719Sgshapiro # if SASL >= 20000
29275719Sgshapiro-		result = sasl_server_new("smtp", AuthRealm, NULL, NULL, NULL,
30275719Sgshapiro-					 NULL, 0, &conn);
31275719Sgshapiro+		result = sasl_server_new("smtp", hostname, AuthRealm, NULL,
32275719Sgshapiro+					 NULL, NULL, 0, &conn);
33275719Sgshapiro # elif SASL > 10505
34275719Sgshapiro 		/* use empty realm: only works in SASL > 1.5.5 */
35275719Sgshapiro 		result = sasl_server_new("smtp", AuthRealm, "", NULL, 0, &conn);
36275719Sgshapiro@@ -5392,7 +5390,7 @@ reset_saslconn(sasl_conn_t **conn, char *hostname,
37275719Sgshapiro 
38275719Sgshapiro 	sasl_dispose(conn);
39275719Sgshapiro # if SASL >= 20000
40275719Sgshapiro-	result = sasl_server_new("smtp", hostname, NULL, NULL, NULL,
41275719Sgshapiro+	result = sasl_server_new("smtp", hostname, AuthRealm, NULL, NULL,
42275719Sgshapiro 				 NULL, 0, conn);
43275719Sgshapiro # elif SASL > 10505
44275719Sgshapiro 	/* use empty realm: only works in SASL > 1.5.5 */
45