[Prelude Hybrid IDS] #200: Segmentation fault with libprelude Python bindings and signal handling

"Prelude Hybrid IDS" <[email protected]>
Newsgroups gmane.comp.security.ids.prelude.devel
Message-ID <[email protected]>
#200: Segmentation fault with libprelude Python bindings and signal handling
------------------------------------+---------------------------------------
 Reporter:  [email protected]  |       Owner:  yoann                                     
     Type:  defect                  |      Status:  new                                       
 Priority:  normal                  |   Milestone:  Libprelude 0.9.13                         
Component:  libprelude              |     Version:  0.9                                       
 Severity:  normal                  |    Keywords:  python bindings libprelude signal handling
------------------------------------+---------------------------------------
 The following piece of python code is intended to print "Message received"
 everytime a new alert is received by the Prelude Manager. It works ok, but
 sending a signal to it (e.g. SIGINT) in order for it stop leads to a
 segmentation fault.

 Signal handling seems to be responsible for this. Other means to stop the
 python process (e.g. by sending a special IDMEF message to it) work fine.

 ==========
 import time
 import prelude
 import sys

 def correlator_stop(signum, frame):
 prelude.prelude_client_destroy(client,prelude.PRELUDE_CLIENT_EXIT_STATUS_SUCCESS
 )
     print "Stop"
     sys.exit()

 signal.signal(signal.SIGINT, correlator_stop)

 prelude.prelude_init(1, ["PythonTest"])
 client = prelude.prelude_client_new("PythonTest")

 prelude.prelude_client_set_required_permission(client,
 prelude.PRELUDE_CONNECTION_PERMISSION_IDMEF_READ|prelude.PRELUDE_CONNECTION_PERMISSION_IDMEF_WRITE);

 prelude.prelude_client_start(client);

 pool = prelude.prelude_client_get_connection_pool(client)

 while 1 :
     msg = prelude.prelude_connection_pool_recv(pool, -1)
     print "Message received"

 ==========

-- 
Ticket URL: <https://trac.prelude-ids.org/ticket/200>
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
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.