filestore: respect g_disable_hashing

If g_disable_hashing is set, behave like libnss wasn't compiled
in.
pull/5722/head
Jason Ish 6 years ago committed by Victor Julien
parent 4e57b5e665
commit e00d21a5cb

@ -181,8 +181,13 @@ void FileForceHashParseCfg(ConfNode *conf)
"found. Please use 'force-hash: [md5]' instead"); "found. Please use 'force-hash: [md5]' instead");
if (ConfValIsTrue(force_md5)) { if (ConfValIsTrue(force_md5)) {
FileForceMd5Enable(); if (g_disable_hashing) {
SCLogInfo("forcing md5 calculation for logged files"); SCLogInfo(
"not forcing md5 calculation for logged files: hashing globally disabled");
} else {
FileForceMd5Enable();
SCLogInfo("forcing md5 calculation for logged files");
}
} }
} }
@ -194,18 +199,33 @@ void FileForceHashParseCfg(ConfNode *conf)
TAILQ_FOREACH(field, &forcehash_node->head, next) { TAILQ_FOREACH(field, &forcehash_node->head, next) {
if (strcasecmp("md5", field->val) == 0) { if (strcasecmp("md5", field->val) == 0) {
FileForceMd5Enable(); if (g_disable_hashing) {
SCLogConfig("forcing md5 calculation for logged or stored files"); SCLogInfo("not forcing md5 calculation for logged files: hashing globally "
"disabled");
} else {
FileForceMd5Enable();
SCLogConfig("forcing md5 calculation for logged or stored files");
}
} }
if (strcasecmp("sha1", field->val) == 0) { if (strcasecmp("sha1", field->val) == 0) {
FileForceSha1Enable(); if (g_disable_hashing) {
SCLogConfig("forcing sha1 calculation for logged or stored files"); SCLogInfo("not forcing sha1 calculation for logged files: hashing globally "
"disabled");
} else {
FileForceSha1Enable();
SCLogConfig("forcing sha1 calculation for logged or stored files");
}
} }
if (strcasecmp("sha256", field->val) == 0) { if (strcasecmp("sha256", field->val) == 0) {
FileForceSha256Enable(); if (g_disable_hashing) {
SCLogConfig("forcing sha256 calculation for logged or stored files"); SCLogInfo("not forcing sha256 calculation for logged files: hashing globally "
"disabled");
} else {
FileForceSha256Enable();
SCLogConfig("forcing sha256 calculation for logged or stored files");
}
} }
} }
} }

Loading…
Cancel
Save