Bugzilla – Attachment 53009 Details for
Bug 15006
Need to distinguish client timeout from login timeout
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15006: [QA Follow-up] Indentation for two subroutines
Bug-15006-QA-Follow-up-Indentation-for-two-subrout.patch (text/plain), 7.24 KB, created by
Marcel de Rooy
on 2016-07-01 06:50:34 UTC
(
hide
)
Description:
Bug 15006: [QA Follow-up] Indentation for two subroutines
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2016-07-01 06:50:34 UTC
Size:
7.24 KB
patch
obsolete
>From c64f9005604e88eb49d201a07e3cd0b3d7280a01 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Fri, 17 Jun 2016 11:07:16 +0200 >Subject: [PATCH] Bug 15006: [QA Follow-up] Indentation for two subroutines >Content-Type: text/plain; charset=utf-8 > >Remove tabs from telnet_transport and sip_protocol_loop. Correct >indentation. > >Test plan: >Compare files before and after without whitespace (diff -b). >Notice only two split lines. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/SIP/SIPServer.pm | 116 +++++++++++++++++++++++++-------------------------- > 1 file changed, 58 insertions(+), 58 deletions(-) > >diff --git a/C4/SIP/SIPServer.pm b/C4/SIP/SIPServer.pm >index d556845..aff49e5 100755 >--- a/C4/SIP/SIPServer.pm >+++ b/C4/SIP/SIPServer.pm >@@ -128,21 +128,21 @@ sub raw_transport { > my $service = $self->{service}; > > while (!$self->{account}) { >- local $SIG{ALRM} = sub { die "raw_transport Timed Out!\n"; }; >- syslog("LOG_DEBUG", "raw_transport: timeout is %d", $service->{timeout}); >- $input = read_request(); >- 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 C4::SIP::Sip::MsgType::handle($input, $self, LOGIN); >+ local $SIG{ALRM} = sub { die "raw_transport Timed Out!\n"; }; >+ syslog("LOG_DEBUG", "raw_transport: timeout is %d", $service->{timeout}); >+ $input = read_request(); >+ 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 C4::SIP::Sip::MsgType::handle($input, $self, LOGIN); > } > > syslog("LOG_DEBUG", "raw_transport: uname/inst: '%s/%s'", >- $self->{account}->{id}, >- $self->{account}->{institution}); >+ $self->{account}->{id}, >+ $self->{account}->{institution}); > > $self->sip_protocol_loop(); > syslog("LOG_INFO", "raw_transport: shutting down"); >@@ -180,55 +180,55 @@ sub telnet_transport { > my $account = undef; > my $input; > my $config = $self->{config}; >- my $timeout = $self->{service}->{timeout} || $config->{timeout} || 30; >- syslog("LOG_DEBUG", "telnet_transport: timeout is %s", $timeout); >+ my $timeout = $self->{service}->{timeout} || $config->{timeout} || 30; >+ syslog("LOG_DEBUG", "telnet_transport: timeout is %s", $timeout); > > eval { >- local $SIG{ALRM} = sub { die "telnet_transport: Timed Out ($timeout seconds)!\n"; }; >- local $| = 1; # Unbuffered output >- $/ = "\015"; # Internet Record Separator (lax version) >- # Until the terminal has logged in, we don't trust it >- # so use a timeout to protect ourselves from hanging. >- >- while ($strikes--) { >- print "login: "; >- alarm $timeout; >- # $uid = &get_clean_input; >- $uid = <STDIN>; >- print "password: "; >- # $pwd = &get_clean_input || ''; >- $pwd = <STDIN>; >- alarm 0; >- >- syslog("LOG_DEBUG", "telnet_transport 1: uid length %s, pwd length %s", length($uid), length($pwd)); >- $uid = get_clean_string ($uid); >- $pwd = get_clean_string ($pwd); >- syslog("LOG_DEBUG", "telnet_transport 2: uid length %s, pwd length %s", length($uid), length($pwd)); >- >- if (exists ($config->{accounts}->{$uid}) >- && ($pwd eq $config->{accounts}->{$uid}->{password})) { >- $account = $config->{accounts}->{$uid}; >- if ( C4::SIP::Sip::MsgType::login_core($self,$uid,$pwd) ) { >- last; >+ local $SIG{ALRM} = sub { die "telnet_transport: Timed Out ($timeout seconds)!\n"; }; >+ local $| = 1; # Unbuffered output >+ $/ = "\015"; # Internet Record Separator (lax version) >+ # Until the terminal has logged in, we don't trust it >+ # so use a timeout to protect ourselves from hanging. >+ >+ while ($strikes--) { >+ print "login: "; >+ alarm $timeout; >+ # $uid = &get_clean_input; >+ $uid = <STDIN>; >+ print "password: "; >+ # $pwd = &get_clean_input || ''; >+ $pwd = <STDIN>; >+ alarm 0; >+ >+ syslog("LOG_DEBUG", "telnet_transport 1: uid length %s, pwd length %s", length($uid), length($pwd)); >+ $uid = get_clean_string ($uid); >+ $pwd = get_clean_string ($pwd); >+ syslog("LOG_DEBUG", "telnet_transport 2: uid length %s, pwd length %s", length($uid), length($pwd)); >+ >+ if( exists ($config->{accounts}->{$uid}) && ($pwd eq $config->{accounts}->{$uid}->{password})) { >+ $account = $config->{accounts}->{$uid}; >+ if ( C4::SIP::Sip::MsgType::login_core($self,$uid,$pwd) ) { >+ last; >+ } > } >- } >- syslog("LOG_WARNING", "Invalid login attempt: '%s'", ($uid||'')); >- print("Invalid login$CRLF"); >- } >+ syslog("LOG_WARNING", "Invalid login attempt: '%s'", ($uid||'')); >+ print("Invalid login$CRLF"); >+ } > }; # End of eval > > if ($@) { >- syslog("LOG_ERR", "telnet_transport: Login timed out"); >- die "Telnet Login Timed out"; >+ syslog("LOG_ERR", "telnet_transport: Login timed out"); >+ die "Telnet Login Timed out"; > } elsif (!defined($account)) { >- syslog("LOG_ERR", "telnet_transport: Login Failed"); >- die "Login Failure"; >+ syslog("LOG_ERR", "telnet_transport: Login Failed"); >+ die "Login Failure"; > } else { >- print "Login OK. Initiating SIP$CRLF"; >+ print "Login OK. Initiating SIP$CRLF"; > } > > $self->{account} = $account; >- syslog("LOG_DEBUG", "telnet_transport: uname/inst: '%s/%s'", $account->{id}, $account->{institution}); >+ syslog("LOG_DEBUG", "telnet_transport: uname/inst: '%s/%s'", >+ $account->{id}, $account->{institution}); > $self->sip_protocol_loop(); > syslog("LOG_INFO", "telnet_transport: shutting down"); > return; >@@ -240,14 +240,14 @@ sub telnet_transport { > # telnet transport. From that point on, both the raw and the telnet > # processes are the same: > sub sip_protocol_loop { >- my $self = shift; >- my $service = $self->{service}; >- my $config = $self->{config}; >+ my $self = shift; >+ my $service = $self->{service}; >+ my $config = $self->{config}; > my $timeout = $self->{service}->{timeout} || $config->{timeout} || 30; > > # The spec says the first message will be: >- # SIP v1: SC_STATUS >- # SIP v2: LOGIN (or SC_STATUS via telnet?) >+ # SIP v1: SC_STATUS >+ # SIP v2: LOGIN (or SC_STATUS via telnet?) > # But it might be SC_REQUEST_RESEND. As long as we get > # SC_REQUEST_RESEND, we keep waiting. > >@@ -255,9 +255,9 @@ sub sip_protocol_loop { > # constraint, so we'll relax about it too. > # Using the SIP "raw" login process, rather than telnet, > # requires the LOGIN message and forces SIP 2.00. In that >- # case, the LOGIN message has already been processed (above). >- # >- # In short, we'll take any valid message here. >+ # case, the LOGIN message has already been processed (above). >+ # >+ # In short, we'll take any valid message here. > eval { > local $SIG{ALRM} = sub { > syslog( 'LOG_DEBUG', 'Inactive: timed out' ); >-- >1.7.10.4
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 15006
:
45039
|
45583
|
45594
|
52477
|
52478
|
52479
|
52480
|
52784
|
52785
|
52786
|
52787
|
52849
|
52850
|
52851
|
52852
|
52853
|
53009
|
53010
|
53011
|
53012
|
53013
|
53014
|
53132
|
53133
|
53134
|
53135
|
53309
|
53310
|
53311
|
53312
|
53355
|
53356
|
53357
|
53358
|
53359
|
53360
|
53363
|
53364
|
53365
|
53366
|
53367
|
53368
|
53369