Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Sep 1998 23:14:50 -0700 (PDT)
From:      nis@pluto.dti.ne.jp
To:        freebsd-gnats-submit@FreeBSD.ORG
Subject:   bin/7817: pw(8) doesn't work correctly with random passwd generation option
Message-ID:  <199809030614.XAA24165@hub.freebsd.org>

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

>Number:         7817
>Category:       bin
>Synopsis:       pw(8) doesn't work correctly with random passwd generation option
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Sep  2 23:20:02 PDT 1998
>Last-Modified:
>Originator:     Hiroshi Nishikawa
>Organization:
Nishikawa System
>Release:        2.2.1-RELEASE
>Environment:
FreeBSD goose.localhost 2.2.1-RELEASE FreeBSD 2.2.1-RELEASE #0: Sun Apr 12 09:09
:14 JST 1998     root@pc01.lan:/usr/src/sys/compile/NIS  i386
>Description:
pw(8) often generates an shorter password than eight letters when I try 
random password generation option.
>How-To-Repeat:
Place 'defaultpasswd = "random"' in /etc/pw.conf and execute 'pw useradd
-n name'.
>Fix:
The functiton 'pw_password' in /usr/src/usr.sbin/pw/pw_user.c should be fixed.

*** /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';

                /*
--- 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';

                /*

>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?199809030614.XAA24165>