rpms/cfs/devel cfs_1.4.1-ret.patch, NONE, 1.1 cfs_1.4.1-opt.patch, NONE, 1.1 cfs_1.4.1-cfix.patch, NONE, 1.1 cfs.spec, 1.10, 1.11

Enrico Scholz (ensc) fedora-extras-commits at redhat.com
Sat Jun 3 11:12:58 UTC 2006


Author: ensc

Update of /cvs/extras/rpms/cfs/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv24829/devel

Modified Files:
	cfs.spec 
Added Files:
	cfs_1.4.1-ret.patch cfs_1.4.1-opt.patch cfs_1.4.1-cfix.patch 
Log Message:
- added a huge patch which fixes missing prototypes and other non K&R
  issues. This should solve problems on AMD64


cfs_1.4.1-ret.patch:

--- NEW FILE cfs_1.4.1-ret.patch ---
--- cfs-1.4.1/cfs_fh.c.ret	2006-06-03 13:02:07.000000000 +0200
+++ cfs-1.4.1/cfs_fh.c	2006-06-03 13:02:07.000000000 +0200
@@ -202,14 +202,20 @@ writeblock(blk,fd,offset,len,key,vect)
 	   the file, is shorter than CFSBLOCK and brings the file to a length
 	   which is evenly dividable by CFSBLOCK */
 	if (offset+len > dtov(sb.st_size) && vtod(offset+len) < sb.st_size) {
-	    ftruncate(fd, vtod(offset+len));
+	    if (ftruncate(fd, vtod(offset+len))==-1) {
+	        perror("ftruncate()");
+	        return -1;
+	    }
 	}
 	/* due to the way the file is padded we may actually have to
 	   truncate it here. This happens when the write is at the end of
 	   the file, is shorter than CFSBLOCK and brings the file to a length
 	   which is evenly dividable by CFSBLOCK */
 	if (offset+len > dtov(sb.st_size) && vtod(offset+len) < sb.st_size) {
-	    ftruncate(fd, vtod(offset+len));
+	    if (ftruncate(fd, vtod(offset+len))==-1) {
+	        perror("ftruncate()");
+	        return -1;
+	    }
 	}
 	/* iolen may contain CFSBLOCK extra chars */
 	return(dtov(iolen)-fronterr);
@@ -1196,7 +1202,10 @@ fhdohardlink(f,t,n)
 	unlink(linkname);
 	if (readlink(f->vectname,vectval,9) == 8) {
 		vectval[8]='\0';
-		symlink(vectval,linkname);
+		if (symlink(vectval,linkname)==-1) {
+		  cfserrno = NFSERR_IO;
+		  return -2;
+		}
 	}
 	return ret;
 }
@@ -1242,7 +1251,10 @@ fhrename(f,fn,t,tn)
 		unlink(tblink);	/* may be a quick race cndtn here */
 		if (readlink(fblink,vectval,9)==8) {
 			vectval[8]='\0';
-			symlink(vectval,tblink);
+			if (symlink(vectval,tblink)==-1) {
+			  cfserrno = NFSERR_IO;
+			  return -2;
+			}
 		}
 		unlink(fblink);
 		/* rename(fblink,tblink); */
--- cfs-1.4.1/cmkdir.c.ret	2006-06-03 13:02:07.000000000 +0200
+++ cfs-1.4.1/cmkdir.c	2006-06-03 13:02:07.000000000 +0200
@@ -200,7 +200,10 @@ main(argc,argv)
 		perror("cmkdir");
 		exit(1);
 	}
-	fwrite(str,8,1,fp);
+	if (fwrite(str,8,1,fp)!=1) {
+	        perror("fwrite");
+	        exit(1);
+	}
 	fclose(fp);
 	sprintf(path,"%s/..c",argv[0]);
 	if ((fp=fopen(path,"w")) == NULL) {
@@ -222,7 +225,10 @@ main(argc,argv)
 			perror("cmkdir");
 			exit(1);
 		}
-		fwrite(ekey,32,1,fp);
+		if (fwrite(ekey,32,1,fp)!=1) {
+			perror("fwrite");
+			exit(1);
+		}
 		fclose(fp);
 	}
 	exit(0);
--- cfs-1.4.1/ccat.c.ret	2006-06-03 13:02:07.000000000 +0200
+++ cfs-1.4.1/ccat.c	2006-06-03 13:02:07.000000000 +0200
@@ -23,6 +23,8 @@
 #include <sys/time.h>
 #include <sys/file.h>
 #include <sys/stat.h>
+#include <errno.h>
+#include <unistd.h>
 #ifdef SOLARIS2X
 #include <string.h>
 #define rindex strrchr
@@ -147,7 +149,10 @@ main(argc,argv)
 			if (siz>8192)
 				siz=8192;
 			siz=readblock(buf,fd,offset,siz,&kt,iv);
-			write(1,buf,siz);
+			if (TEMP_FAILURE_RETRY(write(1,buf,siz))!=siz) {
+				perror("write");
+				exit(1);
+			}
 			offset+=siz;
 		}
 	}
--- cfs-1.4.1/cattach.c.ret	2006-06-03 13:02:07.000000000 +0200
+++ cfs-1.4.1/cattach.c	2006-06-03 13:02:07.000000000 +0200
@@ -231,7 +231,10 @@ main(argc,argv)
 	if ((fp=fopen(cname,"r")) == NULL) {
 		ciph=CFS_STD_DES;
 	} else {
-		fscanf(fp,"%d",&ciph);
+	        if (fscanf(fp,"%d",&ciph)==-1) {
+			perror("fscanf");
+	        	exit(1);
+		}
 		fclose(fp);
 	}
 	if ((fp=fopen(kname,"r")) == NULL) {
--- cfs-1.4.1/cpasswd.c.ret	2006-06-03 13:02:07.000000000 +0200
+++ cfs-1.4.1/cpasswd.c	2006-06-03 13:02:29.000000000 +0200
@@ -21,6 +21,7 @@
 #include <stdio.h>
 #include <rpc/rpc.h>
 #include <sys/time.h>
+#include <errno.h>
 #include "nfsproto.h"
 #include "admproto.h"
 #include "cfs.h"
@@ -106,10 +107,11 @@ main(argc,argv)
 	if ((fp=fopen(cname,"r")) == NULL) {
 		fprintf(stderr,"Can only change passphrase on new format CFS directories\n");
 		exit(1);
-	} else {
-		fscanf(fp,"%d",&ciph);
-		fclose(fp);
+	} else if (fscanf(fp,"%d",&ciph)==-1) {
+	        fprintf(stderr,"fscanf failed with '%s'\n", strerror(errno));
+		exit(1);
 	}
+	fclose(fp);
 	if (((fp=fopen(kname,"r")) == NULL) || (fread(ekey,1,32,fp)<16)) {
 		perror(dir);
 		fprintf(stderr,"Can only change passphrase on new format CFS directories\n");

cfs_1.4.1-opt.patch:

--- NEW FILE cfs_1.4.1-opt.patch ---
--- cfs-1.4.1/Makefile.opt	2006-06-03 11:58:48.000000000 +0200
+++ cfs-1.4.1/Makefile	2006-06-03 11:59:09.000000000 +0200
@@ -131,7 +131,7 @@ RINCLUDES=/usr/mab/rsaref/source
 #RPCOPTS= -k -b
 
 #CFLAGS=$(COPT) -U__OPTIMIZE__ -Dd_fileno=d_ino -I$(RINCLUDES)
-CFLAGS=$(COPT) -U__OPTIMIZE__ -Dd_fileno=d_ino
+CFLAGS=$(COPT) -Dd_fileno=d_ino
 LIBS=
 COMPAT=
 RPCOPTS=

cfs_1.4.1-cfix.patch:

--- NEW FILE cfs_1.4.1-cfix.patch ---
--- cfs-1.4.1/cattach.c.cfix	2006-06-03 12:56:19.000000000 +0200
+++ cfs-1.4.1/cattach.c	2006-06-03 12:56:19.000000000 +0200
@@ -49,6 +49,7 @@
 #include "nfsproto.h"
 #include "admproto.h"
 #include "cfs.h"
+#include "getpass.h"
 
 #ifdef SOLARIS2X
 /* NOTE!  delete the #define statfs below if this won't compile on
@@ -64,6 +65,10 @@
 #define IDLE 0
 #endif
 
+static void enq(char f);
+static int  deq();
+
+int
 main(argc,argv)
      int argc;
      char **argv;
@@ -233,7 +238,7 @@ main(argc,argv)
 		cfmt=0;
 	} else {
 		cfmt=1;
-		if (fread(ekey,32,1,fp) < 0)
+		if (fread(ekey,32,1,fp) < 1)
 			cfmt=0;
 		fclose(fp);
 	}
@@ -274,8 +279,10 @@ main(argc,argv)
 		exit(1);
 	}
 	cln->cl_auth = authunix_create_default();
-	if ((status = clnt_call(cln,ADMPROC_ATTACH,xdr_cfs_attachargs,&ap,
-				xdr_cfsstat,&ret,tout)) != RPC_SUCCESS) {
+	if ((status = clnt_call(cln,ADMPROC_ATTACH,
+				(xdrproc_t)xdr_cfs_attachargs,(void *)&ap,
+				(xdrproc_t)xdr_cfsstat,(void *)&ret,
+				tout)) != RPC_SUCCESS) {
 		clnt_perrno(status);
 		exit(1);
 	}
@@ -291,8 +298,8 @@ struct {
         int tail;
 } argq = {{0},0,0};
 
-enq(f)
-     char f;
+void
+enq(char f)
 {
 	argq.tail++;
 	argq.tail %= QS;
@@ -303,6 +310,7 @@ enq(f)
 	argq.data[argq.tail]=f;
 }
 
+int
 deq()
 {
 	if (argq.head==argq.tail)
--- cfs-1.4.1/ccat.c.cfix	2006-06-03 12:56:19.000000000 +0200
+++ cfs-1.4.1/ccat.c	2006-06-03 12:56:19.000000000 +0200
@@ -32,12 +32,19 @@
 #include "nfsproto.h"
 #include "admproto.h"
 #include "cfs.h"
+#include "getpass.h"
+#include "cfs_adm.h"
+#include "cfs_fh.h"
+#include "cfs_cipher.h"
 
 /* following are never used - just so i can re-use the library */
 int validhost;
 char zerovect[]={0,0,0,0,0,0,0,0,0};
 int cursecs=0;
 
+static int flen(int fd);
+
+int
 main(argc,argv)
      int argc;
      char **argv;
@@ -57,7 +64,7 @@ main(argc,argv)
 	int siz;
 	int offset;
 	int i;
-	char *buf[8192];
+	char buf[8192];
 	int ciph=CFS_BLOWFISH;
 
 	fprintf(stderr,"WARNING: ccat works only on old format CFS files\n");
@@ -100,8 +107,8 @@ main(argc,argv)
 	}
 	copykey(&k,&kt);
 	kt.smsize=LARGESMSIZE;
-	if (((kt.primask=(char*) malloc(kt.smsize)) == NULL)
-	    || ((kt.secmask=(char*) malloc(kt.smsize)) == NULL)) {
+	if (((kt.primask=malloc(kt.smsize)) == NULL)
+	    || ((kt.secmask=malloc(kt.smsize)) == NULL)) {
 		fprintf(stderr,"No memory\n");
 		exit(2);
 	}
@@ -120,7 +127,7 @@ main(argc,argv)
 		else {
 			*p='\0';
 			strcpy(base,++p);
-			snprintf(ivfile, 1024, "%s/.pvect_%s", ivfile, base);
+			l = snprintf(ivfile, 1024, "%s/.pvect_%s", ivfile, base);
 			if (l < 0 || l >= 1024) {
 			  fprintf(stderr, "File name too long\n");
 			  continue;
@@ -146,6 +153,7 @@ main(argc,argv)
 	}
 }
 
+int
 flen(fd)
      int fd;
 {
--- cfs-1.4.1/cfs.c.cfix	2006-06-03 12:56:19.000000000 +0200
+++ cfs-1.4.1/cfs.c	2006-06-03 12:56:19.000000000 +0200
@@ -32,7 +32,9 @@
 /* #include <arpa/inet.h> */
 #include <netdb.h>
 #include <rpc/rpc.h>
+#include <rpc/pmap_clnt.h>
 #include <sys/time.h>
+#include <sys/stat.h>
 #ifndef NORLIMITS
 #include <sys/resource.h>
 #endif
@@ -44,6 +46,7 @@
 #include "cfs.h"
 
 #include <stdlib.h>
+#include <string.h>
 
 struct in_addr validhost;
 
@@ -52,8 +55,8 @@ void nfs_program_2();
 void adm_program_2();
 #include <string.h>
 #else
-int nfs_program_2();
-int adm_program_2();
+void nfs_program_2(struct svc_req *request, SVCXPRT *xprt);
+void adm_program_2(struct svc_req *request, SVCXPRT *xprt);
 #endif
 #ifdef __NetBSD__
 int _rpcsvcdirty;
@@ -73,6 +76,9 @@ int mount_pid =0;
 int umount_pid =0;
 unsigned int doexit =0;
 
+static void initstuff();
+
+int
 main(argc,argv)
      int argc;
      char **argv;
@@ -265,7 +271,7 @@ main(argc,argv)
 	exit(1);
 }
 
-initstuff()
+static void initstuff()
 {
 	int i;
 	static instance ina,inb;
--- cfs-1.4.1/cfs.h.cfix	2006-06-03 12:56:19.000000000 +0200
+++ cfs-1.4.1/cfs.h	2006-06-03 12:56:35.000000000 +0200
@@ -17,11 +17,16 @@
  * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
  */
 
+#ifndef H_ENSC_CFS_CFS_H
+#define H_ENSC_CFS_CFS_H
 /* include files specific to cipher modules go here */
 /* (i don't normally like nested includes) */
+#include <sys/types.h>
+
 #include "mcg.h"
 #include "safer.h"
 #include "cfs_bf.h"
+#include "nfsproto.h"
 
 #define H_REG 0
 #define H_ATTACH 0	/* same as regular */
@@ -139,9 +144,9 @@ typedef struct cfskey {  /* now holds ex
 			safer_key_t secondary;
 		} safer;
 	} var;
-	int smsize; /* right now either LARGESMSIZE or SMALLSMSIZE */
-	char *primask;
-	char *secmask;
+	size_t smsize; /* right now either LARGESMSIZE or SMALLSMSIZE */
+	unsigned char *primask;
+	unsigned char *secmask;
 } cfskey;
 
 typedef struct instance {
@@ -162,7 +167,6 @@ typedef struct instance {
 } instance;
 
 extern int cfserrno;
-extern int errno;
 extern int cursecs;
 
 extern char zerovect[];
@@ -200,7 +204,7 @@ extern cfs_fileid rootnode;
 #define become(x) ((x)==NULL?(setuidx(ID_EFFECTIVE | ID_REAL,0)||setgidx(ID_EFFECTIVE|ID_REAL,0)) :\
            (setgidx(ID_EFFECTIVE|ID_REAL,rgid(x)) || setuidx(ID_EFFECTIVE|ID_REAL, ruid(x))))
 #else
-#ifdef linux
+#ifdef __linux
 #define become(x) ((x)==NULL?(seteuid(0)||setegid(0)) :\
 		(setfsgid(rgid(x)) || setfsuid(ruid(x))))
 #else
@@ -230,3 +234,7 @@ extern cfs_fileid rootnode;
 */
 #endif
 #include<stdlib.h>
+
+void	freeinstance(int i);
+
+#endif // H_ENSC_CFS_CFS_H
--- cfs-1.4.1/cfs_adm.c.cfix	2006-06-03 12:56:19.000000000 +0200
+++ cfs-1.4.1/cfs_adm.c	2006-06-03 12:56:19.000000000 +0200
@@ -18,19 +18,29 @@
 /*
  * server adm rpc handlers - ver 1.3.2
  */
+#include "cfs_adm.h"
+
 #include <sys/types.h>
 #include <stdio.h>
 #include <rpc/rpc.h>
 #include <sys/time.h>
 #include <string.h>
+#include <unistd.h>
+#include <sys/fsuid.h>
 #include "admproto.h"
 #include "nfsproto.h"
 #include "cfs.h"
-
-typedef struct svc_req *SR;
+#include "cfs_fh.h"
+#include "cfs_nfs.h"
+#include "cfs_cipher.h"
 
 int topinstance = 0;
 
+static int already(char *s);
+static int verify(char *path,cfskey *k);
+static void freelist(cfs_fileid *f);
+
+void
 cfs_adm()
 {
 }
@@ -38,6 +48,7 @@ cfs_adm()
 void *
 admproc_null_2_svc(void *a, struct svc_req *r)
 {
+  return 0;
 }
 
 cfsstat *
@@ -47,6 +58,7 @@ admproc_attach_2_svc(cfs_attachargs *ap,
 	int i;
 	cfskey tk;
 	instance *ins;
+	struct timeval	tmp_time;
 
 #ifdef DEBUG
 	printf("attach: %s %s %d\n",ap->dirname, ap->name, ap->anon);
@@ -90,12 +102,12 @@ admproc_attach_2_svc(cfs_attachargs *ap,
 	for (i=0; i<HSIZE; i++)
 		ins->file[i]=NULL;
 	ins->key.smsize = ap->smsize;
-	if ((ins->key.primask=(char*) malloc(ins->key.smsize)) == NULL) {
+	if ((ins->key.primask=malloc(ins->key.smsize)) == NULL) {
 		free(ins);
 		ret = CFSERR_IFULL;
 		return &ret;
 	}
-	if ((ins->key.secmask=(char*) malloc(ins->key.smsize)) == NULL) {
+	if ((ins->key.secmask=malloc(ins->key.smsize)) == NULL) {
 		free(ins->key.primask);
 		free(ins);
 		ret = CFSERR_IFULL;
@@ -108,7 +120,9 @@ admproc_attach_2_svc(cfs_attachargs *ap,
 	genmasks(&ins->key);
 	ins->uid=ap->uid;
 	ins->highsec=ap->highsec;
-	gettimeofday((struct timeval *)&roottime,NULL);
+	gettimeofday(&tmp_time, NULL);
+	roottime.seconds  = tmp_time.tv_sec;
+	roottime.useconds = tmp_time.tv_usec;
 	if (ap->expire !=0)
 		ins->timeout = roottime.seconds + (ap->expire*60);
 	else
@@ -123,6 +137,7 @@ admproc_attach_2_svc(cfs_attachargs *ap,
 	return &ret;
 }
 
+static int
 already(s)
      char *s;
 {
@@ -134,6 +149,7 @@ already(s)
 	return 0;
 }
 
+void
 genmasks(k)
      cfskey *k;
 {
@@ -176,10 +192,13 @@ found:
 }
 
 /* freeinstance is also called by geth if expired */
+void
 freeinstance(i)
     int i;
 {
 	int j;
+	struct timeval tmp_time;
+	
 
 	for (j=0; j<HSIZE; j++) {
 		freelist(instances[i]->file[j]);
@@ -192,10 +211,13 @@ freeinstance(i)
 	bzero((char *)instances[i],sizeof(instance));
 	free(instances[i]);
 	instances[i]=NULL;
-	gettimeofday((struct timeval *)&roottime,NULL);
+	gettimeofday(&tmp_time, NULL);
+	roottime.seconds  = tmp_time.tv_sec;
+	roottime.useconds = tmp_time.tv_usec;
 	closeall();
 }
 
+void
 freelist(f)
     cfs_fileid *f;
 {
@@ -206,13 +228,14 @@ freelist(f)
 	free(f);
 }
 
+int
 verify(path,k)
      char *path;
-     cfs_admkey *k;
+     cfskey *k;
 {
 	FILE *fp;
 	char fn[NFS_MAXPATHLEN];
-	char buf[9];
+	unsigned char buf[9];
 	int l;
 
 	l =snprintf(fn, NFS_MAXPATHLEN, "%s/...",path);
--- cfs-1.4.1/cfs_cipher.c.cfix	1997-12-03 22:40:32.000000000 +0100
+++ cfs-1.4.1/cfs_cipher.c	2006-06-03 12:56:19.000000000 +0200
@@ -14,14 +14,16 @@
  * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
  * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
  */
-
+#include "cfs_cipher.h"
 
 #include <stdio.h>
 #include <rpc/rpc.h>
 #include "nfsproto.h"
 #include "admproto.h"
 #include "cfs.h"
+#include "cfs_des.h"
 
+void
 cipher(k,s,d)
      cfskey *k;
      unsigned char *s;
@@ -70,6 +72,7 @@ cipher(k,s,d)
 	}
 }
 
+void
 mask_cipher(k,s,d)
      cfskey *k;
      unsigned char *s;
@@ -119,7 +122,7 @@ mask_cipher(k,s,d)
 }
 
 
-
+void
 copykey(key,k)
      cfs_admkey *key;
      cfskey *k;
--- /dev/null	2006-05-19 20:31:51.509353000 +0200
+++ cfs-1.4.1/cfs_cipher.h	2006-06-03 12:56:19.000000000 +0200
@@ -0,0 +1,29 @@
+// $Id$    --*- c -*--
+
+// Copyright (C) 2006 Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de>
+//  
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//  
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//  
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifndef H_CFS_CFS_CIPHER_H
+#define H_CFS_CFS_CIPHER_H
+
+#include "cfs.h"
+#include "admproto.h"
+
+void cipher(cfskey *k,unsigned char *s,int d);
+void copykey(cfs_admkey *key,cfskey *k);
+void mask_cipher(cfskey *k,unsigned char *s,int d);
+
+#endif	//  H_CFS_CFS_CIPHER_H
--- cfs-1.4.1/cfs_des.c.cfix	1995-12-25 07:23:32.000000000 +0100
+++ cfs-1.4.1/cfs_des.c	2006-06-03 12:56:19.000000000 +0200
@@ -22,6 +22,9 @@
  *	block_cipher(key, block, decrypting)
  */
 
+#include "cfs_des.h"
+#include <strings.h>
+
 #ifdef SOLARIS2X
 #define bcopy(s, d, l)		memcpy(d, s, l)
 #define bcmp(s, d, l)		(memcmp(s, d, l)? 1 : 0)
@@ -30,7 +33,6 @@
 static long	ip_low();
 static long	ip_high();
 static void	fp();
-void	des_key_setup();
 
 /*
  *	Tables for Combined S and P Boxes
@@ -128,16 +130,17 @@ static long  s7p[] = {
  *	DES electronic codebook encryption of one block
  *	 (quick version)
  */
+void
 q_block_cipher(short_key, text, decrypting)
-char short_key[8];
-char text[8];
+unsigned char short_key[8];
+unsigned char text[8];
 int decrypting;
 {
 	register char *key;
 	register long temp;
 	register long left, right;
-	register i;
-	register key_offset;
+	register int i;
+	register int key_offset;
 	int j,k;
 	static int lk= -1;
 	static char lastkey[4][8]={"xxxxxxx","xxxxxxx","xxxxxxx","xxxxxxx"};
@@ -193,16 +196,17 @@ int decrypting;
  *	DES electronic codebook encryption of one block
  *	 (expanded key version)
  */
+void
 des_block_cipher(expanded_key, text, decrypting)
-char expanded_key[8];
-char text[8];
+unsigned char expanded_key[8];
+unsigned char text[8];
 int decrypting;
 {
-	register char *key;
+	register unsigned char *key;
 	register long temp;
 	register long left, right;
-	register i;
-	register key_offset;
+	register int i;
+	register int key_offset;
 
 	key = expanded_key;
 	left = ip_low(text);
@@ -546,7 +550,7 @@ des_key_setup(key, subkeys)
 char key[8];
 char *subkeys;
 {
-	register octet;
+	register int octet;
 	register char *kp;
 
 	kp = subkeys;
@@ -957,12 +961,10 @@ char *subkeys;
 }
 
 void
-key_crunch(buffer, size, key)
-  char buffer[], key[];
-  int size;
+key_crunch(unsigned char buffer[], size_t size, unsigned char key[])
 {
-    int i;
-    struct {long fo; char key[9];} s;
+    size_t i;
+    struct {long fo; unsigned char key[9];} s;
 
     bcopy("encrypt!",s.key,8);
 
--- /dev/null	2006-05-19 20:31:51.509353000 +0200
+++ cfs-1.4.1/cfs_des.h	2006-06-03 12:56:19.000000000 +0200
@@ -0,0 +1,30 @@
+// $Id$    --*- c -*--
+
+// Copyright (C) 2006 Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de>
+//  
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//  
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//  
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifndef H_CFS_CFS_DES_H
+#define H_CFS_CFS_DES_H
+
+#include <stdlib.h>
+
+void key_crunch(unsigned char buffer[], size_t size, unsigned char key[]);
+void q_block_cipher(unsigned char short_key[8], unsigned char text[8], int decrypting);
+void des_block_cipher(unsigned char expanded_key[8], unsigned char text[8], int decrypting);
+void des_key_setup();
+
+
+#endif	//  H_CFS_CFS_DES_H
--- cfs-1.4.1/cfs_fh.c.cfix	2006-06-03 12:56:19.000000000 +0200
+++ cfs-1.4.1/cfs_fh.c	2006-06-03 12:56:19.000000000 +0200
@@ -20,6 +20,8 @@
  *  local file system interface
  */
 
+#include "cfs_fh.h"
+
 #include <sys/types.h>
 #include <sys/file.h>
 #include <sys/stat.h>
@@ -47,6 +49,8 @@
 #include "nfsproto.h"
 #include "admproto.h"
 #include "cfs.h"
+#include "cfs_cipher.h"
+#include "cfs_des.h"
 
 #ifdef NO_UTIMES
 /* simulate utimes with utime */
@@ -71,6 +75,22 @@ int nfds=0;	/* number of open fd's curre
 
 int cfserrno=NFS_OK;
 
+static int vtod(int d);
+static void dodecrypt(cfskey *k,unsigned char *s,int l,int salt,char *vect);
+static int isbndry(int d);
+static void doencrypt(cfskey *k,unsigned char *s,int l,int salt,char *vect);
+static void chksum(unsigned char *s,long l);
+static void unchksum(unsigned char *s,long l);
+static int modeof(char *s);
+static int mkhandle(cfs_fileid *p,char *n,char *comp,int ino,fhdata *h,
+		    char *vect,char *vectname
+#ifdef SHORTLINKS
+		    , int isl
+#endif /* SHORTLINKS */
+  );
+static void inserth(cfs_fileid *f);
+static void fillinh(fhdata *h,int iid,int ino,unsigned char *check);
+     
 /*
  * get an encrypted block from fd, which damn well better be valid
  */
@@ -88,7 +108,7 @@ readblock(blk,fd,offset,len,key,vect)
 	int iolen;
 	int readmore=0;
 	int userbytes;
-	char buf[8208];	/* big enough, may not even need it */
+	unsigned char buf[8208];	/* big enough, may not even need it */
 
 	/* first, normalize to the proper boundries */
 	fronterr = offset&(CFSBLOCK-1);
@@ -129,14 +149,14 @@ writeblock(blk,fd,offset,len,key,vect)
      cfskey *key;     /* des key */
      char *vect;    /* perturb. vector */
 {
-	u_long begin, end;
+	off_t begin, end;
 	u_long fronterr, totlen,datalen;
 	int iolen;
 	int headlen;
 	int writemore=0;
 	struct stat sb;
 	u_long mask = ~0;	/*tells us whether to expand file */
-	char buf[8216];	/* big enough, may not even need it */
+	unsigned char buf[8216];	/* big enough, may not even need it */
 
 	/* first, normalize to the proper boundries */
 	fronterr = offset&(CFSBLOCK-1);
@@ -209,10 +229,10 @@ encryptname(key,s)
      char *s;
 {
 	static char cryptname[NFS_MAXNAMLEN+1];
-	u_char cryptstring[MAXCLEARNAME+CFSBLOCK+1];
-	u_char x[3];
-	u_long l;
-	int i;
+	unsigned char cryptstring[MAXCLEARNAME+CFSBLOCK+1];
+	char x[3];
+	size_t l;
+	size_t i;
 
 	if ((s==NULL) || ((l=strlen(s)+1)>MAXCLEARNAME))
 		return NULL;
@@ -220,12 +240,12 @@ encryptname(key,s)
 		return s;
 	l=(l+(CFSBLOCK-1)) & (~(CFSBLOCK-1));
 	bzero((char *)cryptstring,l);
-	strcpy(cryptstring,s);
+	memcpy(cryptstring,s,strlen(s)+1);
 	chksum(cryptstring,l);
 	doencrypt(key,cryptstring,l,10241,zerovect);
 	cryptname[0]='\0';
 	for (i=0; i<l; i++) {
-		sprintf((char *)x,"%02x",cryptstring[i]);
+		sprintf(x,"%02x",cryptstring[i]);
 		strcat(cryptname,x);
 	}
 	return cryptname;
@@ -236,8 +256,9 @@ encryptname(key,s)
  * reversible (see unchksum) and backwards-compatible (at least for 7-bit
  * characters).
  */
+void
 chksum(s,l)
-     char *s;
+     unsigned char *s;
      long l;
 {
 	u_long acc;
@@ -263,8 +284,9 @@ chksum(s,l)
 		s[i] ^= bits[i%8];
 }
 
+void
 unchksum(s,l)
-    char *s;
+    unsigned char *s;
     long l;
 {
 	u_long acc;
@@ -294,9 +316,9 @@ decryptname(key,s)
      cfskey *key;
      char *s;
 {
-	static char clearstring[MAXCLEARNAME+CFSBLOCK+1];
+	static unsigned char clearstring[MAXCLEARNAME+CFSBLOCK+1];
 	char x[3];
-	int y;
+	unsigned int y;
 	char *p, *q;
 	int l;
 	int i;
@@ -305,10 +327,10 @@ decryptname(key,s)
 		return NULL;
 	if (!strcmp(s,".") || !strcmp(s,".."))
 		return s;
-	bzero((char *)clearstring,MAXCLEARNAME+CFSBLOCK+1);
+	bzero(clearstring,MAXCLEARNAME+CFSBLOCK+1);
 	/* unencode the string */
 	p=s;
-	q=clearstring;
+	q=(char *)clearstring;
 	x[2]='\0';
 	l=0;
 	while (*p) {
@@ -325,12 +347,13 @@ decryptname(key,s)
 		return NULL;
 	dodecrypt(key,clearstring,l,10241,zerovect);
 	unchksum(clearstring,l);
-	return clearstring;
+	return (char *)clearstring;
 }
 
+void
 doencrypt(k,s,l,salt,vect)
      cfskey *k;
-     char *s;
+     unsigned char *s;
      int l;
      int salt;
      char *vect;
@@ -350,9 +373,10 @@ doencrypt(k,s,l,salt,vect)
 	}
 }
 
+void
 dodecrypt(k,s,l,salt,vect)
      cfskey *k;
-     char *s;
+     unsigned char *s;
      int l;
      int salt;
      char *vect;
@@ -375,7 +399,7 @@ dodecrypt(k,s,l,salt,vect)
 /*
  * convert size of data to size of block to be written
  */
-vtod(d)
+int vtod(d)
      int d;
 {
 	return isbndry(d)?d:(d+CFSBLOCK);
@@ -385,7 +409,7 @@ vtod(d)
 /*
  * convert file size into #of valid bits
  */
-dtov(d)
+size_t dtov(d)
      int d;
 {
 	return isbndry(d)?d:(d-CFSBLOCK);
@@ -394,6 +418,7 @@ dtov(d)
 /*
  * is block size a CFS boundry?
  */
+int
 isbndry(d)
      int d;
 {
@@ -474,7 +499,7 @@ geth(h)
 	return r;
 }
 
-
+int
 htype(f)
      cfs_fileid *f;
 {
@@ -486,6 +511,7 @@ htype(f)
 		return H_REG;
 }
 
+int
 iid(f)
      cfs_fileid *f;
 {
@@ -497,15 +523,17 @@ iid(f)
 		return f->ins->id;
 }
 
+uid_t
 fhowner(f,uid)
      cfs_fileid *f;
-     int uid;
+     uid_t uid;
 {
 	if (f->fileid == 0)	/* an instance root */
 		return (f->ins->uid);	/* return the instance owner */
 	return (uid);	/* normal case */
 }
 
+int
 fhmode(f,mode)
      cfs_fileid *f;
      int mode;
@@ -516,6 +544,7 @@ fhmode(f,mode)
 }
 
 /* return the inode of me */
+int
 fhid(f)
      cfs_fileid *f;
 {
@@ -527,20 +556,23 @@ fhid(f)
 }
 
 /* return the inode of .. (directory only) */
+int
 fhpid(f)
      cfs_fileid *f;
 {
 	if (f==NULL)	/* this is main root */
 		return 1;
-	if (f->parent<=0) /* child of instance root */
+	if (f->parent<=0) { /* child of instance root */
 		if (f->fileid==0)
 			return 1;
 		else
 			return (0-f->ins->id);
+	}
 	return f->parent;	/* this is already 2 for main root  */
 }
 
 /* is uid authorized for this? */
+int
 fhuid(f,u)
      cfs_fileid *f;
      int u;
@@ -554,6 +586,7 @@ fhuid(f,u)
 	return (f->ins->uid==u);
 }
 
+int
 cfsno(err)
      int err;
 {
@@ -684,6 +717,7 @@ fhgetstat(h,sb)
 	return 0;
 }
 
+void
 closeout(f)
      cfs_fileid *f;
 {
@@ -695,6 +729,7 @@ closeout(f)
 	}
 }
 
+void
 closeall()
 {
 	if (openfd!=NULL) {
@@ -705,6 +740,7 @@ closeall()
 	}
 }
 
+int
 fhsetattr(f,a)
      cfs_fileid *f;
      sattr *a;
@@ -802,10 +838,11 @@ fhsetattrprime(f,a)
 	return 0;
 }
 
+int
 fhmkdirent(p,comp,h)
      cfs_fileid *p;
      char *comp;
-     fhdata *h;
+     void *h;
 {
 	char path[NFS_MAXPATHLEN+1];
 	struct stat sb;
@@ -830,7 +867,7 @@ int
 fhmkfileent(p,comp,h)
      cfs_fileid *p;
      char *comp;
-     fhdata *h;
+     void *h;
 {
 	char path[NFS_MAXPATHLEN+1];
 	int fd;
@@ -871,7 +908,7 @@ fhmkfileent(p,comp,h)
 		*/
 		buf.i[0]=(u_long)sb.st_ino;
 		buf.i[1]=(u_long)sb.st_ctime;
-		q_block_cipher("fixedkey",&buf,1);
+		q_block_cipher((unsigned char *)"fixedkey",(void *)&buf,1);
 		/* des is just used here as a hash fn to spread the bits */
 		/* since we only use 32 bits of the result, its a nonperfect */
 		/* hash. but this doesn't really matter since collisions */
@@ -910,7 +947,7 @@ int
 fhlook(p,comp,h)
      cfs_fileid *p;
      char *comp;
-     fhdata *h;
+     void *h;
 {
 	char path[NFS_MAXPATHLEN+1];
 	char linkname[NFS_MAXPATHLEN+1];
@@ -1034,6 +1071,7 @@ mkhandle(p,n,comp,ino,h,vect,vectname
 	return 0;
 }
 
+void
 inserth(f)
      cfs_fileid *f;
 {
@@ -1044,11 +1082,12 @@ inserth(f)
 	instances[f->ins->id]->file[bucket]=f;
 }
 
+void
 fillinh(h,iid,ino,check)
      fhdata *h;
      int iid;
      int ino;
-     char *check;
+     unsigned char *check;
 {
 	bzero((char *)h,sizeof(fhdata));
 	bcopy((char *)magictest,(char *)h->magic,sizeof(magictest));
@@ -1114,6 +1153,7 @@ fhopendir(d)
 	return dp;
 }
 
+void
 fhclosedir(dp)
      DIR *dp;
 {
@@ -1249,7 +1289,7 @@ rootrd(cookie)
 	} else while (cookie<(NINSTANCES+2)) {
 		if (instances[cookie-2] != NULL) {
 			if (instances[cookie-2]->anon)
-				sprintf(d.d_name,".ANON_%d",cookie-2);
+				sprintf(d.d_name,".ANON_%ld",cookie-2);
 			else
 				strcpy(d.d_name,
 				       instances[cookie-2]->name);
@@ -1268,7 +1308,7 @@ rootrd(cookie)
 int
 fhrootlook(n,h)
      char *n;
-     nfs_fh *h;
+     void *h;
 {
 	int i;
 	cfs_fileid *f;
--- /dev/null	2006-05-19 20:31:51.509353000 +0200
+++ cfs-1.4.1/cfs_fh.h	2006-06-03 12:56:19.000000000 +0200
@@ -0,0 +1,61 @@
+// $Id$    --*- c -*--
+
+// Copyright (C) 2006 Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de>
+//  
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//  
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//  
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifndef H_CFS_CFS_FH_H
+#define H_CFS_CFS_FH_H
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <dirent.h>
+
+#include "cfs.h"
+
+struct cfs_fileid;
+int htype(cfs_fileid *f);
+size_t dtov(int d);
+int fhuid(cfs_fileid *f,int u);
+int fhid(cfs_fileid *f);
+
+int cfsno(int err);
+void closeall();
+void closeout(cfs_fileid *);
+int fhsetattr(cfs_fileid *f,sattr *a);
+int fhlook(cfs_fileid *p,char *comp,void *h);
+int fhlinkval(cfs_fileid *f,char *buf);
+int fhtofd(cfs_fileid *f,int mode);
+ssize_t readblock(char *blk,int fd,u_long offset,u_long len,cfskey *key,char *vect);
+ssize_t writeblock(char *blk,int fd,u_long offset,u_long len,cfskey *key,char *vect);
+int fhmkfileent(cfs_fileid *p,char *comp,void *h);
+int fhsetattrprime(cfs_fileid *f,sattr *a);
+int fhdelete(cfs_fileid *f,char *s);
+int iid(cfs_fileid *f);
+int fhrename(cfs_fileid *f,char *fn,cfs_fileid *t,char *tn);
+int fhdohardlink(cfs_fileid *f,cfs_fileid *t,char *n);
+int fhdosymlink(cfs_fileid *f,char *n,char *t);
+int fhmkdirent(cfs_fileid *p,char *comp,void *h);
+int fhdeletedir(cfs_fileid *f,char *s);
+int fhpid(cfs_fileid *f);
+void fhclosedir(DIR *dp);
+int fhgetstat(cfs_fileid *h,struct stat *sb);
+int getftype(int m);
+int fhmode(cfs_fileid *f,int mode);
+uid_t fhowner(cfs_fileid *f,uid_t uid);
+int fhrootlook(char *n,void *h);
+
+
+#endif	//  H_CFS_CFS_FH_H
--- cfs-1.4.1/cfs_nfs.c.cfix	2006-06-03 12:56:19.000000000 +0200
+++ cfs-1.4.1/cfs_nfs.c	2006-06-03 12:56:19.000000000 +0200
@@ -20,6 +20,7 @@
  *  rpc handlers
  *  access control policies
  */
+#include "cfs_nfs.h"
 
 #include <stdio.h>
 #include <sys/file.h>
@@ -33,25 +34,31 @@
 #else
 #include <dirent.h>
 #endif
+#include <sys/fsuid.h>
 #include "nfsproto.h"
 #include "admproto.h"
 #include "cfs.h"
-
-typedef struct svc_req *SR;
+#include "cfs_fh.h"
 
 #define herr(x) (((x)==H_INVALID)?NFSERR_STALE:NFSERR_PERM)
 
+static void rootgetattr(struct fattr *f);
+static int fhstat(cfs_fileid *fh,fattr *fa);
+static int goodsrc(SR rp);
+static void cfsclosedir(DIR *dp);
+static void setstatfsokres(statfsokres *s);
+
 char *
 pfh(fh)
      unsigned char *fh;
 {
 	static char ret[NFS_FHSIZE*2+2];
-	unsigned char x[3];
+	char x[3];
 	int i;
 
 	ret[0]='\0';
 	for (i=0; i<NFS_FHSIZE; i++) {
-		sprintf((char *)x,"%02x",fh[i]);
+		sprintf(x,"%02x",fh[i]);
 		strcat(ret,x);
 	}
 	return ret;
@@ -303,7 +310,7 @@ nfsproc_read_2_svc(readargs *ap, struct 
 	static char buffer[8192];
 	int fd;
 	int uid;
-	int len;
+	ssize_t len;
 	cfskey *key;
 	int ht;
 	cfs_fileid *h;
@@ -345,7 +352,7 @@ nfsproc_read_2_svc(readargs *ap, struct 
 			break;
 		}
 		ret.readres_u.reply.data.data_len = 
-			(len > (ap->count)) ? ap->count : len;
+		  ((size_t)len > (ap->count)) ? ap->count : (size_t)len;
 		ret.readres_u.reply.data.data_val = buffer;
 		ret.status = NFS_OK;
 		break;
@@ -950,6 +957,7 @@ cfsopendir(dir,cookie)
 	return ret;
 }
 
+void
 cfsclosedir(dp)
      DIR *dp;
 {
@@ -969,6 +977,7 @@ nfsproc_statfs_2_svc(nfs_fh *ap, struct 
 	return (&ret);
 }
 
+void
 rootgetattr(f)
 	struct fattr *f;
 {
@@ -989,6 +998,7 @@ rootgetattr(f)
 	
 }
 
+void
 setstatfsokres(s)
 	statfsokres *s;
 {
@@ -1157,6 +1167,7 @@ rootreaddir(ap)
 
 extern struct in_addr validhost;
 
+int
 goodsrc(rp)
      SR rp;
 {
--- /dev/null	2006-05-19 20:31:51.509353000 +0200
+++ cfs-1.4.1/cfs_nfs.h	2006-06-03 12:56:19.000000000 +0200
@@ -0,0 +1,29 @@
+// $Id$    --*- c -*--
+
+// Copyright (C) 2006 Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de>
+//  
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//  
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//  
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifndef H_CFS_CFS_NFS_H
+#define H_CFS_CFS_NFS_H
+
+struct svc_req;
+typedef struct svc_req *SR;
+
+int rgid(SR rp);
+int ruid(SR rp);
+
+
+#endif	//  H_CFS_CFS_NFS_H
--- cfs-1.4.1/cmkdir.c.cfix	2006-06-03 12:56:19.000000000 +0200
+++ cfs-1.4.1/cmkdir.c	2006-06-03 12:56:19.000000000 +0200
@@ -30,7 +30,10 @@
 #include "admproto.h"
 #include "cfs.h"
 #include "shs.h"
+#include "getpass.h"
+#include "cfs_cipher.h"
 
+int
 main(argc,argv)
      int argc;
      char **argv;
@@ -42,12 +45,12 @@ main(argc,argv)
 	cfs_admkey k;
 	cfskey kt;
 	char path[1024];
-	char str[8];
+	unsigned char str[8];
 	FILE *fp;
 	char *flg;
 	struct timeval tv;
 	u_long r;
-	int i;
+	size_t i;
 	int ciph=CFS_BLOWFISH;
 	int cfmt=1;
 	int smsize=LARGESMSIZE;
@@ -172,11 +175,11 @@ main(argc,argv)
 		exit(1);
 	}
 	l =snprintf(path, 1024, "%s/...", argv[0]);
-	if (l < 0 || l >= 1024) {
+	if ((ssize_t)l < 0 || l >= 1024) {
 	  fprintf(stderr, "File name too long\n");
 	  exit(1);
 	}
-	strcpy(str,"qua!");
+	memcpy(str,"qua!", 4);
 	/* now randomize the end of str.. */
 	assert(1 == read(rfd, ((char*)&r), 1));
 	for (i=0; i<sizeof(r); i++) {
--- cfs-1.4.1/getpass.c.cfix	1997-12-03 22:51:34.000000000 +0100
+++ cfs-1.4.1/getpass.c	2006-06-03 12:56:19.000000000 +0200
@@ -33,19 +33,24 @@
  * SUCH DAMAGE.
  */
 
+#include "getpass.h"
+
 #include <stdio.h>
 #include <signal.h>
-#ifndef linux
+#ifndef __linux
 #include <sgtty.h>
 #endif
 #include <sys/types.h>
 #include <rpc/rpc.h>
+#include <fcntl.h>
 #include "nfsproto.h"
 #include "admproto.h"
 #include "cfs.h"
 #include "shs.h"
+#include "cfs_des.h"
+#include "mcg.h"
 
-#if defined(irix) || defined(linux)
+#if defined(irix) || defined(__linux)
 /* hacks to use POSIX style termios instead of old BSD style sgttyb */
 #include <termios.h>
 #define sgttyb termios
@@ -62,7 +67,7 @@ char *prompt;
 	struct sgttyb ttyb;
 	int flags;
 	register char *p;
-	register c;
+	register int c;
 	FILE *fi;
 	static char pbuf[128];
 #ifdef MACH
@@ -96,6 +101,7 @@ char *prompt;
 	return(pbuf);
 }
 
+int
 old_pwcrunch(b,k)
      char *b;
      cfs_admkey *k;
@@ -111,8 +117,8 @@ old_pwcrunch(b,k)
 	/* is just being used as a non-cryptographic hash. */
 	/* note also that k1 and k2 are created from disjoint parts */
 	/* of the passphrase. */
-	key_crunch(&b[l/2],l-l/2,k1);
-	key_crunch(b,l/2,k2);
+	key_crunch((unsigned char *)&b[l/2],l-l/2,k1);
+	key_crunch((unsigned char *)b,l/2,k2);
 	switch (k->cipher) {
 	    case CFS_STD_DES:
 		bcopy(k1,k->cfs_admkey_u.deskey.primary,8);
@@ -154,6 +160,8 @@ old_pwcrunch(b,k)
 	}
 	return 0;
 }
+
+int
 new_pwcrunch(b,k)
      char *b;
      cfs_admkey *k;
@@ -213,6 +221,7 @@ new_pwcrunch(b,k)
 	return 0;
 }
 
+void
 decrypt_key(k,ek)
      cfs_admkey *k;
      u_char *ek;
@@ -263,8 +272,8 @@ decrypt_key(k,ek)
 		break;
 	    case CFS_MACGUFFIN:
 		mcg_keyset(k->cfs_admkey_u.mcgkey.primary,&mk);
-		mcg_block_decrypt(&mk,&(ek[0]));
-		mcg_block_decrypt(&mk,&(ek[8]));
+		mcg_block_decrypt(&(ek[0]),&mk);
+		mcg_block_decrypt(&(ek[8]),&mk);
 		bcopy(ek,k->cfs_admkey_u.mcgkey.primary,16);
 		bcopy(ek,k->cfs_admkey_u.mcgkey.secondary,16);
 		break;
@@ -291,6 +300,7 @@ decrypt_key(k,ek)
 	}
 }
 
+void
 encrypt_key(k,ek)
      cfs_admkey *k;
      u_char *ek;
@@ -334,8 +344,8 @@ encrypt_key(k,ek)
 		break;
 	    case CFS_MACGUFFIN:
 		mcg_keyset(k->cfs_admkey_u.mcgkey.primary,&mk);
-		mcg_block_encrypt(&mk,&(ek[0]));
-		mcg_block_encrypt(&mk,&(ek[8]));
+		mcg_block_encrypt(&(ek[0]),&mk);
+		mcg_block_encrypt(&(ek[8]),&mk);
 		break;
 	    case CFS_SAFER_SK128:
 		Safer_Init_Module();
--- /dev/null	2006-05-19 20:31:51.509353000 +0200
+++ cfs-1.4.1/getpass.h	2006-06-03 12:56:19.000000000 +0200
@@ -0,0 +1,29 @@
+// $Id$    --*- c -*--
+
+// Copyright (C) 2006 Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de>
+//  
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//  
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//  
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifndef H_CFS_GETPASS_H
+#define H_CFS_GETPASS_H
+
+#include "admproto.h"
+
+int  new_pwcrunch(char *b,cfs_admkey *k);
+int  old_pwcrunch(char *b,cfs_admkey *k);
+void decrypt_key(cfs_admkey *k,u_char *ek);
+void encrypt_key(cfs_admkey *k,u_char *ek);
+
+#endif	//  H_CFS_GETPASS_H
--- cfs-1.4.1/mcg.c.cfix	1995-12-25 07:25:33.000000000 +0100
+++ cfs-1.4.1/mcg.c	2006-06-03 12:56:19.000000000 +0200
@@ -31,6 +31,7 @@
 /*
  * codebook encrypt one block with given expanded key
  */
+void
 mcg_block_encrypt(blk,key)
      unsigned char *blk;
      mcg_key *key;
@@ -124,6 +125,7 @@ mcg_block_encrypt(blk,key)
 /*
  * codebook decrypt one block with given expanded key
  */
+void
 mcg_block_decrypt(blk,key)
      unsigned char *blk;
      mcg_key *key;
--- cfs-1.4.1/mcg.h.cfix	1995-12-25 07:25:33.000000000 +0100
+++ cfs-1.4.1/mcg.h	2006-06-03 12:56:19.000000000 +0200
@@ -15,6 +15,9 @@
  * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
  */
 
+#ifndef H_CFS_MCG_H
+#define H_CFS_MCG_H
+
 /* MacGuffin Constants */
 
 #define SIZE (1<<16)
@@ -56,3 +59,8 @@ typedef struct mcg_key {
 	unsigned short val[KSIZE];
 } mcg_key;
 
+void mcg_block_encrypt(unsigned char *blk,mcg_key *key);
+void mcg_block_decrypt(unsigned char *blk,mcg_key *key);
+void mcg_keyset(unsigned char *key,mcg_key *ek);
+
+#endif	//  H_CFS_MCG_H
--- cfs-1.4.1/mcgsbox.c.cfix	1995-12-25 07:25:33.000000000 +0100
+++ cfs-1.4.1/mcgsbox.c	2006-06-03 12:56:19.000000000 +0200
@@ -23,6 +23,7 @@
 
 
 #include "mcg.h"
+#include <strings.h>
 
 /*
  * the 8 s-boxes, expanded to put the output bits in the right
@@ -149,7 +150,7 @@ unsigned short outputmasks[4] = {
  * initialize the macguffin s-box tables.
  * this takes a while, but is only done once.
  */
-mcg_init()
+int mcg_init()
 {
 	unsigned int i,j,k;
 	int b;
@@ -192,6 +193,7 @@ mcg_init()
 #define bcopy(s,d,l) memcpy(d,s,l)
 #endif
 
+void
 mcg_keyset(key,ek)
      unsigned char *key;
      mcg_key *ek;
--- cfs-1.4.1/cdetach.c.cfix	1995-12-25 07:22:35.000000000 +0100
+++ cfs-1.4.1/cdetach.c	2006-06-03 12:56:19.000000000 +0200
@@ -24,6 +24,7 @@
 #include "admproto.h"
 #include "cfs.h"
 
+int
 main(argc,argv)
      int argc;
      char **argv;
@@ -40,8 +41,9 @@ main(argc,argv)
 	ap.name=argv[1];
 	ap.uid=getuid();
 	if ((status = callrpc("localhost",ADM_PROGRAM,ADM_VERSION,
-			    ADMPROC_DETACH,xdr_cfs_detachargs,&ap,
-			    xdr_cfsstat,&ret)) !=0) {
+			      ADMPROC_DETACH,
+			      (xdrproc_t)xdr_cfs_detachargs,(void *)&ap,
+			      (xdrproc_t)xdr_cfsstat,(void *)&ret)) !=0) {
 		clnt_perrno(status);
 		exit(1);
 	}
--- cfs-1.4.1/shs.c.cfix	1995-12-25 07:49:33.000000000 +0100
+++ cfs-1.4.1/shs.c	2006-06-03 12:56:19.000000000 +0200
@@ -48,6 +48,7 @@
 
 #include <sys/types.h>
 #include <stdio.h>
+#include <strings.h>
 #include "shs.h"
 
 static long nbits;
--- cfs-1.4.1/cname.c.cfix	2006-06-03 12:56:19.000000000 +0200
+++ cfs-1.4.1/cname.c	2006-06-03 12:56:19.000000000 +0200
@@ -25,14 +25,18 @@
 #include "nfsproto.h"
 #include "admproto.h"
 #include "cfs.h"
+#include "getpass.h"
+#include "cfs_cipher.h"
+#include "cfs_adm.h"
 
 /* following are never used - just so i can re-use the library */
 int validhost;
 char zerovect[]={0,0,0,0,0,0,0,0,0};
 int cursecs=0;
 
-char *gets();
+static int printable(char *s);
 
+int
 main(argc,argv)
      int argc;
      char **argv;
@@ -92,8 +96,8 @@ main(argc,argv)
 	}
 	copykey(&k,&kt);
 	kt.smsize=LARGESMSIZE;
-	if (((kt.primask=(char*) malloc(kt.smsize)) == NULL)
-	    || ((kt.secmask=(char*) malloc(kt.smsize)) == NULL)) {
+	if (((kt.primask=malloc(kt.smsize)) == NULL)
+	    || ((kt.secmask=malloc(kt.smsize)) == NULL)) {
 		fprintf(stderr,"No memory\n");
 		exit(2);
 	}
--- /dev/null	2006-05-19 20:31:51.509353000 +0200
+++ cfs-1.4.1/cfs_adm.h	2006-06-03 12:56:19.000000000 +0200
@@ -0,0 +1,26 @@
+// $Id$    --*- c -*--
+
+// Copyright (C) 2006 Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de>
+//  
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//  
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//  
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifndef H_ENSC_CFS_CFS_ADM_H
+#define H_ENSC_CFS_CFS_ADM_H
+
+#include "cfs.h"
+
+void genmasks(cfskey *k);
+
+#endif	//  H_ENSC_CFS_CFS_ADM_H
--- cfs-1.4.1/cpasswd.c.cfix	2006-06-03 12:56:19.000000000 +0200
+++ cfs-1.4.1/cpasswd.c	2006-06-03 12:56:19.000000000 +0200
@@ -24,8 +24,13 @@
 #include "nfsproto.h"
 #include "admproto.h"
 #include "cfs.h"
+#include "cfs_cipher.h"
 #include "shs.h"
+#include "getpass.h"
 
+static int checkkey(char *path,cfs_admkey *ak);
+
+int
 main(argc,argv)
      int argc;
      char **argv;
@@ -187,14 +192,14 @@ main(argc,argv)
 	exit(0);
 }
 
-
+int
 checkkey(path,ak)
      char *path;
      cfs_admkey *ak;
 {
 	FILE *fp;
 	char fn[1024];
-	char buf[9];
+	unsigned char buf[9];
 	cfskey k;
 	
 	copykey(ak,&k);


Index: cfs.spec
===================================================================
RCS file: /cvs/extras/rpms/cfs/devel/cfs.spec,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- cfs.spec	18 Feb 2006 09:32:31 -0000	1.10
+++ cfs.spec	3 Jun 2006 11:12:57 -0000	1.11
@@ -7,7 +7,7 @@
 Summary:	Userspace crypto-filesystem
 Name:		cfs
 Version:	1.4.1
-Release:	%release_func 7
+Release:	%release_func 8
 
 License:	BSD like
 Group:		System Environment/Daemons
@@ -21,6 +21,9 @@
 Patch1:		cfs-blowfish.patch
 Patch3:		cfs-root.patch
 Patch4:		cfs-1.4.1-rpm.patch
+Patch5:		cfs_1.4.1-cfix.patch
+Patch6:		cfs_1.4.1-opt.patch
+Patch7:		cfs_1.4.1-ret.patch
 BuildRoot:	%_tmppath/%name-%version-%release-root
 Requires:	nfs-utils
 Requires(post):		%__mkdir /sbin/chkconfig
@@ -59,6 +62,9 @@
 %patch1 -p1 -b .blowfish
 %patch3 -p1 -b .root
 %patch4 -p1 -b .rpm
+%patch5 -p1 -b .cfix
+%patch6 -p1 -b .opt
+%patch7 -p1 -b .ret
 
 %__install -p -m0644 %SOURCE3 INSTALL
 
@@ -67,7 +73,7 @@
 
 %build
 unset D
-%__make %makeflags %{?_smp_mflags} CFLAGS_EXTRA="$RPM_OPT_FLAGS" cfs
+%__make %makeflags %{?_smp_mflags} CFLAGS_EXTRA="$RPM_OPT_FLAGS -D_GNU_SOURCE -Wall -W -pedantic -Wno-unused -std=gnu99" cfs
 
 
 %install
@@ -140,6 +146,10 @@
 
 
 %changelog
+* Sat Jun  3 2006 Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de> - 1.4.1-8
+- added a huge patch which fixes missing prototypes and other non K&R
+  issues. This should solve problems on AMD64
+
 * Sat Feb 18 2006 Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de> - 1.4.1-7
 - rebuilt for FC5
 




More information about the fedora-extras-commits mailing list