From nobody@FreeBSD.org  Mon Sep  2 00:49:32 2002
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 90A8137B400
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  2 Sep 2002 00:49:32 -0700 (PDT)
Received: from www.freebsd.org (www.FreeBSD.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id B058F43EB1
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  2 Sep 2002 00:48:57 -0700 (PDT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.4/8.12.4) with ESMTP id g827l1OT082171
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 2 Sep 2002 00:47:01 -0700 (PDT)
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.4/8.12.4/Submit) id g827l1ga082170;
	Mon, 2 Sep 2002 00:47:01 -0700 (PDT)
Message-Id: <200209020747.g827l1ga082170@www.freebsd.org>
Date: Mon, 2 Sep 2002 00:47:01 -0700 (PDT)
From: Jay Chuang <jay@embeddedos.com.tw>
To: freebsd-gnats-submit@FreeBSD.org
Subject: chpass bug 
X-Send-Pr-Version: www-1.0

>Number:         42315
>Category:       i386
>Synopsis:       chpass bug
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep 02 00:50:01 PDT 2002
>Closed-Date:    Wed Sep 04 08:29:40 PDT 2002
>Last-Modified:  Wed Sep 04 08:29:40 PDT 2002
>Originator:     Jay Chuang
>Release:        4.6.2
>Organization:
STEPTECH
>Environment:
FreeBSD jay.eflash.com.tw 4.6.2-RELEASE FreeBSD 4.6.2-RELEASE #7: Thu Aug 29 14:10:12 CST 2002     rd@jay.eflash.com.tw:/usr/src/sys/compile/KEVIN  i386

>Description:
      chpass bug 
>How-To-Repeat:
bug 1: source /usr/src/usr.sbin/vipw/pw_util.c
int
pw_tmp()
{
        static char path[MAXPATHLEN];
        int fd;
        char *p;

        if ((p = strrchr(masterpasswd, '/')) == NULL)
                strcpy(path, "pw.XXXXXX");
        else
                if (snprintf(path, sizeof path, "%.*s/pw.XXXXXX",
                    (int)(p - masterpasswd), masterpasswd) >= sizeof path)
                        errx(1, "%s: path too long", masterpasswd);
        if ((fd = mkstemp(path)) == -1)
                err(1, "%s", path);
        tempname = path;
        return (fd);
}

bug 2 : source  /usr/src/usr.bin/chpass/chpass.c

    210         if (op == LOADENTRY) {
    211                 if (uid)
    212                         baduser();
    213                 pw = &lpw;
    214                 if (!pw_scan(arg, pw))
    215                         exit(1);
    216         }

>Fix:
bug 1 Fix : change function strchr to strrch
bug 1 Fix : add "old_pw = *pw;" after line 215 
>Release-Note:
>Audit-Trail:

From: Mike Makonnen <makonnen@pacbell.net>
To: Jay Chuang <jay@embeddedos.com.tw>
Cc: freebsd-gnats-submit@FreeBSD.ORG, des@FreeBSD.ORG
Subject: Re: i386/42315: chpass bug
Date: Mon, 02 Sep 2002 03:21:16 -0700

 [CCing des@freebsd.org]
 
 On Mon, 02 Sep 2002 00:47:01 -0700 (PDT)
 Jay Chuang <jay@embeddedos.com.tw> wrote:
 
 
 Speaking for myself, please include a brief description of the problem
 in the future.
 
 > 
 > >Fix:
 > bug 1 Fix : change function strchr to strrch
 
 Looks like this one was a typo by des in
    src/usr.sbin/vipw/pw_util.c,v 1.17.2.3 2002/07/14 13:12:04 des Exp $
 
 Index: usr.sbin/vipw/pw_util.c
 ===================================================================
 RCS file: /home/ncvs/src/usr.sbin/vipw/Attic/pw_util.c,v
 retrieving revision 1.17.2.3
 diff -u -r1.17.2.3 pw_util.c
 --- usr.sbin/vipw/pw_util.c	14 Jul 2002 13:12:04 -0000	1.17.2.3
 +++ usr.sbin/vipw/pw_util.c	2 Sep 2002 10:10:34 -0000
 @@ -148,7 +148,7 @@
  	int fd;
  	char *p;
  
 -	if ((p = strchr(masterpasswd, '/')) == NULL)
 +	if ((p = strrchr(masterpasswd, '/')) == NULL)
  		strcpy(path, "pw.XXXXXX");
  	else
  		if (snprintf(path, sizeof path, "%.*s/pw.XXXXXX",
 
 
 >
 > bug 1 Fix : add "old_pw = *pw;" after line 215 
 
 Upgrade to RELENG_4 (stable) or alternately retrieve
    src/usr.bin/chpass/chpass.c,v 1.16.2.3 2002/07/12 05:33:34 cjc Exp $
 which, I believe has a better fix. This was fixed after 4.6.2 RELEASE.
 
 
 Cheers,
 Mike Makonnen
State-Changed-From-To: open->closed 
State-Changed-By: des 
State-Changed-When: Wed Sep 4 08:29:37 PDT 2002 
State-Changed-Why:  
Fixed, thanks. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=42315 
>Unformatted:
