svn commit: samba r17296 - in branches/SAMBA_3_0/source/smbd: .

jra at samba.org jra at samba.org
Fri Jul 28 23:16:53 GMT 2006


Author: jra
Date: 2006-07-28 23:16:52 +0000 (Fri, 28 Jul 2006)
New Revision: 17296

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=17296

Log:
Replace the understandable parts of the quota
code with become_root_uid_only()/unbecome_root_uid_only()
pairs. This code needs working on.....
Jeremy.

Modified:
   branches/SAMBA_3_0/source/smbd/quotas.c


Changeset:
Modified: branches/SAMBA_3_0/source/smbd/quotas.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/quotas.c	2006-07-28 23:09:12 UTC (rev 17295)
+++ branches/SAMBA_3_0/source/smbd/quotas.c	2006-07-28 23:16:52 UTC (rev 17296)
@@ -238,8 +238,7 @@
 	if (!found)
 		return(False);
 
-	save_re_uid();
-	set_effective_uid(0);  
+	become_root_uid_only();
 
 	if (strcmp(mnt->mnt_type, "xfs")==0) {
 		r=get_smb_linux_xfs_quota(mnt->mnt_fsname, euser_id, egrp_id, &D);
@@ -252,7 +251,7 @@
 		}
 	}
 
-	restore_re_uid();
+	unbecome_root_uid_only();
 
 	/* Use softlimit to determine disk space, except when it has been exceeded */
 	*bsize = D.bsize;
@@ -654,21 +653,20 @@
 	if ( ! found )
 		return(False) ;
 
-	save_re_uid();
-	set_effective_uid(0);
+	become_root_uid_only();
 
 #if defined(SUNOS5)
 	if ( strcmp( mnt.mnt_fstype, "nfs" ) == 0) {
 		BOOL retval;
 		DEBUG(5,("disk_quotas: looking for mountpath (NFS) \"%s\"\n", mnt.mnt_special));
 		retval = nfs_quotas(mnt.mnt_special, euser_id, bsize, dfree, dsize);
-		restore_re_uid();
+		unbecome_root_uid_only();
 		return retval;
 	}
 
 	DEBUG(5,("disk_quotas: looking for quotas file \"%s\"\n", name));
 	if((file=sys_open(name, O_RDONLY,0))<0) {
-		restore_re_uid();
+		unbecome_root_uid_only();
 		return(False);
 	}
 	command.op = Q_GETQUOTA;
@@ -681,7 +679,7 @@
 	ret = quotactl(Q_GETQUOTA, name, euser_id, &D);
 #endif
 
-	restore_re_uid();
+	unbecome_root_uid_only();
 
 	if (ret < 0) {
 		DEBUG(5,("disk_quotas ioctl (Solaris) failed. Error = %s\n", strerror(errno) ));
@@ -841,8 +839,7 @@
   }
 
   euser_id=geteuid();
-  save_re_uid();
-  set_effective_uid(0);  
+  become_root_uid_only();
 
   /* Use softlimit to determine disk space, except when it has been exceeded */
 
@@ -852,7 +849,7 @@
   {
     r=quotactl (Q_GETQUOTA, mnt->mnt_fsname, euser_id, (caddr_t) &D);
 
-    restore_re_uid();
+    unbecome_root_uid_only();
 
     if (r==-1)
       return(False);
@@ -883,7 +880,7 @@
   {
     r=quotactl (Q_XGETQUOTA, mnt->mnt_fsname, euser_id, (caddr_t) &F);
 
-    restore_re_uid();
+    unbecome_root_uid_only();
 
     if (r==-1)
     {
@@ -917,7 +914,7 @@
   }
   else
   {
-	  restore_re_uid();
+	  unbecome_root_uid_only();
 	  return(False);
   }
 
@@ -1181,14 +1178,13 @@
         return False;
 #endif
     
-    save_re_uid();
-    set_effective_uid(0);
+    become_root_uid_only();
 
 #if defined(__FreeBSD__) || defined(__DragonFly__)
     if (strcmp(mnts[i].f_fstypename,"nfs") == 0) {
         BOOL retval;
         retval = nfs_quotas(mnts[i].f_mntfromname,euser_id,bsize,dfree,dsize);
-        restore_re_uid();
+        unbecome_root_uid_only();
         return retval;
     }
 #endif
@@ -1202,7 +1198,7 @@
 	    r= quotactl(path,QCMD(Q_GETQUOTA,GRPQUOTA),egrp_id,(char *) &D);
     }
 
-    restore_re_uid();
+    unbecome_root_uid_only();
   }
 #elif defined(AIX)
   /* AIX has both USER and GROUP quotas: 



More information about the samba-cvs mailing list