AC_CHECK_HEADERS([dirent.h fnmatch.h])
AC_CHECK_HEADERS([sys/resource.h sys/types.h sys/un.h])
AC_CHECK_HEADERS([sys/random.h])
+ AC_CHECK_HEADERS([libgen.h])
AC_CHECK_HEADERS([sys/socket.h net/if.h sys/mman.h linux/if_arp.h], [], [],
[[#ifdef HAVE_SYS_SOCKET_H
}
static const char *hexcodes = "ABCDEFabcdef0123456789";
-
+#include "libgen.h"
/**
* \brief Parse the filemd5, filesha1 or filesha256 keyword
*
char line[8192] = "";
fp = fopen(filename, "r");
if (fp == NULL) {
- SCLogError(SC_ERR_OPENING_RULE_FILE, "opening hash file %s: %s", filename, strerror(errno));
- goto error;
+#ifdef HAVE_LIBGEN_H
+ if (de_ctx->rule_file != NULL) {
+ char *dir = dirname(de_ctx->rule_file);
+ if (dir != NULL) {
+ char path[PATH_MAX];
+ snprintf(path, sizeof(path), "%s/%s", dir, str);
+ fp = fopen(path, "r");
+ if (fp == NULL) {
+ SCLogError(SC_ERR_OPENING_RULE_FILE,
+ "opening hash file %s: %s", path, strerror(errno));
+ goto error;
+ }
+ }
+ }
+ if (fp == NULL) {
+#endif
+ SCLogError(SC_ERR_OPENING_RULE_FILE, "opening hash file %s: %s", filename, strerror(errno));
+ goto error;
+#ifdef HAVE_LIBGEN_H
+ }
+#endif
}
int line_no = 0;