Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Jan 2001 22:32:09 -0800 (PST)
From:      dima@unixfreak.org
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   gnu/24372: [PATCH] (cosmetic) -current send-pr breaks NIS support
Message-ID:  <200101160632.f0G6W9v43972@hornet.unixfreak.org>

next in thread | raw e-mail | index | archive | help

>Number:         24372
>Category:       gnu
>Synopsis:       [PATCH] (cosmetic) -current send-pr breaks NIS support
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan 15 22:40:01 PST 2001
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200101160632.f0G6W9v43972>