semanage: fix error message for fcontext -m
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
@@ -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
Quoted 13 lines · Miroslav Vadkerti
The type must be a file of device type, not a port type.
Signed-off-by Miroslav Vadkerti <[email protected]>--- policycoreutils/semanage/seobject.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)policycoreutils/semanage/seobject.py +0
-0
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
Quoted 19 lines · Dominick Grift
Quoted 18 lines · Miroslav Vadkerti
The type must be a file of device type, not a port type.
Signed-off-by Miroslav Vadkerti <[email protected]> ---
policycoreutils/semanage/seobject.py| 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)(quoted diff) +0
-0
b/policycoreutils/semanage/seobject.pyindex 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 == "": raiseValueError(_("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) + raiseValueError(_("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
Stephen Smalley
AppliedQuoted 3 lines · Miroslav Vadkerti
The type must be a file of device type, not a port type.
Signed-off-by Miroslav Vadkerti <[email protected]>
Thanks, applied.
Quoted 18 lines
--- policycoreutils/semanage/seobject.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)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)