Bug 62084 - username or groupname with spaces = /etc/bashrc error
username or groupname with spaces = /etc/bashrc error
Status: CLOSED NOTABUG
Product: Red Hat Public Beta
Classification: Retired
Component: bash (Show other bugs)
skipjack-beta1
All Linux
medium Severity low
: ---
: ---
Assigned To: wdovlrrw
Ben Levenson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-03-27 04:51 EST by Adam Gibson
Modified: 2007-04-18 12:41 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-06-10 10:54:51 EDT
Type: ---
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 Adam Gibson 2002-03-27 04:51:35 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 Galeon/1.2.0 (X11; Linux i686; U;) Gecko/20020311

Description of problem:
This issue happens with all versions of redhat from 7.1 I have tested lately up
to the current skipjack beta(beta 1 at this time).  When your group name has
spaces in it "Domain Admin", the /etc/bashrc file will show the error below when
evaluating the group name in the bashrc script itself.

[: too many arguments

user's user name is "DOMAIN+username"
user's group name is "Domain Admins"

[static@leeloo static]$ ssh -4 DOMAIN+username@hostname
DOMAIN+username@10.10.20.66's password: 
Last login: Mon Mar 25 22:49:12 2002
[: too many arguments
[DOMAIN+username@hostname somedirectory]$


The problem is that the line below in /etc/bashrc does a string compare on the
group name result of `id -gn` and `id -un` but does not not put quotes around
the two.
if [ `id -gn` = `id -un` -a `id -u` -gt 99 ]; then


Simple fixed line:
if [ "`id -gn`" = "`id -un`" -a `id -u` -gt 99 ]; then

I did not do a search for any other issues like this yet but assume there have
to be a few more things like this.

This problem was discovered while using winbindd which maps windows users/groups
to unix.


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


How reproducible:
Always

Steps to Reproduce:
1. create a username or groupname with a space in the name
2. login :)
3. watch the error from /etc/bashrc appear

	

Actual Results:  Got the error:

[: too many arguments

as i logged in.

Expected Results:  not to get an error? :)

Additional info:
Comment 1 Bernhard Rosenkraenzer 2002-06-10 10:54:45 EDT
Spaces are not valid characters in a user and group name. 
If winbindd creates users/groups with spaces in them, winbindd needs fixing.

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