[Forensics-changes] [yara] 73/415: Implemented callback abortion

Hilko Bengen bengen at moszumanska.debian.org
Thu Apr 3 05:42:46 UTC 2014


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to branch debian
in repository yara.

commit 0eb99660a04e8fbbbf122b0347cd4f4002bbe9fb
Author: Victor M. Alvarez <plusvic at gmail.com>
Date:   Sat Feb 19 20:43:12 2011 +0000

    Implemented callback abortion
---
 libyara/libyara.c | 8 ++++++--
 libyara/yara.h    | 4 +++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/libyara/libyara.c b/libyara/libyara.c
index fc0a4dd..1271daa 100644
--- a/libyara/libyara.c
+++ b/libyara/libyara.c
@@ -501,9 +501,13 @@ int yr_scan_mem_blocks(MEMORY_BLOCK* block, YARA_CONTEXT* context, YARACALLBACK
     		}
 		}
 		
-		if (callback(rule, user_data) != 0)
+		switch (callback(rule, user_data))
 		{
-            return ERROR_CALLBACK_ERROR;
+		    case CALLBACK_ABORT:
+                return ERROR_SUCCESS;
+                
+            case CALLBACK_ERROR:
+                return ERROR_CALLBACK_ERROR;
 		}
 		
 		rule = rule->next;
diff --git a/libyara/yara.h b/libyara/yara.h
index 30711b7..fe232b4 100644
--- a/libyara/yara.h
+++ b/libyara/yara.h
@@ -107,7 +107,9 @@ GNU General Public License for more details.
 #define EXTERNAL_VARIABLE_TYPE_STRING           2
 #define EXTERNAL_VARIABLE_TYPE_BOOLEAN          3
 
-      
+#define CALLBACK_CONTINUE                       0
+#define CALLBACK_ABORT                          1
+#define CALLBACK_ERROR                          2 
 
 typedef struct _MATCH
 {   

-- 
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