1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-13 19:28:56 +00:00

Fix potfile not closed if opened

This commit is contained in:
Jukka Ojanen 2021-08-11 02:17:21 +03:00
parent ce0b4f571a
commit 9c7b9253e7

View File

@ -185,10 +185,13 @@ void potfile_destroy (hashcat_ctx_t *hashcat_ctx)
int potfile_read_open (hashcat_ctx_t *hashcat_ctx)
{
potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx;
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx;
if (potfile_ctx->enabled == false) return 0;
if (hashconfig->potfile_disable == true) return 0;
if (hc_fopen (&potfile_ctx->fp, potfile_ctx->filename, "rb") == false)
{
event_log_error (hashcat_ctx, "%s: %s", potfile_ctx->filename, strerror (errno));
@ -201,8 +204,8 @@ int potfile_read_open (hashcat_ctx_t *hashcat_ctx)
void potfile_read_close (hashcat_ctx_t *hashcat_ctx)
{
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx;
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx;
if (potfile_ctx->enabled == false) return;
@ -215,10 +218,13 @@ void potfile_read_close (hashcat_ctx_t *hashcat_ctx)
int potfile_write_open (hashcat_ctx_t *hashcat_ctx)
{
potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx;
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx;
if (potfile_ctx->enabled == false) return 0;
if (hashconfig->potfile_disable == true) return 0;
if (hc_fopen (&potfile_ctx->fp, potfile_ctx->filename, "ab") == false)
{
event_log_error (hashcat_ctx, "%s: %s", potfile_ctx->filename, strerror (errno));
@ -231,8 +237,8 @@ int potfile_write_open (hashcat_ctx_t *hashcat_ctx)
void potfile_write_close (hashcat_ctx_t *hashcat_ctx)
{
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx;
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
potfile_ctx_t *potfile_ctx = hashcat_ctx->potfile_ctx;
if (potfile_ctx->enabled == false) return;