root/checkpass.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. main

#include<shadow.h>
#include<crypt.h>
#include<stdio.h>
#include<string.h>
int
main ()
{
  char uname[20], pass[20], *crypted;
  struct spwd *r;
  printf ("username:");
  scanf ("%s", uname);
  printf ("password:");
  scanf ("%s", pass);
  r = getspnam (uname);
  printf("%s\n",r->sp_pwdp);
  crypted = crypt (pass, r->sp_pwdp);
  printf("%s\n",crypted);
  if (strncmp (crypted, r->sp_pwdp, 40)==0)
    printf ("OK");
  else
    printf ("Fail!!");
  return 0;
}

/* [<][>][^][v][top][bottom][index][help] */