summaryrefslogtreecommitdiff
path: root/common/smtppass.c
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2004-09-18 00:03:17 +0000
committerStef Walter <stef@memberwebs.com>2004-09-18 00:03:17 +0000
commit56a390456508ed661d6137d417fdfe71b6a8acf9 (patch)
tree7526e50da35269744a781c39bf84e2ad1e5ae3ab /common/smtppass.c
parenta26eb466f043b70d6e2f2ca32fbd75c1d453c5b0 (diff)
Better error messages for 'run as user'
Diffstat (limited to 'common/smtppass.c')
-rw-r--r--common/smtppass.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/common/smtppass.c b/common/smtppass.c
index b13bdac..d1a62a0 100644
--- a/common/smtppass.c
+++ b/common/smtppass.c
@@ -372,11 +372,9 @@ static void drop_privileges()
if(pw == NULL)
errx(1, "couldn't look up user: %s", g_state.user);
- if(setgid(pw->pw_gid) == -1)
- err(1, "unable to switch group: %d", pw->pw_gid);
-
- if(setuid(pw->pw_uid) == -1)
- err(1, "unable to switch user: %d", pw->pw_uid);
+ if(setgid(pw->pw_gid) == -1 ||
+ setuid(pw->pw_uid) == -1)
+ err(1, "unable to switch to user: %s (uid %d, gid %d)", g_state.user, pw->pw_uid, pw->pw_gid);
/* A paranoia check */
if(setreuid(-1, 0) == 0)
@@ -1421,7 +1419,10 @@ static void vmessage(spctx_t* ctx, int level, int err,
{
/* TODO: strerror_r doesn't want to work for us
strerror_r(e, m + strlen(m), MAX_MSGLEN); */
- strncat(m, strerror(e), len);
+
+ sp_lock();
+ strncat(m, strerror(e), len);
+ sp_unlock();
}
m[len - 1] = 0;