diff options
| author | jdennis <jdennis@c9f7a03b-bd48-0410-a16d-cbbf54688b0b> | 2010-11-19 20:38:11 +0000 |
|---|---|---|
| committer | jdennis <jdennis@c9f7a03b-bd48-0410-a16d-cbbf54688b0b> | 2010-11-19 20:38:11 +0000 |
| commit | dc7c8dc30d495e21396d32bafcce716b13e32369 (patch) | |
| tree | 05db7d5e6745e1350e4fa6f62c9fadeea02123b1 /pki/base/silent/src/http/HTTPClient.java | |
| parent | 9fb39ced3de25669ae724d2dff61212d12d24976 (diff) | |
Fix utilities related to UNIX group operations
The Perl functions getgrnam, getpwnam, etc. in a scalar context return
the undef value if the name wasn't found and an empty list in an array
context. Therefore the test for equality to the empty string is not
correct, the test should be if the value is defined.
Replace use of backtick shell invocation with run_command() (see
earlier patch)
The function user_is_a_member_of_group() was not implemented
correctly. There were two fundamental problems:
1) It failed to take the primary group into account, see comments in
the code for an explanation.
2) It tested the username against group members using a regular
expression which incorrectly identified substrings as matches.
The test was:
$members =~ m/$username/;
where $members was a space separated list of user names. However the
regular expression did not match on word boundaries, therefore any
substring would produce a false positive. For example if the username
was "foo" and the $members string was "barfl foobar blatz" the test
would succeed because it found "foo" as a substring of "foobar" but
"foo" != "foobar". The test was rewritten to split the string into
individual names and test for equality on each name, it's a more
robust test and more obvious to the reader.
The member regular expression test had to also be fixed in the
add_user_as_a_member_of_group() function as well.
git-svn-id: svn+ssh://svn.fedorahosted.org/svn/pki/trunk@1544 c9f7a03b-bd48-0410-a16d-cbbf54688b0b
Diffstat (limited to 'pki/base/silent/src/http/HTTPClient.java')
0 files changed, 0 insertions, 0 deletions
