summaryrefslogtreecommitdiff
path: root/net-misc/netkit-rsh/files/patches/050_all_prompt.patch
diff options
context:
space:
mode:
Diffstat (limited to 'net-misc/netkit-rsh/files/patches/050_all_prompt.patch')
-rw-r--r--net-misc/netkit-rsh/files/patches/050_all_prompt.patch37
1 files changed, 37 insertions, 0 deletions
diff --git a/net-misc/netkit-rsh/files/patches/050_all_prompt.patch b/net-misc/netkit-rsh/files/patches/050_all_prompt.patch
new file mode 100644
index 000000000000..5f6a89dc1d94
--- /dev/null
+++ b/net-misc/netkit-rsh/files/patches/050_all_prompt.patch
@@ -0,0 +1,37 @@
+--- a/rexec/rexec.c
++++ b/rexec/rexec.c
+@@ -164,12 +164,30 @@
+ user_name[strlen(user_name)-1] = '\0'; /* Hopefully fgets always adds
+ a newline. */
+ passwd = getpass("Password: ");
++ } else {
++
++ if ( user_name == NULL )
++ user_name = getenv("REXEC_USER");
++ if ( user_name == NULL ) {
++ uid_t uid = getuid();
++ struct passwd *pw = getpwuid(uid);
++ if (!(pw && pw->pw_name)) {
++ fprintf(stderr, "Can't lookup uid %d\n", uid);
++ exit(1);
++ }
++ user_name = strdup(pw->pw_name);
++ }
++ if ( passwd == NULL )
++ passwd = getenv("REXEC_PASS");
++ if ( passwd == NULL )
++ passwd = getpass("Password: ");
+ }
+
+- if ( user_name == NULL )
+- user_name = getenv("REXEC_USER");
+- if ( passwd == NULL )
+- passwd = getenv("REXEC_PASS");
++ if (!(user_name && passwd)) {
++ fprintf(stderr, "Can't use %s without supplying a user and password\n",
++ progname);
++ exit(1);
++ }
+
+ if ( (sock = rexec(&host, port_exec, user_name, passwd, command,
+ p_to_aux_sock)) < 0 )