`
`if (lisl && ((f=findh(ino,p—>ins—>id,O))
`#e1se /* SHORTLINKS */
`
`!= NULL))
`
`{
`
`if ((f=findh(ino,p—>ins—>id))
`#endif /* SHORTLINKS */
`
`!= NULL)
`
`{
`
`if (strcmp(comp,".") && strcmp(comp,".."))
`free(f->name);
`f->name=NULL;
`
`{
`
`}
`
`} else {
`
`if ((f=(cfs_fi1eid *)ma11oc(sizeof(cfs_fi1eid)))==NULL)
`fprintf(stderr,"cfsd: out of memory\n");
`
`{
`
`cfserrno=NFSERR_STALE;
`return -2;
`
`/* bad news */
`
`} f
`
`—>fi1eid=ino;
`
`f->parent=p—>fi1eid;
`#ifdef SHORTLINKS
`
`/* only need for directory */
`
`f->1ink_count = O;
`if (isl)
`
`/* Always start at zero */
`
`f—>1inkid = ++p—>1ink_count;
`
`else
`
`f->1inkid = 0;
`
`#endif /* SHORTLINKS */
`
`f—>ins=p—>ins;
`f->name=NULL;
`
`inserth(f);
`
`} i
`
`f (f—>name==NULL)
`
`{
`
`if ((f—>name=(char *)ma11oc(str1en(n)+l)) ==NULL)
`fprintf(stderr,"cfsd: out of memory\n");
`
`{
`
`cfserrno=NFSERR_STALE;
`return -2;
`
`} s
`
`trcpy(f—>name,n);
`
`strcpy(f—>vectname,vectname);
`
`bcopy((Char *)vect,(char *)f->vect,8);
`f—>VeCt[8]='\O';
`
`} i
`
`{
`f (h!=N'ULL)
`fi11inh(h,p—>ins—>id,ino,p—>ins—>check);
`#ifdef SHORTLINKS
`
`h—>1inkid = f—>1inkid;
`
`if (isl)
`
`h->htype = H_SLNK;
`#endif /* SHORTLINKS */
`
`Petitioner Oracle-Apple — Exhibit 1010 — Page 111
`
`}r
`
`e turn 0 ;
`
`} i
`
`{
`
`nserth(f)
`
`cfs_fi1eid *f;
`
`u—i“t bucket’
`
`EXNbflD
`
`
`
`bucket=hash(f->fileid);
`
`f->next=instances[f->ins->id]—>file[bucket];
`
`instances[f->ins->id]—>file[bucket]=f;
`
`fillinh(h,iid,ino,check)
`
`fhdata *h;
`
`int iid;
`
`int ino;
`
`char *check;
`
`bzero((char *)h,sizeof(fhdata));
`
`bcopy((char *)magictest,(char *)h->magic,sizeof(magictest));
`
`bcopy((char *)check,(char *)h->check,8);
`
`h—>htype=H_REG;
`h->instance=iid;
`
`h—>fileid=ino;
`
`int
`
`fhdelete(f,s)
`
`cfs_fileid *f;
`char *s;
`
`char path[NFS_MAXPATHLEN+l];
`
`char linkname[NFS_MAXPATHLEN+l];
`int ret;
`
`{
`if (f==NULL)
`cfserrno=NFSERR_STALE;
`return -2;
`
`} s
`
`printf(linkname,"%s/.pvect_%s",f—>name,s);
`sprintf(path,"%s/%s",f—>name,s);
`/* note that we don't bother to check and see if there's a
`
`handle allocated for this — just wait for the inode to be
`reclaimed */
`
`if ((ret=unlink(path)) == 0)
`unlink(linkname);
`/* doesn't matter if link isn't there */
`return (ret);
`
`Petitioner Oracle-Apple — Exhibit 1010 — Page 112
`
`int
`
`fhdeletedir(f,s)
`
`cfs_fileid *f;
`char *s;
`
`char path[NFS_MAXPATHLEN+1];
`
`{
`if (f==NULL)
`cfserrno=NFSERR_STALE;
`return -2;
`
`} s
`
`printf(pat ,"%s/%s",f->name,s);
`
`return ‘rmdir ‘Path’ ’ ’
`
`EXNbflD
`
`
`
`DIR *
`
`fhopendir(d)
`
`cfs_fi1eid *d;
`
`DIR *dp;
`
`{
`if (d==NULL)
`CfserrnO=NFSERR_STALE;
`return NULL;
`
`} i
`
`f ((dp=opendir(d->name))==NULL)
`cfserrno=cfsno(errno);
`
`return dp;
`
`hc1osedir(dp)
`
`DIR *dp;
`
`c1osedir(dp);
`
`{
`
`} f
`
`{
`
`}
`
`int
`
`fh1inkVa1(f,buf)
`
`cfs_fi1eid *f;
`char *buf;
`
`{
`if (f==NULL)
`cfserrno=NFSERR_STALE;
`return -2;
`
`} r
`
`eturn(readlink(f—>name,buf,NFS_MAXNAMLEN));
`
`{
`
`}
`
`int
`
`fhdohard1ink(f,t,n)
`
`cfs_fi1eid *f;
`
`cfs_fi1eid *t;
`char *n;
`
`{
`
`char buf[NFS_MAXPATHLEN+l];
`
`char linkname[NFS_MAXPATHLEN+l];
`char vectva1[9];
`
`int ret;
`
`| (t==N'ULL))
`if ((f==N'ULL) |
`cfserrno=NFSERR_STALE;
`return -2;
`
`{
`
`} s
`
`printf(buf,"%s/%s",t—>name,n);
`if ((ret=1ink(f—>name,buf))!=O)
`return ret;
`
`Sprintf ‘1i“k“a“‘e' "%S/ ’P"e°t—%S" ' t‘>“a‘“e'“’ ’
`un1ink(1inkname);
`EXNbflD
`
`Petitioner Oracle-Apple — Exhibit 1010 — Page 113
`
`
`
`if (readlink(f->vectname,vectva1,9) == 8)
`vectva1[8]='\O';
`
`{
`
`sym1ink(VectVa1,linkname);
`
`}r
`
`eturn ret;
`
`int
`
`fhdosym1ink(f,n,t)
`
`cfs_fi1eid *f;
`char *n;
`
`char *t;
`
`char buf[NFS_MAXPATHLEN+l];
`
`{
`if (f==N'ULL)
`cfserrno=NFSERR_STALE;
`return -2;
`
`} s
`
`printf(buf,"%s/%s",f—>name,n);
`return (sym1ink(t,buf));
`
`int
`
`fhrename(f,fn,t,tn)
`
`cfs_fi1eid *f;
`char *fn;
`
`cfs_fi1eid *t;
`char *tn;
`
`char fb[NFS_MAXPATHLEN+l];
`
`char tb[NFS_MAXPATHLEN+l];
`
`char fblink[NFS_MAXPATHLEN+l];
`
`char tblink[NFS_MAXPATHLEN+l];
`char vectva1[9];
`
`I (t==NULL))
`if ((f==N'ULL) I
`cfserrno=NFSERR_STALE;
`return -2;
`
`{
`
`} s
`
`printf(fb,"%s/%s",f—>name,fn);
`
`sprintf(tb,"%s/%s",t—>name,tn);
`
`sprintf(fb1in ,"%s/.pvect_%s",f—>name,fn);
`
`sprintf(tb1ink,"%s/.pvect_%s",t—>name,tn);
`
`/* now we have to do a lookup */
`{
`if (rename(fb,tb)==O)
`un1ink(tb1ink);
`/* may be a quick race cndtn here */
`
`Petitioner Oracle-Apple - Exhibit 1010 - Page 114
`
`if (readlink(fblink,VectVa1,9)==8)
`vectva1[8]='\O';
`
`{
`
`symlink(VectVa1,tb1ink);
`
`} u
`
`n1ink(fb1ink);
`
`/* rename(fb1ink,tb1ink); */
`fh1ook(t,tn,NULL);
`return 0;
`
`}
`return -1;
`EXNbflD
`
`
`
`int
`
`getftype(m)
`int m;
`
`{
`
`if ((m&S_IFMT) == S_IFREG)
`return NFREG;
`
`if ((m&S_IFMT) == S_IFDIR)
`return NFDIR;
`
`if ((m&S_IFMT) == S_IFLNK)
`return NFLNK;
`
`if ((m&S_IFMT) == S_IFBLK)
`return NFBLK;
`
`if ((m&S_IFMT) == S_IFCHR)
`return NFCHR;
`
`if ((m&S_IFMT) == s_IFsoCK)
`return NFSOCK;
`
`return NFBAD;
`
`the first entries, but this probably doesn't
`
`} /
`
`* should make . and ..
`
`break anything */
`struct dirent *
`
`rootrd(cookie)
`
`long cookie;
`
`{
`
`static struct dirent d;
`
`Petitioner Oracle-Apple - Exhibit 1010 - Page 115
`
`/* note that cookie should never == NINSTANCES */
`
`{
`if (cookie == 0)
`strcpy(d.d_name,".");
`
`d.d_fi1eno=l;
`
`{
`} else if (cookie == 1)
`strcpy(d.d_name,"..");
`
`d.d_fi1eno=l;
`
`} else while (cookie<(NINSTANCES+2))
`
`{
`
`{
`!= NULL)
`if (instances[cookie-2]
`if (instances[cookie-2]—>anon)
`
`sprintf(d.d_name,".ANON_%d",cookie-2);
`
`else
`
`strcpy(d.d_name,
`instances[cookie—2]—>name);
`
`d.d_fi1eno=(O-(cookie-2));
`break;
`
`} +
`
`+cookie;
`
`} i
`
`f (cookie>=(NINSTANCES+2))
`return NULL;
`
`d.d_rec1en = ++cookie;
`return &d;
`
`EXNbflD
`
`t
`
`} _
`
`in
`
`
`
`fhroot1ook(n,h)
`
`char *n;
`
`nfs_fh *h;
`
`int i;
`
`cfs_fi1eid *f;
`
`/* self */
`!strcmp(n,"..")) {
`II
`if (!strcmp(n,".")
`bcopy((char *)&roothand1e,(char *)h,sizeof(roothand1e));
`return 0;
`
`} f
`
`i++)
`i<NINSTANCES;
`or (i=0;
`if (instances[i]==NULL)
`
`{
`
`continue;
`
`if (!strcmp(instances[i]—>name,n))
`if ((f=findh(O,i
`#ifdef SHORTLINKS
`
`{
`
`#endif /* SHORTLINKS */
`
`,0
`
`{
`)) == NULL)
`if ((f=(Cfs_fi1eid *)
`
`malloc(sizeof(cfs_fi1eid)))==NULL)
`fprintf(stderr,"cfsd: no memory\n");
`
`{
`
`cfserrno=NFSERR_STALE;
`return -2;
`
`/* bad news */
`
`} f
`
`—>fi1eid = O;
`
`f->parent = O;
`f->ins=instances[i];
`
`inserth(f);
`
`if ((f—>name=(char *)
`
`ma11oc(NFS_MAXPATHLEN+l))==NULL)
`fprintf(stderr,
`
`{
`
`"cfsd: out of memory\n");
`
`cfserrno=NFSERR_STALE;
`return -2;
`
`} s
`
`trcpy(f—>name,instances[i]—>path);
`
`} f
`
`i11inh(h,i,O,f—>ins—>check);
`return 0;
`
`} c
`
`fserrno=NFSERR_NOENT;
`return -2;
`
`EXNbflD
`
`Petitioner Oracle-Apple - Exhibit 1010 - Page 116
`
`
`
`cfs_nfs.c
`
`Exhibit D
`
`Petitioner Oracle-Apple - Exhibit 1010 - Page 117
`
`
`
`* The author of this software is Matt Blaze.
`
`* Permi
`
`Copyright
`COPY.
`ssion to use,
`
`(C)
`
`1992, 1993,
`
`1994 by AT&T.
`
`and modify this software without fee
`
`* is hereby granted, provided that this entire notice is included in
`
`* all copies of any software which is or includes a copy or
`
`* modification of this software and in all copies of the supporting
`* documentation for such software.
`
`* This software is subject to United States export controls.
`
`* THIS
`
`SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
`* WARRANTY.
`IN PARTICULAR, NEITHER THE AUTHORS NOR AT&T MAKE ANY
`* REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
`
`* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
`
`* crypt o—nfs server functions
`*
`rpc handlers
`*
`acce
`
`ss control policies
`
`*/
`
`#include
`
`<StdiO.h>
`
`#include
`
`#include
`
`#include
`
`#include
`
`#include
`
`<sys/file.h>
`
`<sys/types.h>
`
`<sys/stat.h>
`
`<rpc/rpc.h>
`<errno.h>
`
`#ifdef NeXT
`
`#include
`
`#define
`
`<sys/dir.h>
`dirent direct
`
`#else
`
`#include
`
`<dirent.h>
`
`#endif
`
`#include
`
`#include
`
`#include
`
`"nfsproto.h"
`
`"admproto.h"
`"cfs.h"
`
`typedef
`
`struct svc_req *SR;
`
`#define herr(x)
`
`(((x)==H_INVALID)?NFSERR_STALE:NFSERR_PERM)
`
`char *
`
`pfh(fh)
`uns
`
`igned char *fh;
`
`stat
`
`iC char ret[NFS_FHSIZE*2+2];
`unsigned char x[3];
`int
`i;
`
`ret[
`for
`
`O]='\O';
`
`{
`i++)
`i<NFS_FHSIZE;
`(i=0;
`sprintf((char *)x,"%O2x",fh[i]);
`strcat(ret,x);
`
`EXNbflD
`
`Petitioner Oracle-Apple - Exhibit 1010 - Page 118
`
`
`
`return ret;
`
`void *
`
`nfsproc_null_2(ap,rp)
`void *ap;
`SR rp;
`
`static int ret=O;
`
`return ((void*) &ret);
`
`#define as_attr attrstat_u.attributes
`
`diropres *rootlookup();
`readdirres *rootreaddir();
`
`attrstat *
`
`nfsproc_getattr_2(ap,rp)
`
`nfs_fh *ap;
`SR rp;
`
`static attrstat ret;
`
`int uid;
`
`int ht;
`
`cfs_fileid *h;
`
`#ifdef DEBUG
`
`printf("getattr:\n");
`#endif
`
`{
`!=H_REG)
`if ((ht=htype(h=geth(ap))
`/* this is an ugly hack to deal w/
`but it will do for now */;
`
`lookups in root,
`
`Petitioner Oracle-Apple-Exhibit1010-Page119
`
`{
`if (ht==H_ROOT)
`ret.status=NFS_OK;
`
`rootgetattr(&ret.as_attr);
`return &ret;
`
`} r
`
`et.status=NFSERR_STALE;
`return &ret;
`
`} u
`
`id=ruid(rp);
`
`if (!fhuid(h,uid)) {
`ret.status = NFSERR_PERM;
`return &ret;
`
`} b
`
`ecome(rp);
`
`/* become the user */
`
`switch (fhstat(h,&ret.as_attr)) {
`case 0:
`/* ok */
`
`ret.status=NFS_OK;
`break;
`
`/* error from syscall */
`case -1:
`ret.status=cfsno(errno);
`
`break;
`
`/* bad handle’ Pmbably */
`default‘
`ret.status=cfserrno;
`EXMDHD
`
`
`
`break;
`
`closeout(h);
`become(NULL);
`return &ret;
`
`/* if it was open, close it */
`
`attrstat *
`
`nfsproc_setattr_2(ap,rp)
`sattrargs *ap;
`
`SR rp;
`
`static attrstat ret;
`
`int uid;
`
`int ht;
`
`cfs_fileid *h;
`
`/* this is non—atomic, and could leave partial results */
`
`/* also, we vary from std nfs semantics in that failure does
`
`not always leave the file in its previous state */
`
`#ifdef DEBUG
`
`printf("setattr: \n");
`#endif
`
`if ((ht=htype(h=geth(&ap—>file)))!=H_REG)
`ret.status=herr(ht);
`return &ret;
`
`{
`
`} u
`
`id=ruid(rp);
`
`become(rp);
`
`/* become the user */
`
`switch (fhsetattr(h,&ap—>attributes))
`case 0:
`/* ok */
`
`{
`
`/* now do a getattr */
`
`switch (fhstat(h,&ret.as_attr)) {
`case 0:
`
`ret . status=NFS_OK;
`break;
`case -1:
`
`ret.status=cfsno(errno);
`
`break;
`default:
`
`ret.status=cfserrno;
`
`break;
`
`} b
`
`reak;
`
`case -1:
`
`/* error from syscall */
`
`/* but some things may be already set.
`ret.status=cfsno(errno);
`break;
`
`/* bad handle, probably */
`default:
`ret.status=cfserrno;
`
`should fix this */
`
`Petitioner Oracle-Apple — Exhibit 1010 — Page 120
`
`break;
`
`} b
`
`ecome(NULL);
`
`return “re”
`
`EXNbflD
`
`
`
`Void *
`
`nfsproc_root_2(ap,rp)
`void *ap;
`SR rp;
`
`static int ret=O;
`
`return ((void*)&ret);
`
`/* fix this to deal w/ fs root
`
`(instance root should be ok) */
`
`diropres *
`
`nfsproc_lookup_2(ap,rp)
`diropargs *ap;
`SR rp;
`
`static diropres ret;
`
`diropres *retp;
`
`nfs_fh *handle;
`int uid;
`
`cfskey *key;
`char *s;
`
`int ht;
`
`cfs_fileid *h;
`
`/* this, mkdir, create, and the mount protocol are the only ways
`to create a handle */
`#ifdef DEBUG
`
`printf("lookup:
`#endif
`
`\n");
`
`/* this is where most of the security has to lie, since lookup
`returns handles to files.
`so we have to make sure we're coming
`
`from the right place and that it's really a priv port, etc */
`
`{
`if (!goodsrc(rp))
`ret.status=NFSERR_PERM;
`return &ret;
`
`} i
`
`f ((ht=htype(h=geth(&ap—>dir)))!=H_REG)
`
`{
`
`if (ht==H_ROOT)
`become(rp);
`
`{
`
`retp=rootlookup(ap—>name);
`become(NULL);
`
`return retp;
`
`} r
`
`et.status=herr(ht);
`return &ret;
`
`} u
`
`id=ruid(rp);
`
`if (!fhuid(h,uid)) {
`ret.status = NFSERR_PERM;
`return &ret;
`
`be"°‘“e‘rP” /* be"°“‘e the user */
`handle = &ret.diropres_u.diropres.file;
`EXNbflD
`
`Petitioner Oracle-Apple-Exhibit1010-Page121
`
`
`
`key=keyof(h);
`
`if (key==NULL)
`ret.status=cfsno(errno);
`
`else if ((s=encryptname(key,ap—>name))==NULL)
`
`ret.status=NFSERR_NOENT;
`
`{
`else switch (fhlook(h,s,handle))
`/* fhlook might update the underlying name associated with the
`handle, or delete the handle */
`
`case 0:
`
`/* found it */
`
`/* now do a getattr */
`
`switch (fhstat(geth(handle),
`
`&ret.diropres_u.diropres.attributes)) {
`
`case 0:
`
`ret.status=NFS_OK;
`
`/* stat is already in attributes field */
`break;
`
`/* couldn't open file for some reason */
`case -1:
`ret.status=cfsno(errno);
`
`break;
`
`/* shouldn't happen */
`default:
`ret.status=cfserrno;
`
`break;
`
`} b
`
`reak;
`
`/* some parent dir went away, probably */
`case -1:
`ret.status=cfsno(errno);
`
`break;
`
`/* bad parent handle or notfound, probably */
`default:
`ret.status=cfserrno;
`
`Petitioner Oracle-Apple — Exhibit 1010 — Page 122
`
`break;
`
`} b
`
`ecome(NULL);
`
`return (&ret);
`
`readlinkres *
`
`nfsproc_readlink_2(ap,rp)
`
`nfs_fh *ap;
`SR rp;
`
`static readlinkres ret;
`
`int uid;
`
`char buf[NFS_MAXPATHLEN+l];
`char *s;
`
`cfskey *key;
`int ht;
`
`cfs_fileid *h;
`int 1;
`
`#ifdef DEBUG
`
`printf("readlink:\n");
`#endif
`
`if ((ht=htype(h=geth(ap)))!=H_REG)
`ret.status=herr(ht);
`
`{
`
`return “re”
`
`EXNbflD
`
`
`
`uid=ruid(rp);
`
`become(rp);
`
`switch (1=fh1inkva1(h,buf))
`case -1:
`
`{
`
`ret.status=cfsno(errno);
`
`break;
`case -2:
`
`ret.status=cfserrno;
`
`break;
`default:
`
`buf[1]='\O';
`
`if ((key=keyof(h))==NULL)
`ret.status=cfserrno;
`
`{
`
`break;
`
`} i
`
`{
`f ((s=decryptname(key,buf)) == NULL)
`ret.status=NFSERR_NOENT;
`/* close enough */
`break;
`
`} r
`
`et.read1inkres_u.data = s;
`ret.status=NFS_OK;
`break;
`
`become(NULL);
`
`return (&ret);
`
`readres *
`
`nfsproc_read_2(ap,rp)
`readargs *ap;
`SR rp;
`
`static readres ret;
`
`static char buffer[8l92];
`
`int fd;
`
`int uid;
`
`int len;
`
`cfskey *key;
`int ht;
`
`cfs_fi1eid *h;
`
`#ifdef DEBUG
`
`printf("read:\n");
`#endif
`
`Petitioner Oracle-Apple - Exhibit 1010 - Page 123
`
`if ((ht=htype(h=geth(&ap—>fi1e)))!=H_REG)
`ret.status=herr(ht);
`return &ret;
`
`{
`
`} u
`
`id=ruid(rp);
`
`if (!fhuid(h,uid)) {
`ret.status = NFSERR_PERM;
`return &ret;
`
`EXNbflD
`
`
`
`become(rp);
`
`{
`switch (fd=fhtofd(h,CFS_READ))
`case -1:
`/* syscall error */
`ret.status = cfsno(errno);
`break;
`
`/* cfs error */
`case -2:
`ret.status = cfserrno;
`
`break;
`
`/* fd should be valid file descriptor */
`default:
`/* do the read */
`
`key=keyof(h);
`
`{
`if (key==N'ULL)
`ret.status=cfserrno;
`
`break;
`
`} i
`
`} i
`
`f ((1en=readb1ock(buffer,fd,ap—>offset,ap->count,
`
`key,vectof(h)))<O){
`ret.status = cfsno(errno);
`
`break;
`
`f (fhstat(h,&ret.readres_u.rep1y.attributes)!=O) {
`ret.status = cfsno(errno);
`
`break;
`
`} r
`
`et.readres_u.rep1y.data.data_1en =
`(len >
`(ap->count))
`? ap—>count
`
`:
`
`len;
`
`ret.readres_u.rep1y.data.data_va1 = buffer;
`
`Petitioner Oracle-Apple - Exhibit 1010 - Page 124
`
`ret.status = NFS_OK;
`break;
`
`} b
`
`ecome(NULL);
`
`return (&ret);
`
`Void *
`
`nfsproc_writecache_2(ap,rp)
`void *ap;
`SR rp;
`
`static int ret;
`
`return (void *)(&ret);
`
`attrstat *
`
`nfsproc_write_2(ap,rp)
`writeargs *ap;
`SR rp;
`
`static attrstat ret;
`
`int fd;
`
`int uid;
`
`int len;
`
`int offset;
`EXNbflD
`
`
`
`cfskey *key;
`char *buf;
`
`int ht;
`
`cfs_fi1eid *h;
`
`#ifdef DEBUG
`
`printf("write:\n");
`#endif
`
`if ((ht=htype(h=geth(&ap—>fi1e)))!=H_REG)
`ret.status=herr(ht);
`return &ret;
`
`{
`
`uid=ruid(rp);
`
`if (!fhuid(h,uid)) {
`ret.status = NFSERR_PERM;
`return &ret;
`
`} b
`
`ecome(rp);
`
`{
`switch (fd=fhtofd(h,CFS_WRITE))
`case -1:
`/* syscall error */
`ret.status = cfsno(errno);
`
`break;
`
`/* cfs error */
`case -2:
`ret.status = cfserrno;
`
`break;
`
`default:
`
`/* fd should be valid file descriptor */
`
`len = ap->data.data_1en;
`offset = ap->offset;
`
`buf = ap->data.data_va1;
`key=keyof(h);
`
`{
`if (key==NULL)
`ret.status=cfserrno;
`
`break;
`
`} i
`
`} i
`
`f (writeb1ock(buf,fd,offset,1en,key,vectof(h)) < O)
`ret.status = cfsno(errno);
`
`{
`
`break;
`
`f (fhstat(h,&ret.attrstat_u.attributes !=O)
`ret.status = cfsno(errno);
`
`{
`
`break;
`
`become(NULL);
`
`return (&ret);
`
`diropres *
`
`nfsproc_create_2(ap,rp)
`createargs *ap;
`
`SR rp’
`
`EXNbflD
`
`Petitioner Oracle-Apple — Exhibit 1010 — Page 125
`
`
`
`static diropres ret;
`
`static nfs_fh handle;
`int uid;
`
`int ht;
`char *s;
`
`cfs_fileid *h, *h2;
`
`#ifdef DEBUG
`
`printf("create:\n");
`#endif
`
`lookup, mkdir, and the mount protocol are the only ways
`/* this,
`to create a handle */
`
`{
`if (!goodsrc(rp))
`ret.status=NFSERR_PERM;
`return &ret;
`
`} i
`
`f ((ht=htype(h=geth(&ap->where.dir)))!=H_REG)
`ret.status=herr(ht);
`return &ret;
`
`{
`
`} u
`
`id=ruid(rp);
`
`if (!fhuid(h,uid)) {
`ret.status = NFSERR_PERM;
`return &ret;
`
`} b
`
`ecome(rp);
`
`/* first create the dir entry */
`
`/* if one already exist,
`
`the underlying handle name field gets
`
`updated to reflect its new name */
`
`s=encryptname(keyof(h),ap—>where.name);
`
`switch (fhmkfileent(h,s,&handle))
`case 0:
`/* didnt exist */
`
`{
`
`switch (fhsetattr(h2=geth(&handle),&ap—>attributes))
`case 0:
`/* ok */
`
`{
`
`/* now do a getattr */
`switch (fhstat(h2,
`
`&ret.diropres_u.diropres.attributes)) {
`
`case 0:
`
`bcopy(&handle,&ret.diropres_u.diropres.file,
`
`Petitioner Oracle-Apple - Exhibit 1010 - Page 126
`
`sizeof(nfs_fh));
`ret . status=NFS_OK;
`break;
`case -1:
`
`ret.status=cfsno(errno);
`
`break;
`default:
`
`ret.status=cfserrno;
`
`break;
`
`} b
`
`reak;
`
`/* error from syscall */
`case -1:
`ret.status=cfsno(errno);
`
`break;
`
`/* bad handle, probably */
`default:
`ret.status=cfserrno;
`EXNbflD
`
`
`
`break;
`
`} b
`
`reak;
`
`case 1:
`
`/* did exist; no chmod — KLUDGE */
`
`switch (fhsetattrprime(h2=geth(&hand1e),&ap—>attributes))
`case 0:
`/* ok */
`
`{
`
`/* now do a getattr */
`switch (fhstat(h2,
`
`&ret.diropres_u.diropres.attributes)) {
`
`case 0:
`
`bcopy(&hand1e,&ret.diropres_u.diropres.file,
`
`sizeof(nfs_fh));
`ret . status=NFS_OK;
`break;
`case -1:
`
`ret.status=cfsno(errno);
`break;
`default:
`
`ret.status=cfserrno;
`
`break;
`
`} b
`
`reak;
`
`/* error from syscall */
`case -1:
`ret.status=cfsno(errno);
`break;
`
`/* bad handle, probably */
`default:
`ret.status=cfserrno;
`
`Petitioner Oracle-Apple - Exhibit 1010 - Page 127
`
`break;
`
`} b
`
`reak;
`case -1:
`
`ret.status=cfsno(errno);
`break;
`default:
`
`ret.status=cfserrno;
`
`break;
`
`} b
`
`ecome(NULL);
`
`return (&ret);
`
`nfsstat *
`
`nfsproc_remove_2(ap,rp)
`diropargs *ap;
`SR rp;
`
`static nfsstat ret;
`char *s;
`
`cfskey *key;
`int uid;
`
`int ht;
`
`cfs_fi1eid *h;
`
`#ifdef DEBUG
`
`printf("remove:\n" ;
`EXMDHD
`
`
`
`Petitioner Oracle-Apple — Exhibit 1010 — Page 128
`
`#endif
`
`if ((ht=htype(h=geth(&ap->dir)))!=H_REG)
`ret=herr(ht);
`return &ret;
`
`{
`
`} u
`
`id=ruid(rp);
`
`become(rp);
`
`/* become the user */
`
`/* first encrypt the name */
`key=keyof(h);
`
`{
`if (key==NULL)
`ret=cfserrno;
`
`} else if ((s=encryptname(key,ap—>name)) == NULL)
`ret=NFSERR_NOENT;
`/* close enough */
`
`{
`
`} else switch (fhde1ete(h,s))
`case 0:
`
`{
`
`ret=NFS_OK;
`break;
`case -1:
`
`ret=cfsno(errno);
`
`break;
`default:
`
`ret=cfserrno;
`
`} b
`
`ecome(NULL);
`
`return (&ret);
`
`nfsstat *
`
`nfsproc_rename_2(ap,rp)
`renameargs *ap;
`
`SR rp;
`
`static nfsstat ret;
`
`int uid;
`
`Char sl[NFS_MAXPATHLEN+l],
`char *s;
`
`s2[NFS_MAXPATHLEN+l];
`
`cfskey *key;
`int ht;
`
`cfs_fi1eid *fromh, *toh;
`
`#ifdef DEBUG
`
`printf("rename:\n");
`#endif
`
`if ((ht=htype(fromh=geth(&ap—>from.dir)))!=H_REG)
`ret=herr(ht);
`return &ret;
`
`{
`
`} u
`
`id=ruid(rp);
`
`/* just make sure these are the same fs instance
`
`implicitly,
`
`this checks for a valid todir */
`
`{
`!= iid(toh=geth(&ap->to.dir)))
`if (iid(fromh)
`/* what to return? there's no NFSERR_XDEV */
`ret = NFSERR_EXIST;
`
`return “re”
`
`EXNbflD
`
`
`
`become(rp);
`
`/* become the user */
`
`if ((key=keyof(fromh)) == NULL)
`ret=cfserrno;
`
`else if (((s=encryptname(key,ap—>from.name)) == NULL)
`(strcpy(sl,s)==NULL))
`ret=cfserrno;
`
`||
`
`else if (((s=encryptname(key,ap—>to.name)) == NULL)
`(strcpy(s2,s)==NULL))
`ret=cfserrno;
`
`||
`
`/* if sl already has a handle,
`else switch (fhrename(fromh,sl,
`
`rename updates its underlying name */
`
`case -1:
`
`toh,s2)) {
`
`ret=cfsno(errno);
`
`break;
`case -2:
`
`ret=cfserrno;
`
`break;
`default:
`
`ret=NFS_OK;
`
`become(NULL);
`
`return (&ret);
`
`nfsstat *
`
`nfsproc_link_2(ap,rp)
`linkargs *ap;
`SR rp;
`
`static nfsstat ret;
`
`int uid;
`
`char *s;
`
`cfskey *key;
`int ht;
`
`cfs_fileid *fromh, *toh;
`
`#ifdef DEBUG
`
`printf("link:\n");
`#endif
`
`if ((ht=htype(fromh=geth(&ap—>from)))!=H_REG)
`ret=herr(ht);
`return &ret;
`
`{
`
`} u
`
`id=ruid(rp);
`
`/* again, make sure these are the same fs instance
`
`this checks for a valid todir, since iip
`implicitly,
`returns -1 on error */
`
`{
`!= iid(toh=geth(&ap->to.dir)))
`if (iid(fromh)
`/* what to return? there's no NFSERR_XDEV */
`
`ret = NFSERR_EXIST;
`
`/* got a better idea? */
`
`return ‘ret’
`
`EXNbflD
`
`Petitioner Oracle-Apple — Exhibit 1010 — Page 129
`
`
`
`Petitioner Oracle-Apple — Exhibit 1010 — Page 130
`
`if ((key=keyof(toh))==NULL)
`ret=cfserrno;
`return &ret;
`
`{
`
`} b
`
`ecome(rp);
`
`if ((s=encryptname(key,ap—>to.name))==NULL)
`ret=cfserrno;
`
`else switch (fhdohardlink(fromh,toh,s))
`case -1:
`
`{
`
`s2[NFS_MAXPATHLEN+l];
`
`ret=cfsno(errno);
`
`break;
`case -2:
`
`ret=cfserrno;
`
`break;
`default:
`
`ret=NFS_OK;
`break;
`
`} b
`
`ecome(NULL);
`
`return (&ret);
`
`nfsstat *
`
`nfsproc_sym1ink_2(ap,rp)
`symlinkargs *ap;
`SR rp;
`
`static nfsstat ret;
`
`int uid;
`
`char *s;
`
`char Sl[NFS_MAXPATHLEN+l],
`cfskey *key;
`int ht;
`
`cfs_fi1eid *h;
`
`#ifdef DEBUG
`
`printf("sym1ink:\n");
`#endif
`
`if ((ht=htype(h=geth(&ap—>from.dir))
`ret=herr(ht);
`return &ret;
`
`!=H_REG)
`
`{
`
`} u
`
`id=ruid(rp);
`
`if ((key=keyof(h))==NULL)
`ret=cfserrno;
`return &ret;
`
`{
`
`} b
`
`ecome(rp);
`
`if ((s=encryptname(key,ap—>from.name))==NULL)
`ret=cfserrno;
`
`else {
`strcpy(s1,s);
`
`s=encryptname(key,ap—>to)7 /* can't fail */
`
`Strcpy (52 ' S’ ’
`/* ignore the attributes stuff */
`EXNbflD
`
`
`
`switch (fhdosymlink(h,sl,s2))
`case -1:
`
`{
`
`ret=cfsno(errno);
`
`break;
`case -2:
`
`ret=cfserrno;
`
`break;
`default:
`
`ret=NFS_OK;
`break;
`
`} b
`
`ecome(NULL);
`
`return (&ret);
`
`diropres *
`
`nfsproc_mkdir_2(ap,rp)
`createargs *ap;
`
`SR rp;
`
`static diropres ret;
`
`nfs_fh handle;
`char *s;
`
`int uid;
`
`int ht;
`
`cfs_fileid *h, *h2;
`char *k;
`
`#ifdef DEBUG
`
`printf("mkdir:\n");
`#endif
`
`lookup, create, and the mount protocol are the only ways
`/* this,
`to create a handle */
`
`{
`if (!goodsrc(rp))
`ret.status=NFSERR_PERM;
`return &ret;
`
`} i
`
`f ((ht=htype(h=geth(&ap->where.dir)))!=H_REG)
`ret.status=herr(ht);
`return &ret;
`
`{
`
`} u
`
`id=ruid(rp);
`
`become(rp);
`
`/* first create the dir entry */
`
`/* if one already exists,
`
`the underlying handle name field gets
`
`updated to reflect its new name */
`
`s=encryptname(keyof(h),ap—>where.name);
`
`switch (fhmkdirent(h,s,&handle))
`case 0:
`
`{
`
`switch (fhsetattr(h2=geth(&handle),&ap—>attributes))
`case 0:
`/* ok */
`
`{
`
`/* “OW d‘’ a getattr */
`switch (fhstat(h2=geth(&handle),
`EXNDHD
`
`Petitioner Oracle-Apple-Exhibit1010-Page131
`
`
`
`&ret.diropres_u.diropres.attributes)) {
`
`case 0:
`
`bcopy(&hand1e,&ret.diropres_u.diropres.file,
`
`sizeof(nfs_fh));
`ret . status=NFS_OK;
`break;
`case -1:
`
`ret.status=cfsno(errno);
`break;
`default:
`
`ret.status=cfserrno;
`
`break;
`
`} b
`
`reak;
`
`/* error from syscall */
`case -1:
`ret.status=cfsno(errno);
`break;
`
`/* bad handle, probably */
`default:
`ret.status=cfserrno;
`
`break;
`
`} b
`
`reak;
`case -1:
`
`ret.status=cfsno(errno);
`break;
`default:
`
`ret.status=cfserrno;
`
`break;
`
`} b
`
`ecome(NULL);
`
`return (&ret);
`
`nfsstat *
`
`nfsproc_rmdir_2(ap,rp)
`diropargs *ap;
`SR rp;
`
`static nfsstat ret;
`char *s;
`
`cfskey *key;
`int uid;
`
`int ht;
`
`cfs_fi1eid *h;
`
`#ifdef DEBUG
`
`printf("rmdir:\n");
`#endif
`
`Petitioner Oracle-Apple - Exhibit 1010 - Page 132
`
`if ((ht=htype(h=geth(&ap—>dir)))!=H_REG)
`ret=herr(ht);
`return &ret;
`
`{
`
`} u
`
`id=ruid(rp);
`
`become(rp);
`
`/* become the user */
`
`/* first encrypt the name */
`EXMDHD
`
`
`
`key=keyof(h);
`
`{
`if (key==N'ULL)
`ret=cfserrno;
`
`} else if ((s=encryptname(key,ap—>name)) == NULL)
`ret=NFSERR_NOENT;
`/* close enough */
`
`{
`
`} else switch (fhdeletedir(h,s)) {
`case 0:
`
`ret=NFS_OK;
`break;
`case -1:
`
`ret=cfsno(errno);
`
`break;
`default:
`
`ret=cfserrno;
`
`} b
`
`ecome(NULL);
`
`return (&ret);
`
`#define MAXENTRIES 128
`
`#define MAXENTSIZE (NFS_MAXNAMLEN + siZeof(entry) + 32)
`#define dentsize(s)
`(strlen(s) + sizeof(entry) + 32)
`
`/* #define cfsclosedir(x) fhclosedir(x) */
`
`readdirres *
`
`nfsproc_readdir_2(ap,rp)
`readdirargs *ap;
`SR rp;
`
`static readdirres ret;
`
`int uid;
`
`int ht;
`
`static entry entrytab[MAXENTRIES];
`
`/* just deal w/ it staticaly */
`
`typedef char str[NFS_MAXNAMLEN+1];
`static str names[MAXENTRIES];
`
`static DIR *dp=NULL;
`static struct dirent *dent;
`
`entry **preV;
`
`long loc;
`
`char Sl[NFS_MAXNAMLEN+l];
`char *s;
`
`cfskey *key;
`
`static long curcookie=O;
`
`long cookie;
`int eof;
`
`int ne;
`
`int bytes;
`
`DIR *cfsopendir();
`
`cfs_fileid *h;
`static int fid= -10;
`
`#ifdef DEBUG
`
`printf("readdir:\n");
`#endif
`
`if ((ht=htype(h=geth(&ap—>dir)))!=H_REG)
`EXMDHD
`
`{
`
`Petitioner Oracle-Apple - Exhibit 1010 - Page 133
`
`
`
`/* this is an ugly hack to deal w/ readdir of root, */
`
`if (ht==H_ROOT)
`return (rootreaddir(ap));
`ret.status=herr(ht);
`return &ret;
`
`} u
`
`id=ruid(rp);
`
`become(rp);
`
`/* become the user */
`
`bytes = ap->count
`ne=O;
`
`— MAXENTSIZE;
`
`prev: &ret.readdirres_u.reply.entries;
`*preV=NULL;
`
`bcopy(ap->cookie,&cookie,sizeof(cookie));
`eof=TRUE;
`
`key=keyof(h);
`
`ret.Status=NFS_OK;
`
`if (l((h->fileid==fid)&&(cookie==curcookie)))
`
`{
`
`{
`if (dp!=NULL)
`cfsc1osedir(dp);
`
`dp=NULL;
`
`} i
`
`f ((dp=cfsopendir(h,cookie)) == NULL)
`fid = -10;
`
`{
`
`ret.status=cfserrno;
`
`} else {
`fid=h—>fi1eid;
`
`curcookie=cookie;
`
`dent=readdir(dp);
`
`} i
`
`{
`f (dp!=NULL) while (dent!=NULL)
`s=decryptname(key,dent—>d_name);
`cookie++;
`
`/* just skip bogus names */
`{
`if (s==NULL)
`dent=readdir(dp);
`continue;
`
`} e
`
`of=FALSE;
`
`if (((bytes -= dentsize(s)) < 0)
`break;
`
`||
`
`(ne >= MAXENTRIES))
`
`eof=TRUE;
`
`strcpy(names[ne],s);
`
`entrytab[ne].name=names[ne];
`
`if (strcmp(s,".")==O)
`
`/* me */
`
`entrytab[ne].fileid=fhid(h);
`
`/* parent */
`else if (strcmp(s,"..")==O)
`entrytab[ne].fileid=fhpid(h);
`
`else entrytab[ne].fileid=dent->d_fileno;
`bcopy(&cookie,entrytab[ne].cookie,sizeof(long));
`*preV &entrytab[ne];
`prev &entrytab[ne].nextentry;
`entrytab[ne].nextentry=NULL;
`
`“e**’
`curcookie++;
`EXNbflD
`
`Petitioner Oracle-Apple — Exhibit 1010 — Page 134
`
`
`
`dent=readdir(dp);
`
`} r
`
`et.readdirres_u.reply.eof=eof;
`
`if (dent==NULL)
`fid= -10;
`
`{
`
`cfsclosedir(dp);
`
`dp=NULL;
`
`} b
`
`ecome(NULL);
`
`return (&ret);
`
`DIR *curdir;
`
`int curdirid=O;
`
`long curcookie;
`
`DIR *
`
`cfsopendir(dir,cookie)
`
`cfs_fileid *dir;
`long cookie;
`
`DIR *ret;
`
`DIR *fhopendir();
`
`if ((ret=fhopendir(dir))==NULL)
`
`return NULL;
`
`/* fhopendir sets cfserrno */
`
`/* this is an ugly hack to deal with braindead systems (afs)
`
`that can't
`
`do seekdir properly.
`
`fortunately, we almost always already have
`
`the dir open so we don't have to do this bogosity */
`while (cookie—— > O)
`
`readdir(ret);
`return ret;
`
`cfsclosedir(dp)
`
`DIR *dp;
`
`fhclosedir(dp);
`
`statfsres *
`
`nfsproc_statfs_2(ap,rp)
`
`nfs_fh *ap;
`SR rp;
`
`static statfsres ret;
`
`#ifdef DEBUG
`
`printf("statfs: %s\n",pfh(ap));
`#endif
`
`setstatfsokres(&ret.statfsres_u.reply);
`ret . status=NFS_OK;
`return (&ret);
`
`rootgetattr(f)
`EXNbflD
`
`Petitioner Oracle-Apple - Exhibit 1010 - Page 135
`
`
`
`struct fattr *f;
`
`f—>type=NFDIR;
`
`f—>mode=NFSMODE_DIR|0777;
`f—>n1ink=4;
`
`f—>uid=O;
`
`f—>gid=O;
`f->size=8l92;
`
`f->b1ocksize=8l92;
`
`f->rdev= -1;
`
`f->b1ocks=l;
`
`f—>fsid=O;
`
`f—>fileid=l;
`
`bcopy(&roottime,&f->atime,sizeof(nfstime));
`
`bcopy(&roottime,&f->mtime,sizeof(nfstime));
`
`bcopy(&roottime,&f->ctime,sizeof(nfstime));
`
`setstatfsokres(s)
`statfsokres *s;
`
`s—>tsize=8192;
`
`s—>bsize=8192;
`s—>b1ocks=O;
`
`s—>bfree=O;
`
`s—>baVai1=O;
`
`int fhstat(fh,fa)
`
`cfs_fi1eid *fh;
`fattr *fa;
`
`struct stat sb;
`
`int r;
`
`{
`if (fh==NULL)
`cfserrno=NFSERR_STALE;
`return -2;
`
`} i
`
`f (fh== &rootnode)
`rootgetattr(fa);
`return 0;
`
`{
`
`if ((r=fhgetstat(fh.&sb))
`return r;
`
`!= 0)
`
`fa->type = getftype(sb.st_mode);
`
`fa->mode = fhmode(fh,sb.st_mode);
`
`fa—>n1ink = sb.st_n1ink;
`
`fa—>uid = fhowner(fh,sb.st_uid);
`fa—>gid
`
`sb.st_gid;
`
`fa->size = sb.st_size;
`#ifdef irix
`
`fa->b1ocksize = 512;
`
`/* already tweeked */
`
`fa->b1ocks = (sb.st_size + 511)/512;
`EXNbflD
`
`Petitioner Oracle-Apple - Exhibit 1010 - Page 136
`
`
`
`#else
`fa—>blocksize
`
`sb.st_blksize;
`
`fa->blocks
`
`sb.st_blocks;
`
`#endif
`fa->rdev
`
`fa—>fsid
`
`fa—>fileid
`
`sb.st_rdev;
`iid(fh);
`/* we return the instance id */
`
`fhid(fh);
`
`/* inode or O—i for iroots */
`
`bcopy(&sb.st_atime,&fa->atime,sizeof(time_t));
`
`bcopy(&sb.st_mtime,&fa->mtime,sizeof(time_t));
`
`bcopy(&sb.st_ctime,&fa->ctime,sizeof(time_t));
`re turn 0 7
`
`/* return uid associated w/ rpc call — unix style only for now */
`
`/* note that this really doesnt belong here */
`int
`
`ruid(rp)
`SR rp;
`
`struct authunix_parms *cred;
`
`if (rp—>rq_cred.oa_flavor != AUTH_UNIX)
`return -1;
`
`cred=(struct authunix_parms *)
`
`rp—>rq_clntcred;
`
`return cred—>aup_uid;
`
`int
`
`rgid(rp)
`SR rp;
`
`struct authunix_parms *cred;
`
`if (rp—>rq_cred.oa_flavor != AUTH_UNIX)
`return -1;
`
`cred=(struct authunix_parms *)
`
`rp—>rq_clntcred;
`
`return cred—>aup_gid;
`
`/* this is ugly,
`
`since it duplicates much of the code
`
`above in lookup, but it does the job */
`
`diropres *
`
`rootlookup(s)
`char *s;
`
`static diropres ret;
`
`nfs_fh *handle;
`
`handle &ret.diropres_u.diropres.file;
`switch (fhrootlook(s,handle))
`{
`case 0 2
`/* found it */
`
`/* now do a getattr — handle is an instance root, which
`
`is treated normally */
`
`switch (fhstat(geth(handle),
`
`‘rat'dir°PreS—u'dir°PreS‘attributes’ ’ Fetitioner Oracle-Apple — Exhibit 1010 — Page 137
`
`case 0:
`
`EXNbflD
`
`
`
`ret . status=NFS_OK;
`
`/* stat is already in attributes field */
`break;
`
`/* couldn't open file for some reason */
`case -1:
`ret.status=cfsno(errno);
`
`break;
`
`/* shouldn't happen */
`default:
`ret.status=cfserrno;
`
`break;
`
`} b
`
`reak;
`
`/* some parent dir went away, probably */
`case -1:
`ret.status=cfsno(errno);
`
`break;
`
`/* bad parent handle or notfound, probably */
`default:
`ret.status=cfserrno;
`
`break;
`
`} r
`
`eturn (&ret);
`
`/* ugly ugly ugly — duplicates fair bit of code from readdir, but at least
`it works */
`readdirres *
`
`rootreaddir(ap)
`
`readdirargs *ap;
`
`static readdirres ret;
`
`static entry entrytab[MAXENTRIES];
`
`/* just deal w/ it staticaly */
`
`typedef char str[NFS_MAXNAMLEN+1];
`static str names[MAXENTRIES];
`
`entry **preV;
`
`long cookie;
`int eof;
`
`int ne;
`
`int bytes;
`
`cfs_fileid *h;
`struct dirent *dent;
`
`struct dirent *rootrd();
`
`bytes = ap->count
`ne=O;
`
`— MAXENTSIZE;
`
`prev= &ret.readdirres_u.reply.entries;
`*preV=NULL;
`
`bcopy(ap->cookie,&cookie,sizeof(long));
`eof=1;
`
`ret.status=NFS_OK;
`
`while ((dent=rootrd(cookie))!=NULL)
`eof=O;
`
`{
`
`if (((bytes -= dentsize(dent->d_name))<O)||(ne >= MAXENTRIES)){
`break;
`
`Petitioner Oracle-Apple — Exhibit 1010 — Page 138
`
`} e
`
`°f=l’
`strcpy(names[ne],dent—>d_name);
`EXNbflD
`
`
`
`entrytab[ne].name=names[ne];
`
`if (strcmp(dent->d_name,".")==0)
`entrytab[ne].fi1eid=l;
`
`/* me */
`
`else if (strcmp(dent->d_name,"..")==O)
`entrytab[ne].fi1eid=l;
`
`/* parent, also me */
`
`else entrytab[ne].fi1eid=dent->d_fi1eno;
`
`cookie=dent—>d_rec1en;
`*prev &entrytab[ne];
`
`/* may not work everywhere */
`
`bcopy(&cookie,entrytab[ne].cookie,sizeof(1ong));
`prev &entrytab[ne].nextentry;
`entrytab[ne].nextentry=NULL;
`ne++;
`
`ret.readdirres_u.rep1y.eof=eof;
`return (&ret);
`
`extern struct in_addr validhost;
`
`goodsrc(rp)
`SR rp;
`
`struct in_addr ia;
`
`struct in_addr *ip;
`
`if (svc_getca11er(rp—>rq_xprt)—>sin_addr.s_addr != va1idhost.s_addr)
`fprintf(stderr,"bad addr! %x
`!— %x\n",
`
`{
`
`svc_getca11er(rp—>rq_xprt)—>sin_addr.s_addr,va1idhost.s_addr);
`return 0;
`
`} i
`
`f (rp—>rq_cred.oa_f1avor != AUTH_UNIX)
`return 0;
`/* bolster defense against portmap bug */
`#ifndef ANYPORT
`
`{
`> 1023)
`if (ntohs(sVc_getcal1er(rp—>rq_xprt)—>sin_port)
`fprintf(stderr,"bad port! %d\n", ntohs(svc_getca11er(rp->rq_xprt)->sin_port));
`return 0;
`
`}
`#endif
`
`return 1;
`
`EXNbflD
`
`Petitioner Oracle-Apple - Exhibit 1010 - Page 139
`
`
`
`cfsd. 8
`
`Exhibit D
`
`Petitioner Oracle-Apple - Exhibit 1010 - Page 140
`
`
`
`.TH CFSD 8 ""
`
`.SH NAME
`
`cfsd — cryptographic file system daemon
`.SH SYNOPSIS
`
`.B cfsd
`.SH DESCRIPTION
`
`\fBcfsd\fP is the user—level daemon for the Cryptographic File System
`
`(CFS).
`
`It is essentially an RPC server for the NFS protocol augmented
`
`It listens on the CFS port (ordinarily
`with the CFS_ADMIN protocol.
`port 3049) on the \fBlocalhost\fP interface.
`.LP
`
`The main function of \fBcfsd\fP is to manage the keys for currently
`attached encrypted directories, presenting them in clear form under
`
`the CFS mount point (typically "/crypt").
`.LP
`
`time from /etc/rc
`\fBcfsd\fP should ordinarily be invoked at boot
`(or /etc/rc.local).
`The rc file should also start
`
`\fBmountd\fP(8) daemon with least one file system exported to
`
`localhost; note that cfsd itself does not handle the mount protocol.
`
`Once a mountd is running,
`
`the mount(8)
`
`command should be invoked to
`
`mount the exported file system from the localhost interface with
`port=3049.
`.SH EXAMPLES
`
`.TP
`
`/usr/local/etc/cfsd
`
`invokes cfs (in /etc/rc)
`.TP
`
`/etc/mount —o port=3049,intr localhost:/ /crypt
`
`mounts cfs on /crypt
`.SH FILES
`
`(in /etc/rc)
`
`.TP
`
`/crypt
`cfs mount point
`.TP
`
`/etc/exports
`
`exported file systems
`.SH SEE ALSO
`
`cattach(l), cdetach(l), mountd(8), mount(8)
`.SH BUGS
`
`\fBcfsd\fP is single threaded, which means it doesn't handle lots of
`simultanious operations very well.
`In particular, it is not possible
`
`to recursively attach encrypted directories, since that would lead to
`a deadlock.
`.SH AUTHOR
`
`Matt Blaze; for information on cfs, email to
`cfs@research.att.com.
`
`ExmbflD
`
`Petitioner Oracle-Apple - Exhibit 1010 - Page 141
`
`
`
`cmkdir. 1
`
`Exhibit D
`
`Petitioner Oracle-Apple - Exhibit 1010 - Page 142
`
`
`
`.TH CMKDIR l ""
`
`.SH NAME
`
`cmkdir — create encrypted directory for CFS
`.SH SYNOPSIS
`
`.B cmkdir
`
`[
`
`\—\fBl23bdmosp\fP ]
`
`\fIdirectory\fP
`.SH DESCRIPTION
`
`\fBcmkdir\fP creates \fIdirectory\fP and assigns to it cryptographic
`
`keys for use by the Cryptographic File System (CFS). Operation is
`
`similar to the ordinary \fBmkdir\fP(l) command, with the addition that
`
`the user is prompted for a passphrase which is used to generate the
`
`DES keys used by cfsd(8)
`
`to transparently encrypt the files.
`
`The
`
`smartcard version of \fBcmkdir\fP initializes a key smartcard and
`
`requires that a blank smartcard be inserted into the smartcard reader.
`.LP
`
`Once created, encrypted directories can be made available for use with
`
`the \fBcattach\fP(l) command. Users should not ordinarily read and
`
`write directly to directories created with \fBcmkdir\fP, since these
`
`files would not be stored in encrypted form.
`.LP
`