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

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