cck@CUNIXC.COLUMBIA.EDU (Charlie C. Kim) (11/12/87)
CAP Pre-Release Distribution 4.00 with Patches 5,6,7 Bug Report: 0013 Date: 11/11/87 Problem: AUFS: Try installing the 4.3 chgrp program (or running under 4.3) and you'll find that "Change Priviledges" doesn't work right - you always get access priviledge violations Reported by: Rob Cartolano, User Services, Columbia University Priority: Medium Diagnosis: In afpos, unix_chown was returning an access priviledge whenever chgrp failed. Under Ultrix 2.0, it didn't seem to fail if the file didn't exist, but the 4.3 chgrp does... This is the improper thing to do when the file did not exist. Solution: Make unix_chown do a stat on the file first - this also saves the overhead of forking off chgrp if the file doesn't exist or if the group id is already correct... Do this by applying the following patch. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% *** /tmp/,RCSt1003051 Wed Nov 11 20:34:34 1987 --- afpos.c Wed Nov 11 20:30:48 1987 *************** *** 2219,2224 char gid[20]; /* big enough */ int pid, npid; int status; if (DBOSI) printf("unix_chown: Attempting chown %s to owner %d, group %d\n", path,own,grp); --- 2219,2229 ----- char gid[20]; /* big enough */ int pid, npid; int status; + #ifndef USECHOWN + struct stat stb; + OSErr err; + #endif + if (DBOSI) printf("unix_chown: Attempting chown %s to owner %d, group %d\n", path,own,grp); *************** *** 2226,2231 if (usruid != 0) { /* not root, then do it hard way */ if (DBOSI) printf("unix_chown: skipping owern, chgrp %s to group %d\n",path,grp); sprintf(gid, "%d",grp); if ((pid=vfork()) == 0) { execl("/bin/chgrp","chgrp",gid,path, 0); --- 2231,2240 ----- if (usruid != 0) { /* not root, then do it hard way */ if (DBOSI) printf("unix_chown: skipping owern, chgrp %s to group %d\n",path,grp); + if ((err = unix_stat(path, &stb)) != noErr) + return(err); + if (stb.st_gid == grp) /* naught to do */ + return(noErr); sprintf(gid, "%d",grp); if ((pid=vfork()) == 0) { execl("/bin/chgrp","chgrp",gid,path, 0); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%