summaryrefslogtreecommitdiff
path: root/net-misc/netkit-rsh/files/patches/120_all_chdir.patch
diff options
context:
space:
mode:
Diffstat (limited to 'net-misc/netkit-rsh/files/patches/120_all_chdir.patch')
-rw-r--r--net-misc/netkit-rsh/files/patches/120_all_chdir.patch57
1 files changed, 57 insertions, 0 deletions
diff --git a/net-misc/netkit-rsh/files/patches/120_all_chdir.patch b/net-misc/netkit-rsh/files/patches/120_all_chdir.patch
new file mode 100644
index 000000000000..2309a118385c
--- /dev/null
+++ b/net-misc/netkit-rsh/files/patches/120_all_chdir.patch
@@ -0,0 +1,57 @@
+--- a/rshd/rshd.c
++++ b/rshd/rshd.c
+@@ -388,15 +388,6 @@
+ remuser, hostname, locuser, cmdbuf);
+ }
+
+- if (chdir(pwd->pw_dir) < 0) {
+- chdir("/");
+- /*
+- * error("No remote directory.\n");
+- * exit(1);
+- */
+- }
+-
+-
+ if (pwd->pw_uid != 0 && !access(_PATH_NOLOGIN, F_OK)) {
+ error("Logins currently disabled.\n");
+ exit(1);
+@@ -456,6 +447,14 @@
+ exit(1);
+ }
+ environ = envinit;
++
++ if (chdir(pwd->pw_dir) < 0) {
++ chdir("/");
++ /*
++ * error("No remote directory.\n");
++ * exit(1);
++ */
++ }
+
+ strncat(homedir, pwd->pw_dir, sizeof(homedir)-6);
+ homedir[sizeof(homedir)-1] = 0;
+--- a/rexecd/rexecd.c
++++ b/rexecd/rexecd.c
+@@ -375,10 +375,6 @@
+ /* Log successful attempts. */
+ syslog(LOG_INFO, "login from %.128s as %s", remote, user);
+
+- if (chdir(pwd->pw_dir) < 0) {
+- fatal("No remote directory.\n");
+- }
+-
+ write(2, "\0", 1);
+ if (port) {
+ /* If we have a port, dup STDERR on that port KRH */
+@@ -408,6 +404,10 @@
+ if (setuid(pwd->pw_uid)) {
+ perror("setuid");
+ exit(1);
++ }
++
++ if (chdir(pwd->pw_dir) < 0) {
++ fatal("No remote directory.\n");
+ }
+
+ strcat(path, _PATH_DEFPATH);