diff options
author | Simo Sorce <idra@samba.org> | 2005-12-26 17:36:33 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:05:58 -0500 |
commit | d186ff50721011f839a02aaac4866201eda23034 (patch) | |
tree | a6bba517c9560ecdc889b8583886eed07a4f56d1 | |
parent | b7eec4e85693deedf14908cf909e39a2167558eb (diff) | |
download | samba-d186ff50721011f839a02aaac4866201eda23034.tar.gz samba-d186ff50721011f839a02aaac4866201eda23034.tar.bz2 samba-d186ff50721011f839a02aaac4866201eda23034.zip |
r12497: add a simplex option
better usage message
(This used to be commit c007f20c955f224c6a8deeb0b1f82e8432f1b9ab)
-rw-r--r-- | examples/auth/crackcheck/crackcheck.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/examples/auth/crackcheck/crackcheck.c b/examples/auth/crackcheck/crackcheck.c index 0636114a17..ac29b22592 100644 --- a/examples/auth/crackcheck/crackcheck.c +++ b/examples/auth/crackcheck/crackcheck.c @@ -13,9 +13,11 @@ void usage(char *command) { comm = c + 1; } - fprintf(stderr, "Usage: %s -d dictionary\n\n", comm); - fprintf(stderr, " -d dictionary file for cracklib\n\n"); - fprintf(stderr, " The password is expected to be given via stdin.\n\n"); + fprintf(stderr, "Usage: %s [-c] [-s] [-d <dictionary>]\n\n", comm); + fprintf(stderr, " -c enables NT like complexity checks\n"); + fprintf(stderr, " -d <dictionary file> for cracklib\n"); + fprintf(stderr, " -s simple check use NT like checks ONLY\n\n"); + fprintf(stderr, "The password is read via stdin.\n\n"); exit(-1); } @@ -79,14 +81,14 @@ fail: int main(int argc, char **argv) { extern char *optarg; - int c, ret, complex_check = 0; + int c, ret, complex_check = 0, simplex_check = 0; char f[256]; char *dictionary = NULL; char *password; char *reply; - while ( (c = getopt(argc, argv, "d:c")) != EOF){ + while ( (c = getopt(argc, argv, "d:cs")) != EOF){ switch(c) { case 'd': dictionary = strdup(optarg); @@ -94,13 +96,17 @@ int main(int argc, char **argv) { case 'c': complex_check = 1; break; + case 's': + complex_check = 1; + simplex_check = 1; + break; default: usage(argv[0]); } } - if (dictionary == NULL) { - fprintf(stderr, "ERR - Wrong Command Line\n\n"); + if (!simplex_check && dictionary == NULL) { + fprintf(stderr, "ERR - Missing cracklib dictionary\n\n"); usage(argv[0]); } @@ -119,6 +125,10 @@ int main(int argc, char **argv) { } } + if (simplex_check) { + exit(0); + } + reply = FascistCheck(password, dictionary); if (reply != NULL) { fprintf(stderr, "ERR - %s\n\n", reply); @@ -126,6 +136,5 @@ int main(int argc, char **argv) { } exit(0); - } |