[Forensics-changes] [yara] 90/135: Replace fast_scan_mode boolean argument with flags for greater flexibility in the future
Hilko Bengen
bengen at moszumanska.debian.org
Sat Jul 1 10:27:35 UTC 2017
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to annotated tag v3.1.0
in repository yara.
commit 8e869c6b67762f7e6c6978dc17d76a711af0a0b2
Author: Victor M. Alvarez <plusvic at gmail.com>
Date: Mon Aug 11 13:43:01 2014 +0200
Replace fast_scan_mode boolean argument with flags for greater flexibility in the future
---
libyara/include/yara/rules.h | 6 +++---
libyara/rules.c | 16 +++++++---------
yara-python/yara-python.c | 6 +++---
yara.c | 6 +++---
4 files changed, 16 insertions(+), 18 deletions(-)
diff --git a/libyara/include/yara/rules.h b/libyara/include/yara/rules.h
index c07be12..be09b8d 100644
--- a/libyara/include/yara/rules.h
+++ b/libyara/include/yara/rules.h
@@ -54,27 +54,27 @@ int yr_rules_scan_mem(
YR_RULES* rules,
uint8_t* buffer,
size_t buffer_size,
+ int flags,
YR_CALLBACK_FUNC callback,
void* user_data,
- int fast_scan_mode,
int timeout);
int yr_rules_scan_file(
YR_RULES* rules,
const char* filename,
+ int flags,
YR_CALLBACK_FUNC callback,
void* user_data,
- int fast_scan_mode,
int timeout);
int yr_rules_scan_proc(
YR_RULES* rules,
int pid,
+ int flags,
YR_CALLBACK_FUNC callback,
void* user_data,
- int fast_scan_mode,
int timeout);
diff --git a/libyara/rules.c b/libyara/rules.c
index 5a727c5..6530c06 100644
--- a/libyara/rules.c
+++ b/libyara/rules.c
@@ -297,9 +297,9 @@ int yr_rules_scan_mem_block(
int yr_rules_scan_mem_blocks(
YR_RULES* rules,
YR_MEMORY_BLOCK* block,
+ int flags,
YR_CALLBACK_FUNC callback,
void* user_data,
- int flags,
int timeout)
{
YR_SCAN_CONTEXT context;
@@ -492,9 +492,9 @@ int yr_rules_scan_mem(
YR_RULES* rules,
uint8_t* buffer,
size_t buffer_size,
+ int flags,
YR_CALLBACK_FUNC callback,
void* user_data,
- int fast_scan_mode,
int timeout)
{
YR_MEMORY_BLOCK block;
@@ -507,9 +507,9 @@ int yr_rules_scan_mem(
return yr_rules_scan_mem_blocks(
rules,
&block,
+ flags,
callback,
user_data,
- fast_scan_mode ? SCAN_FLAGS_FAST_MODE : 0,
timeout);
}
@@ -517,9 +517,9 @@ int yr_rules_scan_mem(
int yr_rules_scan_file(
YR_RULES* rules,
const char* filename,
+ int flags,
YR_CALLBACK_FUNC callback,
void* user_data,
- int fast_scan_mode,
int timeout)
{
YR_MAPPED_FILE mfile;
@@ -533,9 +533,9 @@ int yr_rules_scan_file(
rules,
mfile.data,
mfile.size,
+ flags,
callback,
user_data,
- fast_scan_mode,
timeout);
yr_filemap_unmap(&mfile);
@@ -548,9 +548,9 @@ int yr_rules_scan_file(
int yr_rules_scan_proc(
YR_RULES* rules,
int pid,
+ int flags,
YR_CALLBACK_FUNC callback,
void* user_data,
- int fast_scan_mode,
int timeout)
{
YR_MEMORY_BLOCK* first_block;
@@ -565,11 +565,9 @@ int yr_rules_scan_proc(
result = yr_rules_scan_mem_blocks(
rules,
first_block,
+ flags | SCAN_FLAGS_PROCESS_MEMORY,
callback,
user_data,
- fast_scan_mode ?
- SCAN_FLAGS_FAST_MODE | SCAN_FLAGS_PROCESS_MEMORY :
- SCAN_FLAGS_PROCESS_MEMORY,
timeout);
block = first_block;
diff --git a/yara-python/yara-python.c b/yara-python/yara-python.c
index 3192f59..6839750 100644
--- a/yara-python/yara-python.c
+++ b/yara-python/yara-python.c
@@ -898,9 +898,9 @@ static PyObject * Rules_match(
error = yr_rules_scan_file(
object->rules,
filepath,
+ fast_mode ? SCAN_FLAGS_FAST_MODE : 0,
yara_callback,
&callback_data,
- fast_mode,
timeout);
Py_END_ALLOW_THREADS
@@ -915,9 +915,9 @@ static PyObject * Rules_match(
object->rules,
(unsigned char*) data,
(unsigned int) length,
+ fast_mode ? SCAN_FLAGS_FAST_MODE : 0,
yara_callback,
&callback_data,
- fast_mode,
timeout);
Py_END_ALLOW_THREADS
@@ -931,9 +931,9 @@ static PyObject * Rules_match(
error = yr_rules_scan_proc(
object->rules,
pid,
+ fast_mode ? SCAN_FLAGS_FAST_MODE : 0,
yara_callback,
&callback_data,
- fast_mode,
timeout);
Py_END_ALLOW_THREADS
diff --git a/yara.c b/yara.c
index e9afe1c..3c8f23a 100644
--- a/yara.c
+++ b/yara.c
@@ -627,9 +627,9 @@ void* scanning_thread(void* param)
result = yr_rules_scan_file(
rules,
file_path,
+ fast_scan ? SCAN_FLAGS_FAST_MODE : 0,
callback,
file_path,
- fast_scan,
timeout);
if (result != ERROR_SUCCESS)
@@ -1074,9 +1074,9 @@ int main(
result = yr_rules_scan_proc(
rules,
pid,
+ fast_scan ? SCAN_FLAGS_FAST_MODE : 0,
callback,
(void*) argv[argc - 1],
- fast_scan,
timeout);
if (result != ERROR_SUCCESS)
@@ -1115,9 +1115,9 @@ int main(
result = yr_rules_scan_file(
rules,
argv[argc - 1],
+ fast_scan ? SCAN_FLAGS_FAST_MODE : 0,
callback,
(void*) argv[argc - 1],
- fast_scan,
timeout);
if (result != ERROR_SUCCESS)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/forensics/yara.git
More information about the forensics-changes
mailing list