diff --git a/ChangeLog b/ChangeLog index e7ab2ca..8cad149 100755 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2018-05-06 +- New bookkeeper hash broke NfSen. Fixed. ported back to release 1.6.17 + 2018-04-20 - Release 1.6.17 diff --git a/bin/bookkeeper.c b/bin/bookkeeper.c index 12b9781..44fd5f1 100644 --- a/bin/bookkeeper.c +++ b/bin/bookkeeper.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -83,15 +84,21 @@ static inline bookkeeper_list_t *Get_bookkeeper_list_entry(bookkeeper_t *bookkee static uint32_t hash(char *str, int flag) { uint32_t h; unsigned char *p; +char cleanPath[MAXPATHLEN]; + + if ( realpath(str, cleanPath) == NULL ) { + return 0; + } h = 0; - for (p = (unsigned char*)str; *p != '\0'; p++) + for (p = (unsigned char*)cleanPath; *p != '\0'; p++) h = MULTIPLIER * h + *p; if ( flag ) { h = MULTIPLIER * h + 'R'; } return h; // or, h % ARRAY_SIZE; + } // End of hash // locks the semaphore, for exclusive access to the bookkeeping record