Re: [solved] FreeBSD auth
Sorry,me stupid. Of course, i wasn't root. Thanks for help. __ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: FreeBSD auth
Dan Toganel wrote: --- Lowell Gilbert <[EMAIL PROTECTED]> wrote: getpwent() *does* give you the encrypted password. It's the second field in the structure passed back. Well, i did: include #include 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/ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: FreeBSD auth
--- Lowell Gilbert <[EMAIL PROTECTED]> wrote: > getpwent() *does* give you the encrypted password. > It's the second field in the structure passed back. > Well, i did: include #include 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? __ Start your day with Yahoo! - Make it your home page! http://www.yahoo.com/r/hs ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: FreeBSD auth
Dan Toganel <[EMAIL PROTECTED]> writes: > --- Igor Robul <[EMAIL PROTECTED]> wrote: > > > It is not recommended directly use /etc/passwd, you > > your program need > > authentification, then use > > PAM (man 3 pam). If you still want ignore PAM, you > > can use getpwent(3) > > family of functions. > > > Thanks for your interest. > Well, the problem with getpwent() is that i can't > retrive hash from master.passwd, > I can use it, only to parse passwd file. > But i also need to parse master.passwd to obtain > the hash and to crypt user password and obtain > the hash. > I need more specific help about those two. getpwent() *does* give you the encrypted password. It's the second field in the structure passed back. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: FreeBSD auth
--- Igor Robul <[EMAIL PROTECTED]> wrote: > It is not recommended directly use /etc/passwd, you > your program need > authentification, then use > PAM (man 3 pam). If you still want ignore PAM, you > can use getpwent(3) > family of functions. > Thanks for your interest. Well, the problem with getpwent() is that i can't retrive hash from master.passwd, I can use it, only to parse passwd file. But i also need to parse master.passwd to obtain the hash and to crypt user password and obtain the hash. I need more specific help about those two. __ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: FreeBSD auth
Dan Toganel wrote: I realize that in FreeBSD master.passwd is the replacement for linux shadow file. Is there a function to parse it? And how can i obtain the hash string? Thanks in advance for any help. It is not recommended directly use /etc/passwd, you your program need authentification, then use PAM (man 3 pam). If you still want ignore PAM, you can use getpwent(3) family of functions. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
FreeBSD auth
Hello list, I'm a newbie in freebsd programming and i need some docs & hints in order to port a program from linux to FreeBSD. The piece of code is: .. struct spwd* shadow=getspnam(name); if(!shadow) { . } char *key=crypt(passwd,shadow->sp_pwdp); if(!key) { } if(strncmp(shadow->sp_pwdp,key,strlen(shadow->sp_pwdp))==0) { /*login success*/ } else { /*login failed*/ } I realize that in FreeBSD master.passwd is the replacement for linux shadow file. Is there a function to parse it? And how can i obtain the hash string? Thanks in advance for any help. __ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"