Files
heimdal/lib/roken/verify.c
Assar Westerlund 4125b5779f Use <crypt.h> if there is one.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@648 ec53bebd-3082-4978-b11e-865c3cabbd6b
1996-08-13 23:45:21 +00:00

35 lines
594 B
C

#ifdef HAVE_CONFIG_H
#include <config.h>
RCSID("$Id$");
#endif
#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_CRYPT_H
#include <crypt.h>
#endif
#include "roken.h"
#if defined(__ultrix) || defined(sun)
char *crypt(const char*, const char*);
#endif
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;
}