From owner-freebsd-current Mon Nov 6 01:39:48 1995 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id BAA17903 for current-outgoing; Mon, 6 Nov 1995 01:39:48 -0800 Received: from hearnvax.nic.surfnet.nl (hearnvax.nic.surfnet.nl [192.87.5.131]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id BAA17897 for ; Mon, 6 Nov 1995 01:39:36 -0800 Received: from hermes.hse.nl by HEARNVAX.nic.SURFnet.nl (PMDF V4.2-12 #3330) id <01HXBJ7NBSI80065ZF@HEARNVAX.nic.SURFnet.nl>; Mon, 6 Nov 1995 10:41:39 +0200 (MET-DST) Received: from charm.il.ft.hse.nl by hermes.hse.nl (AIX 3.2/UCB 5.64/4.04) id AA20325; Mon, 6 Nov 1995 11:40:22 +0100 Received: (from erik@localhost) by charm.il.ft.hse.nl (8.6.11/8.6.9) id KAA08015 for current@freebsd.org; Mon, 6 Nov 1995 10:36:27 +0100 Date: Mon, 06 Nov 1995 10:36:26 +0100 (MET) From: Erik Manders Subject: chpass & co. broken? To: current@freebsd.org Message-id: <199511060936.KAA08015@charm.il.ft.hse.nl> X-Envelope-to: current@freebsd.org X-Mailer: ELM [version 2.4 PL24 ME8a] Content-type: text Content-transfer-encoding: 7BIT X-Location: Somewhere in The Netherlands Content-Length: 1490 Sender: owner-current@freebsd.org Precedence: bulk Hello, There seems to be a problem with chpass and co. If they are compiled with YP support, any and all command line options except '-l' and '-y' are ignored. This appears to be accidental, and is the result of the call to use_yp() at line 172 of usr.bin/chpass/chpass.c . use_yp() calls getpwnam() which apparently overwrites the pw struct in which 'command line' changes have already been made! The following patch apparently solves the problem, but a more thorough solution is needed. Current bugs to this patch: Since I don't have YP, I haven't tested this with it. This patch should check if YP is being used, and forbid certain changes (password for instance). I've left out the loading new entries, since I don't like it (vipw or some adduser prog are for that). This patch applies to the current and the release (951020-SNAP) tree. --- /src/current/usr.bin/chpass/chpass.c Tue Oct 24 20:44:48 1995 +++ ./chpass.c Mon Nov 6 00:22:41 1995 @@ -190,6 +190,15 @@ _use_yp = 0; pw = (struct passwd *)&local_password; } + } + +/* ARGH! These were getting clobbered by the above! Redo them. */ + if (op == NEWSH) { + p_shell(arg, pw, (ENTRY *)NULL); + } + + if (op == NEWPW) { + pw->pw_passwd = arg; } #endif /* YP */ Erik Manders erik@il.ft.hse.nl -- :copy protection: n. A class of methods for preventing incompetent pirates from stealing software and legitimate customers from using it. Considered silly. --Jargon file, version 3.2.0