]> git.ipfire.org Git - thirdparty/openvpn.git/commit
Avoid recursion in virtual_output_callback_func()
authorDavid Sommerseth <davids@redhat.com>
Fri, 16 Nov 2012 11:02:06 +0000 (12:02 +0100)
committerDavid Sommerseth <davids@redhat.com>
Thu, 29 Nov 2012 20:44:30 +0000 (21:44 +0100)
commitb2b66179f6dcc37de9582d5c3044f0357dda3df3
treef70c0e65aa3d0f235769a6b7da3da239122801c3
parentfeca0900dd00577779ab02f2e52b41eb3dab935f
Avoid recursion in virtual_output_callback_func()

This solves a SEGV situation when using the management API while OpenVPN
is closing down.

The situation happens when the management socket has closed and OpenVPN
tries to write an error about this to the management socket.  What happens
is that

 virtual_output_callback_func() is called, which then calls
 -> man_output_list_push_finalize()
    -> man_output_standalone()
       -> man_write()  <-- this does the socket write
          -> man_io_error()
             -> x_msg()
                -> virtual_output_print()
                   -> virtual_output_callback_func() (recursion start)

virtual_output_callback_func() do have a mechanism to avoid recursion,
but that did not keep the recurse counter when
man_output_list_push_finalize()
is called.

This patch just reorganise the recursion block to also keep the counter
while
calling the other functions from virtual_output_callback_func()

Signed-off-by: David Sommerseth <davids@redhat.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: 1353063726-25113-1-git-send-email-dazo@users.sourceforge.net
URL: http://article.gmane.org/gmane.network.openvpn.devel/7130
src/openvpn/manage.c