[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: crypt() isn't generating a valid md5/shadow password



On Wed, Oct 18, 2000 at 11:04:32PM -0400, Chris Gray wrote:
> On Wed, Oct 18, 2000 at 04:48:16PM -0700, Peter Jay Salzman wrote:
> > sorry, but i'm trying to write some tools for beowulf administration.
> > 
> > consider the program:
> > 			printf("Usage: encrypt salt password\n");
> > 		strncpy(password, crypt(argv[1], salt), 49);
> 
> argv[1] is the salt, not the password.  Try fixing this and see what
> happens.

Replying to myself, the crypt(3) man page also states

	The returned  value  points  to the  encrypted  password,  a
	series of 13 printable ASCII characters (the first two
	characters  represent  the salt itself)

So it makes sense that the salt should start out the password.

Cheers,
Chris

-- 
It is much easier to be critical than to be correct.
		-- Benjamin Disraeli



Reply to: