From a0b23e9c42a917200a1a483cb8351c96865cb986 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Fri, 12 Jun 2015 19:01:47 +0000 Subject: [PATCH] LP#1464748: don't toss terminal account information prematurely This patch ensures that when the PreFork Net::Server personality is in use, terminal login information is not prematurely cleared between *_transport() and sip_protocol_loop(). This, in conjunction with the patch for bug 1463459, fixes a problem where a SIP client that connects, issues a 93 request, then a 99 request, could get an incorrect 98 response. To test fixes for 1463459 and 1464748: [1] Set up a SIP configuration with at least two institutions with different capabilities and at least one account for each institution. Assume that account A1 is for institution I1 and A2 for I2. [2] Prior to applying the patches for 1463459 and 1464748, start the SIP server and try the following sequence: a. 93 to log in as A2 b. 99 to get SC status c. Note that the 98 response has values for I1, not I2 [3] Apply the patches and restart SIP, then repeat the steps in [2]. This time, the 98 response should have the values for I2. Signed-off-by: Galen Charlton Signed-off-by: Jason Stephenson --- SIPServer.pm | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/SIPServer.pm b/SIPServer.pm index 30ed53d..055847a 100755 --- a/SIPServer.pm +++ b/SIPServer.pm @@ -182,9 +182,9 @@ sub process_request { syslog("LOG_WARNING", "Unknown transport '%s', dropping", $service->{transport}); return; } else { + # handle client authentication prior to + # passing further processing to sip_protocol_loop() &$transport($self); - # Transport has shut down, remove any lingering login info - $self->{account} = undef; } $self->sip_protocol_loop(); @@ -192,6 +192,17 @@ sub process_request { syslog("LOG_INFO", '%s: shutting down', $transport); } +# for forking personalities, don belt and suspenders +# and ensure that the session account is cleared when +# a client connection ends cleanly (as opposed to the +# Net::Server backend having been terminated). +sub post_process_request { + my $self = shift; + + $self->{account} = undef; + +} + # mux_input is the callback used by Net::Server to handle # an incoming connection request when the peronsality is # Multiplex. -- 2.43.2