|
|
135b98 |
autofs-5.1.4 - better handle hesiod support not built in
|
|
|
135b98 |
|
|
|
135b98 |
From: Ian Kent <raven@themaw.net>
|
|
|
135b98 |
|
|
|
135b98 |
The configure option --without-hesiod is not handled well.
|
|
|
135b98 |
|
|
|
135b98 |
If this option is given and hesiod is seen in the master
|
|
|
135b98 |
map parser or the amd map parser issue a message telling
|
|
|
135b98 |
the user hesiod support isn't built in.
|
|
|
135b98 |
|
|
|
135b98 |
Signed-off-by: Ian Kent <raven@themaw.net>
|
|
|
135b98 |
---
|
|
|
135b98 |
CHANGELOG | 1 +
|
|
|
135b98 |
lib/master_parse.y | 18 ++++++++++++++++--
|
|
|
135b98 |
modules/amd_parse.y | 7 +++++++
|
|
|
135b98 |
modules/parse_amd.c | 28 +++++++++++++++++++++++++---
|
|
|
135b98 |
4 files changed, 49 insertions(+), 5 deletions(-)
|
|
|
135b98 |
|
|
|
135b98 |
--- autofs-5.1.4.orig/CHANGELOG
|
|
|
135b98 |
+++ autofs-5.1.4/CHANGELOG
|
|
|
135b98 |
@@ -36,6 +36,7 @@ xx/xx/2018 autofs-5.1.5
|
|
|
135b98 |
- fix use after free in parse_ldap_config().
|
|
|
135b98 |
- fix incorrect locking in sss lookup.
|
|
|
135b98 |
- fix amd parser opts option handling.
|
|
|
135b98 |
+- better handle hesiod support not built in.
|
|
|
135b98 |
|
|
|
135b98 |
19/12/2017 autofs-5.1.4
|
|
|
135b98 |
- fix spec file url.
|
|
|
135b98 |
--- autofs-5.1.4.orig/lib/master_parse.y
|
|
|
135b98 |
+++ autofs-5.1.4/lib/master_parse.y
|
|
|
135b98 |
@@ -171,7 +171,14 @@ line:
|
|
|
135b98 |
|
|
|
135b98 |
if ((tmp = strchr($2, ',')))
|
|
|
135b98 |
*tmp++ = '\0';
|
|
|
135b98 |
-
|
|
|
135b98 |
+#ifndef WITH_HESIOD
|
|
|
135b98 |
+ /* Map type or or map type parser is hesiod */
|
|
|
135b98 |
+ if (!strcmp($2, "hesiod") || !strcmp(tmp, "hesiod")) {
|
|
|
135b98 |
+ master_error("hesiod support not built in");
|
|
|
135b98 |
+ local_free_vars();
|
|
|
135b98 |
+ YYABORT;
|
|
|
135b98 |
+ }
|
|
|
135b98 |
+#endif
|
|
|
135b98 |
if (type)
|
|
|
135b98 |
free(type);
|
|
|
135b98 |
type = master_strdup($2);
|
|
|
135b98 |
@@ -352,7 +359,14 @@ map: PATH
|
|
|
135b98 |
|
|
|
135b98 |
if ((tmp = strchr($1, ',')))
|
|
|
135b98 |
*tmp++ = '\0';
|
|
|
135b98 |
-
|
|
|
135b98 |
+#ifndef WITH_HESIOD
|
|
|
135b98 |
+ /* Map type or or map type parser is hesiod */
|
|
|
135b98 |
+ if (!strcmp($1, "hesiod") || !strcmp(tmp, "hesiod")) {
|
|
|
135b98 |
+ master_error("hesiod support not built in");
|
|
|
135b98 |
+ local_free_vars();
|
|
|
135b98 |
+ YYABORT;
|
|
|
135b98 |
+ }
|
|
|
135b98 |
+#endif
|
|
|
135b98 |
if (type)
|
|
|
135b98 |
free(type);
|
|
|
135b98 |
if (strcmp($1, "exec"))
|
|
|
135b98 |
--- autofs-5.1.4.orig/modules/amd_parse.y
|
|
|
135b98 |
+++ autofs-5.1.4/modules/amd_parse.y
|
|
|
135b98 |
@@ -574,6 +574,13 @@ static int match_map_option_map_type(cha
|
|
|
135b98 |
!strcmp(map_type, "nisplus") ||
|
|
|
135b98 |
!strcmp(map_type, "ldap") ||
|
|
|
135b98 |
!strcmp(map_type, "hesiod")) {
|
|
|
135b98 |
+#ifndef WITH_HESIOD
|
|
|
135b98 |
+ if (!strcmp(map_type, "hesiod")) {
|
|
|
135b98 |
+ amd_msg("hesiod support not built in");
|
|
|
135b98 |
+ free(map_type);
|
|
|
135b98 |
+ return 0;
|
|
|
135b98 |
+ }
|
|
|
135b98 |
+#endif
|
|
|
135b98 |
amd_set_value(&entry.map_type, map_type);
|
|
|
135b98 |
} else if (!strcmp(map_type, "exec")) {
|
|
|
135b98 |
/* autofs uses "program" for "exec" map type */
|
|
|
135b98 |
--- autofs-5.1.4.orig/modules/parse_amd.c
|
|
|
135b98 |
+++ autofs-5.1.4/modules/parse_amd.c
|
|
|
135b98 |
@@ -1871,15 +1871,25 @@ struct amd_entry *make_default_entry(str
|
|
|
135b98 |
if (amd_parse_list(ap, defaults, &dflts, &sv))
|
|
|
135b98 |
return NULL;
|
|
|
135b98 |
defaults_entry = list_entry(dflts.next, struct amd_entry, list);
|
|
|
135b98 |
- list_del_init(&defaults_entry->list);
|
|
|
135b98 |
/*
|
|
|
135b98 |
* If map type isn't given try to inherit from
|
|
|
135b98 |
* parent. A NULL map type is valid and means
|
|
|
135b98 |
* use configured nss sources.
|
|
|
135b98 |
*/
|
|
|
135b98 |
map_type = conf_amd_get_map_type(ap->path);
|
|
|
135b98 |
- if (map_type)
|
|
|
135b98 |
+ if (map_type) {
|
|
|
135b98 |
defaults_entry->map_type = map_type;
|
|
|
135b98 |
+#ifndef HAVE_HESIOD
|
|
|
135b98 |
+ if (!strcmp(map_type, "hesiod")) {
|
|
|
135b98 |
+ warn(ap->logopt, MODPREFIX
|
|
|
135b98 |
+ "hesiod support not built in, "
|
|
|
135b98 |
+ "defaults map entry not set");
|
|
|
135b98 |
+ defaults_entry = NULL;
|
|
|
135b98 |
+ }
|
|
|
135b98 |
+#endif
|
|
|
135b98 |
+ }
|
|
|
135b98 |
+ if (defaults_entry)
|
|
|
135b98 |
+ list_del_init(&defaults_entry->list);
|
|
|
135b98 |
/* The list should now be empty .... */
|
|
|
135b98 |
free_amd_entry_list(&dflts);
|
|
|
135b98 |
return defaults_entry;
|
|
|
135b98 |
@@ -2005,8 +2015,20 @@ static struct amd_entry *get_defaults_en
|
|
|
135b98 |
* use configured nss sources.
|
|
|
135b98 |
*/
|
|
|
135b98 |
char *map_type = conf_amd_get_map_type(ap->path);
|
|
|
135b98 |
- if (map_type)
|
|
|
135b98 |
+ if (map_type) {
|
|
|
135b98 |
entry->map_type = map_type;
|
|
|
135b98 |
+#ifndef HAVE_HESIOD
|
|
|
135b98 |
+ if (!strcmp(map_type, "hesiod")) {
|
|
|
135b98 |
+ warn(ap->logopt, MODPREFIX
|
|
|
135b98 |
+ "hesiod support not built in, "
|
|
|
135b98 |
+ "attempting to use internal "
|
|
|
135b98 |
+ "default");
|
|
|
135b98 |
+ free_amd_entry(entry);
|
|
|
135b98 |
+ free(expand);
|
|
|
135b98 |
+ goto out;
|
|
|
135b98 |
+ }
|
|
|
135b98 |
+#endif
|
|
|
135b98 |
+ }
|
|
|
135b98 |
}
|
|
|
135b98 |
free(expand);
|
|
|
135b98 |
}
|