Blame SOURCES/autofs-5.1.0-beta1-fix-out-of-order-amd-timestamp-lookup.patch

304803
autofs-5.1.0-beta1 - fix out of order amd timestamp lookup
304803
304803
From: Ian Kent <ikent@redhat.com>
304803
304803
The call in ->lookup_init() for an ldap source tries to get the amd
304803
ldap entry timestamp whether or not the map is amd format.
304803
---
304803
 CHANGELOG             |    1 +
304803
 modules/lookup_ldap.c |    7 +++++--
304803
 2 files changed, 6 insertions(+), 2 deletions(-)
304803
304803
--- autofs-5.0.7.orig/CHANGELOG
304803
+++ autofs-5.0.7/CHANGELOG
304803
@@ -110,6 +110,7 @@
304803
 - extend fix for crash due to thread unsafe use of libldap.
304803
 - add amd map format parser.
304803
 - fix wildcard key lookup.
304803
+- fix out of order amd timestamp lookup.
304803
 
304803
 25/07/2012 autofs-5.0.7
304803
 =======================
304803
--- autofs-5.0.7.orig/modules/lookup_ldap.c
304803
+++ autofs-5.0.7/modules/lookup_ldap.c
304803
@@ -1621,6 +1621,7 @@ static void validate_uris(struct list_he
304803
  */
304803
 int lookup_init(const char *mapfmt, int argc, const char *const *argv, void **context)
304803
 {
304803
+	unsigned int is_amd_format;
304803
 	struct lookup_context *ctxt;
304803
 	char buf[MAX_ERR_BUF];
304803
 	int ret;
304803
@@ -1647,6 +1648,7 @@ int lookup_init(const char *mapfmt, int
304803
 	if (mapfmt == NULL)
304803
 		mapfmt = MAPFMT_DEFAULT;
304803
 	if (!strcmp(mapfmt, "amd")) {
304803
+		is_amd_format = 1;
304803
 		ctxt->format = MAP_FLAG_FORMAT_AMD;
304803
 		ctxt->check_defaults = 1;
304803
 	}
304803
@@ -1654,7 +1656,7 @@ int lookup_init(const char *mapfmt, int
304803
 	ctxt->timeout = defaults_get_ldap_timeout();
304803
 	ctxt->network_timeout = defaults_get_ldap_network_timeout();
304803
 
304803
-	if (!(ctxt->format & MAP_FLAG_FORMAT_AMD)) {
304803
+	if (!is_amd_format) {
304803
 		/*
304803
 		 * Parse out the server name and base dn, and fill them
304803
 		 * into the proper places in the lookup context structure.
304803
@@ -1746,7 +1748,8 @@ int lookup_init(const char *mapfmt, int
304803
 	}
304803
 #endif
304803
 
304803
-	ctxt->timestamp = get_amd_timestamp(ctxt);
304803
+	if (is_amd_format)
304803
+		ctxt->timestamp = get_amd_timestamp(ctxt);
304803
 
304803
 	/* Open the parser, if we can. */
304803
 	ctxt->parse = open_parse(mapfmt, MODPREFIX, argc - 1, argv + 1);