diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1996-10-18 15:46:18 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1996-10-18 15:46:18 +0000 |
commit | 30ac0cb6ccf032c44c08beda24a3d23472cb4f1a (patch) | |
tree | 3cd96d7f561430e92bb4411e8cc5e48d182c1bee /driver.c | |
parent | aec15b99bf6b340227895ecfa6136e9d638c701a (diff) | |
download | fetchmail-30ac0cb6ccf032c44c08beda24a3d23472cb4f1a.tar.gz fetchmail-30ac0cb6ccf032c44c08beda24a3d23472cb4f1a.tar.bz2 fetchmail-30ac0cb6ccf032c44c08beda24a3d23472cb4f1a.zip |
Use seteuid(2) during MDA execution.
svn path=/trunk/; revision=346
Diffstat (limited to 'driver.c')
-rw-r--r-- | driver.c | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -652,8 +652,25 @@ struct method *proto; /* protocol method table */ /* open the delivery pipe now if we're using an MDA */ if (queryctl->mda[0]) - if ((mboxfd = openmailpipe(queryctl)) < 0) + { +#ifdef HAVE_SETEUID + /* + * Arrange to run with user's permissions if we're root. + * This will initialize the ownership of any files the + * MDA creates properly. (The seteuid call is available + * under all BSDs and Linux) + */ + seteuid(queryctl->uid); +#endif /* HAVE_SETEUID */ + mboxfd = openmailpipe(queryctl); +#ifdef HAVE_SETEUID + /* this will fail quietly if we didn't start as root */ + seteuid(0); +#endif /* HAVE_SETEUID */ + + if (mboxfd < 0) goto cleanUp; + } /* read the message and ship it to the output sink */ ok = gen_readmsg(socket, mboxfd, |