From owner-p4-projects@FreeBSD.ORG Wed Nov 26 10:21:35 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 96C3516A4D0; Wed, 26 Nov 2003 10:21:35 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5777E16A4CE for ; Wed, 26 Nov 2003 10:21:35 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 86E2D43F93 for ; Wed, 26 Nov 2003 10:21:34 -0800 (PST) (envelope-from areisse@nailabs.com) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.9/8.12.9) with ESMTP id hAQILYXJ022973 for ; Wed, 26 Nov 2003 10:21:34 -0800 (PST) (envelope-from areisse@nailabs.com) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.9/8.12.9/Submit) id hAQILYMn022970 for perforce@freebsd.org; Wed, 26 Nov 2003 10:21:34 -0800 (PST) (envelope-from areisse@nailabs.com) Date: Wed, 26 Nov 2003 10:21:34 -0800 (PST) Message-Id: <200311261821.hAQILYMn022970@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to areisse@nailabs.com using -f From: Andrew Reisse To: Perforce Change Reviews Subject: PERFORCE change 43060 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2003 18:21:36 -0000 http://perforce.freebsd.org/chv.cgi?CH=43060 Change 43060 by areisse@areisse_ibook on 2003/11/26 10:21:15 libsebsd wrapper for get_file_sids Affected files ... .. //depot/projects/trustedbsd/sedarwin/libsebsd/sebsd.h#4 edit .. //depot/projects/trustedbsd/sedarwin/libsebsd/security_get_user_contexts.c#3 edit Differences ... ==== //depot/projects/trustedbsd/sedarwin/libsebsd/sebsd.h#4 (text+ko) ==== @@ -76,6 +76,7 @@ extern int security_compute_av(struct security_query *query, struct security_response *response); +extern int security_get_file_contexts(const char *fromcontext, char ***retcontexts, size_t *ncontexts); /* ==== //depot/projects/trustedbsd/sedarwin/libsebsd/security_get_user_contexts.c#3 (text+ko) ==== @@ -56,8 +56,8 @@ * allowed SEBSD transitions to be made by a given user in a given * context. */ -int -security_get_user_contexts(const char *fromcontext, const char *username, +static int +security_get_some_contexts(int what, const char *fromcontext, const char *username, char ***retcontexts, size_t *ncontexts) { char *contexts, *s, **contextarray; @@ -70,7 +70,7 @@ uap.ctx = fromcontext; uap.usr = username; uap.out = NULL; - if (mac_syscall ("sebsd", 6, &uap)) + if (mac_syscall ("sebsd", what, &uap)) { return (-1); } @@ -79,7 +79,7 @@ return (-1); } uap.out = contexts; - error = mac_syscall ("sebsd", 6, &uap); + error = mac_syscall ("sebsd", what, &uap); /* * We could possibly race and not have a large enough space * for the current set of contexts. @@ -123,3 +123,16 @@ *retcontexts = contextarray; return (0); } + +int +security_get_user_contexts(const char *fromcontext, const char *username, + char ***retcontexts, size_t *ncontexts) +{ + return security_get_some_contexts (6, fromcontext, username, retcontexts, ncontexts); +} + +int +security_get_file_contexts(const char *fromcontext, char ***retcontexts, size_t *ncontexts) +{ + return security_get_some_contexts (5, fromcontext, "unused", retcontexts, ncontexts); +}