autofs/autofs-5.0.2-check-auto_master.patch
Ian Kent 36ee8299b4 - fix schema selection in LDAP schema discovery.
- check for "*" when looking up wildcard in LDAP.
- fix couple of edge case parse fails of timeout option.
- add SEARCH_BASE configuration option.
- add random selection as a master map entry option.
- re-read config on HUP signal.
- add LDAP_URI, LDAP_TIMEOUT and LDAP_NETWORK_TIMEOUT configuration
    options.
- fix deadlock in submount mount module.
- fix lack of ferror() checking when reading files.
- fix typo in autofs(5) man page.
- fix map entry expansion when undefined macro is present.
- remove unused export validation code.
- add dynamic logging (adapted from v4 patch from Jeff Moyer).
- fix recursive loopback mounts (Matthias Koenig).
- add map re-load to verbose logging.
- fix handling of LDAP base dns with spaces.
- handle MTAB_NOTUPDATED status return from mount.
- when default master map, auto.master, is used also check for auto_master.
- update negative mount timeout handling.
- fix large group handling (Ryan Thomas).
- fix for dynamic logging breaking non-sasl build (Guillaume Rousse).
- eliminate NULL proc ping for singleton host or local mounts.
2007-11-20 07:34:21 +00:00

66 lines
1.9 KiB
Diff

diff --git a/daemon/lookup.c b/daemon/lookup.c
index fd99cf2..0be10d3 100644
--- a/daemon/lookup.c
+++ b/daemon/lookup.c
@@ -222,6 +222,28 @@ int lookup_nss_read_master(struct master *master, time_t age)
"reading master %s %s", this->source, master->name);
result = read_master_map(master, this->source, age);
+
+ /*
+ * If the name of the master map hasn't been explicitly
+ * configured and we're not reading an included master map
+ * then we're using auto.master as the default. Many setups
+ * also use auto_master as the default master map so we
+ * check for this map when auto.master isn't found.
+ */
+ if (result != NSS_STATUS_SUCCESS &&
+ !master->depth && !defaults_master_set()) {
+ char *tmp = strchr(master->name, '.');
+ if (tmp) {
+ debug(logopt,
+ "%s not found, replacing '.' with '_'",
+ master->name);
+ *tmp = '_';
+ result = read_master_map(master, this->source, age);
+ if (result != NSS_STATUS_SUCCESS)
+ *tmp = '.';
+ }
+ }
+
if (result == NSS_STATUS_UNKNOWN) {
debug(logopt, "no map - continuing to next source");
continue;
diff --git a/include/defaults.h b/include/defaults.h
index 0e0e2a5..e296478 100644
--- a/include/defaults.h
+++ b/include/defaults.h
@@ -43,6 +43,7 @@ struct ldap_searchdn;
unsigned int defaults_read_config(unsigned int);
const char *defaults_get_master_map(void);
+int defaults_master_set(void);
unsigned int defaults_get_timeout(void);
unsigned int defaults_get_browse_mode(void);
unsigned int defaults_get_logging(void);
diff --git a/lib/defaults.c b/lib/defaults.c
index 94885e8..f494103 100644
--- a/lib/defaults.c
+++ b/lib/defaults.c
@@ -350,6 +350,15 @@ const char *defaults_get_master_map(void)
return (const char *) master;
}
+int defaults_master_set(void)
+{
+ char *val = getenv(ENV_NAME_MASTER_MAP);
+ if (!val)
+ return 0;
+
+ return 1;
+}
+
unsigned int defaults_get_timeout(void)
{
long timeout;