APG v2.0.0a0
This commit is contained in:
34
apg.c
34
apg.c
@@ -36,6 +36,8 @@
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#define APG_VERSION "2.0.0a0"
|
||||
|
||||
#ifdef __NetBSD__
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
@@ -67,6 +69,7 @@
|
||||
#include "pronpass.h"
|
||||
#include "randpass.h"
|
||||
#include "restrict.h"
|
||||
#include "bloom.h"
|
||||
#include "rnd.h"
|
||||
#include "errs.h"
|
||||
|
||||
@@ -96,6 +99,7 @@ main (int argc, char *argv[])
|
||||
|
||||
int algorithm = 0; /* algorithm for generation */
|
||||
int restrictions_present = FALSE; /* restrictions flag */
|
||||
int bloom_restrict_present = FALSE; /* bloom filter restrictions flag */
|
||||
char *restrictions_file; /* dictionary file name */
|
||||
unsigned int pass_mode = 0; /* password generation mode */
|
||||
unsigned int pass_mode_present = FALSE; /* password generation mode flag */
|
||||
@@ -144,12 +148,12 @@ main (int argc, char *argv[])
|
||||
*/
|
||||
#ifndef CLISERV
|
||||
#ifdef APG_USE_CRYPT
|
||||
while ((option = getopt (argc, argv, "SNCLRM:a:r:sdc:n:m:x:hvy")) != -1)
|
||||
while ((option = getopt (argc, argv, "SNCLRM:a:r:b:sdc:n:m:x:hvy")) != -1)
|
||||
#else /* APG_USE_CRYPT */
|
||||
while ((option = getopt (argc, argv, "SNCLRM:a:r:sdc:n:m:x:hv")) != -1)
|
||||
while ((option = getopt (argc, argv, "SNCLRM:a:r:b:sdc:n:m:x:hv")) != -1)
|
||||
#endif /* APG_USE_CRYPT */
|
||||
#else /* CLISERV */
|
||||
while ((option = getopt (argc, argv, "SNCLRM:a:r:n:m:x:v")) != -1)
|
||||
while ((option = getopt (argc, argv, "SNCLRM:a:r:b:n:m:x:v")) != -1)
|
||||
#endif /* CLISERV */
|
||||
{
|
||||
switch (option)
|
||||
@@ -189,6 +193,11 @@ main (int argc, char *argv[])
|
||||
restrictions_present = TRUE;
|
||||
restrictions_file = optarg;
|
||||
break;
|
||||
case 'b': /* bloom restrictions */
|
||||
restrictions_present = TRUE;
|
||||
bloom_restrict_present = TRUE;
|
||||
restrictions_file = optarg;
|
||||
break;
|
||||
#ifndef CLISERV
|
||||
case 's': /* user random seed required */
|
||||
user_defined_seed = get_user_seq ();
|
||||
@@ -227,7 +236,7 @@ main (int argc, char *argv[])
|
||||
#endif /* CLISERV */
|
||||
case 'v': /* print version */
|
||||
printf ("APG (Automated Password Generator)");
|
||||
printf ("\nversion 1.2.13");
|
||||
printf ("\nversion %s", APG_VERSION);
|
||||
printf ("\nCopyright (c) 1999, 2000, 2001 Adel I. Mirzazhanov\n");
|
||||
return (0);
|
||||
default: /* print help end exit */
|
||||
@@ -284,9 +293,12 @@ main (int argc, char *argv[])
|
||||
(void *)crypt_string, 255);
|
||||
#endif /* APG_USE_CRYPT */
|
||||
#endif /* CLISERV */
|
||||
if (restrictions_present == 1)
|
||||
if (restrictions_present == TRUE)
|
||||
{
|
||||
restrict_res = check_pass(pass_string, restrictions_file);
|
||||
if (bloom_restrict_present == TRUE)
|
||||
restrict_res = bloom_check_pass(pass_string, restrictions_file);
|
||||
else
|
||||
restrict_res = check_pass(pass_string, restrictions_file);
|
||||
switch (restrict_res)
|
||||
{
|
||||
case 0:
|
||||
@@ -351,9 +363,12 @@ main (int argc, char *argv[])
|
||||
(void *)crypt_string, 255);
|
||||
#endif /* APG_USE_CRYPT */
|
||||
#endif /* CLISERV */
|
||||
if (restrictions_present == 1)
|
||||
if ( (restrictions_present == TRUE))
|
||||
{
|
||||
restrict_res = check_pass(pass_string, restrictions_file);
|
||||
if (bloom_restrict_present == TRUE)
|
||||
restrict_res = bloom_check_pass(pass_string, restrictions_file);
|
||||
else
|
||||
restrict_res = check_pass(pass_string, restrictions_file);
|
||||
switch (restrict_res)
|
||||
{
|
||||
case 0:
|
||||
@@ -471,6 +486,8 @@ print_help (void)
|
||||
printf ("\n-S -N -C -L -R password modes\n");
|
||||
printf ("-M mode new style pasword modes\n");
|
||||
printf ("-r file apply dictionary check against file\n");
|
||||
printf ("-b filter_file apply bloom filter check against filter_file\n");
|
||||
printf (" (filter_file should be created with apgbfm(1) utility)\n");
|
||||
printf ("-a algorithm choose algorithm\n");
|
||||
printf (" 1 - random password generation according to\n");
|
||||
printf (" password modes\n");
|
||||
@@ -567,3 +584,4 @@ unsigned int construct_mode(char *s_mode)
|
||||
}
|
||||
return (mode);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user