[apparmor] [PATCH 8/8] Convert codomain to a class
Steve Beattie
steve at nxnw.org
Fri Sep 13 16:32:44 UTC 2013
On Wed, Sep 11, 2013 at 01:47:47AM -0700, Tyler Hicks wrote:
> From: John Johansen <john.johansen at canonical.com>
>
> Convert the codomain to a class, and the policy lists that store
> codomains to stl containers instead of glibc twalk.
>
> Signed-off-by: John Johansen <john.johansen at canonical.com>
> [tyhicks: Merge with dbus changes and process_file_entries() cleanup]
> Signed-off-by: Tyler Hicks <tyhicks at canonical.com>
This patch strips out the #ifdef UNIT_TEST bits from parser.h and
adds an #include <unit_test.h> in appropriate places; however, it
looks like the separated out unit_test.h file was not added to the
git/guilt/whatever patch.
Presumably, it would look something like the following:
---
parser/unit_test.h | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 51 insertions(+)
Index: b/parser/unit_test.h
===================================================================
--- /dev/null
+++ b/parser/unit_test.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2013
+ * Canonical Ltd. (All rights reserved)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, contact Novell, Inc. or Canonical
+ * Ltd.
+ */
+
+#ifndef __UNIT_TEST_H
+#define __UNIT_TEST_H
+
+#ifdef UNIT_TEST
+/* For the unit-test builds, we must include function stubs for stuff that
+ * only exists in the excluded object files; everything else should live
+ * in parser_common.c.
+ */
+
+/* parser_yacc.y */
+void yyerror(const char *msg, ...)
+{
+ va_list arg;
+ char buf[PATH_MAX];
+
+ va_start(arg, msg);
+ vsnprintf(buf, sizeof(buf), msg, arg);
+ va_end(arg);
+
+ PERROR(_("AppArmor parser error: %s\n"), buf);
+
+ exit(1);
+}
+
+#define MY_TEST(statement, error) \
+ if (!(statement)) { \
+ PERROR("FAIL: %s\n", error); \
+ rc = 1; \
+ }
+
+#endif /* UNIT_TEST */
+
+#endif /* __UNIT_TEST_H */
--
Steve Beattie
<sbeattie at ubuntu.com>
http://NxNW.org/~steve/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20130913/278afde6/attachment.pgp>
More information about the AppArmor
mailing list