summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2005-05-20 03:04:31 +0000
committerMike Frysinger <vapier@gentoo.org>2005-05-20 03:04:31 +0000
commitaba549e0debae8224e9759f84da8086bc3333fe5 (patch)
treefc96d24b7d1bc45143c2827273554e7790d3f4df /net-misc/netkit-rsh
parentforgot to add mythweb (diff)
downloadgentoo-2-aba549e0debae8224e9759f84da8086bc3333fe5.tar.gz
gentoo-2-aba549e0debae8224e9759f84da8086bc3333fe5.tar.bz2
gentoo-2-aba549e0debae8224e9759f84da8086bc3333fe5.zip
Import patches from Redhat to resolve #93215.
(Portage version: 2.0.51.22-r1)
Diffstat (limited to 'net-misc/netkit-rsh')
-rw-r--r--net-misc/netkit-rsh/ChangeLog26
-rw-r--r--net-misc/netkit-rsh/files/digest-netkit-rsh-0.17-r62
-rw-r--r--net-misc/netkit-rsh/files/netkit-rsh-0.10-stdarg.patch43
-rw-r--r--net-misc/netkit-rsh/files/netkit-rsh-0.16-jbj.patch33
-rw-r--r--net-misc/netkit-rsh/files/netkit-rsh-0.16-jbj4.patch14
-rw-r--r--net-misc/netkit-rsh/files/netkit-rsh-0.16-nokrb.patch231
-rw-r--r--net-misc/netkit-rsh/files/netkit-rsh-0.16-prompt.patch37
-rw-r--r--net-misc/netkit-rsh/files/netkit-rsh-0.16-rlogin=rsh.patch10
-rw-r--r--net-misc/netkit-rsh/files/netkit-rsh-0.17-chdir.patch57
-rw-r--r--net-misc/netkit-rsh/files/netkit-rsh-0.17-checkdir.patch22
-rw-r--r--net-misc/netkit-rsh/files/netkit-rsh-0.17-errno.patch51
-rw-r--r--net-misc/netkit-rsh/files/netkit-rsh-0.17-ignchld.patch22
-rw-r--r--net-misc/netkit-rsh/files/netkit-rsh-0.17-lfs.patch25
-rw-r--r--net-misc/netkit-rsh/files/netkit-rsh-0.17-nohost.patch63
-rw-r--r--net-misc/netkit-rsh/files/netkit-rsh-0.17-nohostcheck.patch139
-rw-r--r--net-misc/netkit-rsh/files/netkit-rsh-0.17-pam-nologin.patch14
-rw-r--r--net-misc/netkit-rsh/files/netkit-rsh-0.17-pam-sess.patch12
-rw-r--r--net-misc/netkit-rsh/files/netkit-rsh-0.17-pre20000412-jbj5.patch29
-rw-r--r--net-misc/netkit-rsh/files/netkit-rsh-0.17-rexec-netrc.patch251
-rw-r--r--net-misc/netkit-rsh/files/netkit-rsh-0.17-rexec-sig.patch17
-rw-r--r--net-misc/netkit-rsh/files/netkit-rsh-0.17-rexec.patch55
-rw-r--r--net-misc/netkit-rsh/files/netkit-rsh-0.17-sectty.patch32
-rw-r--r--net-misc/netkit-rsh/files/netkit-rsh-0.17-strip.patch66
-rw-r--r--net-misc/netkit-rsh/files/netkit-rsh-0.17-userandhost.patch70
-rw-r--r--net-misc/netkit-rsh/files/redhat.spec27
-rw-r--r--net-misc/netkit-rsh/netkit-rsh-0.17-r6.ebuild65
26 files changed, 1411 insertions, 2 deletions
diff --git a/net-misc/netkit-rsh/ChangeLog b/net-misc/netkit-rsh/ChangeLog
index d493e861447a..32da12bd5312 100644
--- a/net-misc/netkit-rsh/ChangeLog
+++ b/net-misc/netkit-rsh/ChangeLog
@@ -1,6 +1,28 @@
# ChangeLog for net-misc/netkit-rsh
-# Copyright 2002-2004 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-misc/netkit-rsh/ChangeLog,v 1.17 2004/12/08 20:09:05 hansmi Exp $
+# Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/netkit-rsh/ChangeLog,v 1.18 2005/05/20 03:04:31 vapier Exp $
+
+*netkit-rsh-0.17-r6 (20 May 2005)
+
+ 20 May 2005; Mike Frysinger <vapier@gentoo.org>
+ +files/netkit-rsh-0.10-stdarg.patch, +files/netkit-rsh-0.16-jbj.patch,
+ +files/netkit-rsh-0.16-jbj4.patch, +files/netkit-rsh-0.16-nokrb.patch,
+ +files/netkit-rsh-0.16-prompt.patch,
+ +files/netkit-rsh-0.16-rlogin=rsh.patch,
+ +files/netkit-rsh-0.17-chdir.patch, +files/netkit-rsh-0.17-checkdir.patch,
+ +files/netkit-rsh-0.17-errno.patch, +files/netkit-rsh-0.17-ignchld.patch,
+ +files/netkit-rsh-0.17-lfs.patch, +files/netkit-rsh-0.17-nohost.patch,
+ +files/netkit-rsh-0.17-nohostcheck.patch,
+ +files/netkit-rsh-0.17-pam-nologin.patch,
+ +files/netkit-rsh-0.17-pam-sess.patch,
+ +files/netkit-rsh-0.17-pre20000412-jbj5.patch,
+ +files/netkit-rsh-0.17-rexec.patch,
+ +files/netkit-rsh-0.17-rexec-netrc.patch,
+ +files/netkit-rsh-0.17-rexec-sig.patch,
+ +files/netkit-rsh-0.17-sectty.patch, +files/netkit-rsh-0.17-strip.patch,
+ +files/netkit-rsh-0.17-userandhost.patch, +files/redhat.spec,
+ +netkit-rsh-0.17-r6.ebuild:
+ Import patches from Redhat to resolve #93215.
08 Dec 2004; Michael Hanselmann <hansmi@gentoo.org>
netkit-rsh-0.17-r5.ebuild:
diff --git a/net-misc/netkit-rsh/files/digest-netkit-rsh-0.17-r6 b/net-misc/netkit-rsh/files/digest-netkit-rsh-0.17-r6
new file mode 100644
index 000000000000..a734efb0e00a
--- /dev/null
+++ b/net-misc/netkit-rsh/files/digest-netkit-rsh-0.17-r6
@@ -0,0 +1,2 @@
+MD5 65f5f28e2fe22d9ad8b17bb9a10df096 netkit-rsh-0.17.tar.gz 58268
+MD5 17c2b2fa2aed6af7e0b850673d5ef1f9 rexec-1.5.tar.gz 18469
diff --git a/net-misc/netkit-rsh/files/netkit-rsh-0.10-stdarg.patch b/net-misc/netkit-rsh/files/netkit-rsh-0.10-stdarg.patch
new file mode 100644
index 000000000000..584e762ec7e8
--- /dev/null
+++ b/net-misc/netkit-rsh/files/netkit-rsh-0.10-stdarg.patch
@@ -0,0 +1,43 @@
+--- netkit-rsh-0.10/rcp/rcp.c 1999-04-18 05:16:49-04 1.1
++++ netkit-rsh-0.10/rcp/rcp.c 1999-04-18 05:40:52-04
+@@ -836,19 +836,33 @@
+ error(const char *fmt, ...)
+ {
+ static FILE *fp;
+- va_list ap;
+-
+- va_start(ap, fmt);
++ char buf[1000];
+
+ ++errs;
+ if (!fp && !(fp = fdopen(rem, "w")))
+ return;
+- fprintf(fp, "%c", 0x01);
+- vfprintf(fp, fmt, ap);
++
++ /* (fmt,...) might need to go to two streams.
++ *
++ * In { va_start ; vfprintf ; vfprintf ; va_end }, second
++ * vfprintf didn't restart (ie: vfprintf affects ap) (glibc)
++ *
++ * Is { va_start ; vfprintf ; va_end} * 2 even allowed?
++ *
++ * => Dump (fmt,...) to buffer. */
++
++ {
++ va_list ap;
++ va_start(ap, fmt);
++ vsnprintf(buf, sizeof(buf), fmt, ap);
++ buf[sizeof(buf)-1] = 0;
++ va_end(ap);
++ }
++
++ fprintf(fp, "%c%s", 0x01, buf);
+ fflush(fp);
+- if (!iamremote) vfprintf(stderr, fmt, ap);
+
+- va_end(ap);
++ if (!iamremote) fputs(buf, stderr);
+ }
+
+ static void
diff --git a/net-misc/netkit-rsh/files/netkit-rsh-0.16-jbj.patch b/net-misc/netkit-rsh/files/netkit-rsh-0.16-jbj.patch
new file mode 100644
index 000000000000..64495e981f15
--- /dev/null
+++ b/net-misc/netkit-rsh/files/netkit-rsh-0.16-jbj.patch
@@ -0,0 +1,33 @@
+--- netkit-rsh-0.16/rcp/Makefile.jbj Tue Dec 21 16:32:51 1999
++++ netkit-rsh-0.16/rcp/Makefile Tue Dec 21 16:33:16 1999
+@@ -7,7 +7,7 @@
+ $(CC) $(LDFLAGS) $^ $(LIBS) -o $@
+
+ install: rcp
+- install -s -o root -m$(SUIDMODE) rcp $(INSTALLROOT)$(BINDIR)
++ install -s rcp $(INSTALLROOT)$(BINDIR)
+ install -m$(MANMODE) rcp.1 $(INSTALLROOT)$(MANDIR)/man1
+
+ clean:
+--- netkit-rsh-0.16/rlogin/Makefile.jbj Tue Dec 21 16:33:57 1999
++++ netkit-rsh-0.16/rlogin/Makefile Tue Dec 21 16:34:08 1999
+@@ -10,7 +10,7 @@
+ $(CC) $(LDFLAGS) $^ $(LIBS) -o $@
+
+ install: $(PROG)
+- install -s -o root -m$(SUIDMODE) $(PROG) $(INSTALLROOT)$(BINDIR)
++ install -s $(PROG) $(INSTALLROOT)$(BINDIR)
+ install -m $(MANMODE) $(PROG).1 $(INSTALLROOT)$(MANDIR)/man1
+
+ clean:
+--- netkit-rsh-0.16/rsh/Makefile.jbj Tue Dec 21 16:33:28 1999
++++ netkit-rsh-0.16/rsh/Makefile Tue Dec 21 16:33:44 1999
+@@ -9,7 +9,7 @@
+ $(CC) $(LDFLAGS) $^ $(LIBS) -o $@
+
+ install: rsh
+- install -s -o root -m$(SUIDMODE) rsh $(INSTALLROOT)$(BINDIR)
++ install -s rsh $(INSTALLROOT)$(BINDIR)
+ install -m$(MANMODE) rsh.1 $(INSTALLROOT)$(MANDIR)/man1
+
+ clean:
diff --git a/net-misc/netkit-rsh/files/netkit-rsh-0.16-jbj4.patch b/net-misc/netkit-rsh/files/netkit-rsh-0.16-jbj4.patch
new file mode 100644
index 000000000000..73b810e1148e
--- /dev/null
+++ b/net-misc/netkit-rsh/files/netkit-rsh-0.16-jbj4.patch
@@ -0,0 +1,14 @@
+--- netkit-rsh-0.16/rshd/Makefile.jbj4 Fri Jan 28 12:17:42 2000
++++ netkit-rsh-0.16/rshd/Makefile Fri Jan 28 12:17:56 2000
+@@ -6,9 +6,8 @@
+ OBJS = rshd.o
+
+ ifeq ($(USE_PAM),1)
+-# ?
+-CFLAGS += # -DUSE_PAM
+-LIBS += -ldl # -lpam -lpam_misc
++CFLAGS += -DUSE_PAM
++LIBS += -ldl -lpam -lpam_misc
+ endif
+
+ rshd: $(OBJS)
diff --git a/net-misc/netkit-rsh/files/netkit-rsh-0.16-nokrb.patch b/net-misc/netkit-rsh/files/netkit-rsh-0.16-nokrb.patch
new file mode 100644
index 000000000000..f3e06b832cb8
--- /dev/null
+++ b/net-misc/netkit-rsh/files/netkit-rsh-0.16-nokrb.patch
@@ -0,0 +1,231 @@
+diff -uNr netkit-rsh-0.16/rcp/rcp.1 netkit-rsh-0.16/rcp/rcp.1
+--- netkit-rsh-0.16/rcp/rcp.1 Tue Dec 14 07:52:57 1999
++++ netkit-rsh-0.16/rcp/rcp.1 Mon May 29 22:52:34 2000
+@@ -41,12 +41,10 @@
+ .Sh SYNOPSIS
+ .Nm rcp
+ .Op Fl px
+-.Op Fl k Ar realm
+ .Ar file1 file2
+ .Nm rcp
+ .Op Fl px
+ .Op Fl r
+-.Op Fl k Ar realm
+ .Ar file ...
+ .Ar directory
+ .Sh DESCRIPTION
+@@ -79,27 +77,6 @@
+ modified by the
+ .Xr umask 2
+ on the destination host is used.
+-.It Fl k
+-The
+-.Fl k
+-option requests
+-.Nm rcp
+-to obtain tickets
+-for the remote host in realm
+-.Ar realm
+-instead of the remote host's realm as determined by
+-.Xr krb_realmofhost 3 .
+-.It Fl x
+-The
+-.Fl x
+-option turns on
+-.Tn DES
+-encryption for all data passed by
+-.Nm rcp .
+-This may impact response time and
+-.Tn CPU
+-utilization, but provides
+-increased security.
+ .El
+ .Pp
+ If
+@@ -134,11 +111,6 @@
+ .Nm rcp
+ command appeared in
+ .Bx 4.2 .
+-The version of
+-.Nm rcp
+-described here
+-has been reimplemented with Kerberos in
+-.Bx 4.3 Reno .
+ .Sh BUGS
+ Doesn't detect all cases where the target of a copy might
+ be a file in cases where only a directory should be legal.
+diff -uNr netkit-rsh-0.16/rlogin/rlogin.1 netkit-rsh-0.16/rlogin/rlogin.1
+--- netkit-rsh-0.16/rlogin/rlogin.1 Tue Dec 14 07:52:57 1999
++++ netkit-rsh-0.16/rlogin/rlogin.1 Mon May 29 22:51:42 2000
+@@ -42,7 +42,6 @@
+ .Ar rlogin
+ .Op Fl 8EKLdx
+ .Op Fl e Ar char
+-.Op Fl k Ar realm
+ .Op Fl l Ar username
+ .Ar host
+ .Sh DESCRIPTION
+@@ -50,9 +49,7 @@
+ starts a terminal session on a remote host
+ .Ar host .
+ .Pp
+-.Nm Rlogin
+-first attempts to use the Kerberos authorization mechanism, described below.
+-If the remote host does not supporting Kerberos the standard Berkeley
++The standard Berkeley
+ .Pa rhosts
+ authorization mechanism is used.
+ The options are as follows:
+@@ -71,10 +68,6 @@
+ When used with the
+ .Fl 8
+ option, this provides a completely transparent connection.
+-.It Fl K
+-The
+-.Fl K
+-option turns off all Kerberos authentication.
+ .It Fl L
+ The
+ .Fl L
+@@ -94,25 +87,6 @@
+ ``~'' by default.
+ This specification may be as a literal character, or as an octal
+ value in the form \ennn.
+-.It Fl k
+-The
+-.FL k
+-option requests rlogin to obtain tickets for the remote host
+-in realm
+-.Ar realm
+-instead of the remote host's realm as determined by
+-.Xr krb_realmofhost 3 .
+-.It Fl x
+-The
+-.Fl x
+-option turns on
+-.Tn DES
+-encryption for all data passed via the
+-rlogin session.
+-This may impact response time and
+-.Tn CPU
+-utilization, but provides
+-increased security.
+ .El
+ .Pp
+ A line of the form ``<escape char>.'' disconnects from the remote host.
+@@ -129,35 +103,6 @@
+ is transparent.
+ Flow control via ^S/^Q and flushing of input and output on interrupts
+ are handled properly.
+-.Sh KERBEROS AUTHENTICATION
+-Each user may have a private authorization list in the file
+-.Pa .klogin
+-in their home directory.
+-Each line in this file should contain a Kerberos principal name of the
+-form
+-.Ar principal.instance@realm .
+-If the originating user is authenticated to one of the principals named
+-in
+-.Pa .klogin ,
+-access is granted to the account.
+-The principal
+-.Ar accountname.@localrealm
+-is granted access if
+-there is no
+-.Pa .klogin
+-file.
+-Otherwise a login and password will be prompted for on the remote machine
+-as in
+-.Xr login 1 .
+-To avoid certain security problems, the
+-.Pa .klogin
+-file must be owned by
+-the remote user.
+-.Pp
+-If Kerberos authentication fails, a warning message is printed and the
+-standard Berkeley
+-.Nm rlogin
+-is used instead.
+ .Sh ENVIRONMENT
+ The following environment variable is utilized by
+ .Nm rlogin :
+@@ -167,9 +112,6 @@
+ .El
+ .Sh SEE ALSO
+ .Xr rsh 1 ,
+-.Xr kerberos 3 ,
+-.Xr krb_sendauth 3 ,
+-.Xr krb_realmofhost 3
+ .Sh HISTORY
+ The
+ .Nm rlogin
+diff -uNr netkit-rsh-0.16/rsh/rsh.1 netkit-rsh-0.16/rsh/rsh.1
+--- netkit-rsh-0.16/rsh/rsh.1 Tue Dec 14 07:52:58 1999
++++ netkit-rsh-0.16/rsh/rsh.1 Mon May 29 22:51:29 2000
+@@ -41,7 +41,6 @@
+ .Sh SYNOPSIS
+ .Nm rsh
+ .Op Fl Kdnx
+-.Op Fl k Ar realm
+ .Op Fl l Ar username
+ .Ar host
+ .Op command
+@@ -62,10 +61,6 @@
+ normally terminates when the remote command does.
+ The options are as follows:
+ .Bl -tag -width flag
+-.It Fl K
+-The
+-.Fl K
+-option turns off all Kerberos authentication.
+ .It Fl d
+ The
+ .Fl d
+@@ -74,23 +69,11 @@
+ on the
+ .Tn TCP
+ sockets used for communication with the remote host.
+-.It Fl k
+-The
+-.Fl k
+-option causes
+-.Nm rsh
+-to obtain tickets for the remote host in
+-.Ar realm
+-instead of the remote host's realm as determined by
+-.Xr krb_realmofhost 3 .
+ .It Fl l
+ By default, the remote username is the same as the local username.
+ The
+ .Fl l
+ option allows the remote name to be specified.
+-Kerberos authentication is used, and authorization is determined
+-as in
+-.Xr rlogin 1 .
+ .It Fl n
+ The
+ .Fl n
+@@ -99,13 +82,6 @@
+ (see the
+ .Sx BUGS
+ section of this manual page).
+-.It Fl x
+-The
+-.Fl x
+-option turns on
+-.Tn DES
+-encryption for all data exchange.
+-This may introduce a significant delay in response time.
+ .El
+ .Pp
+ If no
+@@ -142,9 +118,6 @@
+ .El
+ .Sh SEE ALSO
+ .Xr rlogin 1 ,
+-.Xr kerberos 3 ,
+-.Xr krb_sendauth 3 ,
+-.Xr krb_realmofhost 3
+ .Sh HISTORY
+ The
+ .Nm rsh
diff --git a/net-misc/netkit-rsh/files/netkit-rsh-0.16-prompt.patch b/net-misc/netkit-rsh/files/netkit-rsh-0.16-prompt.patch
new file mode 100644
index 000000000000..8091dcc69ce3
--- /dev/null
+++ b/net-misc/netkit-rsh/files/netkit-rsh-0.16-prompt.patch
@@ -0,0 +1,37 @@
+--- netkit-rsh-0.16/rexec/rexec.c.prompt Mon Feb 28 16:23:33 2000
++++ netkit-rsh-0.16/rexec/rexec.c Mon Feb 28 16:49:23 2000
+@@ -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 )
diff --git a/net-misc/netkit-rsh/files/netkit-rsh-0.16-rlogin=rsh.patch b/net-misc/netkit-rsh/files/netkit-rsh-0.16-rlogin=rsh.patch
new file mode 100644
index 000000000000..1e06491e50f9
--- /dev/null
+++ b/net-misc/netkit-rsh/files/netkit-rsh-0.16-rlogin=rsh.patch
@@ -0,0 +1,10 @@
+--- netkit-rsh-0.16/rlogin/rlogin.c.rsh Fri Mar 3 08:59:37 2000
++++ netkit-rsh-0.16/rlogin/rlogin.c Fri Mar 3 08:59:45 2000
+@@ -194,6 +194,7 @@
+ p = argv[0];
+
+ if (strcmp(p, "rlogin"))
++ if (strcmp(p, "rsh"))
+ host = p;
+
+ /* handle "rlogin host flags" */
diff --git a/net-misc/netkit-rsh/files/netkit-rsh-0.17-chdir.patch b/net-misc/netkit-rsh/files/netkit-rsh-0.17-chdir.patch
new file mode 100644
index 000000000000..c9217ba26be5
--- /dev/null
+++ b/net-misc/netkit-rsh/files/netkit-rsh-0.17-chdir.patch
@@ -0,0 +1,57 @@
+--- netkit-rsh-0.17/rshd/rshd.c.orig Sun Jul 23 06:16:24 2000
++++ netkit-rsh-0.17/rshd/rshd.c Tue Dec 11 17:45:10 2001
+@@ -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;
+--- netkit-rsh-0.17/rexecd/rexecd.c.orig Sun Jul 23 06:16:22 2000
++++ netkit-rsh-0.17/rexecd/rexecd.c Tue Dec 11 18:28:36 2001
+@@ -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);
diff --git a/net-misc/netkit-rsh/files/netkit-rsh-0.17-checkdir.patch b/net-misc/netkit-rsh/files/netkit-rsh-0.17-checkdir.patch
new file mode 100644
index 000000000000..3437ee6fb1c3
--- /dev/null
+++ b/net-misc/netkit-rsh/files/netkit-rsh-0.17-checkdir.patch
@@ -0,0 +1,22 @@
+--- netkit-rsh-0.17/rcp/rcp.c.checkdir 2005-01-28 16:20:38.280031064 +0100
++++ netkit-rsh-0.17/rcp/rcp.c 2005-01-28 16:25:56.479657368 +0100
+@@ -716,6 +716,10 @@
+ size = size * 10 + (*cp++ - '0');
+ if (*cp++ != ' ')
+ SCREWUP("size not delimited");
++ if ((strchr(cp, '/') != NULL) || (strcmp(cp, "..") == 0)) {
++ error("rcp: unexpected filename: %s", cp);
++ exit(1);
++ }
+ if (targisdir) {
+ static char *namebuf;
+ static int cursize;
+@@ -734,6 +738,8 @@
+ np = targ;
+ exists = stat(np, &stb) == 0;
+ if (buf[0] == 'D') {
++ if (!iamrecursive)
++ SCREWUP("received directory without -r");
+ if (exists) {
+ if ((stb.st_mode&S_IFMT) != S_IFDIR) {
+ errno = ENOTDIR;
diff --git a/net-misc/netkit-rsh/files/netkit-rsh-0.17-errno.patch b/net-misc/netkit-rsh/files/netkit-rsh-0.17-errno.patch
new file mode 100644
index 000000000000..92d024ede8e2
--- /dev/null
+++ b/net-misc/netkit-rsh/files/netkit-rsh-0.17-errno.patch
@@ -0,0 +1,51 @@
+--- netkit-rsh-0.17/rcp/rcp.c.errno 2004-11-17 13:49:13.247815440 +0100
++++ netkit-rsh-0.17/rcp/rcp.c 2004-11-17 13:52:56.638854840 +0100
+@@ -613,6 +613,7 @@
+ struct stat stb;
+ struct timeval tv[2];
+ enum { YES, NO, DISPLAYED } wrerr;
++ int werrno = 0;
+ BUF *bp;
+ off_t i, j, size;
+ char ch, *targ;
+@@ -766,6 +767,7 @@
+ cp = bp->buf;
+ count = 0;
+ wrerr = NO;
++ werrno = 0;
+ for (i = 0; i < size; i += BUFSIZ) {
+ amt = BUFSIZ;
+ if (i + amt > size)
+@@ -784,16 +786,20 @@
+ } while (amt > 0);
+ if (count == bp->cnt) {
+ if (wrerr == NO &&
+- write(ofd, bp->buf, count) != count)
++ write(ofd, bp->buf, count) != count) {
+ wrerr = YES;
++ werrno = errno;
++ }
+ count = 0;
+ cp = bp->buf;
+ }
+ }
+ if (count != 0 && wrerr == NO &&
+- write(ofd, bp->buf, count) != count)
++ write(ofd, bp->buf, count) != count) {
+ wrerr = YES;
+- if (ftruncate(ofd, size)) {
++ werrno = errno;
++ }
++ if (wrerr == NO && ftruncate(ofd, size)) {
+ error("rcp: can't truncate %s: %s\n", np,
+ strerror(errno));
+ wrerr = DISPLAYED;
+@@ -810,7 +816,7 @@
+ }
+ switch(wrerr) {
+ case YES:
+- error("rcp: %s: %s\n", np, strerror(errno));
++ error("rcp: %s: %s\n", np, strerror(werrno));
+ break;
+ case NO:
+ (void)write(rem, "", 1);
diff --git a/net-misc/netkit-rsh/files/netkit-rsh-0.17-ignchld.patch b/net-misc/netkit-rsh/files/netkit-rsh-0.17-ignchld.patch
new file mode 100644
index 000000000000..abb5459f47e4
--- /dev/null
+++ b/net-misc/netkit-rsh/files/netkit-rsh-0.17-ignchld.patch
@@ -0,0 +1,22 @@
+--- netkit-rsh-0.17/rlogind/rlogind.c.ignchld 2004-12-06 13:31:23.263630216 +0100
++++ netkit-rsh-0.17/rlogind/rlogind.c 2004-12-06 13:31:43.382571672 +0100
+@@ -440,7 +440,7 @@
+ ioctl(master, TIOCPKT, &on);
+ signal(SIGCHLD, cleanup);
+ protocol(netfd, master);
+- signal(SIGCHLD, SIG_IGN);
++ signal(SIGCHLD, SIG_DFL);
+ cleanup(0);
+ }
+
+--- netkit-rsh-0.17/rlogin/rlogin.c.ignchld 2004-12-06 13:30:37.110646536 +0100
++++ netkit-rsh-0.17/rlogin/rlogin.c 2004-12-06 13:31:00.224132752 +0100
+@@ -523,7 +523,7 @@
+ stop(char cmdc)
+ {
+ mode(0);
+- signal(SIGCHLD, SIG_IGN);
++ signal(SIGCHLD, SIG_DFL);
+ kill(cmdc == defsusp ? 0 : getpid(), SIGTSTP);
+ signal(SIGCHLD, catch_child);
+ mode(1);
diff --git a/net-misc/netkit-rsh/files/netkit-rsh-0.17-lfs.patch b/net-misc/netkit-rsh/files/netkit-rsh-0.17-lfs.patch
new file mode 100644
index 000000000000..75d016b15b17
--- /dev/null
+++ b/net-misc/netkit-rsh/files/netkit-rsh-0.17-lfs.patch
@@ -0,0 +1,25 @@
+--- netkit-rsh-0.17/rcp/rcp.c.bigfile 2003-01-17 16:06:44.000000000 +0200
++++ netkit-rsh-0.17/rcp/rcp.c 2003-01-17 16:08:48.000000000 +0200
+@@ -482,7 +482,7 @@
+ }
+ }
+ (void)snprintf(buf, sizeof(buf),
+- "C%04o %ld %s\n", stb.st_mode&07777, stb.st_size, last);
++ "C%04o %lld %s\n", stb.st_mode&07777, (long long)(stb.st_size), last);
+ (void)write(rem, buf, (int)strlen(buf));
+ if (response() < 0) {
+ (void)close(f);
+@@ -614,11 +614,11 @@
+ struct timeval tv[2];
+ enum { YES, NO, DISPLAYED } wrerr;
+ BUF *bp;
+- off_t i, j;
++ off_t i, j, size;
+ char ch, *targ;
+ const char *why;
+ int amt, count, exists, first, mask, mode;
+- int ofd, setimes, size, targisdir;
++ int ofd, setimes, targisdir;
+ char *np, *vect[1], buf[BUFSIZ];
+
+ #define atime tv[0]
diff --git a/net-misc/netkit-rsh/files/netkit-rsh-0.17-nohost.patch b/net-misc/netkit-rsh/files/netkit-rsh-0.17-nohost.patch
new file mode 100644
index 000000000000..7304adb2f51d
--- /dev/null
+++ b/net-misc/netkit-rsh/files/netkit-rsh-0.17-nohost.patch
@@ -0,0 +1,63 @@
+--- netkit-rsh-0.17/rexecd/rexecd.8.nohost 2004-12-03 15:20:17.436174216 +0100
++++ netkit-rsh-0.17/rexecd/rexecd.8 2004-12-03 15:39:39.972441840 +0100
+@@ -40,6 +40,16 @@
+ .Nd remote execution server
+ .Sh SYNOPSIS
+ .Nm rexecd
++[
++\fB\-D\fP
++]
++.Sh OPTIONS
++.Nm Rexec
++accepts one option:
++.Pp
++.Bl -tag -width Ds
++.It Sy -D
++Disable reverse DNS look up and in the log will be used client IP addresses.
+ .Sh DESCRIPTION
+ .Nm Rexecd
+ is the server for the
+--- netkit-rsh-0.17/rexecd/rexecd.c.nohost 2004-12-03 15:09:37.163510456 +0100
++++ netkit-rsh-0.17/rexecd/rexecd.c 2004-12-03 15:20:04.832090328 +0100
+@@ -82,7 +82,9 @@
+ #include <string.h>
+ #include <paths.h>
+ #include <grp.h>
+-
++#include <arpa/inet.h>
++
++
+ #ifdef USE_SHADOW
+ #include <shadow.h>
+ #endif
+@@ -141,16 +143,22 @@
+ refuse(&from_host);
+ remote = hosts_info(&from_host);
+ #else
++ if (argc > 1 && argv[1] && strcmp(argv[1], "-D")==0)
+ {
+- struct hostent *h = gethostbyaddr((const char *)&from.sin_addr,
+- sizeof(struct in_addr),
+- AF_INET);
+- if (!h || !h->h_name) {
+- write(0, "\1Where are you?\n", 16);
+- return 1;
++ /* use IP in logs -- this is workaround */
++ remote = strdup(inet_ntoa(from.sin_addr));
+ }
+- /* Be advised that this may be utter nonsense. */
+- remote = strdup(h->h_name);
++ else
++ {
++ struct hostent *h = gethostbyaddr((const char *)&from.sin_addr,
++ sizeof(struct in_addr),
++ AF_INET);
++ if (!h || !h->h_name) {
++ write(0, "\1Where are you?\n", 16);
++ return 1;
++ }
++ /* Be advised that this may be utter nonsense. */
++ remote = strdup(h->h_name);
+ }
+ #endif
+ syslog(allow_severity, "connect from %.128s", remote);
diff --git a/net-misc/netkit-rsh/files/netkit-rsh-0.17-nohostcheck.patch b/net-misc/netkit-rsh/files/netkit-rsh-0.17-nohostcheck.patch
new file mode 100644
index 000000000000..55e76a6eff82
--- /dev/null
+++ b/net-misc/netkit-rsh/files/netkit-rsh-0.17-nohostcheck.patch
@@ -0,0 +1,139 @@
+Binary files netkit-rsh-0.17.orig/rlogind/.error.txt.swp and netkit-rsh-0.17.new/rlogind/.error.txt.swp differ
+diff -uNr netkit-rsh-0.17.orig/rlogind/network.c netkit-rsh-0.17.new/rlogind/network.c
+--- netkit-rsh-0.17.orig/rlogind/network.c Wed Oct 8 12:29:50 2003
++++ netkit-rsh-0.17.new/rlogind/network.c Wed Oct 8 13:44:42 2003
+@@ -90,7 +90,7 @@
+
+
+ static char *
+-find_hostname(const struct sockaddr_in *fromp, int *hostokp)
++find_hostname(const struct sockaddr_in *fromp, int no_host_check, int *hostokp)
+ {
+ struct hostent *hop;
+ char *hname;
+@@ -102,7 +102,7 @@
+ hname = strdup(inet_ntoa(fromp->sin_addr));
+ hostok = 1;
+ }
+- else if (check_all || local_domain(hop->h_name)) {
++ else if ((check_all || local_domain(hop->h_name )) && !no_host_check ) {
+ /*
+ * If name returned by gethostbyaddr is in our domain,
+ * attempt to verify that we haven't been fooled by someone
+@@ -143,7 +143,7 @@
+
+
+ char *
+-network_init(int f, int *hostokp)
++network_init(int f, int no_host_check, int *hostokp)
+ {
+ struct sockaddr_in from, *fromp;
+ socklen_t fromlen;
+@@ -177,7 +177,7 @@
+
+ alarm(0);
+
+- hname = find_hostname(fromp, hostokp);
++ hname = find_hostname(fromp,no_host_check, hostokp);
+
+ port = ntohs(fromp->sin_port);
+ if (fromp->sin_family != AF_INET ||
+diff -uNr netkit-rsh-0.17.orig/rlogind/rlogind.c netkit-rsh-0.17.new/rlogind/rlogind.c
+--- netkit-rsh-0.17.orig/rlogind/rlogind.c Wed Oct 8 12:29:50 2003
++++ netkit-rsh-0.17.new/rlogind/rlogind.c Wed Oct 8 12:58:51 2003
+@@ -84,6 +84,7 @@
+ int use_rhosts = 1;
+ int allow_root_rhosts = 0;
+ int deny_all_rhosts_hequiv = 0;
++static int no_host_check = 0;
+
+ static char oobdata[] = {(char)TIOCPKT_WINDOW};
+ static char line[MAXPATHLEN];
+@@ -386,7 +387,7 @@
+ int hostok;
+ char lusername[32], rusername[32], termtype[256];
+
+- hname = network_init(netfd, &hostok);
++ hname = network_init(netfd, no_host_check, &hostok);
+
+ getstr(rusername, sizeof(rusername), "remuser too long");
+ getstr(lusername, sizeof(lusername), "locuser too long");
+@@ -439,15 +440,16 @@
+ openlog("rlogind", LOG_PID | LOG_CONS, LOG_AUTH);
+
+ opterr = 0;
+- while ((ch = getopt(argc, argv, "ahLln")) != EOF) {
++ while ((ch = getopt(argc, argv, "ahLlDn")) != EOF) {
+ switch (ch) {
+ case 'a': check_all = 1; break;
+ case 'h': allow_root_rhosts = 1; break;
+ case 'L': deny_all_rhosts_hequiv = 1; break;
+ case 'l': use_rhosts = 0; break;
++ case 'D': no_host_check = 1; break;
+ case 'n': keepalive = 0; break;
+ case '?': default:
+- syslog(LOG_ERR, "usage: rlogind [-ahLln]");
++ syslog(LOG_ERR, "usage: rlogind [-ahLlDn]");
+ break;
+ }
+ }
+diff -uNr netkit-rsh-0.17.orig/rlogind/rlogind.h netkit-rsh-0.17.new/rlogind/rlogind.h
+--- netkit-rsh-0.17.orig/rlogind/rlogind.h Wed Oct 8 12:29:50 2003
++++ netkit-rsh-0.17.new/rlogind/rlogind.h Wed Oct 8 12:58:50 2003
+@@ -3,7 +3,7 @@
+ void fatal(int f, const char *msg, int syserr);
+
+ /* network.c */
+-char *network_init(int fd, int *hostokp);
++char *network_init(int fd, int no_host_check, int *hostokp);
+ void network_confirm(void);
+ void network_anticonfirm(void);
+ void network_close(void);
+diff -uNr netkit-rsh-0.17.orig/rshd/rshd.c netkit-rsh-0.17.new/rshd/rshd.c
+--- netkit-rsh-0.17.orig/rshd/rshd.c Wed Oct 8 12:29:50 2003
++++ netkit-rsh-0.17.new/rshd/rshd.c Wed Oct 8 10:43:04 2003
+@@ -90,13 +90,14 @@
+ static pam_handle_t *pamh;
+ #endif /* USE_PAM */
+
+-#define OPTIONS "ahlLn"
++#define OPTIONS "ahlLnD"
+
+ static int keepalive = 1;
+ static int check_all = 0;
+ static int paranoid = 0;
+ static int sent_null;
+-static int allow_root_rhosts=0;
++static int allow_root_rhosts = 0;
++static int no_host_check = 0;
+
+ char username[20] = "USER=";
+ char homedir[64] = "HOME=";
+@@ -305,6 +306,7 @@
+ /*
+ * Attempt to confirm the DNS.
+ */
++
+ #ifdef RES_DNSRCH
+ _res.options &= ~RES_DNSRCH;
+ #endif
+@@ -323,6 +325,8 @@
+ }
+ syslog(LOG_NOTICE, "Host addr %s not listed for host %s",
+ inet_ntoa(fromp->sin_addr), hp->h_name);
++ if ( no_host_check == 1 )
++ return hostname;
+ fail("Host address mismatch for %s\n",
+ remuser, inet_ntoa(fromp->sin_addr), locuser, cmdbuf);
+ return NULL; /* not reachable */
+@@ -596,6 +600,10 @@
+ paranoid = 1;
+ break;
+
++ case 'D':
++ no_host_check = 1;
++ break;
++
+ case '?':
+ default:
+ syslog(LOG_ERR, "usage: rshd [-%s]", OPTIONS);
diff --git a/net-misc/netkit-rsh/files/netkit-rsh-0.17-pam-nologin.patch b/net-misc/netkit-rsh/files/netkit-rsh-0.17-pam-nologin.patch
new file mode 100644
index 000000000000..e159bf8c01ee
--- /dev/null
+++ b/net-misc/netkit-rsh/files/netkit-rsh-0.17-pam-nologin.patch
@@ -0,0 +1,14 @@
+--- netkit-rsh-0.17-pre20000412/rlogind/auth.c.orig Tue Mar 19 11:46:29 2002
++++ netkit-rsh-0.17-pre20000412/rlogind/auth.c Wed Apr 17 16:35:43 2002
+@@ -127,7 +127,10 @@
+
+ network_confirm();
+ retval = attempt_auth();
+- if (retval != PAM_SUCCESS) {
++ if ((retval == PAM_ACCT_EXPIRED) || (retval == PAM_PERM_DENIED)) {
++ syslog(LOG_ERR, "PAM authentication denied for in.rlogind");
++ exit(1);
++ } else if (retval != PAM_SUCCESS) {
+ syslog(LOG_ERR, "PAM authentication failed for in.rlogind");
+ return -1;
+ }
diff --git a/net-misc/netkit-rsh/files/netkit-rsh-0.17-pam-sess.patch b/net-misc/netkit-rsh/files/netkit-rsh-0.17-pam-sess.patch
new file mode 100644
index 000000000000..bad697151aa9
--- /dev/null
+++ b/net-misc/netkit-rsh/files/netkit-rsh-0.17-pam-sess.patch
@@ -0,0 +1,12 @@
+--- netkit-rsh-0.17/rexecd/rexecd.c.pam-sess 2004-11-17 10:58:27.894345912 +0100
++++ netkit-rsh-0.17/rexecd/rexecd.c 2004-11-17 10:58:44.794776656 +0100
+@@ -307,6 +307,9 @@
+ PAM_BAIL;
+ pam_error = pam_setcred(pamh, PAM_ESTABLISH_CRED);
+ PAM_BAIL;
++ pam_error = pam_open_session(pamh, 0);
++ PAM_BAIL;
++ pam_close_session(pamh, 0);
+ pam_end(pamh, PAM_SUCCESS);
+ /* If this point is reached, the user has been authenticated. */
+ setpwent();
diff --git a/net-misc/netkit-rsh/files/netkit-rsh-0.17-pre20000412-jbj5.patch b/net-misc/netkit-rsh/files/netkit-rsh-0.17-pre20000412-jbj5.patch
new file mode 100644
index 000000000000..a65dfe8fee80
--- /dev/null
+++ b/net-misc/netkit-rsh/files/netkit-rsh-0.17-pre20000412-jbj5.patch
@@ -0,0 +1,29 @@
+--- netkit-rsh-0.17-pre20000412/rlogind/auth.c.jbj5 Sun Jun 18 11:18:37 2000
++++ netkit-rsh-0.17-pre20000412/rlogind/auth.c Sun Jun 18 11:21:37 2000
+@@ -37,6 +37,7 @@
+ #include "rlogind.h"
+
+ #ifdef USE_PAM
++#include <grp.h>
+
+ /*
+ * Modifications for Linux-PAM: Al Longyear <longyear@netcom.com>
+@@ -158,18 +159,14 @@
+ pwd = getpwnam(localuser);
+ if (pwd==NULL) {
+ syslog(LOG_ERR, "user returned by PAM does not exist\n");
+- /* don't print this - it tells people which accounts exist */
+- /*fprintf(stderr, "rlogind: internal error\n");*/
+ return -1;
+ }
+ if (setgid(pwd->pw_gid) != 0) {
+ syslog(LOG_ERR, "cannot assume gid for user returned by PAM\n");
+- fprintf(stderr, "rlogind: internal error\n");
+ return -1;
+ }
+ if (initgroups(localuser, pwd->pw_gid) != 0) {
+ syslog(LOG_ERR, "initgroups failed for user returned by PAM\n");
+- fprintf(stderr, "rlogind: internal error\n");
+ return -1;
+ }
+ retval = pam_setcred(pamh, PAM_ESTABLISH_CRED);
diff --git a/net-misc/netkit-rsh/files/netkit-rsh-0.17-rexec-netrc.patch b/net-misc/netkit-rsh/files/netkit-rsh-0.17-rexec-netrc.patch
new file mode 100644
index 000000000000..dcb9a772017f
--- /dev/null
+++ b/net-misc/netkit-rsh/files/netkit-rsh-0.17-rexec-netrc.patch
@@ -0,0 +1,251 @@
+--- netkit-rsh-0.17/rexec/ruserpass.c.netrc 2004-10-14 12:02:04.000000000 -0500
++++ netkit-rsh-0.17/rexec/ruserpass.c 2004-10-14 12:14:14.000000000 -0500
+@@ -0,0 +1,214 @@
++/*
++ * Copyright (c) 1985 Regents of the University of California.
++ * All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ * 3. All advertising materials mentioning features or use of this software
++ * must display the following acknowledgement:
++ * This product includes software developed by the University of
++ * California, Berkeley and its contributors.
++ * 4. Neither the name of the University nor the names of its contributors
++ * may be used to endorse or promote products derived from this software
++ * without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++ * SUCH DAMAGE.
++ */
++
++/*
++ * from: @(#)ruserpass.c 5.3 (Berkeley) 3/1/91
++ */
++char ruserpass_rcsid[] =
++ "$Id: netkit-rsh-0.17-rexec-netrc.patch,v 1.1 2005/05/20 03:04:31 vapier Exp $";
++
++#include <stdio.h>
++#include <stdlib.h>
++#include <utmp.h>
++#include <ctype.h>
++#include <sys/stat.h>
++#include <sys/param.h>
++#include <errno.h>
++#include <string.h>
++#include <unistd.h>
++
++static FILE *cfile;
++static int token(void);
++
++#define MACBUF_LEN 4096
++
++#define DEFAULT 1
++#define LOGIN 2
++#define PASSWD 3
++#define ACCOUNT 4
++#define MACDEF 5
++#define ID 10
++#define MACH 11
++
++static char tokval[100];
++
++static struct toktab {
++ const char *tokstr;
++ int tval;
++} toktab[]= {
++ { "default", DEFAULT },
++ { "login", LOGIN },
++ { "password", PASSWD },
++ { "passwd", PASSWD },
++ { "account", ACCOUNT },
++ { "machine", MACH },
++ { "macdef", MACDEF },
++ { NULL, 0 }
++};
++
++int
++xruserpass(const char *host, char **aname, char **apass)
++{
++ const char *hdir;
++ char buf[BUFSIZ], *tmp;
++ char myname[MAXHOSTNAMELEN];
++ const char *mydomain;
++ int t, usedefault = 0;
++ struct stat stb;
++
++ hdir = getenv("HOME");
++ if (hdir == NULL)
++ hdir = ".";
++ snprintf(buf, sizeof(buf), "%s/.netrc", hdir);
++ cfile = fopen(buf, "r");
++ if (cfile == NULL) {
++ if (errno != ENOENT)
++ perror(buf);
++ return(0);
++ }
++ if (gethostname(myname, sizeof(myname)) < 0)
++ myname[0] = '\0';
++ if ((mydomain = strchr(myname, '.')) == NULL)
++ mydomain = "";
++next:
++ while ((t = token())) switch(t) {
++
++ case DEFAULT:
++ usedefault = 1;
++ /* FALL THROUGH */
++
++ case MACH:
++ if (!usedefault) {
++ if (token() != ID)
++ continue;
++ /*
++ * Allow match of incompletely-specified host in
++ * local domain.
++ */
++ if (strcasecmp(host, tokval) == 0)
++ goto match;
++ if ((tmp = index(host, '.')) != NULL &&
++ strcasecmp(tmp, mydomain) == 0 &&
++ strncasecmp(host, tokval, tmp - host) == 0 &&
++ tokval[tmp - host] == '\0')
++ goto match;
++ continue;
++ }
++ match:
++ while ((t = token()) && t != MACH && t != DEFAULT) switch(t) {
++
++ case LOGIN:
++ if (token()) {
++ if (*aname == 0) {
++ *aname = malloc((unsigned) strlen(tokval) + 1);
++ (void) strcpy(*aname, tokval);
++ } else {
++ if (strcmp(*aname, tokval))
++ goto next;
++ }
++ }
++ break;
++ case PASSWD:
++ if (*aname==NULL) {
++ fprintf(stderr, "Error: `password' must follow `login' in .netrc\n");
++ goto bad;
++ }
++ if (strcmp(*aname, "anonymous") &&
++ fstat(fileno(cfile), &stb) >= 0 &&
++ (stb.st_mode & 077) != 0) {
++ fprintf(stderr, "Error - .netrc file not correct permissions.\n");
++ fprintf(stderr, "Remove password or correct mode (should be 600).\n");
++ goto bad;
++ }
++ if (token() && *apass == 0) {
++ *apass = malloc((unsigned) strlen(tokval) + 1);
++ (void) strcpy(*apass, tokval);
++ }
++ break;
++ case ACCOUNT:
++ break;
++ case MACDEF:
++ break;
++ default:
++ fprintf(stderr, "Unknown .netrc keyword %s\n", tokval);
++ break;
++ }
++ goto done;
++ }
++done:
++ (void) fclose(cfile);
++ return(0);
++bad:
++ (void) fclose(cfile);
++ return(-1);
++}
++
++static
++int
++token(void)
++{
++ char *cp;
++ int c;
++ struct toktab *t;
++
++ if (feof(cfile))
++ return (0);
++ while ((c = getc(cfile)) != EOF &&
++ (c == '\n' || c == '\t' || c == ' ' || c == ','))
++ continue;
++ if (c == EOF)
++ return (0);
++ cp = tokval;
++ if (c == '"') {
++ while ((c = getc(cfile)) != EOF && c != '"') {
++ if (c == '\\')
++ c = getc(cfile);
++ *cp++ = c;
++ }
++ } else {
++ *cp++ = c;
++ while ((c = getc(cfile)) != EOF
++ && c != '\n' && c != '\t' && c != ' ' && c != ',') {
++ if (c == '\\')
++ c = getc(cfile);
++ *cp++ = c;
++ }
++ }
++ *cp = 0;
++ if (tokval[0] == 0)
++ return (0);
++ for (t = toktab; t->tokstr; t++)
++ if (!strcmp(t->tokstr, tokval))
++ return (t->tval);
++ return (ID);
++}
+--- netkit-rsh-0.17/rexec/rexec.c.netrc 2004-10-14 12:02:04.000000000 -0500
++++ netkit-rsh-0.17/rexec/rexec.c 2004-10-14 12:16:46.000000000 -0500
+@@ -100,6 +100,8 @@
+ void echo_sig(int sig);
+ void safe_write_error(const char *message);
+
++int xruserpass(const char *host, char **aname, char **apass);
++
+ /* These need to be global for signal passing. */
+ int aux_sock=-1; /* Socket for auxiliary channel. */
+ int extra_error = 1; /* Setup special channel for standard error? */
+@@ -165,7 +167,10 @@
+ a newline. */
+ passwd = getpass("Password: ");
+ } else {
+-
++ if (xruserpass(host, &user_name, &passwd) < 0) {
++ user_name = NULL;
++ passwd = NULL;
++ }
+ if ( user_name == NULL )
+ user_name = getenv("REXEC_USER");
+ if ( user_name == NULL ) {
+--- netkit-rsh-0.17/rexec/Makefile.netrc 2004-10-14 12:15:30.000000000 -0500
++++ netkit-rsh-0.17/rexec/Makefile 2004-10-14 12:03:37.000000000 -0500
+@@ -11,7 +11,7 @@
+
+ all: rexec
+
+-rexec: rexec.c
++rexec: rexec.o ruserpass.o
+
+ rexec.1:
+
diff --git a/net-misc/netkit-rsh/files/netkit-rsh-0.17-rexec-sig.patch b/net-misc/netkit-rsh/files/netkit-rsh-0.17-rexec-sig.patch
new file mode 100644
index 000000000000..05d29370aaee
--- /dev/null
+++ b/net-misc/netkit-rsh/files/netkit-rsh-0.17-rexec-sig.patch
@@ -0,0 +1,17 @@
+--- netkit-rsh-0.17/rexec/rexec.c.rexec-sig 2004-11-17 16:51:37.000000000 +0100
++++ netkit-rsh-0.17/rexec/rexec.c 2004-11-17 17:17:12.844628352 +0100
+@@ -434,10 +434,10 @@
+ break;
+ default:
+ if ( sigaction(sig, NULL, &action) < 0 )
+- {
+- perror(progname);
+- exit(1);
+- }
++ /* in the signal(7) you can found "...except SIGKILL and SIGSTOP",
++ * but we detect problems with more signals...
++ */
++ return;
+ if ( action.sa_handler != SIG_IGN )
+ {
+ action.sa_handler = handler;
diff --git a/net-misc/netkit-rsh/files/netkit-rsh-0.17-rexec.patch b/net-misc/netkit-rsh/files/netkit-rsh-0.17-rexec.patch
new file mode 100644
index 000000000000..1b582b85e9a6
--- /dev/null
+++ b/net-misc/netkit-rsh/files/netkit-rsh-0.17-rexec.patch
@@ -0,0 +1,55 @@
+--- netkit-rsh-0.10/rexecd/rexecd.8.rexec Mon Jul 15 03:53:47 1996
++++ netkit-rsh-0.10/rexecd/rexecd.8 Fri Jul 30 19:13:15 1999
+@@ -68,8 +68,9 @@
+ it is interpreted as the port number of a secondary
+ stream to be used for the
+ .Em stderr .
+-A second connection is then created to the specified
+-port on the client's machine.
++A second connection will be created to the specified
++port on the client's machine after receiving and authenticating
++the user, password, and command from the client.
+ .It
+ A NUL terminated user name of at most 16 characters
+ is retrieved on the initial socket.
+--- netkit-rsh-0.10/rexec/Makefile.rexec Thu Jul 29 23:32:28 1999
++++ netkit-rsh-0.10/rexec/Makefile Fri Jul 30 19:14:15 1999
+@@ -1,30 +1,23 @@
+
+ SHELL = /bin/sh
+
+-BINDIR = /usr/local/bin
+-MANDIR = /usr/local/man/man1
++include ../MCONFIG
++include ../MRULES
+
+ # Uncomment this line if you get link errors under Solaris
+ #LDLIBS=-lsocket -lnsl
+
+ .PHONY: all
+
+-all: rexec install
++all: rexec
+
+ rexec: rexec.c
+
+ rexec.1:
+
++clean:
++ rm -f *.o rexec
++
+ install: rexec rexec.1
+- @ echo "Installation: Press enter for defaults."; \
+- echo -n "Enter the location to install executable "; \
+- echo -n " (default: $(BINDIR)): "; \
+- read bindir; \
+- bindir=$${bindir:-$(BINDIR)}; \
+- echo -n "Enter the manpage location (default $(MANDIR)): ";\
+- read mandir; \
+- mandir=$${mandir:-$(MANDIR)}; \
+- cp rexec $$bindir; \
+- chmod a+rx $${bindir}/rexec; \
+- cp rexec.1 $$mandir; \
+- chmod a+r $${mandir}/rexec.1
++ install -m 0755 rexec $(INSTALLROOT)/$(BINDIR)/rexec
++ install -m 0644 rexec.1 $(INSTALLROOT)/$(MANDIR)/man1/rexec.1
diff --git a/net-misc/netkit-rsh/files/netkit-rsh-0.17-sectty.patch b/net-misc/netkit-rsh/files/netkit-rsh-0.17-sectty.patch
new file mode 100644
index 000000000000..dd723de80f43
--- /dev/null
+++ b/net-misc/netkit-rsh/files/netkit-rsh-0.17-sectty.patch
@@ -0,0 +1,32 @@
+--- netkit-rsh-0.17-pre20000412/rexecd/rexecd.c.sectty Sat Oct 2 17:50:52 1999
++++ netkit-rsh-0.17-pre20000412/rexecd/rexecd.c Mon Feb 5 16:42:29 2001
+@@ -300,6 +300,7 @@
+ PAM_password = pass;
+ pam_error = pam_start("rexec", PAM_username, &PAM_conversation,&pamh);
+ PAM_BAIL;
++ (void) pam_set_item (pamh, PAM_TTY, "rexec"); /* we don't have a tty yet! */
+ pam_error = pam_authenticate(pamh, 0);
+ PAM_BAIL;
+ pam_error = pam_acct_mgmt(pamh, 0);
+--- netkit-rsh-0.17-pre20000412/rlogind/auth.c.sectty Mon Feb 5 16:43:46 2001
++++ netkit-rsh-0.17-pre20000412/rlogind/auth.c Mon Feb 5 16:44:28 2001
+@@ -123,7 +123,7 @@
+ pam_set_item(pamh, PAM_USER, localuser);
+ pam_set_item(pamh, PAM_RUSER, remoteuser);
+ pam_set_item(pamh, PAM_RHOST, host);
+- pam_set_item(pamh, PAM_TTY, "tty"); /* ? */
++ pam_set_item(pamh, PAM_TTY, "rlogin"); /* we don't have a tty yet! */
+
+ network_confirm();
+ retval = attempt_auth();
+--- netkit-rsh-0.17-pre20000412/rshd/rshd.c.sectty Mon Feb 5 16:43:52 2001
++++ netkit-rsh-0.17-pre20000412/rshd/rshd.c Mon Feb 5 16:44:42 2001
+@@ -243,7 +243,7 @@
+ }
+ pam_set_item (pamh, PAM_RUSER, remuser);
+ pam_set_item (pamh, PAM_RHOST, hostname);
+- pam_set_item (pamh, PAM_TTY, "tty");
++ pam_set_item (pamh, PAM_TTY, "rsh"); /* we don't use a tty, so punt */
+
+ retcode = pam_authenticate(pamh, 0);
+ if (retcode == PAM_SUCCESS) {
diff --git a/net-misc/netkit-rsh/files/netkit-rsh-0.17-strip.patch b/net-misc/netkit-rsh/files/netkit-rsh-0.17-strip.patch
new file mode 100644
index 000000000000..dd29135cab5b
--- /dev/null
+++ b/net-misc/netkit-rsh/files/netkit-rsh-0.17-strip.patch
@@ -0,0 +1,66 @@
+--- netkit-rsh-0.17/rcp/Makefile.strip Wed Jun 19 16:47:42 2002
++++ netkit-rsh-0.17/rcp/Makefile Wed Jun 19 17:01:11 2002
+@@ -7,7 +7,7 @@
+ $(CC) $(LDFLAGS) $^ $(LIBS) -o $@
+
+ install: rcp
+- install -s rcp $(INSTALLROOT)$(BINDIR)
++ install rcp $(INSTALLROOT)$(BINDIR)
+ install -m$(MANMODE) rcp.1 $(INSTALLROOT)$(MANDIR)/man1
+
+ clean:
+--- netkit-rsh-0.17/rexecd/Makefile.strip Sun Dec 12 19:05:00 1999
++++ netkit-rsh-0.17/rexecd/Makefile Wed Jun 19 17:01:41 2002
+@@ -27,7 +27,7 @@
+ $(CC) $(LDFLAGS) $^ $(LIBS) -o $@
+
+ install: rexecd
+- install -s -m$(DAEMONMODE) rexecd $(INSTALLROOT)$(SBINDIR)/in.rexecd
++ install -m$(DAEMONMODE) rexecd $(INSTALLROOT)$(SBINDIR)/in.rexecd
+ install -m$(MANMODE) rexecd.8 $(INSTALLROOT)$(MANDIR)/man8/in.rexecd.8
+ ln -sf in.rexecd.8 $(INSTALLROOT)$(MANDIR)/man8/rexecd.8
+ ifeq ($(USE_PAM),1)
+--- netkit-rsh-0.17/rlogin/Makefile.strip Wed Jun 19 16:47:42 2002
++++ netkit-rsh-0.17/rlogin/Makefile Wed Jun 19 17:02:06 2002
+@@ -10,7 +10,7 @@
+ $(CC) $(LDFLAGS) $^ $(LIBS) -o $@
+
+ install: $(PROG)
+- install -s $(PROG) $(INSTALLROOT)$(BINDIR)
++ install $(PROG) $(INSTALLROOT)$(BINDIR)
+ install -m $(MANMODE) $(PROG).1 $(INSTALLROOT)$(MANDIR)/man1
+
+ clean:
+--- netkit-rsh-0.17/rlogind/Makefile.strip Sun Dec 12 19:05:01 1999
++++ netkit-rsh-0.17/rlogind/Makefile Wed Jun 19 17:02:26 2002
+@@ -20,7 +20,7 @@
+ auth.o network.o: rlogind.h
+
+ install: rlogind
+- install -s -m$(DAEMONMODE) rlogind $(INSTALLROOT)$(SBINDIR)/in.rlogind
++ install -m$(DAEMONMODE) rlogind $(INSTALLROOT)$(SBINDIR)/in.rlogind
+ install -m$(MANMODE) rlogind.8 $(INSTALLROOT)$(MANDIR)/man8/in.rlogind.8
+ ln -sf in.rlogind.8 $(INSTALLROOT)$(MANDIR)/man8/rlogind.8
+
+--- netkit-rsh-0.17/rsh/Makefile.strip Wed Jun 19 16:47:42 2002
++++ netkit-rsh-0.17/rsh/Makefile Wed Jun 19 17:02:45 2002
+@@ -9,7 +9,7 @@
+ $(CC) $(LDFLAGS) $^ $(LIBS) -o $@
+
+ install: rsh
+- install -s rsh $(INSTALLROOT)$(BINDIR)
++ install rsh $(INSTALLROOT)$(BINDIR)
+ install -m$(MANMODE) rsh.1 $(INSTALLROOT)$(MANDIR)/man1
+
+ clean:
+--- netkit-rsh-0.17/rshd/Makefile.strip Wed Jun 19 16:47:42 2002
++++ netkit-rsh-0.17/rshd/Makefile Wed Jun 19 17:02:59 2002
+@@ -14,7 +14,7 @@
+ $(CC) $(LDFLAGS) $^ $(LIBS) -o $@
+
+ install: rshd
+- install -s -m$(DAEMONMODE) rshd $(INSTALLROOT)$(SBINDIR)/in.rshd
++ install -m$(DAEMONMODE) rshd $(INSTALLROOT)$(SBINDIR)/in.rshd
+ install -m$(MANMODE) rshd.8 $(INSTALLROOT)$(MANDIR)/man8/in.rshd.8
+ ln -sf in.rshd.8 $(INSTALLROOT)$(MANDIR)/man8/rshd.8
+
diff --git a/net-misc/netkit-rsh/files/netkit-rsh-0.17-userandhost.patch b/net-misc/netkit-rsh/files/netkit-rsh-0.17-userandhost.patch
new file mode 100644
index 000000000000..a5b760cd80c2
--- /dev/null
+++ b/net-misc/netkit-rsh/files/netkit-rsh-0.17-userandhost.patch
@@ -0,0 +1,70 @@
+--- netkit-rsh-0.17/rlogind/rlogind.c.userandhost 2000-07-23 05:07:58.000000000 +0200
++++ netkit-rsh-0.17/rlogind/rlogind.c 2003-01-17 17:31:25.000000000 +0100
+@@ -333,9 +333,10 @@
+
+
+ static void child(const char *hname, const char *termtype,
+- const char *localuser, int authenticated)
++ const char *localuser, int authenticated,
++ const char *rusername)
+ {
+- char *termenv[2];
++ char *termenv[4];
+
+ setup_term(0, termtype);
+
+@@ -344,7 +345,17 @@
+ strcpy(termenv[0], "TERM=");
+ strcat(termenv[0], termtype);
+ }
+- termenv[1] = NULL;
++ termenv[1] = malloc(strlen(rusername)+12);
++ if (termenv[1]) { /* shouldn't ever fail, mind you */
++ strcpy(termenv[1], "REMOTEUSER=");
++ strcat(termenv[1], rusername);
++ }
++ termenv[2] = malloc(strlen(hname)+12);
++ if (termenv[2]) { /* shouldn't ever fail, mind you */
++ strcpy(termenv[2], "REMOTEHOST=");
++ strcat(termenv[2], hname);
++ }
++ termenv[3] = NULL;
+
+ if (authenticated) {
+ auth_finish();
+@@ -420,7 +431,7 @@
+ if (pid == 0) {
+ /* netfd should always be 0, but... */
+ if (netfd > 2) close(netfd);
+- child(hname, termtype, lusername, authenticated);
++ child(hname, termtype, lusername, authenticated, rusername);
+ }
+ on = 1;
+ ioctl(netfd, FIONBIO, &on);
+--- netkit-rsh-0.17/rshd/rshd.c.userandhost 2003-01-17 17:25:22.000000000 +0100
++++ netkit-rsh-0.17/rshd/rshd.c 2003-01-17 17:25:22.000000000 +0100
+@@ -102,8 +102,10 @@
+ char homedir[64] = "HOME=";
+ char shell[64] = "SHELL=";
+ char path[100] = "PATH=";
++char remoteuser[20] = "REMOTEUSER=";
++char remotehost[50] = "REMOTEHOST=";
+ char *envinit[] =
+- {homedir, shell, path, username, 0};
++ {homedir, shell, path, username, remoteuser, remotehost, 0};
+ extern char **environ;
+
+ static void error(const char *fmt, ...);
+@@ -460,6 +462,12 @@
+ strncat(homedir, pwd->pw_dir, sizeof(homedir)-6);
+ homedir[sizeof(homedir)-1] = 0;
+
++ strncat(remoteuser, remuser, sizeof(remoteuser)-12);
++ remoteuser[sizeof(remoteuser)-1] = 0;
++
++ strncat(remotehost, hostname, sizeof(remotehost)-12);
++ remotehost[sizeof(remotehost)-1] = 0;
++
+ strcat(path, _PATH_DEFPATH);
+
+ strncat(shell, theshell, sizeof(shell)-7);
diff --git a/net-misc/netkit-rsh/files/redhat.spec b/net-misc/netkit-rsh/files/redhat.spec
new file mode 100644
index 000000000000..2c661964b9bf
--- /dev/null
+++ b/net-misc/netkit-rsh/files/redhat.spec
@@ -0,0 +1,27 @@
+#G - ignored on Gentoo
+#R - ignored on Redhat
+netkit-rsh-0.17-sectty.patch
+netkit-rsh-0.17-rexec.patch
+netkit-rsh-0.10-stdarg.patch
+netkit-rsh-0.16-jbj.patch
+#R netkit-rsh-0.16-pamfix.patch
+#R netkit-rsh-0.16-jbj2.patch
+#R netkit-rsh-0.16-jbj3.patch
+netkit-rsh-0.16-jbj4.patch
+netkit-rsh-0.16-prompt.patch
+netkit-rsh-0.16-rlogin=rsh.patch
+netkit-rsh-0.16-nokrb.patch
+netkit-rsh-0.17-pre20000412-jbj5.patch
+netkit-rsh-0.17-userandhost.patch
+netkit-rsh-0.17-strip.patch
+netkit-rsh-0.17-lfs.patch
+netkit-rsh-0.17-chdir.patch
+netkit-rsh-0.17-pam-nologin.patch
+netkit-rsh-0.17-nohostcheck.patch
+netkit-rsh-0.17-rexec-netrc.patch
+netkit-rsh-0.17-pam-sess.patch
+netkit-rsh-0.17-errno.patch
+netkit-rsh-0.17-rexec-sig.patch
+netkit-rsh-0.17-nohost.patch
+netkit-rsh-0.17-ignchld.patch
+netkit-rsh-0.17-checkdir.patch
diff --git a/net-misc/netkit-rsh/netkit-rsh-0.17-r6.ebuild b/net-misc/netkit-rsh/netkit-rsh-0.17-r6.ebuild
new file mode 100644
index 000000000000..cdfeedd232f9
--- /dev/null
+++ b/net-misc/netkit-rsh/netkit-rsh-0.17-r6.ebuild
@@ -0,0 +1,65 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/netkit-rsh/netkit-rsh-0.17-r6.ebuild,v 1.1 2005/05/20 03:04:31 vapier Exp $
+
+inherit eutils
+
+DESCRIPTION="Netkit's Remote Shell Suite: rexec{,d} rlogin{,d} rsh{,d}"
+HOMEPAGE="ftp://ftp.uk.linux.org/pub/linux/Networking/netkit/"
+SRC_URI="ftp://ftp.uk.linux.org/pub/linux/Networking/netkit/${P}.tar.gz
+ mirror://gentoo/rexec-1.5.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~mips ~ppc ~ppc64 ~sparc ~x86"
+IUSE="pam"
+
+DEPEND=">=sys-libs/ncurses-5.2
+ pam? ( >=sys-libs/pam-0.72 )"
+
+src_unpack() {
+ unpack ${P}.tar.gz
+ cd "${S}"
+ unpack rexec-1.5.tar.gz
+ for p in $(grep -v '^#' "${FILESDIR}"/redhat.spec) ; do
+ EPATCH_SINGLE_MSG="Applying Redhat's ${p} ..." \
+ epatch "${FILESDIR}"/${p}
+ done
+ sed -i \
+ -e '/LDFLAGS/s:$: -Wl,-z,now:' \
+ r{cp,login,sh}/Makefile
+}
+
+src_compile() {
+ local myconf
+ use pam || myconf="--without-pam"
+ ./configure ${myconf} || die
+
+ sed -i \
+ -e "s:-pipe -O2:${CFLAGS}:" \
+ -e "s:-Wpointer-arith::" \
+ MCONFIG
+ make || die
+}
+
+src_install() {
+ local b exe
+ insinto /etc/xinetd.d
+ for b in rcp rexec{,d} rlogin{,d} rsh{,d} ; do
+ if [[ ${b:0-1} == "d" ]] ; then
+ dosbin ${b}/${b} || die "dosbin ${b} failed"
+ dosym ${b} /usr/sbin/in.${b}
+ doman ${b}/${b}.8
+ else
+ dobin ${b}/${b} || die "dobin ${b} failed"
+ doman ${b}/${b}.1
+ [[ ${b} != "rexec" ]] \
+ && fperms 4711 /usr/bin/${b}
+ [[ ${b} != "rcp" ]] \
+ && newins "${FILESDIR}"/${b}.xinetd ${b} \
+ && newpamd "${FILESDIR}"/${b}.pamd ${b}
+ fi
+ done
+ dodoc README ChangeLog BUGS
+ newdoc rexec/README README.rexec
+}