Subject: bin/2247: mail does gives disturbing and uninformative diagnostics.
To: None <gnats-bugs@NetBSD.ORG>
From: Peter Seebach <seebs@taniemarie.solon.com>
List: netbsd-bugs
Date: 03/21/1996 18:15:36
>Number:         2247
>Category:       bin
>Synopsis:       mail calls you "ubluit" if it can't find you.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 21 19:35:03 1996
>Last-Modified:
>Originator:     Peter Seebach
>Organization:
Usenet Fact Police (Undercover)
>Release:        Mar 8 1996
>Environment:
System: NetBSD taniemarie 1.1A NetBSD 1.1A (SEEBS) #0: Sat Mar 9 11:19:31 CST 1996 seebs@taniemarie:/usr/src/sys/arch/amiga/compile/SEEBS amiga


>Description:
If /bin/mail can't identify you, it calls you "ubluit" without further
diagnostics.

While we're at it, one of the comments is ludicrously out of date.

>How-To-Repeat:
Run mail when your user id is invalid, but I'm not sure how I did this.

I tested by removing the passwd entry for an account while using it.

The original discovery was an accident.

Or just read the code.

>Fix:
Apply this patch in /usr/src/usr.bin/mail

*** getname.old	Thu Mar 21 18:08:36 1996
--- getname.c	Thu Mar 21 18:09:02 1996
***************
*** 43,50 ****
  /* Getname / getuserid for those with hashed passwd data base). */
  
  /*
!  * Search the passwd file for a uid.  Return name through ref parameter
!  * if found, indicating success with 0 return.  Return -1 on error.
   */
  char *
  getname(uid)
--- 43,49 ----
  /* Getname / getuserid for those with hashed passwd data base). */
  
  /*
!  * Return the name associated with a userid.
   */
  char *
  getname(uid)
*** temp.old	Thu Mar 21 18:00:19 1996
--- temp.c	Thu Mar 21 18:04:09 1996
***************
*** 81,87 ****
  		}
  	} else {
  		if ((cp = username()) == NOSTR) {
! 			myname = "ubluit";
  			if (rcvmode) {
  				printf("Who are you!?\n");
  				exit(1);
--- 81,87 ----
  		}
  	} else {
  		if ((cp = username()) == NOSTR) {
! 			myname = "nobody";
  			if (rcvmode) {
  				printf("Who are you!?\n");
  				exit(1);
*** v7.local.old	Thu Mar 21 18:03:47 1996
--- v7.local.c	Thu Mar 21 18:09:52 1996
***************
*** 86,90 ****
  
  	if ((np = getenv("USER")) != NOSTR)
  		return np;
! 	return getname(getuid());
  }
--- 86,94 ----
  
  	if ((np = getenv("USER")) != NOSTR)
  		return np;
! 	if ((np = getname(getuid())) != NOSTR)
! 		return np;
! 	fprintf(stderr, "Help!  I can't tell who you are, uid %d!\n",
! 		(int) getuid());
! 	return NULL;
  }
>Audit-Trail:
>Unformatted: