PERFORCE change 167283 for review

Ilias Marinos marinosi at FreeBSD.org
Thu Aug 13 12:11:25 UTC 2009


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

Change 167283 by marinosi at 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);
 	}


More information about the p4-projects mailing list