Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 03 Nov 2005 15:55:52 +0300
From:      Igor Robul <igorr@speechpro.com>
To:        Dan Toganel <dantoganelus@yahoo.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: FreeBSD auth
Message-ID:  <436A08D8.8080603@speechpro.com>
In-Reply-To: <20051103124943.39958.qmail@web51315.mail.yahoo.com>
References:  <20051103124943.39958.qmail@web51315.mail.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Dan Toganel wrote:

>--- Lowell Gilbert
><freebsd-questions-local@be-well.ilk.org> wrote:
>  
>
>>getpwent() *does* give you the encrypted password.
>>It's the second field in the structure passed back.
>>
>>    
>>
>Well, i did:
>............................................
>include<sys/types.h>
>#include<pwd.h>
>
>extern int errno;
>
>int main()
>{
>char *name="dan";
>struct passwd *password;
>int uid;
>
>password=getpwnam(name);
>
>if(!password)
>        {
>        perror("getpwnam failed");
>        exit(1);
>        }
>
>uid=password->pw_uid;
>
>printf("Uid: %d, passwd:
>%s\n",uid,password->pw_passwd);
>
>exit(0);
>}
>.........................................
>bash-2.05b$ ./a.out
>Uid: 1001, passwd: *
>........................................
>I get passwd field from /etc/passwd.which
>is '*' for every user, not the hash 
>from /etc/master.passwd.
>
>Where am i wrong?
>  
>
Maybe you are not root :-) ?

%./a.out
Uid: 1001, passwd: *
%sudo ./a.out
Password:
Uid: 1001, passwd: $1$SO.nZTlP$n.HhobnlE.J45gncea5uD/





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