Bug 19375

Summary: makekey accepts only 8-byte password
Product: Base System Reporter: root <root>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 3.4-RELEASE   
Hardware: Any   
OS: Any   

Description root 2000-06-19 13:30:01 UTC
	There is the need to change user passwords non-interactively over a
	privisioning system.

	adduser: does nothing cause the user exists
	chpass : interactively reads from /dev/tty
		 or you need makekey to encrypt the passwd
	passwd : only interactive usable

	So the focus came to makekey, which reads a fixed length of 8 chars
	for the password and 2 chars for the salt. So one can't set a 7 byte
	pasword.

	Also the documentation isn't very usefull.

Fix: 

A very complicated "hack" is

	  echo -e "secret\0\0Sa" | /usr/libexec/makekey

	this is equivalent to

	  echo -e "secret\0 Sa" | /usr/libexec/makekey

	cause the \0 ist the implicit end of string in C.
	
	The very best would be an adduser script which allows the change of
	the password with a flag, like

	adduser -c -p <clear-text-password>

	or a chpass with this option. Sure, it's better to transfer the 
	password encrypted, but than we need a better makekey to do the job.
How-To-Repeat: 
	/usr/libexec/makekey
Comment 1 Garrett A. Wollman 2000-06-19 18:21:05 UTC
<<On Mon, 19 Jun 2000 14:23:04 +0200 (CEST), root@uni-bielefeld.de said:

> 	There is the need to change user passwords non-interactively over a
> 	privisioning system.

perl -e 'print crypt(foo, bar);'

-GAWollman
Comment 2 Mike Barcroft freebsd_committer freebsd_triage 2001-07-22 04:50:50 UTC
State Changed
From-To: open->closed


This is a question, not a problem report.  In any event, wollman 
answered the originator's question; see the Audit-Trail.