Hello, The attached patch makes cfs try to open a file called "..._" if "..." fails. It's simpler than I thought it would be as there are only four places that file is opened or created. cfs built with this patch will still open older cfs directories, and will create compatible directories by default, except where creating "..." fails.
Not extensively tested, but I thought I'd put it out there for comment. Russell -- Russell Steicke -- Fortune says: Success is a journey, not a destination.
diff -ru cfs-1.4.1--orig/cfs_adm.c cfs-1.4.1/cfs_adm.c --- cfs-1.4.1--orig/cfs_adm.c 2007-10-19 18:47:53.000000000 +0800 +++ cfs-1.4.1/cfs_adm.c 2007-10-19 20:44:49.000000000 +0800 @@ -218,8 +218,17 @@ l =snprintf(fn, NFS_MAXPATHLEN, "%s/...",path); if (l < 0 || l >= NFS_MAXPATHLEN) return CFSERR_BADNAME; - if ((fp=fopen(fn,"r"))==NULL) - return CFSERR_NODIR; + if ((fp=fopen(fn,"r"))==NULL) { + if (l < (NFS_MAXPATHLEN-1)) { + fn[l] = '_'; + fn[l+1] = '\0'; + if ((fp=fopen(fn,"r"))==NULL) { + return CFSERR_NODIR; + } + } else { + return CFSERR_NODIR; + } + } if (fread(buf,8,1,fp)!=1) { fclose (fp); return CFSERR_NODIR; diff -ru cfs-1.4.1--orig/cmkdir.c cfs-1.4.1/cmkdir.c --- cfs-1.4.1--orig/cmkdir.c 2007-10-19 18:47:53.000000000 +0800 +++ cfs-1.4.1/cmkdir.c 2007-10-19 19:16:10.000000000 +0800 @@ -196,8 +196,17 @@ mask_cipher(&kt,str,1); cipher(&kt,str,0); if ((fp=fopen(path,"w")) == NULL) { - perror("cmkdir"); - exit(1); + if (l < 1023) { + path[l] = '_'; + path[l+1] = '\0'; + if ((fp=fopen(path,"w")) == NULL) { + perror("cmkdir"); + exit(1); + } + } else { + perror("cmkdir"); + exit(1); + } } fwrite(str,8,1,fp); fclose(fp); diff -ru cfs-1.4.1--orig/cmkkey cfs-1.4.1/cmkkey --- cfs-1.4.1--orig/cmkkey 1997-12-14 06:22:40.000000000 +0800 +++ cfs-1.4.1/cmkkey 2007-10-19 19:11:04.000000000 +0800 @@ -57,7 +57,7 @@ echo "$CMD: $OLD is not a readable CFS directory" exit 1 fi -if [ ! -r "$OLDDIR/..." ]; then +if [ ! -r "$OLDDIR/..." -a ! -r "$OLDDIR/..._" ]; then echo "$CMD: $OLDDIR is not a readable CFS directory" exit 1 fi diff -ru cfs-1.4.1--orig/cpasswd.c cfs-1.4.1/cpasswd.c --- cfs-1.4.1--orig/cpasswd.c 2007-10-19 18:47:53.000000000 +0800 +++ cfs-1.4.1/cpasswd.c 2007-10-19 19:23:24.000000000 +0800 @@ -196,11 +196,20 @@ char fn[1024]; char buf[9]; cfskey k; + size_t l; copykey(ak,&k); - sprintf(fn,"%s/...",path); - if ((fp=fopen(fn,"r"))==NULL) - return 0; + l = sprintf(fn,"%s/...",path); + if ((fp=fopen(fn,"r"))==NULL) { + if (l < 1023) { + fn[l] = '_'; + fn[l+1] = '\0'; + if ((fp=fopen(fn,"r"))==NULL) + return 0; + } else { + return 0; + } + } if (fread(buf,8,1,fp)!=1) { fclose (fp); return 0;