};
if ($@) {
- syslog("LOG_ERR", "raw_transport: LOGIN TIMED OUT: '$@'");
- die "raw_transport: login timed out, exiting";
+ syslog("LOG_ERR", "raw_transport: LOGIN ERROR: '$@'");
+ die "raw_transport: login error, exiting";
} elsif (!$self->{account}) {
syslog("LOG_ERR", "raw_transport: LOGIN FAILED");
die "raw_transport: Login failed, exiting";
$self->{account}->{id},
$self->{account}->{institution});
- $inst = $self->{account}->{institution};
- $self->{institution} = $self->{config}->{institutions}->{$inst};
- $self->{policy} = $self->{institution}->{policy};
-
$self->sip_protocol_loop();
syslog("LOG_INFO", "raw_transport: shutting down");
my $config = $self->{config};
my $input;
- #
- # initialize connection to ILS
- #
- my $module = $config
- ->{institutions}
- ->{ $self->{account}->{institution} }
- ->{implementation};
- $module->use;
-
- if ($@) {
- syslog("LOG_ERR", "%s: Loading ILS implementation '%s' failed, exiting",
- $self->{service}, $self->{account}->{institution});
- die("ILS initialization failed");
- }
-
- $self->{ils} = $module->new($self->{institution}, $self->{account});
-
- if (!$self->{ils}) {
- syslog("LOG_ERR", "%s: ILS connection to '%s' failed, exiting",
- $self->{service}, $self->{account}->{institution});
- die("ILS initialization failed");
- }
# Now that the terminal has logged in, the first message
# we recieve must be an SC_STATUS message. But it might be
# an SC_REQUEST_RESEND. So, as long as we keep receiving
my ($self, $server) = @_;
my ($uid_algorithm, $pwd_algorithm);
my ($uid, $pwd);
+ my $inst;
my $fields;
my $status = 1; # Assume it all works
syslog("LOG_WARNING",
"MsgType::handle_login: Invalid password for login '$uid'");
$status = 0;
- }
-
- # Store the active account someplace handy for everybody else to find.
- if ($status) {
+ } else {
+ # Store the active account someplace handy for everybody else to find.
$server->{account} = $server->{config}->{accounts}->{$uid};
+ $inst = $server->{account}->{institution};
+ $server->{institution} = $server->{config}->{institutions}->{$inst};
+ $server->{policy} = $server->{institution}->{policy};
+
+
syslog("LOG_INFO", "Successful login for '%s' of '%s'",
- $server->{account}->{id}, $server->{account}->{institution});
+ $server->{account}->{id}, $inst);
+ #
+ # initialize connection to ILS
+ #
+ my $module = $server->{config}
+ ->{institutions}
+ ->{ $inst }
+ ->{implementation};
+ $module->use;
+
+ if ($@) {
+ syslog("LOG_ERR", "%s: Loading ILS implementation '%s' for institution '%s' failed",
+ $server->{service}, $module, $inst);
+ die("Failed to load ILS implementation '$module'");
+ }
+
+ $server->{ils} = $module->new($server->{institution}, $server->{account});
+
+ if (!$server->{ils}) {
+ syslog("LOG_ERR", "%s: ILS connection to '%s' failed",
+ $server->{service}, $inst);
+ die("Unable to connect to ILS '$inst'");
+ }
}
$self->write_msg(LOGIN_RESP . $status);