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