lib/pw_check
Submitted by Daryle on Mon, 03/26/2012 - 22:09
Procedure Model Type: ( )Web Page ( )CGI Script (X)Shared Library ( )System API Name: lib/pw_check Assigned to: Reference: |
|
Description |
This function takes a string parameter and runs it against the system pw_check utility to see if it is a sufficiently strong password. If not, the function returns a string describing the weakness(es) of the password. |
Implementation Skills |
C |
Parameter List |
password- a string containing the password string to test |
Called By: |
user/validate.cgi |
Can Call: |
crack.h |
Function Description |
#include <stdio.h> #include <stdlib.h> #include <crack.h> int main(int argc, char *argv[]) { int i; char* pw_check; char* password; char* dict_path = “/usr/lib/cracklib_dict”; char* null_string = “”; char* bad_usage = "Usage: pw_check [password]"; if (argc != 2) { fputs(bad_usage,stdout); return (-1); } password = argv[1]; pw_check = FascistCheck(password, dict_path); if (pw_check != NULL) fputs(pw_check,stdout); else fputs(null_string,stdout); exit(0); } Usage within a PERL or Shell Script: $output=`pw_check([password])`; if ($output eq “”) { # password is good } else { # password is bad. Reason is stored in $output } |
Possible Exit Conditions and Return Values |
|
Sign Off by: |
Project Manager |