Bugzilla – Attachment 8502 Details for
Bug 7787
SIP server closes the TCP connection when it receives an invalid message
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
RAW login can be as robust as telnet login
0002-Make-the-raw-login-robust.patch (text/plain), 2.73 KB, created by
Marc Balmer
on 2012-03-22 11:41:23 UTC
(
hide
)
Description:
RAW login can be as robust as telnet login
Filename:
MIME Type:
Creator:
Marc Balmer
Created:
2012-03-22 11:41:23 UTC
Size:
2.73 KB
patch
obsolete
>From 56189f37204cb96cb8696c9e0e652cbefbf95925 Mon Sep 17 00:00:00 2001 >From: Marc Balmer <marc@msys.ch> >Date: Wed, 21 Mar 2012 20:22:48 +0100 >Subject: [PATCH 2/2] Make the raw login robust. > >--- > C4/SIP/SIPServer.pm | 40 +++++++++++++--------------------------- > 1 files changed, 13 insertions(+), 27 deletions(-) > >diff --git a/C4/SIP/SIPServer.pm b/C4/SIP/SIPServer.pm >index 137fd91..077a80b 100644 >--- a/C4/SIP/SIPServer.pm >+++ b/C4/SIP/SIPServer.pm >@@ -35,7 +35,6 @@ BEGIN { > my %transports = ( > RAW => \&raw_transport, > telnet => \&telnet_transport, >- # http => \&http_transport, # for http just use the OPAC > ); > > # >@@ -126,31 +125,18 @@ sub raw_transport { > my $self = shift; > my ($input); > my $service = $self->{service}; >- my $strikes = 3; > >- eval { >- local $SIG{ALRM} = sub { die "raw_transport Timed Out!\n"; }; >- syslog("LOG_DEBUG", "raw_transport: timeout is %d", $service->{timeout}); >- while ($strikes--) { >- alarm $service->{timeout}; >- $input = Sip::read_SIP_packet(*STDIN); >- alarm 0; >- if (!$input) { >- # EOF on the socket >- syslog("LOG_INFO", "raw_transport: shutting down: EOF during login"); >- return; >- } >- $input =~ s/[\r\n]+$//sm; # Strip off trailing line terminator(s) >- last if Sip::MsgType::handle($input, $self, LOGIN); >- } >- }; >- >- if (length $@) { >- syslog("LOG_ERR", "raw_transport: LOGIN ERROR: '$@'"); >- die "raw_transport: login error (timeout? $@), exiting"; >- } elsif (!$self->{account}) { >- syslog("LOG_ERR", "raw_transport: LOGIN FAILED"); >- die "raw_transport: Login failed (no account), exiting"; >+ while (!$self->{account}) { >+ local $SIG{ALRM} = sub { die "raw_transport Timed Out!\n"; }; >+ syslog("LOG_DEBUG", "raw_transport: timeout is %d", $service->{timeout}); >+ $input = Sip::read_SIP_packet(*STDIN); >+ if (!$input) { >+ # EOF on the socket >+ syslog("LOG_INFO", "raw_transport: shutting down: EOF during login"); >+ return; >+ } >+ $input =~ s/[\r\n]+$//sm; # Strip off trailing line terminator(s) >+ last if Sip::MsgType::handle($input, $self, LOGIN); > } > > syslog("LOG_DEBUG", "raw_transport: uname/inst: '%s/%s'", >@@ -272,8 +258,7 @@ sub sip_protocol_loop { > while (1) { > $input = Sip::read_SIP_packet(*STDIN); > unless ($input) { >- print("96$CR"); >- next; >+ return; # EOF > } > # begin input hacks ... a cheap stand in for better Telnet layer > $input =~ s/^[^A-z0-9]+//s; # Kill leading bad characters... like Telnet handshakers >@@ -281,6 +266,7 @@ sub sip_protocol_loop { > while (chomp($input)) {warn "Extra line ending on input";} > unless ($input) { > syslog("LOG_ERR", "sip_protocol_loop: empty input skipped"); >+ print("96$CR"); > next; > } > # end cheap input hacks >-- >1.7.2.5 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 7787
:
8475
|
8501
|
8502
|
8511
|
10012
|
10362
|
10392