|
|
306fa1 |
autofs-5.1.3 - improve debug logging of lookup key
|
|
|
306fa1 |
|
|
|
306fa1 |
From: Ian Kent <raven@themaw.net>
|
|
|
306fa1 |
|
|
|
306fa1 |
When looking up an amd format map key, if there is a prefix it
|
|
|
306fa1 |
will be used in matching the map key.
|
|
|
306fa1 |
|
|
|
306fa1 |
So print the actual matched key string in debug log output.
|
|
|
306fa1 |
|
|
|
306fa1 |
Signed-off-by: Ian Kent <raven@themaw.net>
|
|
|
306fa1 |
---
|
|
|
306fa1 |
CHANGELOG | 1 +
|
|
|
306fa1 |
modules/lookup_file.c | 14 ++++++++++----
|
|
|
306fa1 |
modules/lookup_hesiod.c | 20 +++++++++++++++++---
|
|
|
306fa1 |
modules/lookup_ldap.c | 15 ++++++++++++---
|
|
|
306fa1 |
modules/lookup_nisplus.c | 15 ++++++++++++---
|
|
|
306fa1 |
modules/lookup_yp.c | 43 +++++++++++++++++++++++++------------------
|
|
|
306fa1 |
6 files changed, 77 insertions(+), 31 deletions(-)
|
|
|
306fa1 |
|
|
|
306fa1 |
--- autofs-5.0.7.orig/CHANGELOG
|
|
|
306fa1 |
+++ autofs-5.0.7/CHANGELOG
|
|
|
306fa1 |
@@ -266,6 +266,7 @@
|
|
|
306fa1 |
- handle additional nfs versions in mount_nfs.c.
|
|
|
306fa1 |
- improve description of mount_nfs_default_protocol.
|
|
|
306fa1 |
- reset master map list on startup retry.
|
|
|
306fa1 |
+- improve debug logging of lookup key.
|
|
|
306fa1 |
|
|
|
306fa1 |
25/07/2012 autofs-5.0.7
|
|
|
306fa1 |
=======================
|
|
|
306fa1 |
--- autofs-5.0.7.orig/modules/lookup_file.c
|
|
|
306fa1 |
+++ autofs-5.0.7/modules/lookup_file.c
|
|
|
306fa1 |
@@ -1290,18 +1290,24 @@ do_cache_lookup:
|
|
|
306fa1 |
}
|
|
|
306fa1 |
}
|
|
|
306fa1 |
cache_unlock(mc);
|
|
|
306fa1 |
- free(lkp_key);
|
|
|
306fa1 |
|
|
|
306fa1 |
- if (!me)
|
|
|
306fa1 |
+ if (!me) {
|
|
|
306fa1 |
+ free(lkp_key);
|
|
|
306fa1 |
return NSS_STATUS_NOTFOUND;
|
|
|
306fa1 |
+ }
|
|
|
306fa1 |
|
|
|
306fa1 |
- if (!mapent)
|
|
|
306fa1 |
+ if (!mapent) {
|
|
|
306fa1 |
+ free(lkp_key);
|
|
|
306fa1 |
return NSS_STATUS_TRYAGAIN;
|
|
|
306fa1 |
+ }
|
|
|
306fa1 |
+
|
|
|
306fa1 |
+ debug(ap->logopt, MODPREFIX "%s -> %s", lkp_key, mapent);
|
|
|
306fa1 |
+
|
|
|
306fa1 |
+ free(lkp_key);
|
|
|
306fa1 |
|
|
|
306fa1 |
master_source_current_wait(ap->entry);
|
|
|
306fa1 |
ap->entry->current = source;
|
|
|
306fa1 |
|
|
|
306fa1 |
- debug(ap->logopt, MODPREFIX "%s -> %s", key, mapent);
|
|
|
306fa1 |
ret = ctxt->parse->parse_mount(ap, key, key_len,
|
|
|
306fa1 |
mapent, ctxt->parse->context);
|
|
|
306fa1 |
if (ret) {
|
|
|
306fa1 |
--- autofs-5.0.7.orig/modules/lookup_hesiod.c
|
|
|
306fa1 |
+++ autofs-5.0.7/modules/lookup_hesiod.c
|
|
|
306fa1 |
@@ -466,14 +466,28 @@ int lookup_mount(struct autofs_point *ap
|
|
|
306fa1 |
}
|
|
|
306fa1 |
|
|
|
306fa1 |
me = match_cached_key(ap, MODPREFIX, source, lkp_key);
|
|
|
306fa1 |
- free(lkp_key);
|
|
|
306fa1 |
- if (!me)
|
|
|
306fa1 |
+
|
|
|
306fa1 |
+ if (!me) {
|
|
|
306fa1 |
+ free(lkp_key);
|
|
|
306fa1 |
return NSS_STATUS_NOTFOUND;
|
|
|
306fa1 |
+ }
|
|
|
306fa1 |
|
|
|
306fa1 |
- if (!me->mapent)
|
|
|
306fa1 |
+ if (!me->mapent) {
|
|
|
306fa1 |
+ free(lkp_key);
|
|
|
306fa1 |
return NSS_STATUS_UNAVAIL;
|
|
|
306fa1 |
+ }
|
|
|
306fa1 |
|
|
|
306fa1 |
mapent = strdup(me->mapent);
|
|
|
306fa1 |
+ if (!mapent) {
|
|
|
306fa1 |
+ char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
|
|
306fa1 |
+ error(ap->logopt, "malloc: %s", estr);
|
|
|
306fa1 |
+ free(lkp_key);
|
|
|
306fa1 |
+ return NSS_STATUS_UNKNOWN;
|
|
|
306fa1 |
+ }
|
|
|
306fa1 |
+
|
|
|
306fa1 |
+ debug(ap->logopt, MODPREFIX "%s -> %s", lkp_key, mapent);
|
|
|
306fa1 |
+
|
|
|
306fa1 |
+ free(lkp_key);
|
|
|
306fa1 |
|
|
|
306fa1 |
rv = ctxt->parser->parse_mount(ap, key, key_len,
|
|
|
306fa1 |
mapent, ctxt->parser->context);
|
|
|
306fa1 |
--- autofs-5.0.7.orig/modules/lookup_ldap.c
|
|
|
306fa1 |
+++ autofs-5.0.7/modules/lookup_ldap.c
|
|
|
306fa1 |
@@ -3785,15 +3785,24 @@ int lookup_mount(struct autofs_point *ap
|
|
|
306fa1 |
}
|
|
|
306fa1 |
}
|
|
|
306fa1 |
cache_unlock(mc);
|
|
|
306fa1 |
- free(lkp_key);
|
|
|
306fa1 |
|
|
|
306fa1 |
- if (!mapent)
|
|
|
306fa1 |
+ if (!me) {
|
|
|
306fa1 |
+ free(lkp_key);
|
|
|
306fa1 |
+ return NSS_STATUS_NOTFOUND;
|
|
|
306fa1 |
+ }
|
|
|
306fa1 |
+
|
|
|
306fa1 |
+ if (!mapent) {
|
|
|
306fa1 |
+ free(lkp_key);
|
|
|
306fa1 |
return NSS_STATUS_TRYAGAIN;
|
|
|
306fa1 |
+ }
|
|
|
306fa1 |
+
|
|
|
306fa1 |
+ debug(ap->logopt, MODPREFIX "%s -> %s", lkp_key, mapent);
|
|
|
306fa1 |
+
|
|
|
306fa1 |
+ free(lkp_key);
|
|
|
306fa1 |
|
|
|
306fa1 |
master_source_current_wait(ap->entry);
|
|
|
306fa1 |
ap->entry->current = source;
|
|
|
306fa1 |
|
|
|
306fa1 |
- debug(ap->logopt, MODPREFIX "%s -> %s", key, mapent);
|
|
|
306fa1 |
ret = ctxt->parse->parse_mount(ap, key, key_len,
|
|
|
306fa1 |
mapent, ctxt->parse->context);
|
|
|
306fa1 |
if (ret) {
|
|
|
306fa1 |
--- autofs-5.0.7.orig/modules/lookup_nisplus.c
|
|
|
306fa1 |
+++ autofs-5.0.7/modules/lookup_nisplus.c
|
|
|
306fa1 |
@@ -824,15 +824,24 @@ int lookup_mount(struct autofs_point *ap
|
|
|
306fa1 |
}
|
|
|
306fa1 |
}
|
|
|
306fa1 |
cache_unlock(mc);
|
|
|
306fa1 |
- free(lkp_key);
|
|
|
306fa1 |
|
|
|
306fa1 |
- if (!mapent)
|
|
|
306fa1 |
+ if (!me) {
|
|
|
306fa1 |
+ free(lkp_key);
|
|
|
306fa1 |
+ return NSS_STATUS_NOTFOUND;
|
|
|
306fa1 |
+ }
|
|
|
306fa1 |
+
|
|
|
306fa1 |
+ if (!mapent) {
|
|
|
306fa1 |
+ free(lkp_key);
|
|
|
306fa1 |
return NSS_STATUS_TRYAGAIN;
|
|
|
306fa1 |
+ }
|
|
|
306fa1 |
+
|
|
|
306fa1 |
+ debug(ap->logopt, MODPREFIX "%s -> %s", lkp_key, mapent);
|
|
|
306fa1 |
+
|
|
|
306fa1 |
+ free(lkp_key);
|
|
|
306fa1 |
|
|
|
306fa1 |
master_source_current_wait(ap->entry);
|
|
|
306fa1 |
ap->entry->current = source;
|
|
|
306fa1 |
|
|
|
306fa1 |
- debug(ap->logopt, MODPREFIX "%s -> %s", key, mapent);
|
|
|
306fa1 |
ret = ctxt->parse->parse_mount(ap, key, key_len,
|
|
|
306fa1 |
mapent, ctxt->parse->context);
|
|
|
306fa1 |
if (ret) {
|
|
|
306fa1 |
--- autofs-5.0.7.orig/modules/lookup_yp.c
|
|
|
306fa1 |
+++ autofs-5.0.7/modules/lookup_yp.c
|
|
|
306fa1 |
@@ -928,28 +928,35 @@ int lookup_mount(struct autofs_point *ap
|
|
|
306fa1 |
}
|
|
|
306fa1 |
}
|
|
|
306fa1 |
cache_unlock(mc);
|
|
|
306fa1 |
+
|
|
|
306fa1 |
+ if (!me) {
|
|
|
306fa1 |
+ free(lkp_key);
|
|
|
306fa1 |
+ return NSS_STATUS_NOTFOUND;
|
|
|
306fa1 |
+ }
|
|
|
306fa1 |
+
|
|
|
306fa1 |
+ if (!mapent) {
|
|
|
306fa1 |
+ free(lkp_key);
|
|
|
306fa1 |
+ return NSS_STATUS_TRYAGAIN;
|
|
|
306fa1 |
+ }
|
|
|
306fa1 |
+
|
|
|
306fa1 |
+ debug(ap->logopt, MODPREFIX "%s -> %s", lkp_key, mapent);
|
|
|
306fa1 |
+
|
|
|
306fa1 |
free(lkp_key);
|
|
|
306fa1 |
|
|
|
306fa1 |
- if (mapent) {
|
|
|
306fa1 |
- master_source_current_wait(ap->entry);
|
|
|
306fa1 |
- ap->entry->current = source;
|
|
|
306fa1 |
-
|
|
|
306fa1 |
- debug(ap->logopt, MODPREFIX "%s -> %s", key, mapent);
|
|
|
306fa1 |
- ret = ctxt->parse->parse_mount(ap, key, key_len,
|
|
|
306fa1 |
- mapent, ctxt->parse->context);
|
|
|
306fa1 |
- if (ret) {
|
|
|
306fa1 |
- /* Don't update negative cache when re-connecting */
|
|
|
306fa1 |
- if (ap->flags & MOUNT_FLAG_REMOUNT)
|
|
|
306fa1 |
- return NSS_STATUS_TRYAGAIN;
|
|
|
306fa1 |
- cache_writelock(mc);
|
|
|
306fa1 |
- cache_update_negative(mc, source, key, ap->negative_timeout);
|
|
|
306fa1 |
- cache_unlock(mc);
|
|
|
306fa1 |
- return NSS_STATUS_TRYAGAIN;
|
|
|
306fa1 |
- }
|
|
|
306fa1 |
- }
|
|
|
306fa1 |
+ master_source_current_wait(ap->entry);
|
|
|
306fa1 |
+ ap->entry->current = source;
|
|
|
306fa1 |
|
|
|
306fa1 |
- if (ret)
|
|
|
306fa1 |
+ ret = ctxt->parse->parse_mount(ap, key, key_len,
|
|
|
306fa1 |
+ mapent, ctxt->parse->context);
|
|
|
306fa1 |
+ if (ret) {
|
|
|
306fa1 |
+ /* Don't update negative cache when re-connecting */
|
|
|
306fa1 |
+ if (ap->flags & MOUNT_FLAG_REMOUNT)
|
|
|
306fa1 |
+ return NSS_STATUS_TRYAGAIN;
|
|
|
306fa1 |
+ cache_writelock(mc);
|
|
|
306fa1 |
+ cache_update_negative(mc, source, key, ap->negative_timeout);
|
|
|
306fa1 |
+ cache_unlock(mc);
|
|
|
306fa1 |
return NSS_STATUS_TRYAGAIN;
|
|
|
306fa1 |
+ }
|
|
|
306fa1 |
|
|
|
306fa1 |
return NSS_STATUS_SUCCESS;
|
|
|
306fa1 |
}
|