Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 Jul 2005 11:00:29 GMT
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 79529 for review
Message-ID:  <200507041100.j64B0Tsu091267@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=79529

Change 79529 by rwatson@rwatson_paprika on 2005/07/04 11:00:13

	Convert some new suser() calls into cap_check() calls.
	
	In the fork() case, we might want CAP_SYS_RESOURCE instead.

Affected files ...

.. //depot/projects/trustedbsd/sebsd/sys/kern/kern_fork.c#12 edit
.. //depot/projects/trustedbsd/sebsd/sys/kern/kern_prot.c#13 edit

Differences ...

==== //depot/projects/trustedbsd/sebsd/sys/kern/kern_fork.c#12 (text+ko) ====

@@ -286,7 +286,7 @@
 	sx_xlock(&allproc_lock);
 	uid = td->td_ucred->cr_ruid;
 	if ((nprocs >= maxproc - 10 &&
-	    suser_cred(td->td_ucred, SUSER_RUID) != 0) ||
+	    cap_check_cred(td->td_ucred, CAP_SYS_ADMIN, SUSER_RUID) != 0) ||
 	    nprocs >= maxproc) {
 		error = EAGAIN;
 		goto fail;

==== //depot/projects/trustedbsd/sebsd/sys/kern/kern_prot.c#13 (text+ko) ====

@@ -548,7 +548,8 @@
 #ifdef POSIX_APPENDIX_B_4_2_2	/* Use the clause from B.4.2.2 */
 	    uid == oldcred->cr_uid ||
 #endif
-	    suser_cred(oldcred, SUSER_ALLOWJAIL) == 0) /* we are using privs */
+	    /* we are using privs */
+	    cap_check_cred(oldcred, CAP_SETUID, SUSER_ALLOWJAIL) == 0)
 #endif
 	{
 		/*
@@ -709,7 +710,8 @@
 #ifdef POSIX_APPENDIX_B_4_2_2	/* use the clause from B.4.2.2 */
 	    gid == oldcred->cr_groups[0] ||
 #endif
-	    suser_cred(oldcred, SUSER_ALLOWJAIL) == 0) /* we are using privs */
+	    /* we are using privs */
+	    cap_check_cred(oldcred, CAP_SETGID, SUSER_ALLOWJAIL) == 0)
 #endif
 	{
 		/*
@@ -1454,7 +1456,8 @@
 				break;
 		}
 		if (!match) {
-			if (suser_cred(u1, SUSER_ALLOWJAIL) != 0)
+			if (cap_check_cred(u1, CAP_SYS_ADMIN,
+			    SUSER_ALLOWJAIL) != 0)
 				return (ESRCH);
 		}
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200507041100.j64B0Tsu091267>