From dima@unixfreak.org  Sun Feb 18 02:59:25 2001
Return-Path: <dima@unixfreak.org>
Received: from bazooka.unixfreak.org (bazooka.unixfreak.org [63.198.170.138])
	by hub.freebsd.org (Postfix) with ESMTP id 8AE3E37B491
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 18 Feb 2001 02:59:24 -0800 (PST)
Received: from hornet.unixfreak.org (hornet [63.198.170.140])
	by bazooka.unixfreak.org (Postfix) with ESMTP id 25BB83E0D
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 18 Feb 2001 02:59:24 -0800 (PST)
Received: (from dima@localhost)
	by hornet.unixfreak.org (8.11.1/8.11.1) id f1IAxN195336;
	Sun, 18 Feb 2001 02:59:23 -0800 (PST)
	(envelope-from dima)
Message-Id: <200102181059.f1IAxN195336@hornet.unixfreak.org>
Date: Sun, 18 Feb 2001 02:59:23 -0800 (PST)
From: dima@unixfreak.org
Reply-To: dima@unixfreak.org
To: FreeBSD-gnats-submit@freebsd.org
Subject: [PATCH] pw(8) seg faults; man page doesn't document lock feature
X-Send-Pr-Version: 3.2

>Number:         25187
>Category:       bin
>Synopsis:       [PATCH] pw(8) seg faults; man page doesn't document lock feature
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    dd
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Feb 18 03:00:02 PST 2001
>Closed-Date:    Wed Apr 25 19:24:51 PDT 2001
>Last-Modified:  Wed Apr 25 19:25:01 PDT 2001
>Originator:     Dima Dorfman
>Release:        FreeBSD 4.2-20010102-STABLE i386
>Organization:
Private
>Environment:

pw(8) since October 1999.  Tested on 3.5-STABLE, 4.2-STABLE, and
5.0-CURRENT (about a month old).  Patch below applies to 4-STABLE and
5-CURRENT.

>Description:

When the user locking feature was added to pw(8), the help text in the
program and the manual page were not ammended.  The former problem
causes a segmentation fault due to an out-of-range array index when
trying to do `pw (un)lock help`.  The latter, combined with the
former, makes it unnecessarily difficult to figure out what lock and
unlock do.

>How-To-Repeat:

dima@hornet% /usr/sbin/pw lock help
Segmentation fault (core dumped)
dima@hornet% /usr/sbin/pw unlock help
Segmentation fault (core dumped)

>Fix:

The following patch,
  - documents the 'lock' and 'unlock' commands in the pw.8 manual page,
  - adds help text to pw.c which prevents the segmentation fault, and
  - mentions, in the built-in help, that the '-q' option is accepted
    for the 'usernext' and 'groupnext' commands (not entirely relevant
    to this problem).

Index: pw.8
===================================================================
RCS file: /st/src/FreeBSD/src/usr.sbin/pw/pw.8,v
retrieving revision 1.21
diff -u -r1.21 pw.8
--- pw.8	2001/02/01 16:43:57	1.21
+++ pw.8	2001/02/13 23:50:32
@@ -169,6 +169,18 @@
 .Ar groupnext
 .Op Fl C Ar config
 .Op Fl q
+.Nm
+.Op Fl V Ar etcdir
+.Ar lock
+.Op name|uid
+.Op Fl C Ar config
+.Op Fl q
+.Nm
+.Op Fl V Ar etcdir
+.Ar unlock
+.Op name|uid
+.Op Fl C Ar config
+.Op Fl q
 .Sh DESCRIPTION
 .Nm Pw
 is a command-line based editor for the system
@@ -758,6 +770,26 @@
 The command
 .Ar groupnext
 returns the next available group id on standard output.
+.Sh USER LOCKING
+.Nm Pw
+supports a simple password locking mechanism for users; it works by
+prepending the string
+.Ql *LOCKED*
+to the beginning of the password field in
+.Pa master.passwd
+to prevent successful authentication.
+.Pp
+The
+.Ar lock
+and
+.Ar unlock
+commands take a user name or uid of the account to lock or unlock,
+respectively.  The
+.Ql Fl V ,
+.Ql Fl C ,
+and
+.Ql Fl q
+options as described above are accepted by these commands.
 .Sh DIAGNOSTICS
 .Nm Pw
 returns EXIT_SUCCESS on successful operation, otherwise 
Index: pw.c
===================================================================
RCS file: /st/src/FreeBSD/src/usr.sbin/pw/pw.c,v
retrieving revision 1.23
diff -u -r1.23 pw.c
--- pw.c	2000/12/29 18:04:49	1.23
+++ pw.c	2001/02/13 23:16:03
@@ -370,6 +370,15 @@
 				"usage: pw usernext [switches]\n"
 				"\t-V etcdir      alternate /etc location\n"
 				"\t-C config      configuration file\n"
+				"\t-q             quiet operation\n",
+				"usage pw: lock [switches]\n"
+				"\t-V etcdir      alternate /etc locations\n"
+				"\t-C config      configuration file\n"
+				"\t-q             quiet operation\n",
+				"usage pw: unlock [switches]\n"
+				"\t-V etcdir      alternate /etc locations\n"
+				"\t-C config      configuration file\n"
+				"\t-q             quiet operation\n"
 			},
 			{
 				"usage: pw groupadd [group|gid] [switches]\n"
@@ -409,6 +418,7 @@
 				"usage: pw groupnext [switches]\n"
 				"\t-V etcdir      alternate /etc location\n"
 				"\t-C config      configuration file\n"
+				"\t-q             quiet operation\n"
 			}
 		};



>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->suspended 
State-Changed-By: dd 
State-Changed-When: Tue Mar 13 19:24:43 PST 2001 
State-Changed-Why:  
Patch committed to -current, awaiting MFC. 


Responsible-Changed-From-To: freebsd-bugs->dd 
Responsible-Changed-By: dd 
Responsible-Changed-When: Tue Mar 13 19:24:43 PST 2001 
Responsible-Changed-Why:  
My PR. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=25187 
State-Changed-From-To: suspended->closed 
State-Changed-By: dd 
State-Changed-When: Wed Apr 25 19:24:51 PDT 2001 
State-Changed-Why:  
MFC'd. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=25187 
>Unformatted:
