[comp.sys.ibm.pc.rt] Patch for quota related utilities

brunner@bullhead.uucp (07/22/89)

Subject: File System Quotas
Index: /etc/*quot*.c IBM/4.3

Description:
	There's a consistency problem with AOS 4.3BSD systems involving
	Melbourne file system quota utilities which check a file system's
	type. As distributed, quota utilities would exit if the mounted
	file system's type was not either "4.3" or "4.2", depending on
	the utility, and would always exit if the type was "ufs".
Fix:
	Apply the attached patchs.


*** edquota.c	Thu Jun  8 14:24:38 1989
--- edquota.c.new	Thu Jun  8 14:24:11 1989
***************
*** 877,883 ****
  
  	mtab = setmntent(MOUNTED, "r");
  	while (mntp = getmntent(mtab)) {
! 		if (strcmp(mntp->mnt_type, MNTTYPE_43) != 0)
  			continue;
  		if (stat(mntp->mnt_fsname, &statb) < 0)
  			continue;
--- 877,885 ----
  
  	mtab = setmntent(MOUNTED, "r");
  	while (mntp = getmntent(mtab)) {
! 		if ((   (strcmp(mntp->mnt_type, MNTTYPE_42) != 0) &&
! 			(strcmp(mntp->mnt_type, MNTTYPE_43) != 0) &&
! 			(strcmp(mntp->mnt_type, MNTTYPE_UFS) != 0)   ))
  			continue;
  		if (stat(mntp->mnt_fsname, &statb) < 0)
  			continue;
*** quot.c	Thu Jun  8 14:28:58 1989
--- quot.c.new	Wed Jun  7 16:39:14 1989
***************
*** 190,196 ****
  		exit(1);
  	}
  	while (mntp = getmntent(fstab)) {
! 		if (strcmp(mntp->mnt_type, MNTTYPE_43) != 0)
  			continue;
  		cp = rindex(mntp->mnt_fsname, '/');
  		if (cp == 0)
--- 190,198 ----
  		exit(1);
  	}
  	while (mntp = getmntent(fstab)) {
! 		if ((   (strcmp(mntp->mnt_type, MNTTYPE_42) != 0) &&
! 			(strcmp(mntp->mnt_type, MNTTYPE_43) != 0) &&
! 			(strcmp(mntp->mnt_type, MNTTYPE_UFS) != 0)   ))
  			continue;
  		cp = rindex(mntp->mnt_fsname, '/');
  		if (cp == 0)
***************
*** 544,550 ****
  	}
  	while (mntp = getmntent(fstab)) {
  		if (strcmp(mntp->mnt_dir, *devpp) == 0) {
! 			if (strcmp(mntp->mnt_type, MNTTYPE_43) != 0) {
  				fprintf(stderr,
  				    "%s: %s not 4.3 filesystem\n",
  				    progname, *devpp);
--- 546,554 ----
  	}
  	while (mntp = getmntent(fstab)) {
  		if (strcmp(mntp->mnt_dir, *devpp) == 0) {
! 			if ((   (strcmp(mntp->mnt_type, MNTTYPE_42) != 0) &&
! 				(strcmp(mntp->mnt_type, MNTTYPE_43) != 0) &&
! 				(strcmp(mntp->mnt_type, MNTTYPE_UFS) != 0) )) {
  				fprintf(stderr,
  				    "%s: %s not 4.3 filesystem\n",
  				    progname, *devpp);
*** quotacheck.c	Thu Jun  8 14:33:14 1989
--- quotacheck.c.new	Wed Jun  7 17:08:23 1989
***************
*** 599,605 ****
  			exit(8);
  		}
  		while (mntp = getmntent(fstab)) {
! 			if (strcmp(mntp->mnt_type, MNTTYPE_43) != 0 ||
  			    !hasmntopt(mntp, MNTOPT_QUOTA) ||
  			    hasmntopt(mntp, MNTOPT_RO))
  				continue;
--- 599,607 ----
  			exit(8);
  		}
  		while (mntp = getmntent(fstab)) {
! 			if (((strcmp(mntp->mnt_type, MNTTYPE_42) != 0) &&
! 				(strcmp(mntp->mnt_type, MNTTYPE_43) != 0) &&
! 				(strcmp(mntp->mnt_type, MNTTYPE_UFS) != 0)) ||
  			    !hasmntopt(mntp, MNTOPT_QUOTA) ||
  			    hasmntopt(mntp, MNTOPT_RO))
  				continue;
***************
*** 624,630 ****
  			exit(8);
  		}
  		while (mntp = getmntent(mtab)) {
! 			if (strcmp(mntp->mnt_type, MNTTYPE_43) == 0 &&
  			    !hasmntopt(mntp, MNTOPT_RO) &&
  			    (oneof(mntp->mnt_fsname, listp, listcnt) ||
  			     oneof(mntp->mnt_dir, listp, listcnt)) ) {
--- 626,634 ----
  			exit(8);
  		}
  		while (mntp = getmntent(mtab)) {
! 			if (((strcmp(mntp->mnt_type, MNTTYPE_42) != 0) &&
! 				(strcmp(mntp->mnt_type, MNTTYPE_43) != 0) &&
! 				(strcmp(mntp->mnt_type, MNTTYPE_UFS) != 0)) &&
  			    !hasmntopt(mntp, MNTOPT_RO) &&
  			    (oneof(mntp->mnt_fsname, listp, listcnt) ||
  			     oneof(mntp->mnt_dir, listp, listcnt)) ) {
***************
*** 673,679 ****
  			if (mntp->mnt_passno != passno)
  				continue;
  
! 			if (strcmp(mntp->mnt_type, MNTTYPE_43) != 0 ||
  			    hasmntopt(mntp, MNTOPT_RO) ||
  			    (!oneof(mntp->mnt_fsname, listp, listcnt) &&
  			     !oneof(mntp->mnt_dir, listp, listcnt)))
--- 677,685 ----
  			if (mntp->mnt_passno != passno)
  				continue;
  
! 			if (((strcmp(mntp->mnt_type, MNTTYPE_42) != 0) &&
! 				(strcmp(mntp->mnt_type, MNTTYPE_43) != 0) &&
! 				(strcmp(mntp->mnt_type, MNTTYPE_UFS) != 0)) ||
  			    hasmntopt(mntp, MNTOPT_RO) ||
  			    (!oneof(mntp->mnt_fsname, listp, listcnt) &&
  			     !oneof(mntp->mnt_dir, listp, listcnt)))
*** quotaon.c	Thu Jun  8 14:40:53 1989
--- quotaon.c.new	Thu Jun  8 14:40:14 1989
***************
*** 298,304 ****
  		listcnt = 0;
  		fstab = setmntent(MNTTAB, "r");
  		while (mntp = getmntent(fstab)) {
! 			if (strcmp(mntp->mnt_type, MNTTYPE_43) != 0 ||
  			    !hasmntopt(mntp, MNTOPT_QUOTA) ||
  			    hasmntopt(mntp, MNTOPT_RO))
  				continue;
--- 298,306 ----
  		listcnt = 0;
  		fstab = setmntent(MNTTAB, "r");
  		while (mntp = getmntent(fstab)) {
! 			if ((   (strcmp(mntp->mnt_type, MNTTYPE_42) != 0) &&
! 				(strcmp(mntp->mnt_type, MNTTYPE_43) != 0) &&
! 				(strcmp(mntp->mnt_type, MNTTYPE_UFS) != 0)) ||
  			    !hasmntopt(mntp, MNTOPT_QUOTA) ||
  			    hasmntopt(mntp, MNTOPT_RO))
  				continue;
***************
*** 340,346 ****
  	 * record before writing it.
  	 */
  	while ((mntp = getmntent(mtab)) != NULL) {
! 		if (strcmp(mntp->mnt_type, MNTTYPE_43) == 0 &&
  		    !hasmntopt(mntp, MNTOPT_RO) &&
  		    (oneof(mntp->mnt_fsname, listp, listcnt) ||
  		     oneof(mntp->mnt_dir, listp, listcnt)) ) {
--- 342,350 ----
  	 * record before writing it.
  	 */
  	while ((mntp = getmntent(mtab)) != NULL) {
! 		if ((   (strcmp(mntp->mnt_type, MNTTYPE_42) != 0) &&
! 			(strcmp(mntp->mnt_type, MNTTYPE_43) != 0) &&
! 			(strcmp(mntp->mnt_type, MNTTYPE_UFS) != 0)) ||
  		    !hasmntopt(mntp, MNTOPT_RO) &&
  		    (oneof(mntp->mnt_fsname, listp, listcnt) ||
  		     oneof(mntp->mnt_dir, listp, listcnt)) ) {
*** repquota.c	Thu Jun  8 14:46:01 1989
--- repquota.c.new	Thu Jun  8 14:45:43 1989
***************
*** 351,357 ****
  			exit(8);
  		}
  		while (mntp = getmntent(fstab)) {
! 			if (strcmp(mntp->mnt_type, MNTTYPE_42) != 0 ||
  			    !hasmntopt(mntp, MNTOPT_QUOTA) ||
  			    hasmntopt(mntp, MNTOPT_RO))
  				continue;
--- 351,359 ----
  			exit(8);
  		}
  		while (mntp = getmntent(fstab)) {
! 			if ((   (strcmp(mntp->mnt_type, MNTTYPE_42) != 0) &&
! 				(strcmp(mntp->mnt_type, MNTTYPE_43) != 0) &&
! 				(strcmp(mntp->mnt_type, MNTTYPE_UFS) != 0)) ||
  			    !hasmntopt(mntp, MNTOPT_QUOTA) ||
  			    hasmntopt(mntp, MNTOPT_RO))
  				continue;
***************
*** 373,379 ****
  		exit(8);
  	}
  	while (mntp = getmntent(mtab)) {
! 		if (strcmp(mntp->mnt_type, MNTTYPE_42) == 0 &&
  		    !hasmntopt(mntp, MNTOPT_RO) &&
  		    (oneof(mntp->mnt_fsname, listp, listcnt) ||
  		     oneof(mntp->mnt_dir, listp, listcnt)) ) {
--- 375,383 ----
  		exit(8);
  	}
  	while (mntp = getmntent(mtab)) {
! 		if ((   (strcmp(mntp->mnt_type, MNTTYPE_42) != 0) &&
! 			(strcmp(mntp->mnt_type, MNTTYPE_43) != 0) &&
! 			(strcmp(mntp->mnt_type, MNTTYPE_UFS) != 0)) ||
  		    !hasmntopt(mntp, MNTOPT_RO) &&
  		    (oneof(mntp->mnt_fsname, listp, listcnt) ||
  		     oneof(mntp->mnt_dir, listp, listcnt)) ) {

Eric Brunner
uunet!ibmsupt!brunner