Subject: vacation doesn't work if homedir not present
To: None <tech-userlevel@NetBSD.org>
From: Edgar =?iso-8859-1?B?RnXf?= <ef@math.uni-bonn.de>
List: tech-userlevel
Date: 07/13/2007 16:55:04
The vacation utility tries to chdir() to an account's home directory,
which fails on a mail server like ours where homedirs are not mounted.
I think this chdir() is superflous if both the database and message files
have been specified as absolute paths. So one could change this block

	if (chdir(pw->pw_dir)) {
 		syslog(LOG_ERR, "%s: no such directory %s.",
 		    getprogname(), pw->pw_dir);
 		exit(1);
	}

to either

	if (chdir(pw->pw_dir) && (dbprefix[0] != '/' || msgfile[0] != '/')) {
etc.

or
	if ((dbprefix[0] != '/' || msgfile[0] != '/') && chdir(pw->pw_dir)) {
etc.

or something along the lines of
	if (chdir(pw->pw_dir)) {
		if (dbprefix[0] == '/' && msgfile[0] == '/') {
 			syslog(LOG_INFO, "%s: no such directory %s.",
 			    getprogname(), pw->pw_dir);
		} else {
 			syslog(LOG_ERR, "%s: no such directory %s.",
 			    getprogname(), pw->pw_dir);
 			exit(1);
		}
	}

Comments? I'm not entirely sure of the implications of this change to the
invocation of sendmail later in the code.