#ifdef HAVE_CONFIG_H
#include <config.h>
RCSID("$Id: verify.c,v 1.8 1996/08/26 22:48:17 assar Exp $");
#endif

#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_CRYPT_H
#include <crypt.h>
#endif
#include "roken.h"

int
verify_unix_user(char *user, char *password)
{
    struct passwd *pw;
    
    pw = k_getpwnam(user);
    if(pw == NULL)
	return -1;
    if(strlen(pw->pw_passwd) == 0 && strlen(password) == 0)
	return 0;
    if(strcmp(crypt(password, pw->pw_passwd), pw->pw_passwd) == 0)
        return 0;
    return -1;
}

