r11078 - prelude-correlator/trunk/plugins/lua

[email protected]
Newsgroups gmane.comp.security.ids.prelude.cvs
Message-ID <[email protected]>
Author: yoann
Date: 2008-10-27 17:31:53 +0100 (Mon, 27 Oct 2008)
New Revision: 11078

Modified:
   prelude-correlator/trunk/plugins/lua/regex.c
Log:
Handle idmef-data type.


Modified: prelude-correlator/trunk/plugins/lua/regex.c
===================================================================
--- prelude-correlator/trunk/plugins/lua/regex.c	2008-10-21 13:46:37 UTC (rev 11077)
+++ prelude-correlator/trunk/plugins/lua/regex.c	2008-10-27 16:31:53 UTC (rev 11078)
@@ -202,6 +202,49 @@
                         break;
                 }
 
+                case IDMEF_VALUE_TYPE_DATA: {
+                        idmef_data_t *d = idmef_value_get_data(value);
+
+                        switch (idmef_data_get_type(d)) {
+                                case IDMEF_DATA_TYPE_CHAR: {
+                                        char c = idmef_data_get_char(d);
+                                        lua_pushlstring(lstate, &c, 1);
+                                        break;
+                                }
+
+                                case IDMEF_DATA_TYPE_BYTE: {
+                                        unsigned char b = idmef_data_get_byte(d);
+                                        lua_pushlstring(lstate, (const char *) &b, 1);
+                                        break;
+                                }
+
+                                case IDMEF_DATA_TYPE_UINT32:
+                                        lua_pushnumber(lstate, idmef_data_get_uint32(d));
+                                        break;
+
+                                case IDMEF_DATA_TYPE_UINT64:
+                                        lua_pushnumber(lstate, idmef_data_get_uint64(d));
+                                        break;
+
+                                case IDMEF_DATA_TYPE_FLOAT:
+                                        lua_pushnumber(lstate, idmef_data_get_uint64(d));
+                                        break;
+
+                                case IDMEF_DATA_TYPE_CHAR_STRING:
+                                        lua_pushlstring(lstate, idmef_data_get_char_string(d), idmef_data_get_len(d));
+                                        break;
+
+                                case IDMEF_DATA_TYPE_BYTE_STRING:
+                                        lua_pushlstring(lstate, (const char *) idmef_data_get_byte_string(d), idmef_data_get_len(d));
+                                        break;
+
+                                default:
+                                        prelude_log(PRELUDE_LOG_ERR, "Unknown IDMEF data type.\n");
+                                        break;
+                        }
+                        break;
+                }
+
                 case IDMEF_VALUE_TYPE_INT8:
                         lua_pushnumber(lstate, idmef_value_get_int8(value));
                         break;

_______________________________________________
Prelude-cvslog site list
[email protected]
http://lists.prelude-ids.org/mailman/listinfo/prelude-cvslog
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.