Bug 25961

Summary: [MFC] rmuser is not case sensitive
Product: Base System Reporter: dan <dan>
Component: binAssignee: Doug Barton <dougb>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description dan 2001-03-21 09:13:25 UTC
>Number:         25961
>Category:       bin
>Synopsis:       rmuser is not case sensitive
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 21 01:20:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Dan Langille
>Release:        FreeBSD 4.3-beta
>Organization:
The FreeBSD Diary
>Environment:
FreeBSD [suppressed].net.au 4.3-BETA FreeBSD 4.3-BETA #0: Mon Mar 12 08:58:20 CST 2001     
root@[suppressed].net.au:/usr/src/sys/compile/PENOLA  i386
>Description:
rmuser is not case sensitive.  It will confirm the user you wish to 
delete, but then it deletes more than one user.
>How-To-Repeat:
adduser JOHN, adduser john, them rmuser john, both users 
are removed.
>Fix:
Linh Pham <lplist@closedsrc.org> reported this in response to my 
post in -questions (200103192332.f2JNWXb68437@ns1.unixathome.org):

In the rmuser script, there is a Search/Replace call that has /io, which
searches in non-case sensitive mode.

Below is a clip of what I have under 4.2-STABLE:

while (<MASTER_PW>) {
	if (not /^\Q$login_name:/io) {
		print NEW_PW;
	} else {
		print STDERR "Dropped entry for $login_name\n" if \
		$debug;

		$skipped = 1;
	}
}

Removing the i would probably resolve the non-case sensitive issue of
rmuser.

>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Comment 1 dan 2001-03-21 09:20:00 UTC
rmuser is not case sensitive.  It will confirm the user you wish to 
delete, but then it deletes more than one user.

Fix: 

Linh Pham <lplist@closedsrc.org> reported this in response to my 
post in -questions (200103192332.f2JNWXb68437@ns1.unixathome.org):

In the rmuser script, there is a Search/Replace call that has /io, which
searches in non-case sensitive mode.

Below is a clip of what I have under 4.2-STABLE:

while (<MASTER_PW>) {
	if (not /^\Q$login_name:/io) {
		print NEW_PW;
	} else {
		print STDERR "Dropped entry for $login_name\n" if \
		$debug;

		$skipped = 1;
	}
}

Removing the i would probably resolve the non-case sensitive issue of
rmuser.
How-To-Repeat: adduser JOHN, adduser john, them rmuser john, both users 
are removed.
Comment 2 lplist 2001-04-11 23:12:26 UTC
I just wanted to clarify my post to -questions:

There is a line in the rmuser script that has:

if (not /^\Q$login_name:/io) {

which should be

if (not /^\Q$login_name:/o) {

since /io does the search in a case-insensitive manner and scans through
the variable only once. /o would make the search case-sensitive... as it
should.

Sorry if this wasn't really clear in my original post.

-- 
Linh Pham
[lplist@closedsrc.org]

// 404b - Brain not found
Comment 3 Dan Langille 2001-04-11 23:21:50 UTC
On 11 Apr 2001, at 15:12, Linh Pham wrote:

> I just wanted to clarify my post to -questions:
> 
> There is a line in the rmuser script that has:
> 
> if (not /^\Q$login_name:/io) {
> 
> which should be
> 
> if (not /^\Q$login_name:/o) {
> 
> since /io does the search in a case-insensitive manner and scans through
> the variable only once. /o would make the search case-sensitive... as it
> should.
> 
> Sorry if this wasn't really clear in my original post.

What you've written above makes sense to me.  Thank you.

-- 
Dan Langille
pgpkey - finger dan@unixathome.org | http://unixathome.org/finger.php
got any work?  I'm looking for some.
Comment 4 Doug Barton freebsd_committer freebsd_triage 2001-04-15 02:44:45 UTC
State Changed
From-To: open->feedback


What benefit is obtained from having two users on the system with the 
same username, differing only by case? Even if it was a benefit of 
some sort, it would likely cause all kinds of other problems. 


Comment 5 Doug Barton freebsd_committer freebsd_triage 2001-04-15 02:44:45 UTC
Responsible Changed
From-To: freebsd-bugs->dougb


I am familiar with the code in question
Comment 6 Dan Langille 2001-04-15 06:13:57 UTC
On 14 Apr 2001, at 18:46, dougb@FreeBSD.org wrote:

> Synopsis: rmuser is not case sensitive
> 
> State-Changed-From-To: open->feedback
> State-Changed-By: dougb
> State-Changed-When: Sat Apr 14 18:44:45 PDT 2001
> State-Changed-Why: 
> 
> What benefit is obtained from having two users on the system with the
> same username, differing only by case? Even if it was a benefit of
> some sort, it would likely cause all kinds of other problems.

The point of the PR is not to make it easier to have two users.  The 
point of the PR is to remove the unexpected behaviour in the case 
where you DO have two users.  I'm not setting administrative policy, 
which is beyond the scope of this PR (i.e. tools not policy).  The script 
asks you if you want to remove a particular user (i.e. the one you 
specified).  You confirm.  Then the script removes both users.  This 
violates POLA.

I think the script is case sensitive for the confirmation but case 
insensitive for the delete.  For consistency, it should use one or the 
other, but not both.  I think case sensitive makes the most sense.  If 
you do wind up with two users with the same name, different case, then 
at least rmuser can be used to remove the one you don't want.

-- 
Dan Langille
pgpkey - finger dan@unixathome.org | http://unixathome.org/finger.php
got any work?  I'm looking for some.
Comment 7 Doug Barton freebsd_committer freebsd_triage 2001-04-15 20:23:01 UTC
State Changed
From-To: feedback->closed


Installations that have two users with the same characters capitalized 
differently should not be using the standard tools, since their situation 
is highly non-standard, and likely to break things. Given that it's hard 
to place POLA on one side or the other of this argument, let's err on 
the side that is most likely to produce working systems for the majority 
of users.
Comment 8 Dan Langille 2001-04-15 20:46:46 UTC
Would someone please reopen this PR?  I don't think we're quite 
finished with the feedback yet.

On 15 Apr 2001, at 12:25, dougb@FreeBSD.org wrote:

> Synopsis: rmuser is not case sensitive
> 
> State-Changed-From-To: feedback->closed

*sigh*

> State-Changed-By: dougb
> State-Changed-When: Sun Apr 15 12:23:01 PDT 2001
> State-Changed-Why: 
> 
> Installations that have two users with the same characters capitalized
> differently should not be using the standard tools, since their situation
> is highly non-standard, and likely to break things. 

You have completely missed my points.  I am not saying that we should 
cater for such installations.  I'm talking about a situation where two 
where two users with the same characters have been created, perhaps 
by accident.  Then they go to delete one.  But rmuser deletes both. 

> Given that it's hard to
> place POLA on one side or the other of this argument, 

It's not hard to place POLA at all.  Look at rmuser alone.  In one section 
of remuser, it is case sensitive ("is this the user do you wish to 
delete?".  In another, it's case insensitive ("OK, I'll delete both users 
now").  This is a bug.  Plain and simple.  It asks if you to delete steve.  
And it deletes both Steve and steve.  That's not right.

> let's err on the side
> that is most likely to produce working systems for the majority of users.

How is fixing this bug going to break anything?

-- 
Dan Langille
pgpkey - finger dan@unixathome.org | http://unixathome.org/finger.php
got any work?  I'm looking for some.
Comment 9 Poul-Henning Kamp 2001-04-15 20:49:45 UTC
I agree with Dan here,  rmuser breaks POLA by being inconsistent.

In message <200104151946.f3FJkme33474@ns1.unixathome.org>, "Dan Langille" write
s:
>Would someone please reopen this PR?  I don't think we're quite 
>finished with the feedback yet.
>
>On 15 Apr 2001, at 12:25, dougb@FreeBSD.org wrote:
>
>> Synopsis: rmuser is not case sensitive
>> 
>> State-Changed-From-To: feedback->closed
>
>*sigh*
>
>> State-Changed-By: dougb
>> State-Changed-When: Sun Apr 15 12:23:01 PDT 2001
>> State-Changed-Why: 
>> 
>> Installations that have two users with the same characters capitalized
>> differently should not be using the standard tools, since their situation
>> is highly non-standard, and likely to break things. 
>
>You have completely missed my points.  I am not saying that we should 
>cater for such installations.  I'm talking about a situation where two 
>where two users with the same characters have been created, perhaps 
>by accident.  Then they go to delete one.  But rmuser deletes both. 
>
>> Given that it's hard to
>> place POLA on one side or the other of this argument, 
>
>It's not hard to place POLA at all.  Look at rmuser alone.  In one section 
>of remuser, it is case sensitive ("is this the user do you wish to 
>delete?".  In another, it's case insensitive ("OK, I'll delete both users 
>now").  This is a bug.  Plain and simple.  It asks if you to delete steve.  
>And it deletes both Steve and steve.  That's not right.
>
>> let's err on the side
>> that is most likely to produce working systems for the majority of users.
>
>How is fixing this bug going to break anything?
>
>-- 
>Dan Langille
>pgpkey - finger dan@unixathome.org | http://unixathome.org/finger.php
>got any work?  I'm looking for some.
>
>To Unsubscribe: send mail to majordomo@FreeBSD.org
>with "unsubscribe freebsd-bugs" in the body of the message
>

--
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk@FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.
Comment 10 Doug Barton freebsd_committer freebsd_triage 2001-04-15 20:51:08 UTC
State Changed
From-To: closed->analyzed


There is disagreement as to the right thing to do 


Comment 11 Doug Barton freebsd_committer freebsd_triage 2001-04-15 20:51:08 UTC
Responsible Changed
From-To: dougb->phk


phk volunteered to head this up by virtue of comments from the peanut gallery
Comment 12 Alfred Perlstein freebsd_committer freebsd_triage 2001-04-15 21:01:15 UTC
Responsible Changed
From-To: phk->alfred

Because this wasn't all the much of a big deal in the first place.
Comment 13 David E. O'Brien freebsd_committer freebsd_triage 2001-04-15 21:03:50 UTC
State Changed
From-To: analyzed->closed

fixed.  Geez!
Comment 14 DougB 2001-04-15 21:04:50 UTC
Dan Langille wrote:

> You have completely missed my points. 

	Don't make the mistake of thinking that becuase I don't agree with you I
couldn't possibly have understood what you said. I do understand exactly
what you're saying, and I think that you are wrong. However, the mass of
public opinion is on the side of maintaining case sensitivity. Go figure.
Comment 15 Doug Barton freebsd_committer freebsd_triage 2001-04-15 21:44:33 UTC
State Changed
From-To: closed->analyzed


I committed a better fix, and will MFC it after the freeze. 


Comment 16 Doug Barton freebsd_committer freebsd_triage 2001-04-15 21:44:33 UTC
Responsible Changed
From-To: alfred->dougb


There was a time, not too long ago, when people on this project knew 
how to take a joke.
Comment 17 Dan Langille 2001-04-15 22:39:24 UTC
On 15 Apr 2001, at 13:04, Doug Barton wrote:

> Dan Langille wrote:
> 
> > You have completely missed my points. 
> 
>  Don't make the mistake of thinking that becuase I don't agree with you I
> couldn't possibly have understood what you said. I do understand exactly
> what you're saying, and I think that you are wrong.

That's not why I thought you didn't understand.

> However, the mass of
> public opinion is on the side of maintaining case sensitivity. Go figure.

Don't get me wrong.  I don't create mixed case users.  I inherited a 
system such a system.  I removed one.  I lost two.

cheers.

-- 
Dan Langille
pgpkey - finger dan@unixathome.org | http://unixathome.org/finger.php
got any work?  I'm looking for some.
Comment 18 Doug Barton freebsd_committer freebsd_triage 2001-04-23 07:53:13 UTC
State Changed
From-To: analyzed->closed


Fix MFC'ed.