bsm.patch   [plain text]


diff -Naur ../openssh-4.4p1.orig/audit-bsm.c ./audit-bsm.c
--- ../openssh-4.4p1.orig/audit-bsm.c	2006-08-31 22:38:36.000000000 -0700
+++ ./audit-bsm.c	2006-10-19 16:56:18.000000000 -0700
@@ -57,6 +57,9 @@
 #include <bsm/audit_uevents.h>
 #include <bsm/audit_record.h>
 #include <locale.h>
+#if defined(__APPLE__)
+#include <errno.h>
+#endif
 
 #if defined(HAVE_GETAUDIT_ADDR)
 #define	AuditInfoStruct		auditinfo_addr
@@ -78,7 +81,9 @@
 #define AUToReturnFunc(a,b)	au_to_return((a), (u_int)(b))
 #endif
 
+#if !defined(__APPLE__)
 extern int	cannot_audit(int);
+#endif
 extern void	aug_init(void);
 extern dev_t	aug_get_port(void);
 extern int 	aug_get_machine(char *, u_int32_t *, u_int32_t *);
@@ -241,10 +246,18 @@
 	/* populate our terminal id structure */
 #if defined(HAVE_GETAUDIT_ADDR)
 	tid->at_port = (dev_t)port;
+#if defined(__APPLE__)
+	/* don't have a aug_get_machine */
+	tid->at_addr[0] = inet_addr(host);
+	tid->at_type = 0;
+	snprintf(buf, sizeof(buf), "%08x", tid->at_addr[0]);
+	debug3("BSM audit: machine ID %s", buf);
+#else
 	aug_get_machine((char *)host, &(tid->at_addr[0]), &(tid->at_type));
 	snprintf(buf, sizeof(buf), "%08x %08x %08x %08x", tid->at_addr[0],
 	    tid->at_addr[1], tid->at_addr[2], tid->at_addr[3]);
 	debug3("BSM audit: iptype %d machine ID %s", (int)tid->at_type, buf);
+#endif
 #else
 	/* this is used on IPv4-only machines */
 	tid->port = (dev_t)port;
diff -Naur ../openssh-4.4p1.orig/configure ./configure
--- ../openssh-4.4p1.orig/configure	2006-09-26 04:03:41.000000000 -0700
+++ ./configure	2006-10-19 16:53:20.000000000 -0700
@@ -13669,6 +13669,23 @@
 #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
+
+				case "$host" in
+				*-*-darwin7* | *-*-darwin8*)
+					echo "$as_me:$LINENO: checking for getaudit_addr usability" >&5
+echo $ECHO_N "checking for getaudit_addr usability... $ECHO_C" >&6
+					echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+					;;
+					*)
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_GETAUDIT_ADDR 1
+_ACEOF
+
+					;;
+				esac
+
+
 fi
 done
 
diff -Naur ../openssh-4.4p1.orig/configure.ac ./configure.ac
--- ../openssh-4.4p1.orig/configure.ac	2006-09-24 12:08:59.000000000 -0700
+++ ./configure.ac	2006-10-19 16:53:33.000000000 -0700
@@ -1201,7 +1201,21 @@
 		AC_CHECK_FUNCS(getaudit, [],
 		    [AC_MSG_ERROR(BSM enabled and required function not found)])
 		# These are optional
-		AC_CHECK_FUNCS(getaudit_addr)
+		AC_CHECK_FUNCS(getaudit_addr,
+				[
+				case "$host" in
+				*-*-darwin7* | *-*-darwin8*)
+					AC_MSG_CHECKING(for getaudit_addr usability)
+					AC_MSG_RESULT(no)
+					;;
+					*) AC_DEFINE(HAVE_GETAUDIT_ADDR,
+							1,
+							[Define if libbsm has 'getaudit_addr'.]
+							)
+					;;
+				esac
+				]
+				)
 		AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
 		;;
 	  debug)