1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-22 08:08:10 +00:00

Fixed bug in --stdout when multiple computing devices are active

This commit is contained in:
Gabriele Gristina 2024-10-24 21:13:11 +02:00
parent 6716447dfc
commit a66c93ae1e
4 changed files with 19 additions and 0 deletions

View File

@ -82,6 +82,7 @@
- Fixed bug in grep out-of-memory workaround on Unit Test
- Fixed bug in input_tokenizer when TOKEN_ATTR_FIXED_LENGTH is used and refactor modules
- Fixed bug in --stdout that caused certain rules to malfunction
- Fixed bug in --stdout when multiple computing devices are active
- Fixed build failed for 10700 optimized with Apple Metal
- Fixed build failed for 13772 and 13773 with Apple Metal
- Fixed build failed for 18400 with Apple Metal

View File

@ -2122,6 +2122,8 @@ typedef struct outfile_ctx
char *filename;
hc_thread_mutex_t mux_outfile;
} outfile_ctx_t;
typedef struct pot

View File

@ -15,6 +15,7 @@
#include "backend.h"
#include "shared.h"
#include "locking.h"
#include "thread.h"
#include "outfile.h"
u32 outfile_format_parse (const char *format_string)
@ -506,6 +507,8 @@ int outfile_init (hashcat_ctx_t *hashcat_ctx)
outfile_ctx->outfile_json = user_options->outfile_json;
outfile_ctx->is_fifo = hc_path_is_fifo (outfile_ctx->filename);
hc_thread_mutex_init (outfile_ctx->mux_outfile);
return 0;
}
@ -513,6 +516,8 @@ void outfile_destroy (hashcat_ctx_t *hashcat_ctx)
{
outfile_ctx_t *outfile_ctx = hashcat_ctx->outfile_ctx;
hc_thread_mutex_delete (outfile_ctx->mux_outfile);
if (outfile_ctx->is_fifo == true && outfile_ctx->fp.pfp != NULL)
{
hc_unlockfile (&outfile_ctx->fp);

View File

@ -12,6 +12,7 @@
#include "mpsp.h"
#include "backend.h"
#include "shared.h"
#include "thread.h"
#include "stdout.h"
static void out_flush (out_t *out)
@ -59,6 +60,10 @@ int process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
user_options_t *user_options = hashcat_ctx->user_options;
// prevent wrong candidates in output when backend_ctx->backend_devices_active > 1
hc_thread_mutex_lock (outfile_ctx->mux_outfile);
char *filename = outfile_ctx->filename;
out_t out;
@ -69,6 +74,8 @@ int process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
{
event_log_error (hashcat_ctx, "%s: %s", filename, strerror (errno));
hc_thread_mutex_unlock (outfile_ctx->mux_outfile);
return -1;
}
@ -78,6 +85,8 @@ int process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
event_log_error (hashcat_ctx, "%s: %s", filename, strerror (errno));
hc_thread_mutex_unlock (outfile_ctx->mux_outfile);
return -1;
}
}
@ -341,5 +350,7 @@ int process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
hc_fclose (&out.fp);
}
hc_thread_mutex_unlock (outfile_ctx->mux_outfile);
return rc;
}