security-manager-tests: use libsmack functions for operations on socket labels 46/36446/2
authorRafal Krypa <r.krypa@samsung.com>
Fri, 6 Mar 2015 09:46:09 +0000 (10:46 +0100)
committerRafal Krypa <r.krypa@samsung.com>
Fri, 6 Mar 2015 10:33:04 +0000 (11:33 +0100)
commitaf544bd0c0ccc5f901a719a0f1b3ae599c214730
treeb6f24e2a727b1f4ba507b36977fa7583841106a5
parent5e509f0bb39dcb9b906687306185c5cc02293361
security-manager-tests: use libsmack functions for operations on socket labels

Use smack_set_label_for_file() and smack_new_label_from_file() instead
of plain fsetxattr() and fgetxattr(). These libsmack functions have
been recently provided by libsmack 1.1.
This change also fixes a bug in the tests. We incorrectly expected
the value from fgetxattr() to be null-terminated. It was before kernel
3.20, but that was incorrect for the kernel to do. With most current
kernels the test failed. Libsmack functions do the null-termination
for us, so the test is working again.

Change-Id: Ifc1820cddad0c5acbe49f3c98e622b07acc31358
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
tests/security-manager-tests/security_manager_tests.cpp