1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
/*
source:
/var/cvs/projects/debian/cracklib/debian/dpkg.src/cracklib2-dev.cracklib_example.c.in,v
revision:
@(#) cracklib2-dev.cracklib_example.c.in,v 1.2 1999/03/29 15:30:21 jplejacq Exp
copyright:
Copyright (C) 1998, 1999 Jean Pierre LeJacq <jplejacq@quoininc.com>
Distributed under the GNU GENERAL PUBLIC LICENSE.
description:
cracklib_example - an example of using cracklib
Nothing fancy here. Simply need to call FascistCheck() with the
potential password and the path+prefix to the dictionary database.
I'm using the path+prefix, CRACKLIB_DICTPATH, used by the
utilities in the cracklib-runtime package. FascistCheck() will
return non-NULL if the password is not selected.
*/
#include <crack.h>
#include <stdio.h>
#include <stdlib.h>
signed main(void)
{
char password[80U] = "";
(void)printf("Example program using cracklib\n");
(void)printf("Enter potential password: ");
(void)scanf("%79s", password);
{
char const * const msg = FascistCheck(password, CRACKLIB_DICTPATH);
if (0 != msg)
{
(void)printf("Please use a different password.\n");
(void)printf("The one you have chosen is unsuitable because:\n");
(void)printf(" %s\n", msg);
}
else
{
(void)printf("Good password.\n");
}
}
return EXIT_SUCCESS;
}
|