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