Bug 1020997 - selinux.rb#get_mcs_label assumes integer name is uid
selinux.rb#get_mcs_label assumes integer name is uid
Status: CLOSED CURRENTRELEASE
Product: OpenShift Online
Classification: Red Hat
Component: Containers (Show other bugs)
2.x
Unspecified Unspecified
high Severity high
: ---
: ---
Assigned To: Jhon Honce
libra bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-18 13:54 EDT by Jhon Honce
Modified: 2015-05-14 19:30 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-01-23 22:25:23 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jhon Honce 2013-10-18 13:54:52 EDT
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-18 22:36:10 EDT
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 01:39:47 EDT
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.