Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!ginosko!uunet!mcsun!ukc!edcastle!lfcs!paul
From: paul@lfcs.ed.ac.uk (Paul Anderson)
Newsgroups: comp.protocols.appletalk
Subject: Executing remote Unix processes from a Mac (part2 of 2)
Message-ID: <514@castle.ed.ac.uk>
Date: 28 Sep 89 11:37:06 GMT
Sender: root@castle.ed.ac.uk
Reply-To: paul@lfcs.ed.ac.uk (Paul Anderson)
Organization: Laboratory for the Foundations of Computer Science, University of Edinburgh
Lines: 1088

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh aufs.diffs <<'END_OF_aufs.diffs'
X*** /export/src/master/cap/CAP-5.0/cap50/applications/aufs/Makefile	Tue May 17 18:40:42 1988
X--- Makefile	Fri Jun 30 17:29:02 1989
X***************
X*** 1,4 ****
X! # Makefile autoconfigured for a: \
X  	Standard BSD system on Tue May 17 13:40:41 EDT 1988
X  
X  
X--- 1,4 ----
X!  # Makefile autoconfigured for a: \
X  	Standard BSD system on Tue May 17 13:40:41 EDT 1988
X  
X  
X***************
X*** 39,45 ****
X  
X  # make sure that you define point getopt to att_getopt.o if your system
X  # doesn't have it builtin
X! GETOPT=att_getopt.o
X  
X  # This encodes the assumed location of certain directories
X  EXTRAS=../../extras
X--- 39,46 ----
X  
X  # make sure that you define point getopt to att_getopt.o if your system
X  # doesn't have it builtin
X! # GETOPT=att_getopt.o
X! GETOPT=
X  
X  # This encodes the assumed location of certain directories
X  EXTRAS=../../extras
X***************
X*** 49,60 ****
X  #
X  # End of configurable options
X  #
X! SRCS=afpos.c afpvols.c afpfile.c afpdir.c afpfork.c \
X  	afpmisc.c afpserver.c aufsicon.c abmisc2.c \
X  	afpdt.c afpdid.c afposenum.c  afpavl.c \
X  	afposfi.c afpgc.c afppasswd.c afposlock.c aufsv.c \
X  	afpudb.c afposncs.c
X! OBJS=afpos.o afpvols.o afpfile.o \
X  	afpmisc.o afpserver.o aufsicon.o abmisc2.o \
X  	afpdt.o afpdir.o afpfork.o afpdid.o afposenum.o afpavl.o \
X  	afposfi.o afpgc.o afppasswd.o aufsv.o \
X--- 50,61 ----
X  #
X  # End of configurable options
X  #
X! SRCS=afpos.c afproc.c afpvols.c afpfile.c afpdir.c afpfork.c \
X  	afpmisc.c afpserver.c aufsicon.c abmisc2.c \
X  	afpdt.c afpdid.c afposenum.c  afpavl.c \
X  	afposfi.c afpgc.c afppasswd.c afposlock.c aufsv.c \
X  	afpudb.c afposncs.c
X! OBJS=afpos.o afproc.o afpvols.o afpfile.o \
X  	afpmisc.o afpserver.o aufsicon.o abmisc2.o \
X  	afpdt.o afpdir.o afpfork.o afpdid.o afposenum.o afpavl.o \
X  	afposfi.o afpgc.o afppasswd.o aufsv.o \
X***************
X*** 67,73 ****
X  	${CC} $(LFLAGS) -o aufs aufs.o $(OBJS) $(CAPFILES) ${RENAME} \
X  		$(GETOPT) ${AFPLIB} ${CAPLIB} ${SLIB}
X  
X! newver: 
X  	/bin/sh aufs_vers.sh `cat aufs_vers` aufs_vers aufsv.c
X  	make all
X  
X--- 68,74 ----
X  	${CC} $(LFLAGS) -o aufs aufs.o $(OBJS) $(CAPFILES) ${RENAME} \
X  		$(GETOPT) ${AFPLIB} ${CAPLIB} ${SLIB}
X  
X! newver: aufs_vers.sh
X  	/bin/sh aufs_vers.sh `cat aufs_vers` aufs_vers aufsv.c
X  	make all
X  
X***************
X*** 91,99 ****
X  att_getopt.c:
X  	ln -s ${EXTRAS}/att_getopt.c
X  
X! afpos.o:	afpos.c
X  	${CC} ${OSDEFS} ${CFLAGS} -c afpos.c
X  
X  afposncs.o:	afposncs.c
X  	${CC} ${OSDEFS} ${CFLAGS} -c afposncs.c
X  
X--- 92,103 ----
X  att_getopt.c:
X  	ln -s ${EXTRAS}/att_getopt.c
X  
X! afpos.o:	afpos.c afppasswd.h afposncs.h afpgc.h afproc.h
X  	${CC} ${OSDEFS} ${CFLAGS} -c afpos.c
X  
X+ afproc.o:	afproc.c afproc.h
X+ 	${CC} ${OSDEFS} ${CFLAGS} -c afproc.c
X+ 
X  afposncs.o:	afposncs.c
X  	${CC} ${OSDEFS} ${CFLAGS} -c afposncs.c
X  
X***************
X*** 100,106 ****
X  afpudb.o:	afpudb.c
X  	${CC} ${CFLAGS} ${AFPUDB} -c afpudb.c
X  
X! aufs.o:	aufs.c
X  	${CC} ${CFLAGS} ${AUFSDEFS} -c aufs.c
X  
X  # Dependencies
X--- 104,110 ----
X  afpudb.o:	afpudb.c
X  	${CC} ${CFLAGS} ${AFPUDB} -c afpudb.c
X  
X! aufs.o:	aufs.c afps.h
X  	${CC} ${CFLAGS} ${AUFSDEFS} -c aufs.c
X  
X  # Dependencies
X***************
X*** 108,113 ****
X--- 112,121 ----
X  				$I/netat/aberrors.h $I/netat/abqueue.h \
X  				$I/netat/afp.h \
X  				afpvols.h $I/netat/afpcmd.h 
X+ afproc.o:        afproc.c       $I/netat/appletalk.h \
X+ 				$I/netat/aberrors.h $I/netat/abqueue.h \
X+ 				$I/netat/afp.h \
X+ 				afpvols.h $I/netat/afpcmd.h 
X  afpudb.o:	afpudb.c	$I/netat/appletalk.h afpudb.h
X  afpfork.o:      afpfork.c       $I/netat/appletalk.h $I/netat/aberrors.h \
X  				$I/netat/abqueue.h $I/netat/afp.h \
X***************
X*** 161,163 ****
X--- 169,173 ----
X  afppasswd.o:    afppasswd.c	$I/netat/sysvcompat.h afppasswd.h
X  afposncs.o:	afposncs.c	$I/netat/appletalk.h $I/netat/afp.h \
X  				afposncs.h afps.h
X+ %:		RCS/%,v
X+ 		co -r$(VERSION) $@
X*** /export/src/master/cap/CAP-5.0/cap50/applications/aufs/afpmisc.c	Thu May 19 20:19:45 1988
X--- afpmisc.c	Fri Jun 30 17:32:17 1989
X***************
X*** 1,7 ****
X  /*
X!  * $Author: cck $ $Date: 88/02/23 17:16:17 $
X!  * $Header: afpmisc.c,v 1.9 88/02/23 17:16:17 cck Rel $
X!  * $Revision: 1.9 $
X  */
X  
X  /*
X--- 1,7 ----
X  /*
X!  * $Author: paul $ $Date: 89/06/06 10:33:34 $
X!  * $Header: /tmp_mnt/auto1b00053/paul/code/aufs/p2/RCS/afpmisc.c,v 1.9.1.1 89/06/06 10:33:34 paul Rel Locker: paul $
X!  * $Revision: 1.9.1.1 $
X  */
X  
X  /*
X***************
X*** 49,58 ****
X    {DBG_DEBG|DBG_SRVR,"Server"},
X    {DBG_DEBG|DBG_UNIX,"Unix"},
X    {DBG_DEBG|DBG_VOLS,"Volume"},
X    {DBG_DEBG,"debug"}
X  };
X  
X! #define DBTABN 11		/* size of debug table */
X  
X  char *DBLevelOpts()
X  {
X--- 49,59 ----
X    {DBG_DEBG|DBG_SRVR,"Server"},
X    {DBG_DEBG|DBG_UNIX,"Unix"},
X    {DBG_DEBG|DBG_VOLS,"Volume"},
X+   {DBG_DEBG|DBG_PROC,"Process"},
X    {DBG_DEBG,"debug"}
X  };
X  
X! #define DBTABN 12		/* size of debug table */
X  
X  char *DBLevelOpts()
X  {
X*** /export/src/master/cap/CAP-5.0/cap50/applications/aufs/afpos.c	Thu Aug 11 14:24:13 1988
X--- afpos.c	Fri Jun 30 17:29:57 1989
X***************
X*** 1,7 ****
X  /*
X!  * $Author: cck $ $Date: 88/05/13 09:19:18 $
X!  * $Header: afpos.c,v 1.81 88/05/13 09:19:18 cck Rel $
X!  * $Revision: 1.81 $
X  */
X  
X  /*
X--- 1,7 ----
X  /*
X!  * $Author: paul $ $Date: 89/06/08 16:05:55 $
X!  * $Header: /tmp_mnt/auto1b00053/paul/code/aufs/p2/RCS/afpos.c,v 1.81.1.3 89/06/08 16:05:55 paul Exp Locker: paul $
X!  * $Revision: 1.81.1.3 $
X  */
X  
X  /*
X***************
X*** 135,140 ****
X--- 135,141 ----
X  #include "afppasswd.h"			/* in case we are using privates */
X  #include "afposncs.h"
X  #include "afpgc.h"
X+ #include "afproc.h"
X  
X  #ifdef MAXBSIZE
X  # define IOBSIZE MAXBSIZE	/* set to max buf entry size by if there */
X***************
X*** 205,210 ****
X--- 206,217 ----
X  #endif
X  
X  import int errno;
X+ import PROCESS *FindProcess();
X+ import OSErr ProcOpen();
X+ import OSErr ProcWrite();
X+ import OSErr ProcRead();
X+ import OSErr ProcClose();
X+ import OSErr ProcDelete();
X  
X  /*
X   * AFPOS functions
X***************
X*** 533,539 ****
X   *  AccessDenied	User does not have the rights (specified in AFP spec).
X   *
X   */
X! OSErr
X  OSDelete(ipdir,idir,file)
X  IDirP ipdir, idir;
X  char *file;
X--- 540,546 ----
X   *  AccessDenied	User does not have the rights (specified in AFP spec).
X   *
X   */
X! export OSErr
X  OSDelete(ipdir,idir,file)
X  IDirP ipdir, idir;
X  char *file;
X***************
X*** 541,548 ****
X    int err;
X    char path[MAXPATHLEN];
X  
X!   OSfname(path,ipdir,file,F_DATA);	/* create data fork name */
X  
X    if (DBOSI)
X      printf("OSDelete file=%s\n",path);
X  
X--- 548,557 ----
X    int err;
X    char path[MAXPATHLEN];
X  
X!   OSfname(path,ipdir,NameOf(file),F_DATA);	/* create data fork name */
X  
X+   if (IsProcess(file)) return ProcDelete(path);
X+ 
X    if (DBOSI)
X      printf("OSDelete file=%s\n",path);
X  
X***************
X*** 556,562 ****
X      err = unix_rmdir(path);		/* delete the data file */
X      if (err != noErr)
X        return(err);
X!     (void) os_delete(ipdir,file,F_FNDR);	/* delete finder fork */
X      /* remove the dirid */
X      FModified(ipdir, file);
X      Idrdirid(ipdir, idir);		/* idir is invalid after this point */
X--- 565,571 ----
X      err = unix_rmdir(path);		/* delete the data file */
X      if (err != noErr)
X        return(err);
X!     (void) os_delete(ipdir,file,F_FNDR); /* delete finder fork */
X      /* remove the dirid */
X      FModified(ipdir, file);
X      Idrdirid(ipdir, idir);		/* idir is invalid after this point */
X***************
X*** 566,574 ****
X    err = unix_unlink(path);		/* rid the data file */
X    if (err != noErr)
X      return(err);
X!   (void) os_delete(ipdir,file,F_RSRC);	/* delete resource fork */
X!   (void) os_delete(ipdir,file,F_FNDR);	/* delete finder fork */
X!   FModified(ipdir, file);
X    return(noErr);
X  }
X  
X--- 575,583 ----
X    err = unix_unlink(path);		/* rid the data file */
X    if (err != noErr)
X      return(err);
X!   (void) os_delete(ipdir,NameOf(file),F_RSRC);	/* delete resource fork */
X!   (void) os_delete(ipdir,NameOf(file),F_FNDR);	/* delete finder fork */
X!   FModified(ipdir, NameOf(file));
X    return(noErr);
X  }
X  
X***************
X*** 687,697 ****
X   *
X   */
X  
X! OSErr
X  OSRename(pdir,from,to)
X  IDirP pdir;				/* parent directory id */
X  char *from,*to;				/* from and to file names */
X  {
X    return(os_move(pdir,from,pdir,to));	/* do the work */
X  }
X  
X--- 696,707 ----
X   *
X   */
X  
X! export OSErr
X  OSRename(pdir,from,to)
X  IDirP pdir;				/* parent directory id */
X  char *from,*to;				/* from and to file names */
X  {
X+   if (IsProcess(from) || IsProcess(to)) return(peInvalid);
X    return(os_move(pdir,from,pdir,to));	/* do the work */
X  }
X  
X***************
X*** 726,731 ****
X--- 736,742 ----
X  char *from;				/* from file name */
X  char *to;				/*  to file name is dest directory */
X  {
X+   if (IsProcess(from) || IsProcess(to)) return(peInvalid);
X    return(os_move(fpdir, from, tpdir, to));
X  }
X  
X***************
X*** 746,753 ****
X    int err,cerr;
X    int mo;
X  
X!   OSfname(fpath,fpdir,from,F_DATA);	/* build data file name */
X!   OSfname(tpath,tpdir,to,F_DATA);	/* for from and to files */
X  
X    if (DBOSI)
X      printf("OSRename from=%s, to=%s\n",fpath,tpath);
X--- 757,764 ----
X    int err,cerr;
X    int mo;
X  
X!   OSfname(fpath,fpdir,NameOf(from),F_DATA);	/* build data file name */
X!   OSfname(tpath,tpdir,NameOf(to),F_DATA);	/* for from and to files */
X  
X    if (DBOSI)
X      printf("OSRename from=%s, to=%s\n",fpath,tpath);
X***************
X*** 772,779 ****
X    if (!S_ISDIR(stb.st_mode)) {		/* directories have no rsrc fork */
X      unix_chmod(tpath, mo);		/* file: try to reset protection */
X      if (fpdir->flags & DID_RESOURCE) {
X!       OSfname(fpath,fpdir,from,F_RSRC);	/* build resource file names */
X!       OSfname(tpath,tpdir,to,F_RSRC);
X        err = unix_rename(fpath,tpath);	/* give unix a shot at it */
X        /* allow non-existant resource */
X        if (err != noErr && err != aeObjectNotFound) { /* error on rename? */
X--- 783,790 ----
X    if (!S_ISDIR(stb.st_mode)) {		/* directories have no rsrc fork */
X      unix_chmod(tpath, mo);		/* file: try to reset protection */
X      if (fpdir->flags & DID_RESOURCE) {
X!       OSfname(fpath,fpdir,NameOf(from),F_RSRC);	/* build resource file names */
X!       OSfname(tpath,tpdir,NameOf(to),F_RSRC);
X        err = unix_rename(fpath,tpath);	/* give unix a shot at it */
X        /* allow non-existant resource */
X        if (err != noErr && err != aeObjectNotFound) { /* error on rename? */
X***************
X*** 780,787 ****
X  	if (DBOSI)
X  	  printf("os_rename: failed %s for %s -> %s\n",
X  		 afperr(err),fpath,tpath);
X! 	OSfname(fpath,fpdir,from,F_DATA); /* try to rebuild */
X! 	OSfname(tpath,tpdir,to,F_DATA);
X  	cerr = unix_rename(tpath,fpath);	/* rename back to orignal */
X  	if (cerr != noErr && DBOSI)
X  	  printf("os_rename: cleanup failed\n");
X--- 791,798 ----
X  	if (DBOSI)
X  	  printf("os_rename: failed %s for %s -> %s\n",
X  		 afperr(err),fpath,tpath);
X! 	OSfname(fpath,fpdir,NameOf(from),F_DATA); /* try to rebuild */
X! 	OSfname(tpath,tpdir,NameOf(to),F_DATA);
X  	cerr = unix_rename(tpath,fpath);	/* rename back to orignal */
X  	if (cerr != noErr && DBOSI)
X  	  printf("os_rename: cleanup failed\n");
X***************
X*** 792,799 ****
X    }  
X  
X    if (fpdir->flags & DID_FINDERINFO) {
X!     OSfname(fpath,fpdir,from,F_FNDR);	/* build finder info file names */
X!     OSfname(tpath,tpdir,to,F_FNDR);
X      err = unix_rename(fpath,tpath);	/* give unix a shot at it */
X      if (err != noErr && DBOSI) {
X        printf("os_rename: failed %s for %s -> %s\n", afperr(err),fpath,tpath);
X--- 803,810 ----
X    }  
X  
X    if (fpdir->flags & DID_FINDERINFO) {
X!     OSfname(fpath,fpdir,NameOf(from),F_FNDR);/* build finder info file names */
X!     OSfname(tpath,tpdir,NameOf(to),F_FNDR);
X      err = unix_rename(fpath,tpath);	/* give unix a shot at it */
X      if (err != noErr && DBOSI) {
X        printf("os_rename: failed %s for %s -> %s\n", afperr(err),fpath,tpath);
X***************
X*** 800,806 ****
X      } else {
X        if (!S_ISDIR(stb.st_mode))
X  	unix_chmod(tpath, mo);		/* file: try to reset protection */
X!       OSSetMacFileName(tpdir, to);
X      }
X    } else
X      if (DBOSI)
X--- 811,817 ----
X      } else {
X        if (!S_ISDIR(stb.st_mode))
X  	unix_chmod(tpath, mo);		/* file: try to reset protection */
X!       OSSetMacFileName(tpdir, NameOf(to));
X      }
X    } else
X      if (DBOSI)
X***************
X*** 807,815 ****
X        printf("os_rename: no finder info to rename\n");
X  
X    if (S_ISDIR(stb.st_mode))		/* if a directory then need to */
X!     Idmove(fpdir,from,tpdir,to);	/*  change internal structure */
X  
X!   FModified(fpdir, from);	/* does an emodified */
X    /* EModified(fpdir); */
X    /* don't need to mark dest file as modified since mac won't let this */
X    /* happen */
X--- 818,826 ----
X        printf("os_rename: no finder info to rename\n");
X  
X    if (S_ISDIR(stb.st_mode))		/* if a directory then need to */
X!     Idmove(fpdir,NameOf(from),tpdir,NameOf(to)); /*change internal structure */
X  
X!   FModified(fpdir, NameOf(from));	/* does an emodified */
X    /* EModified(fpdir); */
X    /* don't need to mark dest file as modified since mac won't let this */
X    /* happen */
X***************
X*** 879,885 ****
X  OSClose(fd)
X  int fd;
X  {
X!   return(unix_close(fd));		/* return OSErr */
X  }
X  
X  /*
X--- 890,899 ----
X  OSClose(fd)
X  int fd;
X  {
X!   PROCESS *p;
X! 
X!   if (p=FindProcess(fd)) return ProcClose(p);
X!   else return(unix_close(fd));		/* return OSErr */
X  }
X  
X  /*
X***************
X*** 904,909 ****
X--- 918,924 ----
X  int trans_table_index;
X  {
X    register char c;
X+   PROCESS *p;
X    int cnt,i;
X  
X  #ifdef notdef
X***************
X*** 914,919 ****
X--- 929,937 ----
X    }
X  #endif
X  
X+   if (p=FindProcess(fd))
X+     return( ProcRead( p, r, reqcnt, rl ) );
X+ 
X    if (offs != *fpos)
X      lseek(fd,(off_t)offs,L_SET);
X  
X***************
X*** 978,983 ****
X--- 996,1002 ----
X   * unixtomax - if non-zero translate cr to lf on writes
X   *
X  */
X+ export OSErr
X  OSWrite(fd,wbuf,wlen,offs,flg,fpos,trans_table_index)
X  int fd;
X  byte *wbuf;
X***************
X*** 987,996 ****
X--- 1006,1018 ----
X  int trans_table_index;
X  {
X    int cnt;
X+   PROCESS *p;
X  
X    if (wlen == 0)			/* zero byte request? */
X      return(noErr);			/*  yes... no work */
X  
X+   if (p=FindProcess(fd)) return( ProcWrite( p, wbuf, wlen ) );
X+ 
X    if (flg == 0) {
X      if (offs != *fpos)
X        *fpos = lseek(fd,(off_t)offs,L_SET);
X***************
X*** 1077,1082 ****
X--- 1099,1106 ----
X    if (DBOSI)
X      printf("OSCreateDir: creating %s\n",name);
X  
X+   if (IsProcess(name)) return(peInvalid);
X+ 
X    err = unix_stat(pathstr(pdir),&stb);	/* get current protections */
X    mo = stb.st_mode & 0777;
X  
X***************
X*** 1120,1131 ****
X    struct stat buf;
X    time_t sometime;
X  
X!   OSfname(path,ipdir,fn,F_DATA);
X  
X    if (DBOSI)
X      printf("OSFileDirInfo on %s\n",path);
X  
X!   if (stat(path,&buf) != 0) {		/* file exists? */
X      if (idir)				/* was in directory tree? */
X        Idrdirid(ipdir, idir);		/* invalidate the entry then */
X      return(aeObjectNotFound);		/* no... */
X--- 1144,1155 ----
X    struct stat buf;
X    time_t sometime;
X  
X!   OSfname(path,ipdir,NameOf(fn),F_DATA);
X  
X    if (DBOSI)
X      printf("OSFileDirInfo on %s\n",path);
X  
X!   if (stat(path,&buf) != 0) {         /* file exists? */
X      if (idir)				/* was in directory tree? */
X        Idrdirid(ipdir, idir);		/* invalidate the entry then */
X      return(aeObjectNotFound);		/* no... */
X***************
X*** 1140,1157 ****
X  
X    fdp->fdp_bdate = 0;
X    fdp->fdp_zero = 0;			/* zero the zero byte (?) */
X! /*  strcpy(fdp->fdp_lname,fn);		/* copy long name */
X    if (idir == VolRootD(volid))
X      strcpy(fdp->fdp_lname, VolName(volid));
X    else
X!     ItoEName(fn,fdp->fdp_lname);
X  
X    if (S_ISDIR(buf.st_mode)) {		/* is this a directory? */
X      fdp->fdp_flg = FDP_DIRFLG;		/* yes... */
X!     return(OSDirInfo(ipdir,fn,fdp,&buf,volid));	/* fill in */
X    }
X    fdp->fdp_flg = 0;			/* otherwise a file */
X!   return(OSFileInfo(ipdir,fn,fdp,&buf)); /* fill in */
X  }
X  
X    
X--- 1164,1181 ----
X  
X    fdp->fdp_bdate = 0;
X    fdp->fdp_zero = 0;			/* zero the zero byte (?) */
X! /*  strcpy(fdp->fdp_lname,NameOf(fn));		/* copy long name */
X    if (idir == VolRootD(volid))
X      strcpy(fdp->fdp_lname, VolName(volid));
X    else
X!     ItoEName(NameOf(fn),fdp->fdp_lname);
X  
X    if (S_ISDIR(buf.st_mode)) {		/* is this a directory? */
X      fdp->fdp_flg = FDP_DIRFLG;		/* yes... */
X!     return(OSDirInfo(ipdir,NameOf(fn),fdp,&buf,volid));	/* fill in */
X    }
X    fdp->fdp_flg = 0;			/* otherwise a file */
X!   return(OSFileInfo(ipdir,NameOf(fn),fdp,&buf)); /* fill in */
X  }
X  
X    
X***************
X*** 1168,1173 ****
X--- 1192,1199 ----
X    word bm;
X    int nchild;
X  
X+   if (IsProcess(fn)) return(peInvalid);
X+ 
X    fdp->fdp_dbitmap &= DP_AUFS_VALID; /* truncate to findable */
X    bm = fdp->fdp_dbitmap;
X  
X***************
X*** 1279,1302 ****
X    char rpath[MAXPATHLEN];
X    word bm;
X  
X!   fdp->fdp_fbitmap &= FP_AUFS_VALID; /* truncate to aufs supported */
X    bm = fdp->fdp_fbitmap;		/* fetch file bitmap */
X  
X    if (DBDIR)
X!     printf("OSFileInfo on %s bm=%x\n",fn,bm);
X  
X    if (bm & FP_ATTR)			/* skip attr if not requested */
X!     OSGetAttr(ipdir,fn,&fdp->fdp_attr);
X  
X    if (bm & FP_FINFO)			/* skip finfo if not requested */
X!     OSGetFNDR(ipdir,fn,fdp->fdp_finfo);
X  
X    fdp->fdp_parms.fp_parms.fp_fileno = buf->st_ino;
X    fdp->fdp_parms.fp_parms.fp_dflen = buf->st_size;
X    fdp->fdp_parms.fp_parms.fp_rflen = 0;
X  
X    if (bm & FP_RFLEN) {
X!     OSfname(rpath,ipdir,fn,F_RSRC);	/* convert to rsrc name */
X      if (stat(rpath,&stb) != 0)		/* to figure size of resource fork */
X        return(noErr);
X      if (DBFIL)
X--- 1305,1329 ----
X    char rpath[MAXPATHLEN];
X    word bm;
X  
X!   fdp->fdp_fbitmap &= FP_AUFS_VALID;    /* truncate to aufs supported */
X    bm = fdp->fdp_fbitmap;		/* fetch file bitmap */
X  
X    if (DBDIR)
X!     printf("OSFileInfo on %s bm=%x\n",NameOf(fn),bm);
X  
X    if (bm & FP_ATTR)			/* skip attr if not requested */
X!     OSGetAttr(ipdir,NameOf(fn),&fdp->fdp_attr);
X  
X    if (bm & FP_FINFO)			/* skip finfo if not requested */
X!     OSGetFNDR(ipdir,NameOf(fn),fdp->fdp_finfo);
X  
X    fdp->fdp_parms.fp_parms.fp_fileno = buf->st_ino;
X    fdp->fdp_parms.fp_parms.fp_dflen = buf->st_size;
X    fdp->fdp_parms.fp_parms.fp_rflen = 0;
X+   fdp->fdp_parms.fp_parms.fp_rflen = 0;
X  
X    if (bm & FP_RFLEN) {
X!     OSfname(rpath,ipdir,NameOf(fn),F_RSRC);	/* convert to rsrc name */
X      if (stat(rpath,&stb) != 0)		/* to figure size of resource fork */
X        return(noErr);
X      if (DBFIL)
X***************
X*** 1319,1325 ****
X    char path[MAXPATHLEN];  
X    struct stat stb;
X  
X!   OSfname(path, ipdir, fn, type);
X    return(unix_stat(path, &stb));
X  }
X  
X--- 1346,1352 ----
X    char path[MAXPATHLEN];  
X    struct stat stb;
X  
X!   OSfname(path, ipdir, NameOf(fn), type);
X    return(unix_stat(path, &stb));
X  }
X  
X***************
X*** 1334,1339 ****
X--- 1361,1368 ----
X    struct stat stb;
X    int err;
X  
X+   if (IsProcess(fn)) return(noErr);
X+ 
X    OSfname(path,ipdir,fn,F_DATA);	/* unix file name */
X    if ((err = unix_stat(path,&stb)) != noErr) {
X      /* can't find it !!! */
X***************
X*** 1356,1361 ****
X--- 1385,1392 ----
X  {
X    word bm = fdp->fdp_fbitmap;
X  
X+   if (IsProcess(fn)) return(noErr);
X+ 
X    if (bm & (FP_FINFO|FP_ATTR))
X      OSSetFA(ipdir,fn,fdp->fdp_fbitmap,fdp);
X    return(noErr);
X***************
X*** 1367,1373 ****
X   * 
X   *
X  */
X! OSErr
X  OSSetDirParms(ipdir,fn,fdp)
X  IDirP ipdir;
X  char *fn;
X--- 1398,1404 ----
X   * 
X   *
X  */
X! export OSErr
X  OSSetDirParms(ipdir,fn,fdp)
X  IDirP ipdir;
X  char *fn;
X***************
X*** 1379,1384 ****
X--- 1410,1417 ----
X    DirParm *dp = &fdp->fdp_parms.dp_parms;
X    int flags;
X  
X+   if(IsProcess(fn)) return(peInvalid);
X+ 
X    if (fdp->fdp_dbitmap & (DP_FINFO|DP_ATTR))
X      OSSetFA(ipdir,fn,fdp->fdp_dbitmap,fdp);
X  
X***************
X*** 1433,1438 ****
X--- 1466,1474 ----
X  int len;
X  {
X    int err;
X+ 
X+   if (FindProcess(fd)) return(noErr);
X+ 
X    if (DBOSI)
X      printf("OSSetForklen: truncating file on file descriptor %d to %d\n",
X  	   fd,len);
X***************
X*** 1694,1700 ****
X    if (mode & OFK_MRD)
X      imode |= R_OK;
X  
X!   OSfname(path,idir,fn,F_DATA);		/* create unix style filename */
X    err = access(path,imode);
X    if (err == 0)
X      return(noErr);
X--- 1730,1736 ----
X    if (mode & OFK_MRD)
X      imode |= R_OK;
X  
X!   OSfname(path,idir,NameOf(fn),F_DATA);	/* create unix style filename */
X    err = access(path,imode);
X    if (err == 0)
X      return(noErr);
X***************
X*** 2060,2065 ****
X--- 2096,2103 ----
X    int mo;
X    int err;
X  
X+   if (IsProcess(spath) || IsProcess(dpath)) return (peInvalid);
X+ 
X    OSfname(spath,spdir,sfile,F_DATA);	/* create unix style name for data */
X    OSfname(dpath,dpdir,dfile,F_DATA);	/*  same for destination */
X  
X***************
X*** 2204,2215 ****
X    int err,derr,rerr,cerr,mo;
X    struct stat stb;
X  
X!   OSfname(path,pdir,file,F_DATA);	/* create data file name */
X  
X    if (DBOSI)
X      printf("OSCreateFile: creating %s with %s\n",path,
X  	   (delf) ? "OverWrite" : "No OverWrite");
X!   
X    err = unix_stat(pathstr(pdir),&stb);
X    if (err != noErr)
X      return(err);
X--- 2242,2255 ----
X    int err,derr,rerr,cerr,mo;
X    struct stat stb;
X  
X!   if (IsProcess(file)) return (peInvalid);
X  
X+   OSfname(path,pdir,file,F_DATA); /* create name */
X+ 
X    if (DBOSI)
X      printf("OSCreateFile: creating %s with %s\n",path,
X  	   (delf) ? "OverWrite" : "No OverWrite");
X! 
X    err = unix_stat(pathstr(pdir),&stb);
X    if (err != noErr)
X      return(err);
X***************
X*** 2230,2236 ****
X      return(derr);
X    }
X  
X!   OSfname(path,pdir,file,F_RSRC);	/* try creating resource fork */
X    rerr = unix_create(path,delf,mo);	/* ... */
X    if (rerr != noErr && rerr != aeObjectExists && rerr != aeObjectNotFound) {
X      if (DBOSI)
X--- 2270,2276 ----
X      return(derr);
X    }
X  
X!   OSfname(path,pdir,file,F_RSRC);/* try creating resource fork */
X    rerr = unix_create(path,delf,mo);	/* ... */
X    if (rerr != noErr && rerr != aeObjectExists && rerr != aeObjectNotFound) {
X      if (DBOSI)
X***************
X*** 2255,2262 ****
X    EModified(pdir);
X    return(noErr);
X  }
X-   
X  
X  export OSErr
X  OSOpenFork(pdir,file,mode,typ,fhdl)
X  IDirP pdir;				/* parent directory */
X--- 2295,2302 ----
X    EModified(pdir);
X    return(noErr);
X  }
X  
X+ 
X  export OSErr
X  OSOpenFork(pdir,file,mode,typ,fhdl)
X  IDirP pdir;				/* parent directory */
X***************
X*** 2268,2274 ****
X    char *ms;
X    int mo;
X  
X!   OSfname(path,pdir,file,typ);		/* expand name */
X  
X    if ((mode & ~(OFK_MRD|OFK_MWR)) != 0)
X      if (DBOSI)
X--- 2308,2314 ----
X    char *ms;
X    int mo;
X  
X!   OSfname(path,pdir,NameOf(file),typ); /* expand name */
X  
X    if ((mode & ~(OFK_MRD|OFK_MWR)) != 0)
X      if (DBOSI)
X***************
X*** 2288,2294 ****
X    if (DBOSI) 
X      printf("OSOpenFork: Opening %s for %s\n",path,ms);
X  
X!   return(unix_open(path,mo,fhdl));
X  }
X  
X  
X--- 2328,2335 ----
X    if (DBOSI) 
X      printf("OSOpenFork: Opening %s for %s\n",path,ms);
X  
X!   if (IsProcess(file)) return( ProcOpen( path, mo, fhdl ) );
X!   else return(unix_open(path,mo,fhdl));
X  }
X  
X  
X*** /export/src/master/cap/CAP-5.0/cap50/applications/aufs/afps.h	Thu May 19 20:20:07 1988
X--- afps.h	Fri Jun 30 17:29:12 1989
X***************
X*** 1,7 ****
X  /*
X!  * $Author: cck $ $Date: 88/05/13 09:24:04 $
X!  * $Header: afps.h,v 1.19 88/05/13 09:24:04 cck Rel $
X!  * $Revision: 1.19 $
X  */
X  
X  /*
X--- 1,7 ----
X  /*
X!  * $Author: paul $ $Date: 89/06/06 10:39:06 $
X!  * $Header: /tmp_mnt/auto1b00053/paul/code/aufs/p2/RCS/afps.h,v 1.19.1.1 89/06/06 10:39:06 paul Rel $
X!  * $Revision: 1.19.1.1 $
X  */
X  
X  /*
X***************
X*** 62,67 ****
X--- 62,68 ----
X  #define DBG_DEBG 00200		/* in debug */
X  #define DBG_UNIX 00400		/* debug unix routines */
X  #define DBG_ENUM 01000		/* debug directory enumerations */
X+ #define DBG_PROC 02000		/* debug processes */
X  
X  #define DBG_ALL (DBG_FILE|DBG_FORK|DBG_SRVR|DBG_VOLS| \
X  		 DBG_OSIN|DBG_DIRS|DBG_DESK|DBG_DEBG| \
X***************
X*** 78,83 ****
X--- 79,85 ----
X  #define DBDEB (afp_dbug & DBG_DEBG)
X  #define DBUNX (afp_dbug & DBG_UNIX)
X  #define DBENU (afp_dbug & DBG_ENUM)
X+ #define DBPRO (afp_dbug & DBG_PROC)
X  
X  /* afpdid.c */
X  
X*** /export/src/master/cap/CAP-5.0/cap50/applications/aufs/aufs.c	Thu Aug 11 14:10:26 1988
X--- aufs.c	Fri Jun 30 17:29:10 1989
X***************
X*** 1,7 ****
X  /*
X!  * $Author: cck $ $Date: 88/05/19 13:11:35 $
X!  * $Header: aufs.c,v 1.53 88/05/19 13:11:35 cck Rel $
X!  * $Revision: 1.53 $
X  */
X  
X  /*
X--- 1,7 ----
X  /*
X!  * $Author: paul $ $Date: 89/06/08 19:56:35 $
X!  * $Header: /tmp_mnt/auto1b00053/paul/code/aufs/p2/RCS/aufs.c,v 1.53.1.4 89/06/08 19:56:35 paul Exp $
X!  * $Revision: 1.53.1.4 $
X  */
X  
X  /*
X***************
X*** 69,74 ****
X--- 69,75 ----
X  char *mytod();			/* return tod */
X  
X  export int statflg = FALSE;	/* default is not to show stats */
X+ export int enableProcs = FALSE; /* default is not to allow process execution */
X  
X  private char *sysvolfile = NULL; /* system afpvols file */
X  private char *srvrname = NULL;
X***************
X*** 146,151 ****
X--- 147,155 ----
X  private int *ctp_stack;
X  private int ctp_stack_cnt;
X  
X+ import void ProcInit();
X+ import void ProcCleanup();
X+ 
X  usage(name)
X  char *name;
X  {
X***************
X*** 173,178 ****
X--- 177,183 ----
X    fprintf(stderr,"\t-S  limit responses to  packets\n");
X    fprintf(stderr,"\t-R  limit remote to sending  packets\n");
X    fprintf(stderr,"\t-X datafile of logged in users\n"); /* budd */
X+   fprintf(stderr,"\t-p to enable remote process code\n");
X    fprintf(stderr,"\nExample: %s -t 'bdelete irename' -a 'file fork dir' -s\n",
X  	  name);
X    exit(1);
X***************
X*** 204,210 ****
X    extern char *optarg;
X    extern int optind;
X    
X!   while ((c = getopt(argc,argv,"a:d:D:n:N:t:sV:U:G:P:c:l:z:S:R:X:")) != EOF) {
X      switch (c) {
X      case 'z':
X        strncpy(zonetorun, optarg, 32);
X--- 209,215 ----
X    extern char *optarg;
X    extern int optind;
X    
X!   while ((c = getopt(argc,argv,"a:d:D:n:N:t:sV:U:G:P:c:l:z:S:R:X:p")) != EOF) {
X      switch (c) {
X      case 'z':
X        strncpy(zonetorun, optarg, 32);
X***************
X*** 247,252 ****
X--- 252,260 ----
X      case 'P':
X        passwdlookaside = optarg;
X        break;
X+     case 'p':
X+       enableProcs = TRUE;
X+       break;
X      case 'G':
X        guestid = optarg;
X        break;
X***************
X*** 551,556 ****
X--- 559,565 ----
X  #endif
X  	signal(SIGHUP, dienow);	/* superior signaled us to shutdown */
X  	mypid = getpid();
X+ 	ProcInit();             /* Initialize process code */
X  #ifndef NOSHUTDOWNCODE
X  	setpgrp(0, parent_pid);	/* set our process group */
X  	dying();		/* are we dying? if so, handle it*/
X***************
X*** 558,564 ****
X        }
X        sigsetmask(mask);
X  #ifndef DEBUGFORK
X!     } else pid = 0;
X  #endif
X    } while (pid != 0);		/* pid = 0 implies inferior process */
X  
X--- 567,576 ----
X        }
X        sigsetmask(mask);
X  #ifndef DEBUGFORK
X!     } else {
X!       pid = 0;
X!       ProcInit();
X!     }
X  #endif
X    } while (pid != 0);		/* pid = 0 implies inferior process */
X  
X***************
X*** 588,593 ****
X--- 600,606 ----
X      SPGetRequest(cno,buf,mcs,&reqref,&type,&rlen,&comp);
X      while (comp > 0) { abSleep(sectotick(60),TRUE); }
X      if (comp == SessClosed || comp == ParamErr) {
X+       ProcCleanup();            /* Kill any processes owned by the session */
X        log("Session (%d) closed",cno);
X        clearuserlogin();			/* budd */
X        return;
X***************
X*** 824,832 ****
X    /* Try closing just in case */
X    SPCloseSession(cno, 3, 2, &comp); /* 3 times, .5 seconds */
X    while (comp > 0) { abSleep(30, TRUE); } /* close down if we can */
X    exit(0);
X  }
X- 
X  #ifndef NOSHUTDOWNCODE
X  
X  /*
X--- 837,846 ----
X    /* Try closing just in case */
X    SPCloseSession(cno, 3, 2, &comp); /* 3 times, .5 seconds */
X    while (comp > 0) { abSleep(30, TRUE); } /* close down if we can */
X+   /* Kill any active processes */
X+   ProcCleanup();
X    exit(0);
X  }
X  #ifndef NOSHUTDOWNCODE
X  
X  /*
END_OF_aufs.diffs
if test 28109 -ne `wc -c