Patch #: 73 Type: operational change Priority: none Modification: improved AUFS group membership handling revisited Submitted: David Hornsby Archived: munnari.OZ.AU mac/cap.patches/cap60.patch073 Application: 'cd cap60; patch -p < cap60.patches/cap60.patch073' File: cap60/applications/aufs/afpos.c *** applications/aufs/afpos.c.orig Sun Nov 17 19:14:53 1991 --- applications/aufs/afpos.c Mon Nov 18 21:33:05 1991 *************** *** 1,7 **** /* ! * $Author: djh $ $Date: 1991/11/17 08:14:34 $ ! * $Header: /mac/src/cap60/applications/aufs/RCS/afpos.c,v 2.15 1991/11/17 08:14:34 djh Rel djh $ ! * $Revision: 2.15 $ */ /* --- 1,7 ---- /* ! * $Author: djh $ $Date: 1991/11/18 10:32:54 $ ! * $Header: /mac/src/cap60/applications/aufs/RCS/afpos.c,v 2.16 1991/11/18 10:32:54 djh Rel djh $ ! * $Revision: 2.16 $ */ /* *************** *** 1698,1705 **** /* * OSSetDirParms * ! * ! */ OSErr OSSetDirParms(ipdir,fn,fdp) IDirP ipdir; --- 1698,1705 ---- /* * OSSetDirParms * ! */ ! OSErr OSSetDirParms(ipdir,fn,fdp) IDirP ipdir; *************** *** 1709,1717 **** u_short EtoIAccess(); char p_ath[MAXPATHLEN]; char path[MAXPATHLEN]; ! int own,grp,err; /* owner and group ids */ DirParm *dp = &fdp->fdp_parms.dp_parms; - int flags; #ifdef NETWORKTRASH struct stat buf; #endif NETWORKTRASH --- 1709,1717 ---- u_short EtoIAccess(); char p_ath[MAXPATHLEN]; char path[MAXPATHLEN]; ! int flags, err; ! int own, grp; /* owner and group ids */ DirParm *dp = &fdp->fdp_parms.dp_parms; #ifdef NETWORKTRASH struct stat buf; #endif NETWORKTRASH *************** *** 1728,1755 **** flags = ipdir->flags; /* should use to prevent overworking */ if (own != -1 || grp != -1) { /* error recovery? do all just in case */ ! OSfname(p_ath,ipdir,fn,F_DATA); /* change unix name */ ! #ifdef NOCASEMATCH if ((err = unix_chown(p_ath,own,grp)) != noErr) { noCaseFind(p_ath); if ((err = unix_chown(p_ath,own,grp)) != noErr) return(err); } ! #else NOCASEMATCH ! if ((err = unix_chown(p_ath,own,grp)) != noErr) ! return(err); ! #endif NOCASEMATCH strcpy(path,p_ath); strcat(path,RFDIR); if ((err = unix_chown(path,own,grp)) != noErr && err != aeObjectNotFound) return(err); strcpy(path,p_ath); strcat(path,FIDIR); if ((err = unix_chown(path,own,grp)) != noErr && err != aeObjectNotFound) return(err); EModified(ipdir); } if (fdp->fdp_dbitmap & DP_ACCES) { ! u_short acc, accd; acc = accd = EtoIAccess(dp->dp_accright); #ifdef NETWORKTRASH /* make the Network Trash Folder the same */ --- 1728,1776 ---- flags = ipdir->flags; /* should use to prevent overworking */ if (own != -1 || grp != -1) { /* error recovery? do all just in case */ ! OSfname(p_ath,ipdir,fn,F_DATA); ! /* change owner/group for fn */ if ((err = unix_chown(p_ath,own,grp)) != noErr) { + #ifdef NOCASEMATCH noCaseFind(p_ath); if ((err = unix_chown(p_ath,own,grp)) != noErr) + #endif NOCASEMATCH return(err); } ! /* change owner/group for fn/.resource */ strcpy(path,p_ath); strcat(path,RFDIR); if ((err = unix_chown(path,own,grp)) != noErr && err != aeObjectNotFound) return(err); + + /* change owner/group for fn/.finderinfo */ strcpy(path,p_ath); strcat(path,FIDIR); if ((err = unix_chown(path,own,grp)) != noErr && err != aeObjectNotFound) return(err); + + /* change owner/group for ../.resource/fn */ + OSfname(path,ipdir,fn,F_RSRC); + if ((err = unix_chown(path,own,grp)) != noErr && err != aeObjectNotFound) { + #ifdef NOCASEMATCH + noCaseFind(path); + if ((err = unix_chown(path,own,grp)) != noErr && err != aeObjectNotFound) + #endif NOCASEMATCH + return(err); + } + + /* change owner/group for ../.finderinfo/fn */ + OSfname(path,ipdir,fn,F_FNDR); + if ((err = unix_chown(path,own,grp)) != noErr && err != aeObjectNotFound) { + #ifdef NOCASEMATCH + noCaseFind(path); + if ((err = unix_chown(path,own,grp)) != noErr && err != aeObjectNotFound) + #endif NOCASEMATCH + return(err); + } EModified(ipdir); } if (fdp->fdp_dbitmap & DP_ACCES) { ! u_short acc, accd; /* file, directory mode */ acc = accd = EtoIAccess(dp->dp_accright); #ifdef NETWORKTRASH /* make the Network Trash Folder the same */ *************** *** 1771,1797 **** accd |= I_SETGID; #endif USEDIRSETGID if ((err = os_chmod(ipdir,fn,accd,F_DATA)) != noErr) return(err); ! /* change all file protections, owner & group */ os_change_all(ipdir, fn, acc, own, grp, F_DATA); os_change_all(ipdir, fn, acc, own, grp, F_RSRC); os_change_all(ipdir, fn, acc, own, grp, F_FNDR); OSfname(p_ath,ipdir,fn,F_DATA); ! /* change our .resource DIRECTORY */ strcpy(path,p_ath); strcat(path,RFDIR); ! unix_chmod(path,accd); ! /* change our .finderinfo DIRECTORY */ strcpy(path,p_ath); strcat(path,FIDIR); ! unix_chmod(path,accd); ! /* change our .resource FILE */ if ((err = os_chmod(ipdir,fn,acc,F_RSRC)) != noErr && err != aeObjectNotFound) return(err); ! /* change our .finderinfo FILE */ if ((err = os_chmod(ipdir,fn,acc,F_FNDR)) != noErr && err != aeObjectNotFound) return(err); --- 1792,1833 ---- accd |= I_SETGID; #endif USEDIRSETGID + /* change mode for fn */ if ((err = os_chmod(ipdir,fn,accd,F_DATA)) != noErr) return(err); ! /* change all file protections, owner & group in fn */ os_change_all(ipdir, fn, acc, own, grp, F_DATA); os_change_all(ipdir, fn, acc, own, grp, F_RSRC); os_change_all(ipdir, fn, acc, own, grp, F_FNDR); OSfname(p_ath,ipdir,fn,F_DATA); ! /* change mode for fn/.resource */ strcpy(path,p_ath); strcat(path,RFDIR); ! if (( err = unix_chmod(path,accd)) != noErr && err != aeObjectNotFound) { ! #ifdef NOCASEMATCH ! noCaseFind(path); ! if (( err = unix_chmod(path,accd)) != noErr && err != aeObjectNotFound) ! #endif NOCASEMATCH ! return(err); ! } ! ! /* change mode for fn/.finderinfo */ strcpy(path,p_ath); strcat(path,FIDIR); ! if (( err = unix_chmod(path,accd)) != noErr && err != aeObjectNotFound) { ! #ifdef NOCASEMATCH ! noCaseFind(path); ! if (( err = unix_chmod(path,accd)) != noErr && err != aeObjectNotFound) ! #endif NOCASEMATCH ! return(err); ! } ! /* change mode for ../.resource/fn */ if ((err = os_chmod(ipdir,fn,acc,F_RSRC)) != noErr && err != aeObjectNotFound) return(err); ! ! /* change mode for ../.finderinfo/fn */ if ((err = os_chmod(ipdir,fn,acc,F_FNDR)) != noErr && err != aeObjectNotFound) return(err); *************** *** 1881,1886 **** --- 1917,1923 ---- int own, grp, typ; { char path[MAXPATHLEN]; + char p_ath[MAXPATHLEN]; struct stat stb; #ifdef USEDIRENT struct dirent *dp, *readdir(); *************** *** 1903,1909 **** break; } if (DBOSI) ! printf("os_chmod: setting %o for %s\n",mode,path); dirp = opendir(path); if (dirp == NULL) { --- 1940,1946 ---- break; } if (DBOSI) ! printf("os_change_all: setting %o for %s\n",mode,path); dirp = opendir(path); if (dirp == NULL) { *************** *** 1912,1918 **** if((dirp = opendir(path)) == NULL) { #endif NOCASEMATCH if (DBOSI) ! printf("os_chmod: opendir failed on %s\n",path); return; #ifdef NOCASEMATCH } --- 1949,1955 ---- if((dirp = opendir(path)) == NULL) { #endif NOCASEMATCH if (DBOSI) ! printf("os_change_all: opendir failed on %s\n",path); return; #ifdef NOCASEMATCH } *************** *** 1925,1935 **** strcpy(path+pl,dp->d_name); /* create file name */ if (stat(path,&stb) != 0) { /* get the file status */ if (DBOSI) ! printf("os_chmod: stat failed for %s\n",path); continue; /* some error... */ } if (S_ISDIR(stb.st_mode)) continue; /* ignore errors */ unix_chmod(path,mode); /* set the mode for this file */ unix_chown(path,own,grp); /* set owner and group for file */ --- 1962,1980 ---- strcpy(path+pl,dp->d_name); /* create file name */ if (stat(path,&stb) != 0) { /* get the file status */ if (DBOSI) ! printf("os_change_all: stat failed for %s\n",path); continue; /* some error... */ } if (S_ISDIR(stb.st_mode)) continue; + if (typ == F_FNDR) { + OSfname(p_ath,idir,fn,F_DATA); + strcat(p_ath,"/"); strcat(p_ath,dp->d_name); + if (stat(p_ath,&stb) == 0) { + if (S_ISDIR(stb.st_mode)) + continue; + } + } /* ignore errors */ unix_chmod(path,mode); /* set the mode for this file */ unix_chown(path,own,grp); /* set owner and group for file */ *** README.orig Mon Nov 18 21:33:42 1991 --- README Mon Nov 18 21:34:16 1991 *************** *** 3,9 **** (For use with AppleTalk/Ethernet bridge) o RELEASE NOTES ! o CAP Distribution 6.0, Patch Level 72, November 1991 Introduction ------------ --- 3,9 ---- (For use with AppleTalk/Ethernet bridge) o RELEASE NOTES ! o CAP Distribution 6.0, Patch Level 73, November 1991 Introduction ------------