[PATCH] Fix for crash on expired keyboard_redirect prompt (i.e. crash on confirm server key change after disconnect from server)

Skywing <[email protected]> Sat, 8 Nov 2008 18:16:55 -0600
Newsgroups gmane.network.silc.devel
Message-ID <982D8D05B6407A49AD506E6C3AC8E7D6BE3B8F0EA8@caralain.haven.nynaeve.net>
Hello,

The following changes ( available for git pulling @ git://valera-ext.nynaeve.net/silc.git ) fix the problem where an expired keyboard_redirect prompt (e.g. to confirm a server key change) crashes the silc client due to use after free.  The fix did require substantial reworking of how keyboard redirection works in the silc irssi frontend / silc irssi plugin, as they're now wrapped in a silc_async wrapper.

I left the initial prompt for private key passphrase at boot time alone, since it doesn't really have a problem with expiration due to the nature of it.

If a keyboard prompt request is made while a stale prompt is still pending, the new request is denied.  Until the irssi folks fix their keyboard_input_redirect API, this is the best we can do, as there's no way to cancel a pending keyboard_input_redirect call, and making a new such request while a previous one was pending is a memory leak.

A more elegant solution would have been to cancel the outstanding keyboard_input_redirect request, but that requires major changes to how irssi's keyboard input redirect pluggable system works, so this will have to do for now.  (A bug about that API being kinda broken by design has been entered in irssi's bug tracking system.)

--

commit 5e7b2671da238a39001d1c4eb79f87ac56c2add2
Author: Skywing <[email protected]>
Date:   Sat Nov 8 17:54:03 2008 -0500

    Fix crash on expired keyboard prompts



The following commits are also recommended to be included if they're not already:


commit 9ada9d21e5378510e745b837035eac5b7b73d14c
Author: Skywing <[email protected]>
Date:   Sat Jun 28 00:21:51 2008 -0500

    Add reference counting to SilcClientEntry/SilcServerEntry for getkey response.

    This is necessary in case the entry goes away before the user responds to the
    keyboard input request.  (Fix for getkey crash if a user logs off before one
    responds to the getkey prompt.)

commit 6fbdb9acb4b8f4f90632c5b317c4daf81f7b2ec4
Author: Skywing <[email protected]>
Date:   Sat Jun 28 00:12:18 2008 -0500

    Fix initialization/deinitialization of various Silc*Entry objects.

    A number of init/deinit cases were failing to clean up
    certain resources.

commit 9145000948d0df9c9db99beb8d2f0855ba88e40c
Author: Skywing <[email protected]>
Date:   Fri Jun 27 23:44:03 2008 -0500

    Fix reference counting for SilcServerEntry objects,

    analogous to the previous fixes for the broken
    reference counting for SilcChannelEntry and
    SilcClientEntry objects.

- S

_______________________________________________________________________
Info:    https://lists.silcnet.org/mailman/listinfo/silc-announce
Archive: https://lists.silcnet.org/pipermail/silc-announce
FAQ:     http://silcnet.org/support/faq/