summaryrefslogtreecommitdiffstats
path: root/libexec
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>1997-03-24 05:57:28 +0000
committerimp <imp@FreeBSD.org>1997-03-24 05:57:28 +0000
commit7f79bbed5b777c701afb47dfa79b43ff953c2b8a (patch)
tree7d1015143d75cb40fe6f0e5bb6ffeaad835b3b95 /libexec
parent3c8c5177a0a5ca7bb746709f0bd6d78c09f72627 (diff)
downloadFreeBSD-src-7f79bbed5b777c701afb47dfa79b43ff953c2b8a.zip
FreeBSD-src-7f79bbed5b777c701afb47dfa79b43ff953c2b8a.tar.gz
Julian A's fix. Do chdir as user rather than as root. Fixes a minor NFS
compatibility problem at the same time. Some buffer made large enough for worst case hostname. fixes PR 2593. Reviewed by: Dan Cross and maybe others
Diffstat (limited to 'libexec')
-rw-r--r--libexec/rexecd/rexecd.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/libexec/rexecd/rexecd.c b/libexec/rexecd/rexecd.c
index a54a5af..119551e 100644
--- a/libexec/rexecd/rexecd.c
+++ b/libexec/rexecd/rexecd.c
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id$
+ * $Id: rexecd.c,v 1.13 1997/02/22 14:22:06 peter Exp $
*/
#ifndef lint
@@ -66,9 +66,9 @@ static char sccsid[] = "@(#)rexecd.c 8.1 (Berkeley) 6/4/93";
/*VARARGS1*/
int error();
-char username[20] = "USER=";
-char homedir[64] = "HOME=";
-char shell[64] = "SHELL=";
+char username[MAXLOGNAME + 5 + 1] = "USER=";
+char homedir[MAXPATHLEN + 5 + 1] = "HOME=";
+char shell[MAXPATHLEN + 6 + 1] = "SHELL=";
char path[sizeof(_PATH_DEFPATH) + sizeof("PATH=")] = "PATH=";
char *envinit[] =
{homedir, shell, path, username, 0};
@@ -213,10 +213,6 @@ doit(f, fromp)
syslog(LOG_INFO, "login from %s as %s", remote, user);
- if (chdir(pwd->pw_dir) < 0) {
- error("No remote directory.\n");
- exit(1);
- }
(void) write(2, "\0", 1);
if (port) {
(void) pipe(pv);
@@ -276,6 +272,10 @@ doit(f, fromp)
cp++;
else
cp = pwd->pw_shell;
+ if (chdir(pwd->pw_dir) < 0) {
+ error("No remote directory.\n");
+ exit(1);
+ }
execl(pwd->pw_shell, cp, "-c", cmdbuf, 0);
perror(pwd->pw_shell);
exit(1);
OpenPOWER on IntegriCloud