- if (*login)
- {
- execl ("/usr/ucb/rsh", "rsh", system, "-l", login,
- "/etc/rmt", (char *) 0);
- execl ("/usr/bin/remsh", "remsh", system, "-l", login,
- "/etc/rmt", (char *) 0);
- execl ("/usr/bin/rsh", "rsh", system, "-l", login,
- "/etc/rmt", (char *) 0);
- execl ("/usr/bsd/rsh", "rsh", system, "-l", login,
- "/etc/rmt", (char *) 0);
- execl ("/usr/bin/nsh", "nsh", system, "-l", login,
- "/etc/rmt", (char *) 0);
- }
- else
- {
- execl ("/usr/ucb/rsh", "rsh", system,
- "/etc/rmt", (char *) 0);
- execl ("/usr/bin/remsh", "remsh", system,
- "/etc/rmt", (char *) 0);
- execl ("/usr/bin/rsh", "rsh", system,
- "/etc/rmt", (char *) 0);
- execl ("/usr/bsd/rsh", "rsh", system,
- "/etc/rmt", (char *) 0);
- execl ("/usr/bin/nsh", "nsh", system,
+ close (0);
+ dup (to_remote[remote_pipe_number][PREAD]);
+ close (to_remote[remote_pipe_number][PREAD]);
+ close (to_remote[remote_pipe_number][PWRITE]);
+
+ close (1);
+ dup (from_remote[remote_pipe_number][PWRITE]);
+ close (from_remote[remote_pipe_number][PREAD]);
+ close (from_remote[remote_pipe_number][PWRITE]);
+
+#if !MSDOS
+ setuid (getuid ());
+ setgid (getgid ());
+#endif
+
+ if (remote_user)
+ execl (remote_shell, remote_shell_basename, remote_host,
+ "-l", remote_user, "/etc/rmt", (char *) 0);
+ else
+ execl (remote_shell, remote_shell_basename, remote_host,