From 58c6e71b4dd2ca1e9cbf3f913d8c16b4d6d1a3b1 Mon Sep 17 00:00:00 2001 From: Packit Service Date: Nov 06 2020 06:10:54 +0000 Subject: Apply patch autofs-5.1.4-better-handle-hesiod-support-not-built-in.patch patch_name: autofs-5.1.4-better-handle-hesiod-support-not-built-in.patch present_in_specfile: true --- diff --git a/CHANGELOG b/CHANGELOG index 4014d4a..f374706 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -36,6 +36,7 @@ xx/xx/2018 autofs-5.1.5 - fix use after free in parse_ldap_config(). - fix incorrect locking in sss lookup. - fix amd parser opts option handling. +- better handle hesiod support not built in. 19/12/2017 autofs-5.1.4 - fix spec file url. diff --git a/lib/master_parse.y b/lib/master_parse.y index 84ca5ca..9aa5732 100644 --- a/lib/master_parse.y +++ b/lib/master_parse.y @@ -171,7 +171,14 @@ line: if ((tmp = strchr($2, ','))) *tmp++ = '\0'; - +#ifndef WITH_HESIOD + /* Map type or or map type parser is hesiod */ + if (!strcmp($2, "hesiod") || !strcmp(tmp, "hesiod")) { + master_error("hesiod support not built in"); + local_free_vars(); + YYABORT; + } +#endif if (type) free(type); type = master_strdup($2); @@ -352,7 +359,14 @@ map: PATH if ((tmp = strchr($1, ','))) *tmp++ = '\0'; - +#ifndef WITH_HESIOD + /* Map type or or map type parser is hesiod */ + if (!strcmp($1, "hesiod") || !strcmp(tmp, "hesiod")) { + master_error("hesiod support not built in"); + local_free_vars(); + YYABORT; + } +#endif if (type) free(type); if (strcmp($1, "exec")) diff --git a/modules/amd_parse.y b/modules/amd_parse.y index be923c2..17fd9b2 100644 --- a/modules/amd_parse.y +++ b/modules/amd_parse.y @@ -574,6 +574,13 @@ static int match_map_option_map_type(char *map_option, char *type) !strcmp(map_type, "nisplus") || !strcmp(map_type, "ldap") || !strcmp(map_type, "hesiod")) { +#ifndef WITH_HESIOD + if (!strcmp(map_type, "hesiod")) { + amd_msg("hesiod support not built in"); + free(map_type); + return 0; + } +#endif amd_set_value(&entry.map_type, map_type); } else if (!strcmp(map_type, "exec")) { /* autofs uses "program" for "exec" map type */ diff --git a/modules/parse_amd.c b/modules/parse_amd.c index 627c3c0..5eee3ca 100644 --- a/modules/parse_amd.c +++ b/modules/parse_amd.c @@ -1871,15 +1871,25 @@ struct amd_entry *make_default_entry(struct autofs_point *ap, if (amd_parse_list(ap, defaults, &dflts, &sv)) return NULL; defaults_entry = list_entry(dflts.next, struct amd_entry, list); - list_del_init(&defaults_entry->list); /* * If map type isn't given try to inherit from * parent. A NULL map type is valid and means * use configured nss sources. */ map_type = conf_amd_get_map_type(ap->path); - if (map_type) + if (map_type) { defaults_entry->map_type = map_type; +#ifndef HAVE_HESIOD + if (!strcmp(map_type, "hesiod")) { + warn(ap->logopt, MODPREFIX + "hesiod support not built in, " + "defaults map entry not set"); + defaults_entry = NULL; + } +#endif + } + if (defaults_entry) + list_del_init(&defaults_entry->list); /* The list should now be empty .... */ free_amd_entry_list(&dflts); return defaults_entry; @@ -2005,8 +2015,20 @@ static struct amd_entry *get_defaults_entry(struct autofs_point *ap, * use configured nss sources. */ char *map_type = conf_amd_get_map_type(ap->path); - if (map_type) + if (map_type) { entry->map_type = map_type; +#ifndef HAVE_HESIOD + if (!strcmp(map_type, "hesiod")) { + warn(ap->logopt, MODPREFIX + "hesiod support not built in, " + "attempting to use internal " + "default"); + free_amd_entry(entry); + free(expand); + goto out; + } +#endif + } } free(expand); }