summaryrefslogtreecommitdiffstats
path: root/contrib/sendmail/src/control.c
diff options
context:
space:
mode:
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