Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 17 Jan 2007 13:33:52 +0300
From: Solar Designer <solar@...nwall.com>
To: john-users@...ts.openwall.com
Subject: Re: OpenUnix 8 hash format is not the normal DES?

On Mon, Jan 15, 2007 at 02:26:07PM -0300, Danett song wrote:
> > perl -e 'print "$n:$p:$u:$g:$f:$d:$s\n" while ($n,$p,$u,$g,$q,$c,$f,$d,$s) = getpwent()'
>   
>   Unhapply it doesn't work as expected, it show all informations, expect the hashs...
>   
>   root:x:0:3:0000-Admin(0000):/:/sbin/sh

Did you run the above command as root?  If so, then either this build of
Perl lacks shadow password support (it's a Perl compile-time option) or
the getspnam(3) function doesn't return the hashes.  I suspect that it's
the former.  Please try the attached C program.

-- 
Alexander Peslyak <solar at openwall.com>
GPG key ID: 5B341F15  fp: B3FB 63F4 D7A3 BCCC 6F6E  FC55 A2FC 027C 5B34 1F15
http://www.openwall.com - bringing security into open computing environments

Was I helpful?  Please give your feedback here: http://rate.affero.net/solar

#include <stdio.h>
#include <pwd.h>
#include <shadow.h>

int main(void)
{
	struct passwd *pw;
	struct spwd *spw;

	while ((pw = getpwent())) {
		spw = getspnam(pw->pw_name);
		if (spw)
			pw->pw_passwd = spw->sp_pwdp;
		printf("%s:%s:%u:%u:%s:%s:%s\n",
			pw->pw_name, pw->pw_passwd, pw->pw_uid, pw->pw_gid,
			pw->pw_gecos, pw->pw_dir, pw->pw_shell);
	}

	return 0;
}


-- 
To unsubscribe, e-mail john-users-unsubscribe@...ts.openwall.com and reply
to the automated confirmation request that will be sent to you.

Powered by blists - more mailing lists

Your e-mail address:

Powered by Openwall GNU/*/Linux - Powered by OpenVZ