On Tue, Nov 02, 1999 at 09:49:25AM -0500, [EMAIL PROTECTED] wrote:
> I have a very simplistic source in my posession but I'm looking for more
> sophisticated examples.
Hi,
The attached source file is our kpwvalid. Hope this helps.
--
============================================================================
__/\__ ** Remember Yesterday, Dream about Tomorrow, but ... LIVE TODAY !!!
\ /\ / -------------------------------------------------------------------
/_\/_\ ** [EMAIL PROTECTED] http://www.postech.ac.kr/~jay
\/ ** Jaeyoung Kim Dept. of Computer Science, POSTECH, KOREA
#include <stdio.h>
/*
AFS password check program
made by flower
Jan 9. 1997
*/
/* #include "AFS_component_version_number.c"*/
/* returns 0 if the password is long enough, otherwise non-zero */
main( )
{
char oldpassword[512];
char password[512];
int rc, len, falpha, fnoalpha, i, fdiff;
if (fgets(oldpassword, 512, stdin))
while (fgets(password, 512, stdin)) {
falpha = fnoalpha = 0 ;
fdiff = 1 ;
len = strlen(password) - 1 ;
if (len >= 8) { /* password includes a newline */
for (i=0 ; i < len ; i++) {
if (((password[i] >= 'a') & (password[i] <=
'z'))
|| ((password[i] >='A') &
(password[i]<='Z'))
|| ((password[i]>='0') &
(password[i]<='9')))
falpha = 1 ;
else fnoalpha = 1 ;
}
for ( i= 0 ; i <= len-4; ) {
if ( password[i+2] != password[i+3] )
i = i+3 ;
else if (password[i+1] != password[i+2] )
i = i+2 ;
else if ( password[i] != password[i+1] )
i = i+1;
else {
fdiff = 0 ;
break ;
}
}
if ((falpha == 1) & ( fnoalpha == 1 ) & ( fdiff == 1
)){
rc = 0;
fputs("0\n",stdout);
fflush(stdout);
}
else {
rc = 1 ;
if ( fdiff == 0 )
fputs("Passwords should not have more
than 3 same characters in a row\n", stderr) ;
else if ( falpha == 0 )
fputs("Passwords must contain at least
one alphnumeric character.\n", stderr) ;
else
fputs("Passwords must contain at least
one non-alphanumeric character.\n", stderr);
fputs("1\n", stdout) ;
fflush( stdout ) ;
}
}
else {
rc = 1;
fputs("Passwords must contain at least 8 characters.\n",stderr);
fputs("1\n",stdout);
fflush(stdout);
}
}
}