# cfs.1.3.3.patch
# upgrades to cfs.1.3.3 from cfs.1.3.2
# mab 3/17/96
diff -c ./Makefile ../cfs133/Makefile
*** ./Makefile	Mon Dec 25 05:21:55 1995
--- ../cfs133/Makefile	Sun Mar 17 03:30:11 1996
***************
*** 1,4 ****
! # Makefile for cfs 1.3.2, ESM 1.0
  #*
  #* The author of this software is Matt Blaze.
  #*              Copyright (c) 1992, 1993, 1994, 1995 by AT&T.
--- 1,4 ----
! # Makefile for cfs 1.3.3, ESM 1.0
  #*
  #* The author of this software is Matt Blaze.
  #*              Copyright (c) 1992, 1993, 1994, 1995 by AT&T.
***************
*** 28,38 ****
  
  # NOTE TO LINUX USERS and others with a non-standard rpcgen:
  # There are two versions of rpcgen floating around.  You MUST make sure
! # that you are using a version that emits SunRPC compatible C code.
  # The version of rpcgen distributed with some (but not all) versions of
! # Linux will not work with CFS.  If CFS won't compile out of the box,
! # this is the most likely problem.  Replace rpcgen, and things should
! # work fine.  If you can't find the correct version of rpcgen, try
  # using "./make_with_bad_rpcgen" in this directory instead of "make".
  # (You'll need to do a "make clean" first if you've already failed with
  # the existing rpcgen.)
--- 28,40 ----
  
  # NOTE TO LINUX USERS and others with a non-standard rpcgen:
  # There are two versions of rpcgen floating around.  You MUST make sure
! # that you are using the compile options for the right one so that
! # it that emits standard SunRPC compatible C code with standard names.
  # The version of rpcgen distributed with some (but not all) versions of
! # Linux does not do this by default.  If CFS won't compile out of the box,
! # this is the most likely problem.  Change RPC options, and things should
! # work fine (do a "make clean" after re-editing the makefile).
! # As a last resort, if you absolutely can't make your rpcgen work, try
  # using "./make_with_bad_rpcgen" in this directory instead of "make".
  # (You'll need to do a "make clean" first if you've already failed with
  # the existing rpcgen.)
***************
*** 101,150 ****
  #CFLAGS=$(COPT) -I$(RINCLUDES) -DSUN
  #LIBS=
  #COMPAT=
  
! ## use these for Linux (Slackware 1.1.2)
  # See NOTE TO LINUX USERS above, and also README.linux,
  # if you can't make things work.
  #CFLAGS=$(COPT) -I$(RINCLUDES)
  #LIBS=
  #COMPAT=
  
  ## Irix 4.0 -- markh@wimsey.bc.ca
  # see README.irix
  #CFLAGS=-cckr $(COPT) -Dirix -I$(RINCLUDES)
  #LIBS=-lrpcsvc -lsun
  #COMPAT=
  
  ## hpux 8.0 -- markh@wimsey.bc.ca
  # also thanks to Charles Henrich (henrich@crh.cl.msu.edu)
  # and Eric Ross (ericr@hpvclq.vcd.hp.com)
  #CFLAGS=$(COPT) -Dhpux -DNORLIMITS -I$(RINCLUDES)
- #LIBS=-lBSD
  #COMPAT=
  
  ## use these for AIX 3.2.0 -- markh@wimsey.bc.ca
  #CFLAGS=$(COPT) -D_BSD -D_SUN -DAIX320EUIDBUG -I$(RINCLUDES)
  #LIBS=
  #COMPAT=
  
  ## use these for 4.4/BSD386 systems with CFS on its own port
  #CFLAGS=$(COPT) -DBSD44 -DANYPORT -I$(RINCLUDES)
  #LIBS=-lrpc
  #COMPAT=-lcompat
  
  ## Ultrix 4.2a
  #CFLAGS=$(COPT) -DANYPORT -I$(RINCLUDES)
  #LIBS=
  #COMPAT=
  
  ## use these for 4.4/BSD386 systems with CFS on the NFS port because of no
  # support for the port options in the mount syscall
  # BSDI support by mab
  # Also works under freeBSD, though you may want to use -static on the
  #  linker (dean@deanstoy.wa.com (Dean M. Phillips))
  #CFLAGS=$(COPT) -DBSD44 -DANYPORT -DCFS_PORT=2049 -DSHORTLINKS -I$(RINCLUDES)
  #LIBS=-lrpc
  #COMPAT=-lcompat
  
  ##use these for NetBSD i386 1.0 (John Kohl)
  # for mounting, you need to use a command like:
--- 103,179 ----
  #CFLAGS=$(COPT) -I$(RINCLUDES) -DSUN
  #LIBS=
  #COMPAT=
+ #RPCOPTS=
  
! ## use these for recent versions of Linux with rpcgen-from-hell
! # See NOTE TO LINUX USERS above, and also README.linux,
! # if you can't make things work.
! #CFLAGS=$(COPT) -U__OPTIMIZE__ -traditional -Dd_fileno=d_ino -I$(RINCLUDES)
! #LIBS=
! #COMPAT=
! #RPCOPTS= -k -b
! 
! ## use these for older versions Linux (Slackware 1.1.2)
  # See NOTE TO LINUX USERS above, and also README.linux,
  # if you can't make things work.
  #CFLAGS=$(COPT) -I$(RINCLUDES)
  #LIBS=
  #COMPAT=
+ #RPCOPTS=
  
  ## Irix 4.0 -- markh@wimsey.bc.ca
  # see README.irix
  #CFLAGS=-cckr $(COPT) -Dirix -I$(RINCLUDES)
  #LIBS=-lrpcsvc -lsun
  #COMPAT=
+ #RPCOPTS=
  
  ## hpux 8.0 -- markh@wimsey.bc.ca
  # also thanks to Charles Henrich (henrich@crh.cl.msu.edu)
  # and Eric Ross (ericr@hpvclq.vcd.hp.com)
  #CFLAGS=$(COPT) -Dhpux -DNORLIMITS -I$(RINCLUDES)
  #COMPAT=
+ #RPCOPTS=
+ #LIBS=-lBSD
+ # on later hpux versions, use
+ #LIBS=
  
  ## use these for AIX 3.2.0 -- markh@wimsey.bc.ca
  #CFLAGS=$(COPT) -D_BSD -D_SUN -DAIX320EUIDBUG -I$(RINCLUDES)
  #LIBS=
  #COMPAT=
+ #RPCOPTS=
  
  ## use these for 4.4/BSD386 systems with CFS on its own port
  #CFLAGS=$(COPT) -DBSD44 -DANYPORT -I$(RINCLUDES)
  #LIBS=-lrpc
  #COMPAT=-lcompat
+ #RPCOPTS=
  
  ## Ultrix 4.2a
  #CFLAGS=$(COPT) -DANYPORT -I$(RINCLUDES)
  #LIBS=
  #COMPAT=
+ #RPCOPTS=
+ 
+ ## use these for 4.4/BSD386 systems with CFS on its own port 
+ # Use this for BSDI 2.1 or later
+ # BSDI support by mab
+ #CFLAGS=$(COPT) -DBSD44 -DANYPORT -DSHORTLINKS -I$(RINCLUDES)
+ #LIBS=-lrpc
+ #COMPAT=-lcompat
+ #RPCOPTS=
  
  ## use these for 4.4/BSD386 systems with CFS on the NFS port because of no
  # support for the port options in the mount syscall
+ # Use this for BSDI 2.0 or earlier.
  # BSDI support by mab
  # Also works under freeBSD, though you may want to use -static on the
  #  linker (dean@deanstoy.wa.com (Dean M. Phillips))
  #CFLAGS=$(COPT) -DBSD44 -DANYPORT -DCFS_PORT=2049 -DSHORTLINKS -I$(RINCLUDES)
  #LIBS=-lrpc
  #COMPAT=-lcompat
+ #RPCOPTS=
  
  ##use these for NetBSD i386 1.0 (John Kohl)
  # for mounting, you need to use a command like:
***************
*** 153,163 ****
--- 182,194 ----
  #CFLAGS=$(COPT) -DBSD44 -DANYPORT -DCFS_PORT=2049 -DSHORTLINKS -I$(RINCLUDES)
  #LIBS=
  #COMPAT=-lcompat
+ #RPCOPTS=
  
  ## use these flags on Solaris 2.3 / SUNOS 5.x
  #CFLAGS=$(COPT) -DSOLARIS2X -DPORTMAP -I$(RINCLUDES) -DPTMX
  #LIBS=-lsocket -lnsl
  #COMPAT=
+ #RPCOPTS=
  
  ## not sure what to do for NeXT.  I think this works:
  #CFLAGS=$(COPT) -posix -D_BSD -DANYPORT -I$(RINCLUDES)
***************
*** 244,268 ****
  	$(CC) -c truerand.c
  
  nfsproto_xdr.c: nfsproto.x
! 	rpcgen -c -o nfsproto_xdr.c nfsproto.x 
  
  nfsproto_svr.c: nfsproto.x
! 	rpcgen -m -o nfsproto_svr.c nfsproto.x 
  
  nfsproto.h: nfsproto.x
! 	rpcgen -h -o nfsproto.h nfsproto.x
  
  admproto_xdr.c: admproto.x
! 	rpcgen -c -o admproto_xdr.c admproto.x 
  
  admproto_svr.c: admproto.x
! 	rpcgen -m -o admproto_svr.c admproto.x 
  
  admproto.h: admproto.x
! 	rpcgen -h -o admproto.h admproto.x
  
  admproto_clnt.c: admproto.x
! 	rpcgen -l -o admproto_clnt.c admproto.x 
  
  clean:
  	rm -f $(OBJS) $(COBJS) $(OTHERS)
--- 275,299 ----
  	$(CC) -c truerand.c
  
  nfsproto_xdr.c: nfsproto.x
! 	rpcgen $(RPCOPTS) -c -o nfsproto_xdr.c nfsproto.x 
  
  nfsproto_svr.c: nfsproto.x
! 	rpcgen $(RPCOPTS) -m -o nfsproto_svr.c nfsproto.x 
  
  nfsproto.h: nfsproto.x
! 	rpcgen $(RPCOPTS) -h -o nfsproto.h nfsproto.x
  
  admproto_xdr.c: admproto.x
! 	rpcgen $(RPCOPTS) -c -o admproto_xdr.c admproto.x 
  
  admproto_svr.c: admproto.x
! 	rpcgen $(RPCOPTS) -m -o admproto_svr.c admproto.x 
  
  admproto.h: admproto.x
! 	rpcgen $(RPCOPTS) -h -o admproto.h admproto.x
  
  admproto_clnt.c: admproto.x
! 	rpcgen $(RPCOPTS) -l -o admproto_clnt.c admproto.x 
  
  clean:
  	rm -f $(OBJS) $(COBJS) $(OTHERS)
diff -c ./README ../cfs133/README
*** ./README	Thu Oct 26 15:17:06 1995
--- ../cfs133/README	Sun Mar 17 03:31:22 1996
***************
*** 1,4 ****
! This is version 1.3.0 of CFS, the Cryptographic File System, which
  also includes version 1.0 of ESM, the Encrypting Session Manager.
  
  There is a mailing list, cfs-users, for discussion of topics of
--- 1,4 ----
! This is version 1.3.3 of CFS, the Cryptographic File System, which
  also includes version 1.0 of ESM, the Encrypting Session Manager.
  
  There is a mailing list, cfs-users, for discussion of topics of
diff -c ./README.history ../cfs133/README.history
*** ./README.history	Mon Dec 25 03:49:06 1995
--- ../cfs133/README.history	Sun Mar 17 03:33:23 1996
***************
*** 1,5 ****
--- 1,10 ----
  CFS revision history:
  
+ 1.3.3 - More minor bug fixes.  Makefile should work more easily
+ under newer Linux versions.  Cname/ccat fixed to work again (but
+ still only for directories created with cmkdir -o).  Compatible with
+ 1.3.2.
+ 
  1.3.2 - Minor bug fixes.  Triple DES (2key) now default.  Added true
  3-key 3des (-3) option.  (Cmkdir options are different from previous
  versions).  Added "--" option to cmkdir and cattach to read keys from
diff -c ./README.linux ../cfs133/README.linux
*** ./README.linux	Thu Oct 26 15:17:07 1995
--- ../cfs133/README.linux	Sat Mar 16 21:30:23 1996
***************
*** 1,3 ****
--- 1,12 ----
+ There are two versions of RPCGEN on various linuxes.  Read the makefile
+ carefully to make sure you compile for the right one (if you get it
+ wrong, do a "make clean" before switching to the other).
+ 
+ -matt (3/96)
+ 
+ Here's some background:
+ 
+ 
  From owner-cfs-users  Wed Mar  8 18:22:15 1995
  Received: by merckx.info.att.com (4.1/4.7)
          id AA15369; Wed, 8 Mar 95 18:22:15 EST
***************
*** 54,58 ****
          -Dadmproc_detach_1_svc=admproc_detach_1 \
          -Dadmproc_ls_1_svc=admproc_ls_1 \
                  "
! 
  
--- 63,105 ----
          -Dadmproc_detach_1_svc=admproc_detach_1 \
          -Dadmproc_ls_1_svc=admproc_ls_1 \
                  "
! From:     Monty Walls <mwalls@castor.oktax.state.ok.us>
! To:       Matt Blaze <mab@research.att.com>
! Date:     Fri, 16 Feb 1996 14:34:50 -0600 (CST)
! Subject:  Re: Linux Compatibility & rpcgen
! In-Reply-To: <199602151603.LAA14987@nsa.tempo.att.com>
! References: <199602151603.LAA14987@nsa.tempo.att.com>
! 
! 
! Here are the cflags I used for Slackware 2.3:
!  
! RPCGEN=rpcgen -k -b
! CFLAGS=$(COPT) -U__OPTIMIZE__ -traditional -Dd_fileno=d_ino -I$(RINCLUDES)
! 
! why:
! 
! -U__OPTIMIZE__ - turns off inline code (turned on by -O) for some
! functions which will give syntax errors when using -traditional (GCC
! again).
! 
! -traditional    - required because rpcgen.new generates prototypes even in
! k&r mode (tests for __STDC__, which is true with GCC).
! 
! I done some preliminary testing and it appears to work ok.  Rpcinfo does
! complain about how cfs is registered:
! 
! castor# /usr/sbin/rpcinfo -p
!    program vers proto   port
!     100000    2   tcp    111  portmapper
!     100000    2   udp    111  portmapper
!     100005    1   udp    849  mountd
!     100005    1   tcp    851  mountd
! clnttcp_create: RPC: Program not registered
! clnttcp_create: RPC: Program not registered
! 1092830567    2   udp   3049
! 
! -Monty Walls (mwalls@castor.oktax.state.ok.us)
! -       MIS(Technical Supt), Oklahoma Tax Commission
! -
! - My opinions are my own, my employer knows nothing about it.
  
diff -c ./ccat.c ../cfs133/ccat.c
*** ./ccat.c	Mon Dec 25 01:22:01 1995
--- ../cfs133/ccat.c	Sun Mar 17 03:26:17 1996
***************
*** 58,69 ****
  	int offset;
  	int i;
  	char *buf[8192];
! 	int ciph=CFS_STD_DES;
  
  	fprintf(stderr,"WARNING: ccat works only on old format CFS files\n");
  	while (--argc && (**++argv == '-')) {
  		for (flg= ++*argv; *flg; ++flg)
  			switch (*flg) {
  			    case '3':
  				ciph=CFS_THREE_DES;
  				break;
--- 58,72 ----
  	int offset;
  	int i;
  	char *buf[8192];
! 	int ciph=CFS_THREE_DES;
  
  	fprintf(stderr,"WARNING: ccat works only on old format CFS files\n");
  	while (--argc && (**++argv == '-')) {
  		for (flg= ++*argv; *flg; ++flg)
  			switch (*flg) {
+ 			    case '1':
+ 				ciph=CFS_STD_DES;
+ 				break;
  			    case '3':
  				ciph=CFS_THREE_DES;
  				break;
***************
*** 79,85 ****
  				ciph=CFS_SAFER_SK128;
  				break;
  			    default:
! 				fprintf(stderr,"usage: ccat [-3bms] file...\n");
  				exit(1);
  			}
  	}
--- 82,88 ----
  				ciph=CFS_SAFER_SK128;
  				break;
  			    default:
! 				fprintf(stderr,"usage: ccat [-13bms] file...\n");
  				exit(1);
  			}
  	}
***************
*** 98,103 ****
--- 101,112 ----
  		exit(1);
  	}
  	copykey(&k,&kt);
+ 	kt.smsize=LARGESMSIZE;
+ 	if (((kt.primask=(char*) malloc(kt.smsize)) == NULL)
+ 	    || ((kt.secmask=(char*) malloc(kt.smsize)) == NULL)) {
+ 		fprintf(stderr,"No memory\n");
+ 		exit(2);
+ 	}
  	genmasks(&kt);
  	for (i=0; i<argc; i++) {
  		strcpy(ivfile,argv[i]);
diff -c ./cname.c ../cfs133/cname.c
*** ./cname.c	Mon Dec 25 01:49:00 1995
--- ../cfs133/cname.c	Sun Mar 17 03:25:17 1996
***************
*** 46,52 ****
  	char estr[1024];
  	char *cstr;
  	int i;
! 	int ciph=CFS_STD_DES;
  	int verb=0;
  	
  	fprintf(stderr,"WARNING: cname works only on old format CFS dirs\n");
--- 46,52 ----
  	char estr[1024];
  	char *cstr;
  	int i;
! 	int ciph=CFS_THREE_DES;
  	int verb=0;
  	
  	fprintf(stderr,"WARNING: cname works only on old format CFS dirs\n");
***************
*** 56,61 ****
--- 56,64 ----
  			    case 'v':
  				verb++;
  				break;
+ 			    case '1':
+ 				ciph=CFS_STD_DES;
+ 				break;
  			    case '3':
  				ciph=CFS_THREE_DES;
  				break;
***************
*** 76,82 ****
  			}
  	}
  	if (argc!=0) {
! 		fprintf(stderr,"Usage: cname [-3bmsv]\n");
  		exit(1);
  	}
  	if ((pw=getpassword("Key:"))==NULL) {
--- 79,85 ----
  			}
  	}
  	if (argc!=0) {
! 		fprintf(stderr,"Usage: cname [-13bmsv]\n");
  		exit(1);
  	}
  	if ((pw=getpassword("Key:"))==NULL) {
***************
*** 90,95 ****
--- 93,104 ----
  		exit(1);
  	}
  	copykey(&k,&kt);
+ 	kt.smsize=LARGESMSIZE;
+ 	if (((kt.primask=(char*) malloc(kt.smsize)) == NULL)
+ 	    || ((kt.secmask=(char*) malloc(kt.smsize)) == NULL)) {
+ 		fprintf(stderr,"No memory\n");
+ 		exit(2);
+ 	}
  	genmasks(&kt);
  	while (fgets(estr, sizeof(estr), stdin) != NULL) {
  		if (estr[strlen(estr)-1] == '\n')
diff -c ./ver.c ../cfs133/ver.c
*** ./ver.c	Mon Dec 25 02:48:02 1995
--- ../cfs133/ver.c	Sun Mar 17 03:31:18 1996
***************
*** 1,2 ****
  static char version[]=
!    "CFS 1.3.2 - cryptlevel: DES=5, 3DES=3, T3DES=1, MCG=3, SAFER=1";
--- 1,2 ----
  static char version[]=
!    "CFS 1.3.3 - cryptlevel: DES=5, 3DES=3, T3DES=1, MCG=3, SAFER=1";

