--- inetutils-1.4.1/rshd/rshd.c.orig Mon Sep 2 16:13:37 2002 +++ inetutils-1.4.1/rshd/rshd.c Thu Sep 5 09:49:11 2002 @@ -565,20 +565,6 @@ goto fail; } - /* We'll execute the client's command in the home directory - * of locuser. - */ - if (chdir (pwd->pw_dir) < 0) - { - (void) chdir ("/"); - syslog (LOG_INFO|LOG_AUTH, "address@hidden as %s: no home directory. cmd='%.80s'", - remuser, hostname, locuser, cmdbuf); - error ("No remote directory.\n"); -#ifdef notdef - exit (1); -#endif - } - #ifdef KERBEROS if (use_kerberos) { @@ -866,6 +852,20 @@ * setuid should handle the seteuid as well. * seteuid ((uid_t)pwd->pw_uid); */ setuid ((uid_t)pwd->pw_uid); + + /* We'll execute the client's command in the home directory + * of locuser. + */ + if (chdir (pwd->pw_dir) < 0) + { + (void) chdir ("/"); + syslog (LOG_INFO|LOG_AUTH, "address@hidden as %s: no home directory. cmd='%.80s'", + remuser, hostname, locuser, cmdbuf); + error ("No remote directory.\n"); +#ifdef notdef + exit (1); +#endif + } /* Set up an initial environment for the shell that we exec() */ environ = envinit;