From: Thomas Berezansky Date: Mon, 8 Jun 2015 20:57:11 +0000 (-0400) Subject: LP#1463459: make SC Status handler recognize logged-in SIP session X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=22b77ed625bb3e341aba3c74696e7614c310cd74;p=working%2FSIPServer.git LP#1463459: make SC Status handler recognize logged-in SIP session Due to MsgType not having an account field, handle_sc_status should be checking $server, not $self, for account information. As a result of checking the wrong field handle_sc_status always assumes the session is not logged in and returns status based on the first account. When this account is not flagged for some capabilities and the client expects/needs those capabilities the client may determine it can't function and disconnect, even though the login actually has those capabilities. This patch fixes that; it also adjusts how $server->{account} is checked (definedness, not existence). Signed-off-by: Thomas Berezansky Signed-off-by: Galen Charlton Signed-off-by: Jason Stephenson --- diff --git a/Sip/MsgType.pm b/Sip/MsgType.pm index afada58..863be59 100644 --- a/Sip/MsgType.pm +++ b/Sip/MsgType.pm @@ -780,7 +780,7 @@ sub handle_sc_status { $protocol_version = $new_proto; } - unless (exists $self->{account}) { + unless (defined $server->{account}) { # If we haven't logged in yet, go ahead and # return the SC status anyway, arbitrarily using the # first account in Perl string sort order to specify @@ -797,13 +797,13 @@ sub handle_sc_status { if ($status == SC_STATUS_PAPER) { syslog("LOG_WARNING", "Self-Check unit '%s@%s' out of paper", - $self->{account}->{id}, $self->{account}->{institution}); + $server->{account}->{id}, $server->{account}->{institution}); } elsif ($status == SC_STATUS_SHUTDOWN) { syslog("LOG_WARNING", "Self-Check unit '%s@%s' shutting down", - $self->{account}->{id}, $self->{account}->{institution}); + $server->{account}->{id}, $server->{account}->{institution}); } - $self->{account}->{print_width} = $print_width; + $server->{account}->{print_width} = $print_width; return send_acs_status($self, $server) ? SC_STATUS : ''; }