Hello,
I built qmail V1.03 on a Solaris 2.5.1 (SPARC) machine.
All went well, but when I tried to do some tests, a strange behaviour
appeared. I was successfully able to do a local-to-local delivery running
the following command as "pv" (a local non-privileged username):
echo to: pv | /var/qmail/bin/qmail-inject
But when I tried to run the same command as root, it failed with the
message:
qmail-inject: fatal: qq trouble in home directory (#4.3.0)
I looked into the syslog file: nothing.
I traced the run with truss(1), with the following command:
truss -iafe sh -c 'echo to: pv | /var/qmail/bin/qmail-inject' 2>&1
and this is (part of) the output:
------------------------------- (cut here) ----------------------------------
1243: execve("/bin/sh", 0xEFFFFD5C, 0xEFFFFD6C) argc = 3
1243: argv: sh -c echo to: pv | /var/qmail/bin/qmail-inject
1243: envp: FROMUSER=root HOME=/ HOSTNAME=lacerta HZ=100
1243: LOGNAME=root MAIL=/usr/local/qmail/alias/Mailbox
1243:
MANPATH=/usr/share/man:/usr/openwin/share/man:/usr/dt/share/man:/usr/local/man
1243: MBOX=+mbox MOZILLA_HOME=/usr/local/netscape
1243:
PATH=/bin:/usr/bin:/usr/sbin:/usr/ccs/bin:/usr/ucb:/usr/openwin/bin:/usr/dt/bin:/usr/local/bin:/usr/local/sbin:/etc:/ccuuroot/bin
1243: PWD=/tmp SHELL=/bin/csh TERM=vt300 TZ=MET USER=root
1243: open("/dev/zero", O_RDONLY) = 3
.
.
.
1244: execve("/var/qmail/bin/qmail-inject", 0x00038884, 0x0003888C) argc = 1
1244: argv: /var/qmail/bin/qmail-inject
1244: envp: FROMUSER=root HOME=/ HOSTNAME=lacerta HZ=100
1244: LOGNAME=root MAIL=/usr/local/qmail/alias/Mailbox
1244:
MANPATH=/usr/share/man:/usr/openwin/share/man:/usr/dt/share/man:/usr/local/man
1244: MBOX=+mbox MOZILLA_HOME=/usr/local/netscape
1244:
PATH=/bin:/usr/bin:/usr/sbin:/usr/ccs/bin:/usr/ucb:/usr/openwin/bin:/usr/dt/bin:/usr/local/bin:/usr/local/sbin:/etc:/ccuuroot/bin
1244: PWD=/tmp SHELL=/bin/csh TERM=vt300 TZ=MET USER=root
1244: Received signal #18, SIGCLD [default]
1244: siginfo: SIGCLD CLD_EXITED pid=1246 status=0x0000
1244: open("/dev/zero", O_RDONLY) = 3
.
.
.
1244: chdir("/usr/local/qmail") = 0
.
.
.
1248: chdir("/usr/local/qmail") = 0
1248: execve("bin/qmail-queue", 0x0002A530, 0xEFFFFD8C) argc = 1
1248: *** SUID: ruid/euid/suid = 0 / 500 / 500 ***
1248: argv: bin/qmail-queue
1248: envp: FROMUSER=root HOME=/ HOSTNAME=lacerta HZ=100
1248: LOGNAME=root MAIL=/usr/local/qmail/alias/Mailbox
1248:
MANPATH=/usr/share/man:/usr/openwin/share/man:/usr/dt/share/man:/usr/local/man
1248: MBOX=+mbox MOZILLA_HOME=/usr/local/netscape
1248:
PATH=/bin:/usr/bin:/usr/sbin:/usr/ccs/bin:/usr/ucb:/usr/openwin/bin:/usr/dt/bin:/usr/local/bin:/usr/local/sbin:/etc:/ccuuroot/bin
1248: PWD=/tmp SHELL=/bin/csh TERM=vt300 TZ=MET USER=root
1244: close(3) = 0
1248: open("/dev/zero", O_RDONLY) = 3
.
.
.
1248: chdir("/usr/local/qmail") Err#13 EACCES
1248: _exit(61)
1244: Received signal #18, SIGCLD, in waitid() [default]
1244: siginfo: SIGCLD CLD_EXITED pid=1248 status=0x003D
1244: waitid(P_PID, 1248, 0xEFFFFAD8, WEXITED|WTRAPPED) = 0
qmail-inject: fatal: qq trouble in home directory (#4.3.0)
1244: write(2, " q m a i l - i n j e c t".., 59) = 59
1244: _exit(111)
1243: Received signal #18, SIGCLD, in waitid() [default]
1243: siginfo: SIGCLD CLD_EXITED pid=1244 status=0x006F
1243: waitid(P_PID, 1244, 0xEFFFFAA0, WEXITED|WTRAPPED|WSTOPPED|WNOWAIT) = 0
1243: ioctl(0, TIOCGPGRP, 0xEFFFFA5C) = 0
1243: ioctl(0, TCGETS, 0x00037C24) = 0
1243: waitid(P_PID, 1244, 0xEFFFFAA0, WEXITED|WTRAPPED|WSTOPPED) = 0
1243: lseek(0, 0, SEEK_CUR) = 103
1243: _exit(111)
------------------------------- (cut here) ----------------------------------
The problem seem to be in the
chdir("/usr/local/qmail")
system call done by qmail-queue.
The question is: why qmail-queue can access regularly /usr/local/qmail when
called by a non-root account, but has permission problems when called by root?
Here are some supplementary data:
------------------------------- (cut here) ----------------------------------
% grep qmailq /etc/passwd
qmailq:x:500:500::/usr/local/qmail:/sbin/sh
% grep 500 /etc/group
qmail::500:
% ls -la /var/qmail
lrwxrwxrwx 1 root sys 16 Mar 29 12:58 /var/qmail -> /usr/local/qmail
% ls -lad / /usr /usr/local /usr/local/qmail
drwxr-sr-x 23 root root 1024 Mar 31 11:25 /
drwxrwxr-x 31 root sys 1024 Oct 20 1997 /usr
drwx--lr-x 17 root sys 512 Mar 29 11:19 /usr/local
drwxr-xr-x 10 root qmail 512 Mar 30 13:04 /usr/local/qmail
% cat `cat SYSDEPS`
qmail 1.03
sunos-5.5.1-generic_103640-18-:sparc-:sun4-:sun4u-:sun4u-
#ifndef SELECT_H
#define SELECT_H
#include <sys/types.h>
#include <sys/time.h>
#include <sys/select.h>
extern int select();
#endif
#ifndef FORK_H
#define FORK_H
extern int fork();
extern int vfork();
#endif
#define HASSIGACTION 1
#ifndef DIRENTRY_H
#define DIRENTRY_H
#include <sys/types.h>
#include <dirent.h>
#define direntry struct dirent
#endif
#define HASSIGPROCMASK 1
#define HASWAITPID 1
#define HASMKFIFO 1
#ifndef UINT32_H
#define UINT32_H
typedef unsigned long uint32;
#endif
-lresolv
-lsocket -lnsl
-lgen
------------------------------- (cut here) ----------------------------------
As a final remark: some months ago I built and installed qmail V1.02 on a
Solaris 2.6 (SPARC) machine and I didn't encounter this problem.
Any ideas?
Any hint will be greatly appreciated. TIA.
Paolo.Vicario
<[EMAIL PROTECTED]>