autofs-5.1.8 - fix some sss error return cases

From: Ian Kent <raven@themaw.net>

There are some cases where the error return handling isn't quite right,
fix them.

Also fix a typo. in configuration file comment.

Signed-off-by: Ian Kent <raven@themaw.net>
---
 CHANGELOG                      |    1 +
 modules/lookup_sss.c           |    6 +++---
 redhat/autofs.conf.default.in  |    2 +-
 samples/autofs.conf.default.in |    2 +-
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 3885474c..3a0351cb 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -92,6 +92,7 @@
 - make open files limit configurable.
 - use correct reference for IN6 macro call.
 - dont probe interface that cant send packet.
+- fix some sss error return cases.
 
 19/10/2021 autofs-5.1.8
 - add xdr_exports().
diff --git a/modules/lookup_sss.c b/modules/lookup_sss.c
index 7eb7e783..19e840a5 100644
--- a/modules/lookup_sss.c
+++ b/modules/lookup_sss.c
@@ -368,7 +368,7 @@ static int setautomntent_wait(unsigned int logopt,
 			*sss_ctxt = NULL;
 		}
 
-		if (proto_version(ctxt) == 0 && retry > retries)
+		if (proto_version(ctxt) == 0 && retry >= retries)
 			ret = ETIMEDOUT;
 	}
 	return ret;
@@ -496,7 +496,7 @@ static int getautomntent_wait(unsigned int logopt,
 		info(logopt,
 		     "successfully contacted sssd to get map entry");
 	else {
-		if (retry == retries)
+		if (proto_version(ctxt) == 0 && retry >= retries)
 			ret = ETIMEDOUT;
 	}
 	return ret;
@@ -621,7 +621,7 @@ static int getautomntbyname_wait(unsigned int logopt,
 		info(logopt,
 		     "successfully contacted sssd to lookup key value");
 	else {
-		if (proto_version(ctxt) == 0 && retry > retries)
+		if (proto_version(ctxt) == 0 && retry >= retries)
 			ret = ETIMEDOUT;
 	}
 	return ret;
diff --git a/redhat/autofs.conf.default.in b/redhat/autofs.conf.default.in
index 50f50329..fb4b002d 100644
--- a/redhat/autofs.conf.default.in
+++ b/redhat/autofs.conf.default.in
@@ -214,7 +214,7 @@ mount_nfs_default_protocol = 4
 # sss_master_map_wait - When sssd is starting up it can sometimes return
 #			"no such entry" for a short time until it has read
 # 			in the LDAP map information. Internal default is 0
-# 			(don't wait) or 10 if sss supports returning EHSTDOWN.
+# 			(don't wait) or 10 if sss supports returning EHOSTDOWN.
 # 			If there is a problem with autofs not finding the
 # 			master map at startup (when it should) then try setting
 # 			this to 10 or more. If the sss library supports returning
diff --git a/samples/autofs.conf.default.in b/samples/autofs.conf.default.in
index 94635203..94f95305 100644
--- a/samples/autofs.conf.default.in
+++ b/samples/autofs.conf.default.in
@@ -213,7 +213,7 @@ browse_mode = no
 # sss_master_map_wait - When sssd is starting up it can sometimes return
 #			"no such entry" for a short time until it has read
 # 			in the LDAP map information. Internal default is 0
-# 			(don't wait) or 10 if sss supports returning EHSTDOWN.
+# 			(don't wait) or 10 if sss supports returning EHOSTDOWN.
 # 			If there is a problem with autofs not finding the
 # 			master map at startup (when it should) then try setting
 # 			this to 10 or more. If the sss library supports returning