diff mbox

semanage: fix error message for fcontext -m

Message ID 1471519081-26417-1-git-send-email-mvadkert@redhat.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Miroslav Vadkerti Aug. 18, 2016, 11:18 a.m. UTC
The type must be a file of device type, not a port type.

Signed-off-by: Miroslav Vadkerti <mvadkert@redhat.com>
---
 policycoreutils/semanage/seobject.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Dac Override Aug. 18, 2016, 11:51 a.m. UTC | #1
On 08/18/2016 01:18 PM, Miroslav Vadkerti wrote:
> The type must be a file of device type, not a port type.
> 
> Signed-off-by: Miroslav Vadkerti <mvadkert@redhat.com>
> ---
>  policycoreutils/semanage/seobject.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/policycoreutils/semanage/seobject.py 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)
>  
>          self.validate(target)
>  
> 

Hard-coded reference policy specific type attributes in seobject
(self.valid_types)
Stephen Smalley Aug. 18, 2016, 1:01 p.m. UTC | #2
On 08/18/2016 07:51 AM, Dominick Grift wrote:
> On 08/18/2016 01:18 PM, Miroslav Vadkerti wrote:
>> The type must be a file of device type, not a port type.
>> 
>> Signed-off-by: Miroslav Vadkerti <mvadkert@redhat.com> --- 
>> policycoreutils/semanage/seobject.py | 2 +- 1 file changed, 1
>> insertion(+), 1 deletion(-)
>> 
>> diff --git a/policycoreutils/semanage/seobject.py
>> 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)
>> 
>> 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 Aug. 18, 2016, 7:26 p.m. UTC | #3
On 08/18/2016 07:18 AM, Miroslav Vadkerti wrote:
> The type must be a file of device type, not a port type.
> 
> Signed-off-by: Miroslav Vadkerti <mvadkert@redhat.com>

Thanks, applied.

> ---
>  policycoreutils/semanage/seobject.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/policycoreutils/semanage/seobject.py 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)
>  
>          self.validate(target)
>  
>
diff mbox

Patch

diff --git a/policycoreutils/semanage/seobject.py 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)
 
         self.validate(target)