Bug 1020997 - selinux.rb#get_mcs_label assumes integer name is uid
Summary: selinux.rb#get_mcs_label assumes integer name is uid
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OpenShift Online
Classification: Red Hat
Component: Containers
Version: 2.x
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: ---
Assignee: Jhon Honce
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-10-18 17:54 UTC by Jhon Honce
Modified: 2015-05-14 23:30 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-01-24 03:25:23 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Jhon Honce 2013-10-18 17:54:52 UTC
Description of problem:
Method assumes a name that looks like an integer is a uid. A name of 921957316561229358039040 breaks that assumption.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1.
2.
3.

Actual results:
/opt/rh/ruby193/root/usr/share/gems/gems/openshift-origin-node-1.16.0/lib/openshift-origin-node/utils/selinux.rb:118:in `get_mcs_label': Argument resolved to a UID too large for MCS set parameters: 921957316561229358039040 (ArgumentError)
	from /usr/sbin/oo-su:77:in `<main>'


Expected results:
return msc label from this name


Additional info:

Comment 1 openshift-github-bot 2013-10-19 02:36:10 UTC
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/fbfaaf1f08dd844c9dbac84f1498971776961c55
Bug 1020997 - Introduce etc_utils.rb

* Add common/lib/openshift-origin-common/utils/etc_utils.rb to safely
  allow the Node and Broker code to map a login name to UNIX user uid
* Add etc_utils to lib include

Comment 2 Xiaoli Tian 2013-10-21 05:39:47 UTC
Verified it on devenv_3921:

Create an gear whose gear name only contains integer number like below:
237981574296734099570688:x:1010:1010:OpenShift guest:/var/lib/openshift/237981574296734099570688:/usr/bin/oo-trap-user

[root@ip-10-191-57-158 ~]# oo-get-mcs-level 237981574296734099570688
s0:c0,c1010


For QE: We need to add a test cases to test the gear name only contains number like above.


Note You need to log in before you can comment on or make changes to this bug.