Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Nov 2003 10:21:34 -0800 (PST)
From:      Andrew Reisse <areisse@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 43060 for review
Message-ID:  <200311261821.hAQILYMn022970@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
+}



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