Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Mar 2000 01:33:41 -0500 (EST)
From:      Mike Heffner <mheffner@mailandnews.com>
To:        cpiazza@FreeBSD.org
Cc:        davidn@FreeBSD.org, freebsd-bugs@FreeBSD.org, Egon Niederacher <niederacher@fh-vorarlberg.ac.at>
Subject:   Re: misc/17069: /usr/sbin/pw pw(8) fails for a specific username
Message-ID:  <XFMail.20000319013341.mheffner@mailandnews.com>
In-Reply-To: <200003180453.UAA42682@freefall.freebsd.org>

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

On 18-Mar-2000 cpiazza@FreeBSD.org wrote:
  | Synopsis: /usr/sbin/pw pw(8) fails for a specific username "mod"
  | 
  | Responsible-Changed-From-To: freebsd-bugs->davidn 
  | Responsible-Changed-By: cpiazza
  | Responsible-Changed-When: Fri Mar 17 20:53:23 PST 2000
  | Responsible-Changed-Why: 
  | Over to the author of pw
  | 

Here's a patch to make pw(8) behave like it's manpage, even when the username
is an operation keyword (eg 'mod'). This is sort of a hack, could someone look
at this and see if it breaks something else I didn't see.


Index: pw.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/pw/pw.c,v
retrieving revision 1.18
diff -u -r1.18 pw.c
--- pw.c        2000/01/15 00:20:20     1.18
+++ pw.c        2000/03/19 06:27:58
@@ -153,11 +153,12 @@
                        } else
                                break;
                }
-               else if ((tmp = getindex(Modes, argv[1])) != -1)
+               else if (mode == -1 && (tmp = getindex(Modes, argv[1])) != -1)
                        mode = tmp;
-               else if ((tmp = getindex(Which, argv[1])) != -1)
+               else if (which == -1 && (tmp = getindex(Which, argv[1])) != -1)
                        which = tmp;
-               else if ((tmp = getindex(Combo1, argv[1])) != -1 || (tmp =
getindex(Combo2, argv[1])) != -1) {
+               else if ((which == -1 && mode == -1) && ((tmp =
getindex(Combo1, argv[1])) != -1 || 
+                        (tmp = getindex(Combo2, argv[1])) != -1)) {
                        which = tmp / M_NUM;
                        mode = tmp % M_NUM;
                } else if (strcmp(argv[1], "help") == 0)



/****************************************
 * Mike Heffner <spock@techfour.net>    *
 * Fredericksburg, VA -- ICQ# 882073    *
 * Sent at: 19-Mar-2000 -- 01:29:01 EST *
 * http://my.ispchannel.com/~mheffner   *
 ****************************************/


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?XFMail.20000319013341.mheffner>