*BSD News Article 18319


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!haven.umd.edu!uunet!cs.utexas.edu!milano!uudell!obiwan!bob
From: bob@obiwan.uucp (Bob Willcox)
Newsgroups: comp.os.386bsd.bugs
Subject: Problem w/passwd for user w/o a password w/patch
Message-ID: <CA18x3.AB0@obiwan.uucp>
Date: 12 Jul 93 03:41:13 GMT
Organization: Bob's Place
Lines: 35

I had this little problem with the passwd command when a user was
trying to add a password and they currently did not have one.
Seems that passwd does not take into account the empty old password
case.  Below is a patch for the probem that works for me.

Bob


===================================================================
RCS file: /usr/src/usr.bin/passwd/RCS/local_passwd.c,v
retrieving revision 1.1
diff -c -r1.1 /usr/src/usr.bin/passwd/local_passwd.c
*** /tmp/,RCSt1013337	Sun Jul 11 22:39:18 1993
--- /usr/src/usr.bin/passwd/local_passwd.c	Sun Jul 11 22:30:53 1993
***************
*** 91,97 ****
  
  	(void)printf("Changing local password for %s.\n", pw->pw_name);
  
! 	if (uid && pw->pw_passwd &&
  #ifdef DES
  	    strcmp(crypt(getpass("Old password:"), pw->pw_passwd),
  	    pw->pw_passwd)) {
--- 91,97 ----
  
  	(void)printf("Changing local password for %s.\n", pw->pw_name);
  
! 	if (uid && pw->pw_passwd && *pw->pw_passwd &&
  #ifdef DES
  	    strcmp(crypt(getpass("Old password:"), pw->pw_passwd),
  	    pw->pw_passwd)) {
-- 
Bob Willcox                ...!{rutgers|ames}!cs.utexas.edu!uudell!obiwan!bob
Phone: 512 258-4224 (home)
       512 838-3914 (work)