[apparmor] [PATCH v2 08/11] tests: Test the shutdown permission in unix_socket

Tyler Hicks tyhicks at canonical.com
Mon Sep 15 19:56:01 UTC 2014


The server will now do a shutdown() on its socket in order to test the
AppArmor 'shutdown' unix rule permission.

Signed-off-by: Tyler Hicks <tyhicks at canonical.com>
---
 tests/regression/apparmor/unix_socket.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tests/regression/apparmor/unix_socket.c b/tests/regression/apparmor/unix_socket.c
index 34d1b9e..1b89c45 100644
--- a/tests/regression/apparmor/unix_socket.c
+++ b/tests/regression/apparmor/unix_socket.c
@@ -217,6 +217,12 @@ int main (int argc, char *argv[])
 		exit(1);
 	}
 
+	rc = shutdown(sock, SHUT_RDWR);
+	if (rc == -1) {
+		perror("FAIL - shutdown");
+		exit(1);
+	}
+
 	printf("PASS\n");
 	exit(0);
 }
-- 
2.1.0




More information about the AppArmor mailing list