Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 06 Nov 1995 10:36:26 +0100 (MET)
From:      Erik Manders <erik@il.ft.HSE.NL>
To:        current@freebsd.org
Subject:   chpass & co. broken?
Message-ID:  <199511060936.KAA08015@charm.il.ft.hse.nl>

next in thread | raw e-mail | index | archive | help
 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199511060936.KAA08015>