summaryrefslogtreecommitdiffstats
path: root/contrib/sendmail/src/control.c
diff options
context:
space:
mode:
authorgshapiro <gshapiro@FreeBSD.org>2001-01-21 22:17:06 +0000
committergshapiro <gshapiro@FreeBSD.org>2001-01-21 22:17:06 +0000
commitc5e098efbef941858129b84a112a036d572ba53c (patch)
tree277ca53e5c12bcf1d38feccf7fd364839dbf811a /contrib/sendmail/src/control.c
parentf1e9c33a3410fd42927853cf01fb4279382f2bcf (diff)
parent167a83e7b8733416154f871e39e86ba77eb1554d (diff)
downloadFreeBSD-src-c5e098efbef941858129b84a112a036d572ba53c.zip
FreeBSD-src-c5e098efbef941858129b84a112a036d572ba53c.tar.gz
This commit was generated by cvs2svn to compensate for changes in r71345,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'contrib/sendmail/src/control.c')
-rw-r--r--contrib/sendmail/src/control.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/contrib/sendmail/src/control.c b/contrib/sendmail/src/control.c
index 7865b0e..dda2761 100644
--- a/contrib/sendmail/src/control.c
+++ b/contrib/sendmail/src/control.c
@@ -9,7 +9,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: control.c,v 8.44.14.8 2000/09/17 17:04:26 gshapiro Exp $";
+static char id[] = "@(#)$Id: control.c,v 8.44.14.13 2000/12/28 21:25:52 gshapiro Exp $";
#endif /* ! lint */
#include <sendmail.h>
@@ -77,16 +77,26 @@ opencontrolsocket()
return -1;
}
- if (geteuid() == 0 && TrustedUid != 0)
+ if (geteuid() == 0)
{
- if (chown(ControlSocketName, TrustedUid, -1) < 0)
+ uid_t u = 0;
+
+ if (RunAsUid != 0)
+ u = RunAsUid;
+ else if (TrustedUid != 0)
+ u = TrustedUid;
+
+ if (u != 0 &&
+ chown(ControlSocketName, u, -1) < 0)
{
save_errno = errno;
sm_syslog(LOG_ALERT, NOQID,
- "ownership change on %s failed: %s",
- ControlSocketName, errstring(save_errno));
- message("050 ownership change on %s failed: %s",
- ControlSocketName, errstring(save_errno));
+ "ownership change on %s to uid %d failed: %s",
+ ControlSocketName, (int) u,
+ errstring(save_errno));
+ message("050 ownership change on %s to uid %d failed: %s",
+ ControlSocketName, (int) u,
+ errstring(save_errno));
closecontrolsocket(TRUE);
errno = save_errno;
return -1;
@@ -141,8 +151,8 @@ closecontrolsocket(fullclose)
ControlSocket = -1;
}
- rval = safefile(ControlSocketName, RunAsUid, RunAsGid, RunAsUserName,
- sff, S_IRUSR|S_IWUSR, NULL);
+ rval = safefile(ControlSocketName, RunAsUid, RunAsGid,
+ RunAsUserName, sff, S_IRUSR|S_IWUSR, NULL);
/* if not safe, don't unlink */
if (rval != 0)
OpenPOWER on IntegriCloud