summaryrefslogtreecommitdiff
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
commit5d5eab6f91c923881168d740b263206a3976a85f (patch)
tree364b0ad8b1c07685caf64d6900318ab9933361e4
parent4f078c1accf0fcc0c7feec6a55b3ba89adade829 (diff)
Better error messages for 'run as user'
-rw-r--r--ChangeLog2
-rw-r--r--common/smtppass.c13
-rw-r--r--configure.in4
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 <nielsen@memberwebs.com>
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"