NetBSD Problem Report #789

From gnats  Wed Feb  8 05:35:06 1995
Received: from pain.lcs.mit.edu (pain.lcs.mit.edu [128.52.46.239]) by sun-lamp.cs.berkeley.edu (8.6.9/8.6.9) with ESMTP id FAA00753 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Wed, 8 Feb 1995 05:35:05 -0800
Message-Id: <199502080809.AAA01294@antie.nas.nasa.gov>
Date: Wed, 8 Feb 1995 00:09:50 -0800
From: Jason Thorpe <thorpej@nas.nasa.gov>
Reply-To: thorpej@nas.nasa.gov
To: gnats-bugs@NetBSD.ORG
Subject: `passwd -y' doesn't send old password correctly
X-Send-Pr-Version: 3.2

>Number:         789
>Category:       bin
>Synopsis:       `passwd -y' doesn't send old password correctly
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 08 05:50:02 +0000 1995
>Closed-Date:    Wed Feb 08 20:23:17 +0000 1995
>Last-Modified:  
>Originator:     Jason Thorpe
>Release:        -current of Feb 6
>Organization:
Numerical Aerodynamic Simulation Project - NASA Ames
>Environment:

System: NetBSD antie 1.0A NetBSD 1.0A (ANTIE) #5: Tue Feb 7 14:14:26 PST 1995 thorpej@antie:/work/netbsd/src/sys/arch/i386/compile/ANTIE i386


>Description:
	`passwd -y' is supposed to send the old password to rpc.yppasswdd
	for authentication purposes.  Instead, it is currently sending
	an empty string.
>How-To-Repeat:
	% passwd -y
>Fix:
===================================================================
RCS file: /mastersrc/netbsd/src/usr.bin/passwd/yp_passwd.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 yp_passwd.c
*** 1.1.1.1	1995/02/02 06:05:27
--- yp_passwd.c	1995/02/08 08:01:05
***************
*** 200,209 ****
  				   errno = EACCES;
  				   pw_error(NULL, 1, 1);
  		} else {
  			p = "";
  		}
- 
- 		*old_pass = strdup(p);
  	}
  	for (buf[0] = '\0', tries = 0;;) {
  		p = getpass("New password:");
--- 200,208 ----
  				   errno = EACCES;
  				   pw_error(NULL, 1, 1);
  		} else {
+ 			*old_pass = strdup(p);
  			p = "";
  		}
  	}
  	for (buf[0] = '\0', tries = 0;;) {
  		p = getpass("New password:");
>Release-Note:
>Audit-Trail:

From: phil@cs.wwu.edu (Phil Nelson)
To: thorpej@nas.nasa.gov
Subject: Re: bin/789: `passwd -y' doesn't send old password correctly
Date: Wed, 8 Feb 95 08:34:21 PST


 I don't agree with this fix.  The suggested code change changes my last
 "fix."  The suggested fix will reintroduce the previous segmentation fault
 on changing an empty password.

 >  				   errno = EACCES;
 >  				   pw_error(NULL, 1, 1);
 >  		} else {
 >+ 			*old_pass = strdup(p);
 >  			p = "";
 >  		}
 >  	}

 I think the following fix is correct.

 *** yp_passwd.c.ori	Wed Feb  8 08:25:14 1995
 --- yp_passwd.c	Wed Feb  8 08:26:47 1995
 ***************
 *** 194,204 ****
   	if (old_pass) {
   		*old_pass = NULL;

 ! 		if (pw->pw_passwd[0] &&
 ! 		    strcmp(crypt(p = getpass("Old password:"), pw->pw_passwd),
 ! 			   pw->pw_passwd)) {
 ! 				   errno = EACCES;
 ! 				   pw_error(NULL, 1, 1);
   		} else {
   			p = "";
   		}
 --- 194,205 ----
   	if (old_pass) {
   		*old_pass = NULL;

 ! 		if (pw->pw_passwd[0]) {
 ! 			if (strcmp(crypt(p = getpass("Old password:"),
 ! 					 pw->pw_passwd), pw->pw_passwd)) {
 ! 				errno = EACCES;
 ! 				pw_error(NULL, 1, 1);
 ! 			}
   		} else {
   			p = "";
   		}


 --Phil

State-Changed-From-To: open->closed 
State-Changed-By: phil 
State-Changed-When: Wed Feb 8 12:23:17 PST 1995 
State-Changed-Why:  
Phil's fix was checked in. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.