Skip to content

Commit

Permalink
Suppress crypt_fmt's warnings about unsupported hashes for pot file e…
Browse files Browse the repository at this point in the history
…ntries.
  • Loading branch information
solar committed Nov 23, 2011
1 parent f803189 commit 2c119a3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/c3_fmt.c
Expand Up @@ -25,6 +25,7 @@
#include "memory.h"
#include "common.h"
#include "formats.h"
#include "loader.h"

#define FORMAT_LABEL "crypt"
#define FORMAT_NAME "generic crypt(3)"
Expand Down Expand Up @@ -144,7 +145,7 @@ static int valid(char *ciphertext)
return 1;
}

if (id != 10)
if (id != 10 && !ldr_in_pot)
fprintf(stderr, "Generic crypt(3) module: "
"hash encoding string length %d, type id %c%c\n"
"appears to be unsupported on this system; "
Expand Down
16 changes: 15 additions & 1 deletion src/loader.c
Expand Up @@ -21,6 +21,7 @@

#ifdef HAVE_CRYPT
extern struct fmt_main fmt_crypt;
int ldr_in_pot = 0;
#endif

/*
Expand Down Expand Up @@ -594,8 +595,15 @@ static void ldr_load_pot_line(struct db_main *db, char *line)

void ldr_load_pot_file(struct db_main *db, char *name)
{
if (db->format)
if (db->format) {
#ifdef HAVE_CRYPT
ldr_in_pot = 1;
#endif
read_file(db, name, RF_ALLOW_MISSING, ldr_load_pot_line);
#ifdef HAVE_CRYPT
ldr_in_pot = 0;
#endif
}
}

/*
Expand Down Expand Up @@ -849,7 +857,13 @@ static void ldr_show_pot_line(struct db_main *db, char *line)

void ldr_show_pot_file(struct db_main *db, char *name)
{
#ifdef HAVE_CRYPT
ldr_in_pot = 1;
#endif
read_file(db, name, RF_ALLOW_MISSING, ldr_show_pot_line);
#ifdef HAVE_CRYPT
ldr_in_pot = 0;
#endif
}

static void ldr_show_pw_line(struct db_main *db, char *line)
Expand Down
5 changes: 5 additions & 0 deletions src/loader.h
Expand Up @@ -194,6 +194,11 @@ struct db_main {
struct fmt_main *format;
};

#ifdef HAVE_CRYPT
/* Non-zero while the loader is processing the pot file */
extern int ldr_in_pot;
#endif

/*
* Initializes the database before loading.
*/
Expand Down

0 comments on commit 2c119a3

Please sign in to comment.