[apparmor] [PATCH] tests: Remove remainder of libimmunix and 2.[24] kernel support

Tyler Hicks tyhicks at canonical.com
Mon Nov 4 19:33:12 UTC 2013


The previous patch for removing libimmunix support from the regression
tests wasn't complete. Also, the 2.2 and 2.4 kernel support code is
closely related and can be removed considering how old those kernels
are.

Signed-off-by: Tyler Hicks <tyhicks at canonical.com>
---
 tests/regression/apparmor/Makefile    | 28 +++-----------------
 tests/regression/apparmor/changehat.h | 49 +++--------------------------------
 2 files changed, 6 insertions(+), 71 deletions(-)

diff --git a/tests/regression/apparmor/Makefile b/tests/regression/apparmor/Makefile
index 99977a7..623d1ac 100644
--- a/tests/regression/apparmor/Makefile
+++ b/tests/regression/apparmor/Makefile
@@ -81,34 +81,12 @@ ifneq (,$(findstring $(shell uname -i),i386 i486 i586 i686 x86 x86_64))
 SRC+=syscall_ioperm.c syscall_iopl.c
 endif
 
-# Suck, Fedora Core 3 no longer includes /sbin/kernelversion
-KERNELVERSION:=$(shell if [ -x /sbin/kernelversion ] ; then \
-				/sbin/kernelversion ; \
-		       else \
-		       		uname -r ; \
-		       fi )
-KERNELMAJOR:=$(shell echo ${KERNELVERSION} | cut -d. -f1)
-KERNELMINOR:=$(shell echo ${KERNELVERSION} | cut -d. -f2)
-CHANGEHAT_FLAGS=$(shell if [ ! -f /usr/include/sys/apparmor.h ] ; then \
-        			if [ -f /usr/include/sys/immunix.h ] ; then \
-					echo -DUSE_COMPAT_IMMUNIX_H ; \
-				else \
-					(echo -DCHANGEHAT_NOT_IN_LIBRARY; \
-					[ $(KERNELMAJOR) -eq 2 ] && \
-	  				if [ $(KERNELMINOR) -eq 4 ] ; then \
-						echo -DCHANGEHAT_2_4_KERNEL ; \
-	  				elif [ $(KERNELMINOR) -eq 2 ] ; then \
-						echo -DCHANGEHAT_2_2_KERNEL ;\
-	       				fi ) \
-	  			fi ;\
-			fi )
-
-LIBIMMUNIX:=$(shell	if ldconfig -p | grep -q libapparmor\.so ; then \
+LIBAPPARMOR:=$(shell	if ldconfig -p | grep -q libapparmor\.so ; then \
 				echo -lapparmor ; \
 			fi )
 
-CFLAGS+=$(CHANGEHAT_FLAGS) -Wall -Wstrict-prototypes
-LDLIBS+=$(LIBIMMUNIX)
+CFLAGS+=-Wall -Wstrict-prototypes
+LDLIBS+=$(LIBAPPARMOR)
 
 EXEC=$(SRC:%.c=%)
 
diff --git a/tests/regression/apparmor/changehat.h b/tests/regression/apparmor/changehat.h
index 0872950..b4c721c 100644
--- a/tests/regression/apparmor/changehat.h
+++ b/tests/regression/apparmor/changehat.h
@@ -1,51 +1,8 @@
-
-/* #define CHANGEHAT_NOT_IN_GLIB */
-
-#define SD_ID_MAGIC     0x8c235e38
-
-#ifdef CHANGEHAT_NOT_IN_LIBRARY
-#  ifdef CHANGEHAT_2_4_KERNEL
-
-struct sd_hat {
-        char *hat_name;
-        unsigned int hat_magic;
-};
-
-#define __NR_security   223 
-#define SD_CHANGE_HAT   10
-
-_syscall3(int, security, unsigned int, id, unsigned int, call, unsigned long *, args);
-
-int change_hat (char * subprofile, unsigned int token)
-{
-	struct sd_hat hat;
-	unsigned int id = SD_ID_MAGIC;
-
-	hat.hat_name=subprofile;
-	hat.hat_magic = token;
-
-	return security(id, SD_CHANGE_HAT, (unsigned long*)&hat);
-}
-
-#  else
-#    ifdef CHANGEHAT_2_2_KERNEL
-#define __NR_change_hat 230
-
-_syscall2(int, change_hat, char *, subdomain, unsigned int, magic_token);
-
-#    endif /* CHANGEHAT_2_2_KERNEL */
-#  endif /* CHANGEHAT_2_4_KERNEL */
-
-#else /* !CHANGEHAT_NOT_IN_LIBRARY */
-#ifdef USE_COMPAT_IMMUNIX_H
-#include <sys/immunix.h>
-#else
-#include <sys/apparmor.h>
-#endif /* USE_COMPAT_IMMUNIX_H */
-#endif /* CHANGEHAT_NOT_IN_LIBRARY */
-
 #include <fcntl.h>
 #include <string.h>
+#include <sys/apparmor.h>
+
+#define SD_ID_MAGIC     0x8c235e38
 
 inline int do_open (char * file)
 {
-- 
1.8.3.2




More information about the AppArmor mailing list