SELinux Archive on lore.kernel.org
 help / color / Atom feed
From: Stephen Smalley <sds@tycho.nsa.gov>
To: Vit Mojzis <vmojzis@redhat.com>, selinux@vger.kernel.org
Subject: Re: [PATCH 2/2] python/semanage: Add support for DCCP and SCTP protocols
Date: Thu, 10 Oct 2019 15:57:50 -0400
Message-ID: <dfac02ea-b8fb-8d15-7c61-120050f4c51e@tycho.nsa.gov> (raw)
In-Reply-To: <8820fee0-2472-3209-ba5d-1ef957e4d559@tycho.nsa.gov>

On 10/9/19 10:39 AM, Stephen Smalley wrote:
> On 10/8/19 8:22 AM, Vit Mojzis wrote:
>> Fixes:
>>     # semanage port -a -p sctp -t port_t 1234
>>     ValueError: Protocol udp or tcp is required
>>     # semanage port -d -p sctp -t port_t 1234
>>     ValueError: Protocol udp or tcp is required
>>
>> Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
> 
> For both patches,
> 
> Acked-by: Stephen Smalley <sds@tycho.nsa.gov>

Thanks, applied.

> 
>> ---
>>   python/semanage/seobject.py | 14 ++++++++------
>>   1 file changed, 8 insertions(+), 6 deletions(-)
>>
>> diff --git a/python/semanage/seobject.py b/python/semanage/seobject.py
>> index f4c29854..dc413ca5 100644
>> --- a/python/semanage/seobject.py
>> +++ b/python/semanage/seobject.py
>> @@ -1058,13 +1058,15 @@ class portRecords(semanageRecords):
>>               pass
>>       def __genkey(self, port, proto):
>> -        if proto == "tcp":
>> -            proto_d = SEMANAGE_PROTO_TCP
>> +        protocols = {"tcp": SEMANAGE_PROTO_TCP,
>> +                     "udp": SEMANAGE_PROTO_UDP,
>> +                     "sctp": SEMANAGE_PROTO_SCTP,
>> +                     "dccp": SEMANAGE_PROTO_DCCP}
>> +
>> +        if proto in protocols.keys():
>> +            proto_d = protocols[proto]
>>           else:
>> -            if proto == "udp":
>> -                proto_d = SEMANAGE_PROTO_UDP
>> -            else:
>> -                raise ValueError(_("Protocol udp or tcp is required"))
>> +            raise ValueError(_("Protocol has to be one of udp, tcp, 
>> dccp or sctp"))
>>           if port == "":
>>               raise ValueError(_("Port is required"))
>>
> 


      reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-08 12:22 [PATCH 1/2] libsemanage: " Vit Mojzis
2019-10-08 12:22 ` [PATCH 2/2] python/semanage: " Vit Mojzis
2019-10-09 14:39   ` Stephen Smalley
2019-10-10 19:57     ` Stephen Smalley [this message]

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dfac02ea-b8fb-8d15-7c61-120050f4c51e@tycho.nsa.gov \
    --to=sds@tycho.nsa.gov \
    --cc=selinux@vger.kernel.org \
    --cc=vmojzis@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

SELinux Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/selinux/0 selinux/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 selinux selinux/ https://lore.kernel.org/selinux \
		selinux@vger.kernel.org
	public-inbox-index selinux

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.selinux


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git