From dima@unixfreak.org  Mon Jan 15 22:32:10 2001
Return-Path: <dima@unixfreak.org>
Received: from bazooka.unixfreak.org (bazooka.unixfreak.org [63.198.170.138])
	by hub.freebsd.org (Postfix) with ESMTP id 2FA7137B400
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 15 Jan 2001 22:32:10 -0800 (PST)
Received: from hornet.unixfreak.org (hornet [63.198.170.140])
	by bazooka.unixfreak.org (Postfix) with ESMTP id B284E3E02
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 15 Jan 2001 22:32:09 -0800 (PST)
Received: (from dima@localhost)
	by hornet.unixfreak.org (8.11.1/8.11.1) id f0G6W9v43972;
	Mon, 15 Jan 2001 22:32:09 -0800 (PST)
	(envelope-from dima)
Message-Id: <200101160632.f0G6W9v43972@hornet.unixfreak.org>
Date: Mon, 15 Jan 2001 22:32:09 -0800 (PST)
From: dima@unixfreak.org
Reply-To: dima@unixfreak.org
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] (cosmetic) -current send-pr breaks NIS support
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         24372
>Category:       gnu
>Synopsis:       [PATCH] (cosmetic) -current send-pr breaks NIS support
>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:   Mon Jan 15 22:40:01 PST 2001
>Closed-Date:    Wed May 23 20:49:52 PDT 2001
>Last-Modified:  Wed May 23 20:51:08 PDT 2001
>Originator:     Dima Dorfman
>Release:        FreeBSD 5.0-20010101-CURRENT i386
>Organization:
Private
>Environment:
System: FreeBSD spike.unixfreak.org 5.0-20010101-CURRENT FreeBSD 5.0-20010101-CURRENT #6: Tue Jan 2 03:14:04 PST 2001 dima@spike.unixfreak.org:/usr/home/dima/w/f/src/sys/compile/SPIKE i386

>Description:

send-pr on -current uses `cat /etc/passwd` when looking for the
default name for the ``Originator'' field.  If the user filing the
problem report doesn't have a local account (authenticated via NIS,
for example), the field will be left blank.

Of course, one can always set the field manually, but this works in
RELENG_4, so why shouldn't it work in 5-CURRENT?

>How-To-Repeat:

Sign on using an account authenticated via NIS or anything which
doesn't require an entry in the local password database, then do:

	send-pr -P | grep '^>Originator'

and notice how the field is blank.  Now sign on with a local account,
repeat the above command, and notice how your name appears.

>Fix:

The following patch employs a different method from that in RELENG_4.
The latter uses something to the effect of,

	ypcat passwd | cat - /etc/passwd

which fixes the problem, but is not the Right Way(tm).  The following
patch uses pw(8) to do the dirty work.

Index: send-pr.sh
===================================================================
RCS file: /st/src/FreeBSD/src/gnu/usr.bin/send-pr/send-pr.sh,v
retrieving revision 1.20
diff -u -r1.20 send-pr.sh
--- send-pr.sh	2000/10/29 22:11:39	1.20
+++ send-pr.sh	2001/01/16 06:23:59
@@ -58,8 +58,8 @@
 # host-dependent.
 MAIL_AGENT="${MAIL_AGENT:-/usr/sbin/sendmail -oi -t}"
 
-# How to read the passwd database.
-PASSWD="cat /etc/passwd"
+# Path to pw(8)
+PW="/usr/sbin/pw"
 
 ECHON=bsd
 
@@ -97,7 +97,7 @@
   PTEMP=`mktemp -t p` || exit 1
   # Must use temp file due to incompatibilities in quoting behavior
   # and to protect shell metacharacters in the expansion of $LOGNAME
-  $PASSWD | grep "^$LOGNAME:" | awk -F: '{print $5}' | sed -e 's/,.*//' > $PTEMP
+  $PW usershow $LOGNAME | awk -F: '{ print $8 }' | sed -e 's/,.*//' > $PTEMP
   ORIGINATOR="`cat $PTEMP`"
   rm -f $PTEMP
 fi


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: dd 
State-Changed-When: Wed May 23 20:49:52 PDT 2001 
State-Changed-Why:  
Committed my own patch. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=24372 
>Unformatted:
