diff --git a/CHANGELOG b/CHANGELOG index 88b6a47..6f6e71f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -32,6 +32,7 @@ - allow only one master map read task at a time. - fix misc memory leaks. - mitigate manual umount of automounts where possible. +- fix multiply recursive bind mounts. 1/9/2006 autofs-5.0.1 rc2 ------------------------- diff --git a/daemon/spawn.c b/daemon/spawn.c index 84df3b9..7510b96 100644 --- a/daemon/spawn.c +++ b/daemon/spawn.c @@ -96,6 +96,9 @@ static int do_spawn(logger *log, unsigne unsigned int use_lock = options & SPAWN_OPT_LOCK; unsigned int use_opendir = options & SPAWN_OPT_OPENDIR; sigset_t allsigs, tmpsig, oldsig; + struct thread_stdenv_vars *tsv; + pid_t euid = 0; + gid_t egid = 0; if (pipe(pipefd)) return -1; @@ -111,6 +114,12 @@ static int do_spawn(logger *log, unsigne fatal(status); } + tsv = pthread_getspecific(key_thread_stdenv_vars); + if (tsv) { + euid = tsv->uid; + egid = tsv->gid; + } + f = fork(); if (f == 0) { reset_signals(); @@ -131,11 +140,23 @@ static int do_spawn(logger *log, unsigne argc++; argc -= 2; - /* Set non-autofs program group to trigger mount */ + /* + * Pretend to be requesting user and set non-autofs + * program group to trigger mount + */ + if (euid) { + seteuid(euid); + setegid(egid); + } setpgrp(); + + /* Trigger the recursive mount */ if ((dfd = opendir(argv[argc])) == NULL) _exit(errno); closedir(dfd); + + seteuid(0); + setegid(0); setpgid(0, pgrp); }