Skip to contentSkip to conversation

policy Makefile patch

PATCH Frank Mayer 1 participant 2 messages Feb 21, 2003 – Feb 24, 2003 SELinux security module

lore
Share & tools
lore
#0 lore raw

Attached is a patch that changes the policy make file. The problem was that the users file was being run through m4, but user names must support any name that might be used for a Linux user. Any name that is also used as a macro name, or something as simple as "dnl" would cause an error if defined as a user in the policy. This patch excludes users (as well as the flask definitions and the security context specifications) from the m4 processing, but still has all the te and rbac files, as well as the constraints file, pass through m4.

Frank

selinux/policy/Makefile +11 -2
@@ -30,8 +30,9 @@
 ifeq ($(MLS),y)
 POLICYFILES += mls
 endif
-POLICYFILES += tmp/all.te 
-POLICYFILES += rbac users constraints
+POLICYFILES += tmp/te-rbac.m4
+POLICYFILES += users 
+POLICYFILES += tmp/contraints.m4
 POLICYFILES += initial_sid_contexts fs_use genfs_contexts net_contexts
 
 FC = file_contexts/file_contexts
@@ -72,6 +73,14 @@
 	cp -R . $(SRCINSTALLDIR)/policy
 
 ALLTEFILES := attrib.te tmp/program_used_flags.te tmp/all_macros.te tmp/all_types.te tmp/all_domains.te assert.te 
+TE_RBAC_MACRO_FILES := tmp/all.te rbac
+CONSTRAINT_MACRO_FILES := tmp/program_used_flags.te tmp/all_macros.te constraints
+
+tmp/te-rbac.m4: $(TE_RBAC_MACRO_FILES)
+	m4 -Imacros -s $^ > $@
+	
+tmp/contraints.m4: $(CONSTRAINT_MACRO_FILES)
+	m4 -Imacros -s $^ > $@
 
 tmp/all.te: $(ALLTEFILES)
 	cat $^ > $@
#1 lore raw

Sorry there was a problem with the last patch file...here is a correction. Frank

Quoted 2 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]

On

Quoted 6 lines

Behalf Of Frank Mayer
Sent: Friday, February 21, 2003 5:14 PM
To: [email protected]
Subject: policy Makefile patch

Attached is a patch that changes the policy make file. The problem

was

Quoted 2 lines

that the users file was being run through m4, but user names must support any name that might be used for a Linux user. Any name that

is

Quoted 2 lines

also used as a macro name, or something as simple as "dnl" would cause an error if defined as a user in the policy. This patch excludes

users

Quoted 5 lines

(as well as the flask definitions and the security context specifications) from the m4 processing, but still has all the te and rbac files, as well as the constraints file, pass through m4.

Frank

selinux/policy/Makefile +12 -4
@@ -30,9 +30,9 @@
 ifeq ($(MLS),y)
 POLICYFILES += mls
 endif
-POLICYFILES += tmp/all.te 
-POLICYFILES += rbac users constraints
-POLICYFILES += initial_sid_contexts fs_use genfs_contexts net_contexts
+POLICYFILES += tmp/te-rbac.m4
+POLICYFILES += users 
+POLICYFILES += tmp/contraints-contexts.m4
 
 FC = file_contexts/file_contexts
 FCFILES=file_contexts/types.fc $(patsubst domains/program/%.te,file_contexts/program/%.fc, $(wildcard domains/program/*.te))
@@ -63,7 +63,7 @@
 
 policy.conf: $(POLICYFILES) 
 	mkdir -p tmp
-	m4 -Imacros -s $(POLICYFILES) > policy.conf
+	cat $^ > $@
 
 install-src: 
 	rm -rf $(SRCINSTALLDIR)/policy.old
@@ -72,6 +72,14 @@
 	cp -R . $(SRCINSTALLDIR)/policy
 
 ALLTEFILES := attrib.te tmp/program_used_flags.te tmp/all_macros.te tmp/all_types.te tmp/all_domains.te assert.te 
+TE_RBAC_MACRO_FILES := tmp/all.te rbac
+CONSTRAINT_CONTEXT_MACRO_FILES := tmp/program_used_flags.te tmp/all_macros.te constraints initial_sid_contexts fs_use genfs_contexts net_contexts
+
+tmp/te-rbac.m4: $(TE_RBAC_MACRO_FILES)
+	m4 -Imacros -s $^ > $@
+	
+tmp/contraints-contexts.m4: $(CONSTRAINT_CONTEXT_MACRO_FILES)
+	m4 -Imacros -s $^ > $@
 
 tmp/all.te: $(ALLTEFILES)
 	cat $^ > $@