[2204] in Kerberos-V5-bugs
rdist v6.1.3 patches -> krdist
daemon@ATHENA.MIT.EDU (John Stewart)
Tue Sep 3 13:38:01 1996
To: rdist-dev@usc.edu, krb5-bugs@MIT.EDU
Date: Tue, 03 Sep 1996 10:35:39 -0700
From: John Stewart <jns@cisco.com>
Attached are patches for rdist v6.1.3 that then generate "krdist" - a
version of rdist which uses Kerberos v5 krsh and krshd for its
transport mechanisms.
The patches are also available from:
ftp://cco.cisco.com/pub/people/jns/rdist-6.1.3-krdist.patch.gz
I've left the RCS strings in the patch, and once applied, it will
usually result in .rej files containing just those areas. No worries.
These patches are considerably cleaner than the v6.1 patches I
released some time ago, since rdist v6.1.3 now properly handles
stdin/stdout pipes in their expected r/o and w/o fashions. Thank you
Michael Cooper :)
released into the pd, comments/bug-fixes/improvements are always
welcome. I hope to soon release v2 patches which will allow seemless
integration into the rdist v6.1.3 source tree and base the behaviour
on argv[0], I just haven't had enuf time :(
--John
John Stewart Systems Administrator/Web Developer Email: jns@cisco.com
Adv. Customer Systems Where no one Phone: +1.408.526.8499
Cisco Systems, Inc. has gone before... FAX: +1.408.526.8787
------=------=------=------=------=------=------=------=------=------
Index: Makefile.local
===================================================================
RCS file: /local/src/cvsroot/krdist/Makefile.local,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Makefile.local 1996/08/28 17:09:03 1.3
+++ Makefile.local 1996/08/28 19:29:45 1.4
@@ -1,5 +1,5 @@
#
-# $Id: Makefile.local,v 1.3 1996/08/28 17:09:03 jns Exp $
+# $Id: Makefile.local,v 1.4 1996/08/28 19:29:45 jns Exp $
#
# Makefile for local overrides of default variables
#
@@ -14,7 +14,7 @@
# Add any local definitions you want pass to the compiler to DEFS_LOCAL
# below. This includes those items found in "config/config.h".
#
-#DEFS_LOCAL = -DDIRECT_RCMD
+DEFS_LOCAL = -DKERBEROS
#
# Add any local libraries that your system might need to LIBS_LOCAL below.
Index: include/defs.h
===================================================================
RCS file: /local/src/cvsroot/krdist/include/defs.h,v
retrieving revision 1.3
retrieving revision 1.5
diff -u -r1.3 -r1.5
--- defs.h 1996/08/28 17:13:07 1.3
+++ defs.h 1996/08/30 18:37:14 1.5
@@ -34,7 +34,7 @@
*/
/*
- * $Id: defs.h,v 1.3 1996/08/28 17:13:07 jns Exp $
+ * $Id: defs.h,v 1.5 1996/08/30 18:37:14 jns Exp $
* @(#)defs.h 5.2 (Berkeley) 3/20/86
*/
@@ -189,6 +189,13 @@
#define COMMENT_CHAR '#' /* Config file comment char */
#define CNULL '\0' /* NULL character */
+#ifdef KERBEROS
+/*
+ * Establish the encryption flag
+ */
+#define ENCRYPT_FLAG "-x"
+#endif
+
/*
* These are the top level protocol commands.
*/
@@ -310,6 +317,9 @@
extern char *path_remsh; /* Remote shell command */
extern char buf[]; /* General purpose buffer */
extern char host[]; /* Host name of master copy */
+#ifdef KERBEROS
+extern int xencrypt; /* To encrypt or not to encrypt */
+#endif
extern char *currenthost; /* Name of current host */
extern char *progname; /* Name of this program */
extern char **realargv; /* Real argv */
Index: include/pathnames.h
===================================================================
RCS file: /local/src/cvsroot/krdist/include/pathnames.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- pathnames.h 1996/08/28 17:13:12 1.2
+++ pathnames.h 1996/08/28 19:29:49 1.3
@@ -32,7 +32,7 @@
*/
/*
- * $Id: pathnames.h,v 1.2 1996/08/28 17:13:12 jns Exp $
+ * $Id: pathnames.h,v 1.3 1996/08/28 19:29:49 jns Exp $
* @(#)pathnames.h 5.4 (Berkeley) 8/27/90
*/
@@ -42,6 +42,13 @@
# define _RDIST_TMP "rdistXXXXXX" /* Temporary file */
#endif /* _RDIST_TMP */
+#ifdef KERBEROS
+#if !defined(_PATH_RDISTD)
+# define _PATH_RDISTD "/usr/local/krb5/sbin/krdistd"/* K5 Rdist server
+ */
+#endif /* _PATH_RDISTD */
+#else
#if !defined(_PATH_RDISTD)
# define _PATH_RDISTD "rdistd" /* Rdist server */
#endif /* _PATH_RDISTD */
+#endif
Index: include/paths.h
===================================================================
RCS file: /local/src/cvsroot/krdist/include/paths.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- paths.h 1996/08/28 17:13:14 1.3
+++ paths.h 1996/08/28 19:29:50 1.4
@@ -32,7 +32,7 @@
*/
/*
- * $Id: paths.h,v 1.3 1996/08/28 17:13:14 jns Exp $
+ * $Id: paths.h,v 1.4 1996/08/28 19:29:50 jns Exp $
* @(#)paths.h
*/
@@ -56,4 +56,10 @@
#ifndef _PATH_REMSH
#define _PATH_REMSH "/usr/ucb/rsh" /* Remote shell */
+#endif
+
+#ifdef KERBEROS
+#ifndef _PATH_KREMSH
+#define _PATH_KREMSH "/local/krb5/bin/rsh" /* Remote shell */
+#endif
#endif
Index: mf/Makefile.var
===================================================================
RCS file: /local/src/cvsroot/krdist/mf/Makefile.var,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Makefile.var 1996/08/28 17:13:31 1.2
+++ Makefile.var 1996/08/28 19:29:51 1.3
@@ -31,7 +31,7 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
-# $Id: Makefile.var,v 1.2 1996/08/28 17:13:31 jns Exp $
+# $Id: Makefile.var,v 1.3 1996/08/28 19:29:51 jns Exp $
#
#
@@ -50,7 +50,8 @@
# RDIST_MODE - File mode of rdist (client) program
# RDISTD_MODE - File mode of rdistd (server) program
#
-BIN_DIR = /usr/ucb
+CLIENT_BIN_DIR = /usr/local/krb5/bin
+SERVER_BIN_DIR = /usr/local/krb5/sbin
BIN_OWNER = root
BIN_GROUP = bin
RDIST_MODE = 555
@@ -77,8 +78,8 @@
# CLIENT - Name of client program (rdist) in ${BIN}
# SERVER - Name of server program (rdistd) in ${BIN}
#
-CLIENT = rdist
-SERVER = rdistd
+CLIENT = krdist
+SERVER = krdistd
#
# Name of your BSD style install program
Index: src/Makefile.real
===================================================================
RCS file: /local/src/cvsroot/krdist/src/Makefile.real,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Makefile.real 1996/08/28 17:13:45 1.2
+++ Makefile.real 1996/08/28 19:29:53 1.3
@@ -31,7 +31,7 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
-# $Id: Makefile.real,v 1.2 1996/08/28 17:13:45 jns Exp $
+# $Id: Makefile.real,v 1.3 1996/08/28 19:29:53 jns Exp $
#
IN_ARGS = -c -g ${BIN_GROUP}
@@ -79,8 +79,8 @@
install: $(CLIENT_BIN) $(SERVER_BIN)
$(INSTALL) ${IN_ARGS} -o root -m ${RDIST_MODE} \
- $(CLIENT_BIN) $(BIN_DIR)/$(CLIENT)
+ $(CLIENT_BIN) $(CLIENT_BIN_DIR)/$(CLIENT)
$(INSTALL) ${IN_ARGS} -o ${BIN_OWNER} -m ${RDISTD_MODE} \
- $(SERVER_BIN) $(BIN_DIR)/$(SERVER)
+ $(SERVER_BIN) $(SERVER_BIN_DIR)/$(SERVER)
install.man:
Index: src/common.c
===================================================================
RCS file: /local/src/cvsroot/krdist/src/common.c,v
retrieving revision 1.3
retrieving revision 1.5
diff -u -r1.3 -r1.5
--- common.c 1996/08/28 17:13:56 1.3
+++ common.c 1996/08/29 22:37:33 1.5
@@ -33,7 +33,7 @@
#ifndef lint
static char RCSid[] =
-"$Id: common.c,v 1.3 1996/08/28 17:13:56 jns Exp $";
+"$Id: common.c,v 1.5 1996/08/29 22:37:33 jns Exp $";
static char sccsid[] = "@(#)common.c";
@@ -61,6 +61,9 @@
char *locuser = NULL; /* Local User's name */
int isserver = FALSE; /* We're the server */
int amchild = 0; /* This PID is a child */
+#ifdef KERBEROS
+int xencrypt = 0; /* To encrypt or not to */
+#endif
int do_fork = 1; /* Fork child process */
char *currenthost = NULL; /* Current client hostname */
char *progname = NULL; /* Name of this program */
Index: src/docmd.c
===================================================================
RCS file: /local/src/cvsroot/krdist/src/docmd.c,v
retrieving revision 1.3
retrieving revision 1.5
diff -u -r1.3 -r1.5
--- docmd.c 1996/08/28 17:14:03 1.3
+++ docmd.c 1996/08/29 22:37:36 1.5
@@ -33,7 +33,7 @@
#ifndef lint
static char RCSid[] =
-"$Id: docmd.c,v 1.3 1996/08/28 17:14:03 jns Exp $";
+"$Id: docmd.c,v 1.5 1996/08/29 22:37:36 jns Exp $";
static char sccsid[] = "@(#)docmd.c 5.1 (Berkeley) 6/6/85";
@@ -72,6 +72,18 @@
{
debugmsg(DM_CALL, "closeconn() called\n");
+#ifdef KERBEROS
+ if (isserver) {
+ if (rem_w >= 0) {
+ signal(SIGPIPE, SIG_IGN);
+
+ (void) sendcmd(C_FERRMSG, NULL);
+ (void) close(rem_w);
+ rem_w = -1;
+ }
+ }
+ else
+#endif
if (rem_w >= 0) {
/* We don't care if the connection is still good or not */
signal(SIGPIPE, SIG_IGN);
@@ -345,7 +357,16 @@
if (!IS_ON(options, DO_QUIET))
message(MT_VERBOSE, "updating host %s", rhost);
- (void) sprintf(buf, "%.*s -S", sizeof(buf)-5, path_rdistd);
+#ifdef KERBEROS
+ if (xencrypt) {
+ (void) sprintf(buf, "%.*s -S -e", sizeof(buf)-5, path_rdistd);
+ }
+ else {
+#endif
+ (void) sprintf(buf, "%.*s -S", sizeof(buf)-5, path_rdistd);
+#ifdef KERBEROS
+ }
+#endif
if ((rem_r = rem_w = remotecmd(rhost, locuser, ruser, buf)) < 0)
return(0);
Index: src/rdist.c
===================================================================
RCS file: /local/src/cvsroot/krdist/src/rdist.c,v
retrieving revision 1.3
retrieving revision 1.5
diff -u -r1.3 -r1.5
--- rdist.c 1996/08/28 17:14:49 1.3
+++ rdist.c 1996/08/29 22:37:37 1.5
@@ -33,7 +33,7 @@
#ifndef lint
static char RCSid[] =
-"$Id: rdist.c,v 1.3 1996/08/28 17:14:49 jns Exp $";
+"$Id: rdist.c,v 1.5 1996/08/29 22:37:37 jns Exp $";
static char sccsid[] = "@(#)main.c 5.1 (Berkeley) 6/6/85";
@@ -60,10 +60,18 @@
struct group *gr = NULL; /* Static area for getgrent */
char localmsglist[] = "stdout=all:notify=all:syslog=nerror,ferror";
char *remotemsglist = NULL;
+#ifdef KERBEROS
+char optchars[] = "A:a:bcd:DeFf:hil:L:M:m:NnOo:p:P:qRrst:Vvwxy";
+#else
char optchars[] = "A:a:bcd:DFf:hil:L:M:m:NnOo:p:P:qRrst:Vvwxy";
+#endif
FILE *opendist();
char *path_rdistd = _PATH_RDISTD;
+#ifdef KERBEROS
+char *path_remsh = _PATH_KREMSH;
+#else
char *path_remsh = _PATH_REMSH;
+#endif
/*
* Add a hostname to the host list
@@ -177,7 +185,11 @@
else if (c == 't')
rtimeout = atoi(optarg);
break;
-
+#ifdef KERBEROS
+ case 'e':
+ xencrypt = 1;
+ break;
+#endif
case 'F':
do_fork = FALSE;
break;
Index: src/rdistd.c
===================================================================
RCS file: /local/src/cvsroot/krdist/src/rdistd.c,v
retrieving revision 1.2
retrieving revision 1.4
diff -u -r1.2 -r1.4
--- rdistd.c 1996/08/28 17:14:54 1.2
+++ rdistd.c 1996/08/29 22:37:37 1.4
@@ -33,7 +33,7 @@
#ifndef lint
static char RCSid[] =
-"$Id: rdistd.c,v 1.2 1996/08/28 17:14:54 jns Exp $";
+"$Id: rdistd.c,v 1.4 1996/08/29 22:37:37 jns Exp $";
static char sccsid[] = "@(#)rdistd.c";
@@ -50,7 +50,11 @@
*/
static void usage()
{
+#ifdef KERBEROS
+ fprintf(stderr, "usage: %s -e -S [ -DV ]\n", progname);
+#else
fprintf(stderr, "usage: %s -S [ -DV ]\n", progname);
+#endif
exit(1);
}
@@ -70,7 +74,11 @@
if (init(argc, argv, envp) < 0)
exit(1);
+#ifdef KERBEROS
+ while ((c = getopt(argc, argv, "eSDV")) != -1)
+#else
while ((c = getopt(argc, argv, "SDV")) != -1)
+#endif
switch (c) {
case 'S':
isserver++;
@@ -79,7 +87,11 @@
case 'D':
debug++;
break;
-
+#ifdef KERBEROS
+ case 'e':
+ xencrypt = 1;
+ break;
+#endif
case 'V':
printf("%s\n", getversion());
exit(0);
Index: src/rshrcmd.c
===================================================================
RCS file: /local/src/cvsroot/krdist/src/rshrcmd.c,v
retrieving revision 1.3
retrieving revision 1.5
diff -u -r1.3 -r1.5
--- rshrcmd.c 1996/08/28 17:15:02 1.3
+++ rshrcmd.c 1996/08/29 22:37:38 1.5
@@ -6,7 +6,7 @@
#ifndef lint
static char RCSid[] =
-"$Id: rshrcmd.c,v 1.3 1996/08/28 17:15:02 jns Exp $";
+"$Id: rshrcmd.c,v 1.5 1996/08/29 22:37:38 jns Exp $";
#endif
#include "defs.h"
@@ -87,9 +87,17 @@
cmd, (char *) NULL);
error("execlp %s failed: %s.", _PATH_BSHELL, SYSERR);
} else {
+#ifdef KERBEROS
+ if (xencrypt) {
+ execlp(path_remsh, xbasename(path_remsh),
+ *ahost, ENCRYPT_FLAG, "-l", ruser, cmd,
+ (char *) NULL);
+ }
+ else
+#endif
execlp(path_remsh, xbasename(path_remsh),
*ahost, "-l", ruser, cmd, (char *) NULL);
- error("execlp %s failed: %s.", path_remsh, SYSERR);
+ error("execlp %s failed: %s.", path_remsh, SYSERR);
}
_exit(255);
}