PERFORCE change 43060 for review

Andrew Reisse areisse at FreeBSD.org
Wed Nov 26 18:21:34 GMT 2003


http://perforce.freebsd.org/chv.cgi?CH=43060

Change 43060 by areisse at 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);
+}
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message



More information about the trustedbsd-cvs mailing list