1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-24 23:48:39 +00:00

Merge pull request #1383 from philsmd/master

fixed the nanosecond access time problem, also working on macos now
This commit is contained in:
Jens Steube 2017-10-04 12:55:52 +02:00 committed by GitHub
commit 48684d9fcf
3 changed files with 16 additions and 13 deletions

View File

@ -75,18 +75,21 @@ but this is nededed for VS compiler which doesn't have inline keyword but has __
#define MAYBE_UNUSED __attribute__((unused))
/* Check if we also need to use/set the nanoseconds for the file stats:
The linux manual says that the only valid way to check for nanosecond resolution is to follow this rule:
"The nanosecond components of each timestamp are available via names of the form st_atim.tv_nsec
if the _BSD_SOURCE or _SVID_SOURCE feature test macro is defined"
/*
* Check if the system uses nanoseconds for file timestamps.
* In case the system uses nanoseconds we set some custom macros here,
* e.g. the (nanosecond) access time macros for dictstat
*/
#if defined (_BSD_SOURCE)
#define WITH_NANOSECONDS_IN_STAT 1
#if defined (__linux__)
#include <linux/version.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,48)
#define STAT_NANOSECONDS_ACCESS_TIME st_atim.tv_nsec
#endif
#endif
#if defined (_SVID_SOURCE)
#define WITH_NANOSECONDS_IN_STAT 1
#if defined (__APPLE__)
#define STAT_NANOSECONDS_ACCESS_TIME st_atimespec.tv_nsec
#endif
// config section

View File

@ -19,8 +19,8 @@ int sort_by_dictstat (const void *s1, const void *s2)
d2->stat.st_atime = d1->stat.st_atime;
#if defined (WITH_NANOSECONDS_IN_STAT)
d2->stat.st_atim.tv_nsec = d1->stat.st_atim.tv_nsec;
#if defined (STAT_NANOSECONDS_ACCESS_TIME)
d2->stat.STAT_NANOSECONDS_ACCESS_TIME = d1->stat.STAT_NANOSECONDS_ACCESS_TIME;
#endif
const int rc_from = strcmp (d1->encoding_from, d2->encoding_from);

View File

@ -293,8 +293,8 @@ int count_words (hashcat_ctx_t *hashcat_ctx, FILE *fd, const char *dictfile, u64
d.stat.st_rdev = 0;
d.stat.st_atime = 0;
#if defined (WITH_NANOSECONDS_IN_STAT)
d.stat.st_atim.tv_nsec = 0;
#if defined (STAT_NANOSECONDS_ACCESS_TIME)
d.stat.STAT_NANOSECONDS_ACCESS_TIME = 0;
#endif
#if defined (_POSIX)