PERFORCE change 155372 for review

Robert Watson rwatson at FreeBSD.org
Sun Dec 28 07:06:51 PST 2008


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

Change 155372 by rwatson at rwatson_cinnamon on 2008/12/28 15:06:27

	Add new routines to convert between local and BSM constants for
	socket types and protocol families in extended socket tokens. 
	
	Make the existing errno mapping routines more consistent with the
	new ones.
	
	Update test socket_ex tokens to use conversion routines.

Affected files ...

.. //depot/projects/trustedbsd/openbsm/NEWS#24 edit
.. //depot/projects/trustedbsd/openbsm/bsm/libbsm.h#41 edit
.. //depot/projects/trustedbsd/openbsm/configure#49 edit
.. //depot/projects/trustedbsd/openbsm/libbsm/Makefile.am#8 edit
.. //depot/projects/trustedbsd/openbsm/libbsm/Makefile.in#13 edit
.. //depot/projects/trustedbsd/openbsm/libbsm/au_domain.3#1 add
.. //depot/projects/trustedbsd/openbsm/libbsm/au_socket_type.3#1 add
.. //depot/projects/trustedbsd/openbsm/libbsm/au_token.3#17 edit
.. //depot/projects/trustedbsd/openbsm/libbsm/bsm_domain.c#1 add
.. //depot/projects/trustedbsd/openbsm/libbsm/bsm_errno.c#14 edit
.. //depot/projects/trustedbsd/openbsm/libbsm/bsm_io.c#60 edit
.. //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#86 edit
.. //depot/projects/trustedbsd/openbsm/libbsm/libbsm.3#15 edit
.. //depot/projects/trustedbsd/openbsm/sys/bsm/Makefile.am#3 edit
.. //depot/projects/trustedbsd/openbsm/sys/bsm/Makefile.in#5 edit
.. //depot/projects/trustedbsd/openbsm/sys/bsm/audit_record.h#9 edit
.. //depot/projects/trustedbsd/openbsm/sys/bsm/audit_socket_type.h#1 add
.. //depot/projects/trustedbsd/openbsm/test/bsm/generate.c#13 edit

Differences ...

==== //depot/projects/trustedbsd/openbsm/NEWS#24 (text+ko) ====

@@ -4,6 +4,14 @@
 
 - Stub libauditd(3) man page added.
 - All BSM error number constants with BSM_ERRNO_.
+- Interfaces to convert between local and BSM socket types and protocol
+  families have been added: au_bsm_to_domain(3), au_bsm_to_socket_type(3),
+  au_domain_to_bsm(3), and au_socket_type_to_bsm(3), along with definitions
+  of constants in audit_domain.h and audit_socket_type.h.  This improves
+  interoperability by converting local constant spaces, which vary by OS, to
+  and from Solaris constants (where available) or OpenBSM constants for
+  protocol domains not present in Solaris (a fair number).  These routines
+  should be used when generating and interpreting extended socket tokens.
 
 OpenBSM 1.1 alpha 4
 
@@ -398,4 +406,4 @@
   to support reloading of kernel event table.
 - Allow comments in /etc/security configuration files.
 
-$P4: //depot/projects/trustedbsd/openbsm/NEWS#23 $
+$P4: //depot/projects/trustedbsd/openbsm/NEWS#24 $

==== //depot/projects/trustedbsd/openbsm/bsm/libbsm.h#41 (text+ko) ====

@@ -26,7 +26,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- * $P4: //depot/projects/trustedbsd/openbsm/bsm/libbsm.h#40 $
+ * $P4: //depot/projects/trustedbsd/openbsm/bsm/libbsm.h#41 $
  */
 
 #ifndef _LIBBSM_H_
@@ -821,14 +821,22 @@
  */
 void			 au_print_xml_header(FILE *outfp);
 void			 au_print_xml_footer(FILE *outfp);
-__END_DECLS
 
 /*
- * Functions relating to BSM<->errno conversion.
+ * BSM library routines for converting between local and BSM constant spaces.
+ * (Note: some of these are replicated in audit_record.h for the benefit of
+ * the FreeBSD and Mac OS X kernels)
  */
-int			 au_bsm_to_errno(u_char bsm_error, int *errorp);
-u_char			 au_errno_to_bsm(int error);
-const char		*au_strerror(u_char bsm_error);
+int	 au_bsm_to_domain(u_short bsm_domain, int *local_domainp);
+int	 au_bsm_to_errno(u_char bsm_error, int *errorp);
+int	 au_bsm_to_socket_type(u_short bsm_socket_type,
+	    int *local_socket_typep);
+u_short	 au_domain_to_bsm(int local_domain);
+u_char	 au_errno_to_bsm(int local_errno);
+u_short	 au_socket_type_to_bsm(int local_socket_type);
+
+const char	 *au_strerror(u_char bsm_error);
+__END_DECLS
 
 /*
  * The remaining APIs are associated with Apple's BSM implementation, in

==== //depot/projects/trustedbsd/openbsm/configure#49 (xtext) ====

@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.ac P4: //depot/projects/trustedbsd/openbsm/configure.ac#48 .
+# From configure.ac P4: //depot/projects/trustedbsd/openbsm/configure.ac#49 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.61 for OpenBSM 1.1alpha5.
 #

==== //depot/projects/trustedbsd/openbsm/libbsm/Makefile.am#8 (text+ko) ====

@@ -1,5 +1,5 @@
 #
-# $P4: //depot/projects/trustedbsd/openbsm/libbsm/Makefile.am#7 $
+# $P4: //depot/projects/trustedbsd/openbsm/libbsm/Makefile.am#8 $
 #
 
 if USE_NATIVE_INCLUDES
@@ -14,11 +14,13 @@
 	bsm_audit.c	\
 	bsm_class.c	\
 	bsm_control.c	\
+	bsm_domain.c	\
 	bsm_errno.c	\
 	bsm_event.c	\
 	bsm_flags.c	\
 	bsm_io.c	\
 	bsm_mask.c	\
+	bsm_socket_type.c	\
 	bsm_token.c	\
 	bsm_user.c
 
@@ -31,12 +33,14 @@
 man3_MANS =		\
 	au_class.3	\
 	au_control.3	\
+	au_domain.3	\
 	au_errno.3	\
 	au_event.3	\
 	au_free_token.3	\
 	au_io.3		\
 	au_mask.3	\
 	au_open.3	\
+	au_socket_type.3	\
 	au_token.3	\
 	au_user.3	\
 	libbsm.3

==== //depot/projects/trustedbsd/openbsm/libbsm/Makefile.in#13 (text+ko) ====

@@ -15,7 +15,7 @@
 @SET_MAKE@
 
 #
-# $P4: //depot/projects/trustedbsd/openbsm/libbsm/Makefile.in#12 $
+# $P4: //depot/projects/trustedbsd/openbsm/libbsm/Makefile.in#13 $
 #
 
 VPATH = @srcdir@
@@ -60,13 +60,15 @@
 LTLIBRARIES = $(lib_LTLIBRARIES)
 libbsm_la_LIBADD =
 am__libbsm_la_SOURCES_DIST = bsm_audit.c bsm_class.c bsm_control.c \
-	bsm_errno.c bsm_event.c bsm_flags.c bsm_io.c bsm_mask.c \
-	bsm_token.c bsm_user.c bsm_notify.c bsm_wrappers.c
+	bsm_domain.c bsm_errno.c bsm_event.c bsm_flags.c bsm_io.c \
+	bsm_mask.c bsm_socket_type.c bsm_token.c bsm_user.c \
+	bsm_notify.c bsm_wrappers.c
 @HAVE_AUDIT_SYSCALLS_TRUE at am__objects_1 = bsm_notify.lo \
 @HAVE_AUDIT_SYSCALLS_TRUE@	bsm_wrappers.lo
 am_libbsm_la_OBJECTS = bsm_audit.lo bsm_class.lo bsm_control.lo \
-	bsm_errno.lo bsm_event.lo bsm_flags.lo bsm_io.lo bsm_mask.lo \
-	bsm_token.lo bsm_user.lo $(am__objects_1)
+	bsm_domain.lo bsm_errno.lo bsm_event.lo bsm_flags.lo bsm_io.lo \
+	bsm_mask.lo bsm_socket_type.lo bsm_token.lo bsm_user.lo \
+	$(am__objects_1)
 libbsm_la_OBJECTS = $(am_libbsm_la_OBJECTS)
 DEFAULT_INCLUDES = -I. -I$(top_builddir)/config at am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/config/depcomp
@@ -199,18 +201,20 @@
 @USE_NATIVE_INCLUDES_FALSE at INCLUDES = -I$(top_builddir) -I$(top_srcdir) -I$(top_srcdir)/sys
 @USE_NATIVE_INCLUDES_TRUE at INCLUDES = -I$(top_builddir) -I$(top_srcdir)
 lib_LTLIBRARIES = libbsm.la
-libbsm_la_SOURCES = bsm_audit.c bsm_class.c bsm_control.c bsm_errno.c \
-	bsm_event.c bsm_flags.c bsm_io.c bsm_mask.c bsm_token.c \
-	bsm_user.c $(am__append_1)
+libbsm_la_SOURCES = bsm_audit.c bsm_class.c bsm_control.c bsm_domain.c \
+	bsm_errno.c bsm_event.c bsm_flags.c bsm_io.c bsm_mask.c \
+	bsm_socket_type.c bsm_token.c bsm_user.c $(am__append_1)
 man3_MANS = \
 	au_class.3	\
 	au_control.3	\
+	au_domain.3	\
 	au_errno.3	\
 	au_event.3	\
 	au_free_token.3	\
 	au_io.3		\
 	au_mask.3	\
 	au_open.3	\
+	au_socket_type.3	\
 	au_token.3	\
 	au_user.3	\
 	libbsm.3
@@ -287,12 +291,14 @@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bsm_audit.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bsm_class.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bsm_control.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bsm_domain.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bsm_errno.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bsm_event.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bsm_flags.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bsm_io.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bsm_mask.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bsm_notify.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bsm_socket_type.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bsm_token.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bsm_user.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bsm_wrappers.Plo at am__quote@

==== //depot/projects/trustedbsd/openbsm/libbsm/au_token.3#17 (text+ko) ====

@@ -23,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $P4: //depot/projects/trustedbsd/openbsm/libbsm/au_token.3#16 $
+.\" $P4: //depot/projects/trustedbsd/openbsm/libbsm/au_token.3#17 $
 .\"
 .Dd April 19, 2005
 .Dt AU_TOKEN 3
@@ -60,6 +60,7 @@
 .Nm au_to_sock_inet32 ,
 .Nm au_to_sock_inet128 ,
 .Nm au_to_sock_inet ,
+.Nm au_to_socket_ex ,
 .Nm au_to_subject32 ,
 .Nm au_to_subject64 ,
 .Nm au_to_subject ,
@@ -156,6 +157,8 @@
 .Ft "token_t *"
 .Fn au_to_sock_int "struct sockaddr_in *so"
 .Ft "token_t *"
+.Fn au_to_socket_ex "u_short so_domain" "u_short so_type" "struct sockaddr *sa_local" "struct sockaddr *sa_remote"
+.Ft "token_t *"
 .Fo au_to_subject32
 .Fa "au_id_t auid" "uid_t euid" "gid_t egid" "uid_t ruid"
 .Fa "gid_t rgid" "pid_t pid" "au_asid_t sid" "au_tid_t *tid"

==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_errno.c#14 (text+ko) ====

@@ -26,7 +26,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE. 
  *
- * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_errno.c#13 $
+ * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_errno.c#14 $
  */
 
 #include <sys/types.h>
@@ -47,9 +47,9 @@
  * stored in a single 8-bit character, so don't have a byte order.
  */
 
-struct bsm_errors {
-	int		 be_bsm_error;
-	int		 be_os_error;
+struct bsm_errnos {
+	int		 be_bsm_errno;
+	int		 be_local_errno;
 	const char	*be_strerror;
 };
 
@@ -70,7 +70,7 @@
  * support catalogues; these are only used if the OS doesn't have an error
  * string using strerror(3).
  */
-static const struct bsm_errors bsm_errors[] = {
+static const struct bsm_errnos bsm_errnos[] = {
 	{ BSM_ERRNO_ESUCCESS, 0, "Success" },
 	{ BSM_ERRNO_EPERM, EPERM, "Operation not permitted" },
 	{ BSM_ERRNO_ENOENT, ENOENT, "No such file or directory" },
@@ -563,30 +563,43 @@
 #endif
 	"Key was rejected by service" },
 };
-static const int bsm_errors_count = sizeof(bsm_errors) / sizeof(bsm_errors[0]);
+static const int bsm_errnos_count = sizeof(bsm_errnos) / sizeof(bsm_errnos[0]);
 
-static const struct bsm_errors *
-au_bsm_error_lookup_errno(int error)
+static const struct bsm_errnos *
+bsm_lookup_errno_local(int local_errno)
 {
 	int i;
 
-	if (error == ERRNO_NO_LOCAL_MAPPING)
-		return (NULL);
-	for (i = 0; i < bsm_errors_count; i++) {
-		if (bsm_errors[i].be_os_error == error)
-			return (&bsm_errors[i]);
+	for (i = 0; i < bsm_errnos_count; i++) {
+		if (bsm_errnos[i].be_local_errno == local_errno)
+			return (&bsm_errnos[i]);
 	}
 	return (NULL);
 }
 
-static const struct bsm_errors *
-au_bsm_error_lookup_bsm(u_char bsm_error)
+/*
+ * Conversion to the BSM errno space isn't allowed to fail; we simply map to
+ * BSM_ERRNO_UNKNOWN and let the remote endpoint deal with it.
+ */
+u_char
+au_errno_to_bsm(int local_errno)
+{
+	const struct bsm_errnos *bsme;
+
+	bsme = bsm_lookup_errno_local(local_errno);
+	if (bsme == NULL)
+		return (BSM_ERRNO_UNKNOWN);
+	return (bsme->be_bsm_errno);
+}
+
+static const struct bsm_errnos *
+bsm_lookup_errno_bsm(u_char bsm_errno)
 {
 	int i;
 
-	for (i = 0; i < bsm_errors_count; i++) {
-		if (bsm_errors[i].be_bsm_error == bsm_error)
-			return (&bsm_errors[i]);
+	for (i = 0; i < bsm_errnos_count; i++) {
+		if (bsm_errnos[i].be_bsm_errno == bsm_errno)
+			return (&bsm_errnos[i]);
 	}
 	return (NULL);
 }
@@ -594,49 +607,31 @@
 /*
  * Converstion from a BSM error to a local error number may fail if either
  * OpenBSM doesn't recognize the error on the wire, or because there is no
- * appropriate local mapping.  However, we don't allow conversion to BSM to
- * fail, we just convert to BSM_ERRNO_UNKNOWN.
+ * appropriate local mapping.
  */
 int
-au_bsm_to_errno(u_char bsm_error, int *errorp)
+au_bsm_to_errno(u_char bsm_errno, int *errorp)
 {
-	const struct bsm_errors *bsme;
+	const struct bsm_errnos *bsme;
 
-	bsme = au_bsm_error_lookup_bsm(bsm_error);
-	if (bsme == NULL || bsme->be_os_error == ERRNO_NO_LOCAL_MAPPING)
+	bsme = bsm_lookup_errno_bsm(bsm_errno);
+	if (bsme == NULL || bsme->be_local_errno == ERRNO_NO_LOCAL_MAPPING)
 		return (-1);
-	*errorp = bsme->be_os_error;
+	*errorp = bsme->be_local_errno;
 	return (0);
 }
 
-u_char
-au_errno_to_bsm(int error)
-{
-	const struct bsm_errors *bsme;
-
-	/*
-	 * We should never be passed this libbsm-internal constant, and
-	 * because it is ambiguous we just return an error.
-	 */
-	if (error == ERRNO_NO_LOCAL_MAPPING)
-		return (BSM_ERRNO_UNKNOWN);
-	bsme = au_bsm_error_lookup_errno(error);
-	if (bsme == NULL)
-		return (BSM_ERRNO_UNKNOWN);
-	return (bsme->be_bsm_error);
-}
-
 #if !defined(KERNEL) && !defined(_KERNEL)
 const char *
-au_strerror(u_char bsm_error)
+au_strerror(u_char bsm_errno)
 {
-	const struct bsm_errors *bsme;
+	const struct bsm_errnos *bsme;
 
-	bsme = au_bsm_error_lookup_bsm(bsm_error);
+	bsme = bsm_lookup_errno_bsm(bsm_errno);
 	if (bsme == NULL)
 		return ("Unrecognized BSM error");
-	if (bsme->be_os_error != ERRNO_NO_LOCAL_MAPPING)
-		return (strerror(bsme->be_os_error));
+	if (bsme->be_local_errno != ERRNO_NO_LOCAL_MAPPING)
+		return (strerror(bsme->be_local_errno));
 	return (bsme->be_strerror);
 }
 #endif

==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_io.c#60 (text+ko) ====

@@ -32,7 +32,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_io.c#59 $
+ * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_io.c#60 $
  */
 
 #include <sys/types.h>
@@ -3827,6 +3827,12 @@
     __unused char sfrm, int xml)
 {
 
+	/*
+	 * This print routine prints BSM constant space domains and socket
+	 * types rather than converting them.  If we add string printers for
+	 * these constants in the future, we may want to call conversion
+	 * routines.
+	 */
 	print_tok_type(fp, tok->id, "socket", raw, xml);
 	if (xml) {
 		open_attr(fp, "sock_dom");

==== //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#86 (text+ko) ====

@@ -30,7 +30,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#85 $
+ * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_token.c#86 $
  */
 
 #include <sys/types.h>
@@ -944,6 +944,9 @@
  * local address           4 bytes/16 bytes (IPv4/IPv6 address)
  * remote port             2 bytes
  * remote address          4 bytes/16 bytes (IPv4/IPv6 address)
+ *
+ * Domain and type arguments to this routine are assumed to already have been
+ * converted to the BSM constant space, so we don't do that here.
  */
 token_t *
 au_to_socket_ex(u_short so_domain, u_short so_type,

==== //depot/projects/trustedbsd/openbsm/libbsm/libbsm.3#15 (text+ko) ====

@@ -1,5 +1,6 @@
 .\"-
 .\" Copyright (c) 2005-2007 Robert N. M. Watson
+.\" Copyright (c) 2008 Apple Inc.
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -23,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $P4: //depot/projects/trustedbsd/openbsm/libbsm/libbsm.3#14 $
+.\" $P4: //depot/projects/trustedbsd/openbsm/libbsm/libbsm.3#15 $
 .\"
 .Dd November 12, 2008
 .Dt LIBBSM 3
@@ -170,6 +171,7 @@
 .Xr au_to_sock_inet 3 ,
 .Xr au_to_sock_inet32 3 ,
 .Xr au_to_sock_inet128 3 ,
+.Xr au_to_socket_ex 3 ,
 .Xr au_to_subject 3 ,
 .Xr au_to_subject32 3 ,
 .Xr au_to_subject64 3 ,
@@ -191,6 +193,17 @@
 .Xr getauusernam 3 ,
 .Xr getauusernam_r 3 ,
 .Xr getfauditflags 3 .
+.Ss Audit Constant Conversion Interfaces
+These functions convert between BSM and local constants, including the
+.Xr errno 2
+number, socket type, and protocol famil spaces, and must be used to generate
+and interpret BSM return and extended socket tokens:
+.Xr au_bsm_to_domain 3 ,
+.Xr au_bsm_to_errno 3 ,
+.Xr au_bsm_to_socket_type 3 ,
+.Xr au_domain_to_bsm 3 ,
+.Xr au_errno_to_bsm 3 ,
+.Xr au_socket_type_to_bsm 3 .
 .Sh SEE ALSO
 .Xr au_class 3 ,
 .Xr audit_submit 3 ,
@@ -201,12 +214,6 @@
 .Xr au_user 3 ,
 .Xr audit_class 5 ,
 .Xr audit_control 5
-.Ss Audit Error Interfaces
-These functions convert between BSM and local
-.Xr errno 2
-error numbers, and must be used to interpret and generate BSM return tokens:
-.Xr au_bsm_to_errno 3 ,
-.Xr au_errno_to_bsm 3 .
 .Sh HISTORY
 The OpenBSM implementation was created by McAfee Research, the security
 division of McAfee Inc., under contract to Apple Computer, Inc., in 2004.

==== //depot/projects/trustedbsd/openbsm/sys/bsm/Makefile.am#3 (text+ko) ====

@@ -1,5 +1,5 @@
 #
-# $P4: //depot/projects/trustedbsd/openbsm/sys/bsm/Makefile.am#2 $
+# $P4: //depot/projects/trustedbsd/openbsm/sys/bsm/Makefile.am#3 $
 #
 
 
@@ -8,8 +8,10 @@
 
 openbsm_HEADERS =		\
 	audit.h			\
+	audit_domain.h		\
 	audit_errno.h		\
 	audit_internal.h	\
 	audit_kevents.h		\
-	audit_record.h
+	audit_record.h		\
+	audit_socket_type.h
 endif

==== //depot/projects/trustedbsd/openbsm/sys/bsm/Makefile.in#5 (text+ko) ====

@@ -15,7 +15,7 @@
 @SET_MAKE@
 
 #
-# $P4: //depot/projects/trustedbsd/openbsm/sys/bsm/Makefile.in#4 $
+# $P4: //depot/projects/trustedbsd/openbsm/sys/bsm/Makefile.in#5 $
 #
 
 VPATH = @srcdir@
@@ -48,8 +48,9 @@
 CONFIG_CLEAN_FILES =
 SOURCES =
 DIST_SOURCES =
-am__openbsm_HEADERS_DIST = audit.h audit_errno.h audit_internal.h \
-	audit_kevents.h audit_record.h
+am__openbsm_HEADERS_DIST = audit.h audit_domain.h audit_errno.h \
+	audit_internal.h audit_kevents.h audit_record.h \
+	audit_socket_type.h
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -173,10 +174,12 @@
 @USE_NATIVE_INCLUDES_FALSE at openbsmdir = $(includedir)/bsm
 @USE_NATIVE_INCLUDES_FALSE at openbsm_HEADERS = \
 @USE_NATIVE_INCLUDES_FALSE@	audit.h			\
+ at USE_NATIVE_INCLUDES_FALSE@	audit_domain.h		\
 @USE_NATIVE_INCLUDES_FALSE@	audit_errno.h		\
 @USE_NATIVE_INCLUDES_FALSE@	audit_internal.h	\
 @USE_NATIVE_INCLUDES_FALSE@	audit_kevents.h		\
- at USE_NATIVE_INCLUDES_FALSE@	audit_record.h
+ at USE_NATIVE_INCLUDES_FALSE@	audit_record.h		\
+ at USE_NATIVE_INCLUDES_FALSE@	audit_socket_type.h
 
 all: all-am
 

==== //depot/projects/trustedbsd/openbsm/sys/bsm/audit_record.h#9 (text+ko) ====

@@ -26,7 +26,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_record.h#8 $
+ * $P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_record.h#9 $
  */
 
 #ifndef _BSM_AUDIT_RECORD_H_
@@ -281,10 +281,15 @@
 token_t	*au_to_zonename(const char *zonename);
 
 /*
- * BSM library routines for manipulating errno values.
+ * BSM library routines for converting between local and BSM constant spaces.
  */
+int	 au_bsm_to_domain(u_short bsm_domain, int *local_domainp);
 int	 au_bsm_to_errno(u_char bsm_error, int *errorp);
-u_char	 au_errno_to_bsm(int error);
+int	 au_bsm_to_socket_type(u_short bsm_socket_type,
+	    int *local_socket_typep);
+u_short	 au_domain_to_bsm(int local_domain);
+u_char	 au_errno_to_bsm(int local_errno);
+u_short	 au_socket_type_to_bsm(int local_socket_type);
 
 __END_DECLS
 

==== //depot/projects/trustedbsd/openbsm/test/bsm/generate.c#13 (text+ko) ====

@@ -24,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $P4: //depot/projects/trustedbsd/openbsm/test/bsm/generate.c#12 $
+ * $P4: //depot/projects/trustedbsd/openbsm/test/bsm/generate.c#13 $
  */
 
 /*
@@ -916,7 +916,7 @@
 	write_record(directory, record_filename, zonename_token, AUE_NULL);
 }
 
-static u_short socketex_domain = AF_INET;
+static u_short socketex_domain = PF_INET;
 static u_short socketex_type = SOCK_STREAM;
 static struct sockaddr_in socketex_laddr, socketex_raddr;
 
@@ -935,7 +935,8 @@
 	socketex_raddr.sin_len = sizeof(socketex_raddr);
 	socketex_raddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
 
-	socketex_token = au_to_socket_ex(socketex_domain, socketex_type,
+	socketex_token = au_to_socket_ex(au_domain_to_bsm(socketex_domain),
+	    au_socket_type_to_bsm(socketex_type),
 	    (struct sockaddr *)&socketex_laddr,
 	    (struct sockaddr *)&socketex_raddr);
 	if (socketex_token == NULL)
@@ -958,7 +959,8 @@
 	socketex_raddr.sin_len = sizeof(socketex_raddr);
 	socketex_raddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
 
-	socketex_token = au_to_socket_ex(socketex_domain, socketex_type,
+	socketex_token = au_to_socket_ex(au_domain_to_bsm(socketex_domain),
+	    au_socket_type_to_bsm(socketex_type),
 	    (struct sockaddr *)&socketex_laddr,
 	    (struct sockaddr *)&socketex_raddr);
 	if (socketex_token == NULL)


More information about the p4-projects mailing list