-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow UID to be returned by the mapper script. #3795
Merged
Merged
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
fcd2187
Allow UID to be returned by the mapper script. Using a UID is useful …
guruevi e57ce02
Use POSIX call, should be faster than running a command.
guruevi 740bcfe
Fix various side cases (see comments)
guruevi 9196987
Benchmarked and optimized.
guruevi 330e174
Negative condition in control flow statement
guruevi f9dbc36
Merge branch 'master' of https://github.com/OSC/ondemand
guruevi e4fa9ff
Merge branch 'OSC:master' into master
guruevi f8a4bdf
Merge branch 'master' of https://github.com/OSC/ondemand
guruevi 06a37d4
Merge branch 'master' of https://github.com/guruevi/ondemand
guruevi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why check the first character here -
user[0]
?"123jeff".to_i
returns123
and"jeff123".to_i
returns 0.Maybe we need a regex to account for the case when
user
is a proper username that just happens to start with a number. Maybeuser.to_s.chomp.match?(/\A\d+\Z/)
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usernames are illegal to start with numbers per the POSIX standard (^[a-z][-a-z0-9]*$").
I was of the impression there were cases that certain strings could return numbers (I am not a Ruby expert), but you are correct, just user.to_i > 0 is shorter. I am away from the desk, but I will change that soon. I didn't want to do a regexp because of the overhead of parsing regexp.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If only this were true! Or at least, if only all Linux distros adhered to it. Here I just hopped into a rocky 9 container and made the
123jeff
user without any issue.And just for kicks - there's the
--badname
flag (lol)I just went through this with #3753 having to account for
@
in usernames.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put a new version up that works in various test I did and this will 'fall through' if someone out there has all-number login as their user name.
I also found a bug in the group conversion. Eg "domain users" is a group name that SSSD can return. So again, I used number id and then map them to an array of strings using Etc.