patch-2.1.116 linux/kernel/sys.c

Next file: linux/mm/filemap.c
Previous file: linux/kernel/ksyms.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.115/linux/kernel/sys.c linux/kernel/sys.c
@@ -405,10 +405,9 @@
 		 * cheaply with the new uid cache, so if it matters
 		 * we should be checking for it.  -DaveM
 		 */
-		charge_uid(current, -1);
+		free_uid(current);
 		current->uid = new_ruid;
-		if(new_ruid)
-			charge_uid(current, 1);
+		alloc_uid(current);
 	}
 	
 	if (!issecure(SECURE_NO_SETUID_FIXUP)) {
@@ -450,10 +449,9 @@
 
        if (new_ruid != old_ruid) {
 		/* See comment above about NPROC rlimit issues... */
-		charge_uid(current, -1);
+		free_uid(current);
 		current->uid = new_ruid;
-		if(new_ruid)
-			charge_uid(current, 1);
+		alloc_uid(current);
 	}
 
 	if (!issecure(SECURE_NO_SETUID_FIXUP)) {
@@ -473,7 +471,8 @@
 	int old_ruid = current->uid;
 	int old_euid = current->euid;
 	int old_suid = current->suid;
-       if (!capable(CAP_SETUID)) {
+
+	if (!capable(CAP_SETUID)) {
 		if ((ruid != (uid_t) -1) && (ruid != current->uid) &&
 		    (ruid != current->euid) && (ruid != current->suid))
 			return -EPERM;
@@ -486,10 +485,9 @@
 	}
 	if (ruid != (uid_t) -1) {
 		/* See above commentary about NPROC rlimit issues here. */
-		charge_uid(current, -1);
+		free_uid(current);
 		current->uid = ruid;
-		if(ruid)
-			charge_uid(current, 1);
+		alloc_uid(current);
 	}
 	if (euid != (uid_t) -1) {
 		if (euid != current->euid)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov