Bug 62084 - username or groupname with spaces = /etc/bashrc error
Summary: username or groupname with spaces = /etc/bashrc error
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Public Beta
Classification: Retired
Component: bash
Version: skipjack-beta1
Hardware: All
OS: Linux
medium
low
Target Milestone: ---
Assignee: wdovlrrw
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-03-27 09:51 UTC by static
Modified: 2007-04-18 16:41 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2002-06-10 14:54:51 UTC
Embargoed:


Attachments (Terms of Use)

Description static 2002-03-27 09:51:35 UTC
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.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 14:54:45 UTC
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.