From owner-freebsd-bugs Wed Sep 2 23:20:18 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id XAA25447 for freebsd-bugs-outgoing; Wed, 2 Sep 1998 23:20:18 -0700 (PDT) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id XAA25387 for ; Wed, 2 Sep 1998 23:20:09 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id XAA00934; Wed, 2 Sep 1998 23:20:02 -0700 (PDT) Received: (from nobody@localhost) by hub.freebsd.org (8.8.8/8.8.8) id XAA24165; Wed, 2 Sep 1998 23:14:50 -0700 (PDT) (envelope-from nobody) Message-Id: <199809030614.XAA24165@hub.freebsd.org> Date: Wed, 2 Sep 1998 23:14:50 -0700 (PDT) From: nis@pluto.dti.ne.jp To: freebsd-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: www-1.0 Subject: bin/7817: pw(8) doesn't work correctly with random passwd generation option Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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