From 5d5eab6f91c923881168d740b263206a3976a85f Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Sat, 18 Sep 2004 00:03:17 +0000 Subject: Better error messages for 'run as user' --- ChangeLog | 2 ++ common/smtppass.c | 13 +++++++------ configure.in | 4 ++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index f502bd4..6edc605 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,8 @@ - Fixed some minor IO bugs - Changed default header to be similar to Amavis - Compiles and runs on systems without error checking mutexes + - Ability to run as a different user + - Fixed config file bugs 0.8 - clamsmtpd now uses a configuration file 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; diff --git a/configure.in b/configure.in index 28a81e5..7283d90 100644 --- a/configure.in +++ b/configure.in @@ -36,8 +36,8 @@ dnl Nate Nielsen dnl dnl Process this file with autoconf to produce a configure script. -AC_INIT(clamsmtp, 0.8.91, nielsen@memberwebs.com) -AM_INIT_AUTOMAKE(clamsmtp, 0.8.91) +AC_INIT(clamsmtp, 0.8.92, nielsen@memberwebs.com) +AM_INIT_AUTOMAKE(clamsmtp, 0.8.92) LDFLAGS="$LDFLAGS -L/usr/local/lib" CFLAGS="$CFLAGS -I/usr/local/include" -- cgit v1.2.3