autofs-5.1.0-beta1 - fix out of order amd timestamp lookup From: Ian Kent 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(-) diff --git a/CHANGELOG b/CHANGELOG index 1127ecd..d788ea0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -10,6 +10,7 @@ - amd lookup update lookup hesiod to handle amd keys. - inadvertantly dropped from initial series. - fix wildcard key lookup. +- fix out of order amd timestamp lookup. 28/03/2014 autofs-5.0.9 ======================= diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c index dac346c..c9541ed 100644 --- a/modules/lookup_ldap.c +++ b/modules/lookup_ldap.c @@ -1621,6 +1621,7 @@ static void validate_uris(struct list_head *list) */ 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 argc, const char *const *argv, void **co 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 argc, const char *const *argv, void **co 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 argc, const char *const *argv, void **co } #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);