Bug 7817 - pw(8) doesn't work correctly with random passwd generation option
Summary: pw(8) doesn't work correctly with random passwd generation option
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 2.2.1-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 1998-09-03 07:20 UTC by nis
Modified: 1999-01-02 04:45 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description nis 1998-09-03 07:20:02 UTC
pw(8) often generates an shorter password than eight letters when I try 
random password generation option.

Fix: The functiton 'pw_password' in /usr/src/usr.sbin/pw/pw_user.c should be fixed.



/*
--- 903,909 ----
                l = (random() % 8 + 8); /* 8 - 16 chars */
                pw_getrand(rndbuf, l);
                for (i = 0; i < l; i++)
!                       pwbuf[i] = chars[rndbuf[i] % (sizeof(chars)-1)];
                pwbuf[i] = '\0';

                /*--StWMFHSx4x5VFzRZj7BlPeAXuMTgoD3MMiJfQXDtQkWYzWTS
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

*** /usr/src/usr.sbin/pw/pw_user.c      Tue Sep  1 20:02:14 1998
--- /usr/src/usr.sbin/pw/pw_user.c      Thu Sep  3 13:25:02 1998
***************
*** 903,909 ****
                l = (random() % 8 + 8); /* 8 - 16 chars */
                pw_getrand(rndbuf, l);
                for (i = 0; i < l; i++)
!                       pwbuf[i] = chars[rndbuf[i] % sizeof(chars)];
                pwbuf[i] = '\0';
How-To-Repeat: Place 'defaultpasswd = "random"' in /etc/pw.conf and execute 'pw useradd
-n name'.
Comment 1 bill fumerola freebsd_committer freebsd_triage 1999-01-02 04:43:52 UTC
State Changed
From-To: open->closed

updated in HEAD(1.24) and RELENG_2_2(1.1.1.1.2.11) src/usr.sbin/pw/pw_user.c 
Sat Jan 2 4:37:46 1999 UTC by billf