Re: [Prelude Hybrid IDS] #269: Wrong idmef_*_get_next_* python binding functions?
"Prelude Hybrid IDS" <[email protected]>
| Newsgroups | gmane.comp.security.ids.prelude.devel |
|---|---|
| Message-ID | <[email protected]> |
#269: Wrong idmef_*_get_next_* python binding functions? ------------------------------------+--------------------------------------- Reporter: [email protected] | Owner: yoann Type: defect | Status: new Priority: normal | Milestone: Libprelude 0.9.17 Component: libprelude | Version: 0.9 Severity: normal | Resolution: Keywords: python binding | ------------------------------------+--------------------------------------- Comment (by pollux): If I understand correctly, the problem is that swig tries to convert the second object to an ''idmef_source_t *'' unconditionally, and that will fail for the ''None'' object with the following error: {{{ Traceback (most recent call last): File "./test_standard.py", line 25, in ? source = prelude.idmef_alert_get_next_source(alert,None) SystemError: error return without exception set }}} The correct solution is to tell swig how to handle correctly the pointer, by adding an input typemap. Could you test adding the following: {{{ %typemap(in) idmef_source_t *object { if ( $input == Py_None ) $1 = NULL; }; }}} to the file ''bindings/libprelude_python.i'' ? I have tested it on a very small example, it seems to work (no error). Tested code: {{{ message = prelude.idmef_message_new() time = prelude.idmef_time_new_from_time(long(time.time())) alert = prelude.idmef_message_new_alert(message) prelude.idmef_alert_set_create_time(alert, time) source = prelude.idmef_alert_get_next_source(alert,None) }}} -- Ticket URL: <https://trac.prelude-ids.org/ticket/269#comment:2> Prelude Hybrid IDS <http://www.prelude-ids.org> The Prelude Hybrid Intrusion Detection System suite _______________________________________________ Prelude-devel site list [email protected] http://www.prelude-ids.org/mailman/listinfo/prelude-devel