Skip to contentSkip to conversation

semanage: fix error message for fcontext -m

PATCH Applied Miroslav Vadkerti 3 participants 4 messages Aug 18, 2016 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 semanage: fix error message for fcontext -m

The type must be a file of device type, not a port type.

---
 policycoreutils/semanage/seobject.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
policycoreutils/semanage/seobject.py +1 -1
index a6681f0..a34d20d 100644
@@ -1937,7 +1937,7 @@ class fcontextRecords(semanageRecords):
         if serange == "" and setype == "" and seuser == "":
             raise ValueError(_("Requires setype, serange or seuser"))
         if setype and setype not in self.valid_types:
-            raise ValueError(_("Type %s is invalid, must be a port type") % setype)
+            raise ValueError(_("Type %s is invalid, must be a file or device type") % setype)
 
         self.validate(target)
 
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 13 lines · Miroslav Vadkerti

The type must be a file of device type, not a port type.

---
 policycoreutils/semanage/seobject.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
policycoreutils/semanage/seobject.py +0 -0
index a6681f0..a34d20d 100644

policycoreutils/semanage/seobject.py class fcontextRecords(semanageRecords): · line 1943

Quoted 8 lines
policycoreutils/semanage/seobject.py +1 -1
@@ -1937,7 +1937,7 @@ class fcontextRecords(semanageRecords):
         if serange == "" and setype == "" and seuser == "":
             raise ValueError(_("Requires setype, serange or seuser"))
         if setype and setype not in self.valid_types:
-            raise ValueError(_("Type %s is invalid, must be a port type") % setype)
+            raise ValueError(_("Type %s is invalid, must be a file or device type") % setype)
 
         self.validate(target)
 

Hard-coded reference policy specific type attributes in seobject (self.valid_types)

Signature · 3 lines
Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8  02D5 3B6C 5F1D 2C7B 6B02
https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02
Dominick Grift
#2 lore raw
Quoted 19 lines · Dominick Grift
Quoted 18 lines · Miroslav Vadkerti

The type must be a file of device type, not a port type.

policycoreutils/semanage/seobject.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

(quoted diff) +0 -0

b/policycoreutils/semanage/seobject.py index a6681f0..a34d20d 100644 --- a/policycoreutils/semanage/seobject.py +++ b/policycoreutils/semanage/seobject.py @@ -1937,7 +1937,7 @@ class fcontextRecords(semanageRecords): if serange == "" and setype == "" and seuser == "": raise ValueError(_("Requires setype, serange or seuser")) if setype and setype not in
self.valid_types: - raise ValueError(_("Type %s is
invalid, must be a port type") % setype) + raise
ValueError(_("Type %s is invalid, must be a file or device type") % setype)

Quoted 6 lines
Quoted 3 lines

self.validate(target)

Hard-coded reference policy specific type attributes in seobject (self.valid_types)

That's true, but not introduced by this patch.
Another example where we need some kind of key=value configuration mapping that can be read by semanage/seobject rather than hardcoding them. Preferably automatically generated during refpolicy build so that we don't have to manually keep it in sync.

For example, valid_fcontext_type_attributes=file_type,device_type

#3 lore raw
In reply to Miroslav Vadkerti
Quoted 3 lines · Miroslav Vadkerti

The type must be a file of device type, not a port type.

Thanks, applied.

Quoted 18 lines
---
 policycoreutils/semanage/seobject.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
policycoreutils/semanage/seobject.py +1 -1
index a6681f0..a34d20d 100644
@@ -1937,7 +1937,7 @@ class fcontextRecords(semanageRecords):
         if serange == "" and setype == "" and seuser == "":
             raise ValueError(_("Requires setype, serange or seuser"))
         if setype and setype not in self.valid_types:
-            raise ValueError(_("Type %s is invalid, must be a port type") % setype)
+            raise ValueError(_("Type %s is invalid, must be a file or device type") % setype)
 
         self.validate(target)