]> git.pld-linux.org Git - packages/autofs.git/blame - autofs-5.0.2-check-auto_master.patch
- rel.1, lets try
[packages/autofs.git] / autofs-5.0.2-check-auto_master.patch
CommitLineData
3d551623
PG
1diff --git a/CHANGELOG b/CHANGELOG
2index 795ec30..1c147c5 100644
3--- a/CHANGELOG
4+++ b/CHANGELOG
5@@ -40,6 +40,7 @@
6 - add map re-load to verbose logging.
7 - fix handling of LDAP base dns with spaces.
8 - handle MTAB_NOTUPDATED status return from mount.
9+- when default master map, auto.master, is used also check for auto_master.
10
11 18/06/2007 autofs-5.0.2
12 -----------------------
13diff --git a/daemon/lookup.c b/daemon/lookup.c
14index fd99cf2..0be10d3 100644
15--- a/daemon/lookup.c
16+++ b/daemon/lookup.c
17@@ -222,6 +222,28 @@ int lookup_nss_read_master(struct master *master, time_t age)
18 "reading master %s %s", this->source, master->name);
19
20 result = read_master_map(master, this->source, age);
21+
22+ /*
23+ * If the name of the master map hasn't been explicitly
24+ * configured and we're not reading an included master map
25+ * then we're using auto.master as the default. Many setups
26+ * also use auto_master as the default master map so we
27+ * check for this map when auto.master isn't found.
28+ */
29+ if (result != NSS_STATUS_SUCCESS &&
30+ !master->depth && !defaults_master_set()) {
31+ char *tmp = strchr(master->name, '.');
32+ if (tmp) {
33+ debug(logopt,
34+ "%s not found, replacing '.' with '_'",
35+ master->name);
36+ *tmp = '_';
37+ result = read_master_map(master, this->source, age);
38+ if (result != NSS_STATUS_SUCCESS)
39+ *tmp = '.';
40+ }
41+ }
42+
43 if (result == NSS_STATUS_UNKNOWN) {
44 debug(logopt, "no map - continuing to next source");
45 continue;
46diff --git a/include/defaults.h b/include/defaults.h
47index 0e0e2a5..e296478 100644
48--- a/include/defaults.h
49+++ b/include/defaults.h
50@@ -43,6 +43,7 @@ struct ldap_searchdn;
51
52 unsigned int defaults_read_config(unsigned int);
53 const char *defaults_get_master_map(void);
54+int defaults_master_set(void);
55 unsigned int defaults_get_timeout(void);
56 unsigned int defaults_get_browse_mode(void);
57 unsigned int defaults_get_logging(void);
58diff --git a/lib/defaults.c b/lib/defaults.c
59index 94885e8..f494103 100644
60--- a/lib/defaults.c
61+++ b/lib/defaults.c
62@@ -350,6 +350,15 @@ const char *defaults_get_master_map(void)
63 return (const char *) master;
64 }
65
66+int defaults_master_set(void)
67+{
68+ char *val = getenv(ENV_NAME_MASTER_MAP);
69+ if (!val)
70+ return 0;
71+
72+ return 1;
73+}
74+
75 unsigned int defaults_get_timeout(void)
76 {
77 long timeout;
This page took 0.0463 seconds and 4 git commands to generate.