Pretending to be Elad's keyboard:
Attached diff let's call kauth_register_scope() with a NULL default listener. from tn2127: "callback is the address of the listener callback function for this scope; this becomes the scope's default listener. This parameter may be NULL, in which case a callback that always returns KAUTH_RESULT_DEFER is assumed."
This commit is contained in:
parent
8ef6dfdf8c
commit
c07e49883f
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: kern_auth.c,v 1.15 2006/07/26 17:13:26 elad Exp $ */
|
||||
/* $NetBSD: kern_auth.c,v 1.16 2006/08/16 17:57:26 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2005, 2006 Elad Efrat <elad@NetBSD.org>
|
||||
|
@ -531,13 +531,13 @@ kauth_ifindscope(const char *id)
|
|||
*/
|
||||
kauth_scope_t
|
||||
kauth_register_scope(const char *id, kauth_scope_callback_t callback,
|
||||
void *cookie)
|
||||
void *cookie)
|
||||
{
|
||||
kauth_scope_t scope;
|
||||
kauth_listener_t listener;
|
||||
|
||||
/* Sanitize input */
|
||||
if (id == NULL || callback == NULL)
|
||||
if (id == NULL)
|
||||
return (NULL);
|
||||
|
||||
/* Allocate space for a new scope and listener. */
|
||||
|
@ -562,18 +562,18 @@ kauth_register_scope(const char *id, kauth_scope_callback_t callback,
|
|||
scope->cookie = cookie;
|
||||
scope->nlisteners = 1;
|
||||
|
||||
/* Add default listener */
|
||||
listener->func = callback;
|
||||
listener->scope = scope;
|
||||
listener->refcnt = 0;
|
||||
SIMPLEQ_INIT(&scope->listenq);
|
||||
SIMPLEQ_INSERT_HEAD(&scope->listenq, listener, listener_next);
|
||||
|
||||
/* Add default listener */
|
||||
if (callback != NULL) {
|
||||
listener->func = callback;
|
||||
listener->scope = scope;
|
||||
listener->refcnt = 0;
|
||||
SIMPLEQ_INSERT_HEAD(&scope->listenq, listener, listener_next);
|
||||
}
|
||||
|
||||
/* Insert scope to scopes list */
|
||||
if (SIMPLEQ_EMPTY(&scope_list))
|
||||
SIMPLEQ_INSERT_HEAD(&scope_list, scope, next_scope);
|
||||
else
|
||||
SIMPLEQ_INSERT_TAIL(&scope_list, scope, next_scope);
|
||||
SIMPLEQ_INSERT_TAIL(&scope_list, scope, next_scope);
|
||||
|
||||
simple_unlock(&scopes_lock);
|
||||
|
||||
|
@ -589,6 +589,7 @@ kauth_register_scope(const char *id, kauth_scope_callback_t callback,
|
|||
void
|
||||
kauth_init(void)
|
||||
{
|
||||
SIMPLEQ_INIT(&scope_list);
|
||||
simple_lock_init(&scopes_lock);
|
||||
|
||||
/* Register generic scope. */
|
||||
|
|
Loading…
Reference in New Issue