Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Aug 2009 12:11:24 GMT
From:      Ilias Marinos <marinosi@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 167283 for review
Message-ID:  <200908131211.n7DCBOaA070717@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=167283

Change 167283 by marinosi@marinosi_redrum on 2009/08/13 12:10:38

	Implemented a new command A_LISTSLICES for the auditing syscalls.

Affected files ...

.. //depot/projects/soc2009/marinosi_appaudit/src/sys/bsm/audit.h#6 edit
.. //depot/projects/soc2009/marinosi_appaudit/src/sys/security/audit/audit.c#21 edit

Differences ...

==== //depot/projects/soc2009/marinosi_appaudit/src/sys/bsm/audit.h#6 (text) ====

@@ -130,6 +130,7 @@
 #define	A_UPDATESLICE	40
 #define	A_GETSLICE	41
 #define	A_REMOVESLICE	42
+#define	A_LISTSLICES	43
 
 /*
  * Audit policy controls.

==== //depot/projects/soc2009/marinosi_appaudit/src/sys/security/audit/audit.c#21 (text) ====

@@ -988,6 +988,7 @@
 {
 
 	struct audit_slice *as = NULL;
+	struct audit_slice *cur = NULL;
 	struct ucred *cred, *newcred, *oldcred;
 	int error;
 	union auditon_udata udata;
@@ -1000,9 +1001,9 @@
 
 	/*
 	 * The only way for 'as' to be NULL is when we want to create a new
-	 * slice.
+	 * slice or when we want to list all available slices.
 	 */
-	if ((as == NULL) && (cmd != A_CREATESLICE))
+	if ((as == NULL) && (cmd != A_CREATESLICE) && (cmd != A_LISTSLICES))
 		return (EINVAL);
 
 	memset((void *)&udata, 0, sizeof(udata));
@@ -1402,6 +1403,19 @@
 		audit_slice_destroy(as);
 		break;
 
+	case A_LISTSLICES:
+		/*
+		 * Use lock to prevent slice creation/removal while iterating through
+		 * the queue, listing the slices.
+		 */
+		uprintf("Slices List:\n");
+		AUDIT_SLICES_LOCK();
+		TAILQ_FOREACH(cur, &audit_slice_q, as_q) {
+			uprintf("%s\n", cur->as_name);
+		}
+		AUDIT_SLICES_UNLOCK();
+		break;
+
 	default:
 		return (EINVAL);
 	}



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