Subject: Re: no listeners loaded [was: Re: CVS commit: src/sys/kern]
To: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
From: Elad Efrat <elad@NetBSD.org>
List: tech-kern
Date: 09/14/2006 20:20:05
This is a multi-part message in MIME format.

--Boundary_(ID_SFi3p4/TY0aex4T1E+L5hQ)
Content-type: text/plain; charset=ISO-8859-1
Content-transfer-encoding: 7BIT

2nd diff attached.

-e.

-- 
Elad Efrat

--Boundary_(ID_SFi3p4/TY0aex4T1E+L5hQ)
Content-type: text/plain; name=kern_auth.c.diff
Content-transfer-encoding: 7BIT
Content-disposition: inline; filename=kern_auth.c.diff

Index: kern_auth.c
===================================================================
RCS file: /usr/cvs/src/sys/kern/kern_auth.c,v
retrieving revision 1.21
diff -u -p -r1.21 kern_auth.c
--- kern_auth.c	14 Sep 2006 11:37:07 -0000	1.21
+++ kern_auth.c	13 Sep 2006 16:53:50 -0000
@@ -104,6 +104,8 @@ static kauth_scope_t kauth_builtin_scope
 static kauth_scope_t kauth_builtin_scope_network;
 static kauth_scope_t kauth_builtin_scope_machdep;
 
+static boolean_t listeners_have_been_loaded = FALSE;
+
 /* Allocate new, empty kauth credentials. */
 kauth_cred_t
 kauth_cred_alloc(void)
@@ -667,6 +669,8 @@ kauth_listen_scope(const char *id, kauth
 	scope->nlisteners++;
 	listener->scope = scope;
 
+	listeners_have_been_loaded = TRUE;
+
 	return (listener);
 }
 
@@ -717,9 +721,11 @@ kauth_authorize_action(kauth_scope_t sco
 	if (cred == NOCRED || cred == FSCRED)
 		return (0);
 
-	/* Short-circuit requests when there are no listeners. */
-	if (SIMPLEQ_EMPTY(&scope->listenq))
+	if (!listeners_have_been_loaded) {
+		KASSERT(SIMPLEQ_EMPTY(&scope->listenq));
+
 		return (0);
+	}
 
 	fail = 0;
 	allow = 0;

--Boundary_(ID_SFi3p4/TY0aex4T1E+L5hQ)--