autofs-5.1.1 - fix out of order call in program map lookup From: Ian Kent Commit 91e42e58b4 fixed a problem with program map environment variable naming and commit 743deb0e4e added a configuration option to force use of the old environment names for those who need it and are sure it is safe to continue to use them. But the call to get the configuration entry was placed after a fork() so the state of the mutex used when querying the configuration is undefined and can lead to a deadlock. Signed-off-by: Ian Kent --- CHANGELOG | 1 + modules/lookup_program.c | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 2c516e4..3dd28cc 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -20,6 +20,7 @@ - change lookup to use reinit instead of reopen. - update map_hash_table_size description. - add configuration option to use fqdn in mounts. +- fix out of order call in program map lookup. 21/04/2015 autofs-5.1.1 ======================= diff --git a/modules/lookup_program.c b/modules/lookup_program.c index 3e9c448..a46ff0e 100644 --- a/modules/lookup_program.c +++ b/modules/lookup_program.c @@ -200,6 +200,16 @@ static char *lookup_one(struct autofs_point *ap, } /* + * By default use a prefix with standard environment + * variables to prevent system subversion by interpreted + * languages. + */ + if (defaults_force_std_prog_map_env()) + prefix = NULL; + else + prefix = "AUTOFS_"; + + /* * We don't use popen because we don't want to run /bin/sh plus we * want to send stderr to the syslog, and we don't use spawnl() * because we need the pipe hooks @@ -238,16 +248,6 @@ static char *lookup_one(struct autofs_point *ap, ap->path, ctxt->mapname); /* - * By default use a prefix with standard environment - * variables to prevent system subversion by interpreted - * languages. - */ - if (defaults_force_std_prog_map_env()) - prefix = NULL; - else - prefix = "AUTOFS_"; - - /* * MAPFMT_DEFAULT must be "sun" for ->parse_init() to have setup * the macro table. */