Koha-clms/C4/SIP
Tomas Cohen Arazi 4e1cd02932
Bug 40270: Fix uninitialized value warnings in SIP logging
The SIP server generates warnings when logging account information
for failed logins:

Use of uninitialized value $args[0] in sprintf at /kohadevbox/koha/C4/SIP/Sip.pm line 314
Use of uninitialized value $args[1] in sprintf at /kohadevbox/koha/C4/SIP/Sip.pm line 314

This occurs when $self->{account}->{id} or $self->{account}->{institution}
are undefined during failed authentication attempts.

This patch fixes the issue by:
1. Adding a safer sprintf implementation in siplog that handles undefined values
2. Providing default values for undefined account information in logging calls

To test:
1. Start SIP server
2. Attempt to connect with invalid credentials using sip_cli_emulator.pl:
   ./misc/sip_cli_emulator.pl -a 127.0.0.1 -p 6001 -su invaliduser -sp wrongpass -l kohalibrary2 --patron koha -m patron_information
3. Check /var/log/koha/kohadev/sip-output.log
=> FAIL: 'Use of uninitialized value...' warns
4. Apply this patch
5. Repeat 2
=> SUCCESS: No "Use of uninitialized value" warnings appear
=> SUCCESS: Logging shows 'undef/undef' for failed logins instead of empty strings
6. Try a valid login
=> SUCCESS: Still works correctly for valid logins
7. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 9cad25967d)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-08-22 09:48:24 +02:00
..
ILS Bug 32934: Correctly honor the no block due date for SIP checkout messages 2025-07-24 10:23:12 +02:00
Sip Bug 29410: Resolve warn on numeric ne for two dates 2025-03-07 15:41:15 +01:00
ILS.pm Bug 39325: Automatic fix 2025-04-28 18:51:22 +02:00
Logger.pm Bug 26673: Remove shebangs from Perl modules 2020-10-26 00:14:42 +01:00
Makefile
…
README Bug 15253: Rename syslog() to siplog() 2020-05-12 11:46:46 +01:00
SIPServer.pm Bug 40270: Fix uninitialized value warnings in SIP logging 2025-08-22 09:48:24 +02:00
Sip.pm Bug 40270: Fix uninitialized value warnings in SIP logging 2025-08-22 09:48:24 +02:00
Trapper.pm Bug 39911: Remove redundant warn 2025-06-22 23:48:47 +02:00

README

README for Open NSIP 3M-SIP Server

DEPENDENCIES

SIPServer is written entirely in Perl, but it require these CPAN
perl modules to run:

     Net::Server - The SIP server is a Net::Server::Prefork server
     XML::LibXML
     XML::Parser
     XML::Simple - for parsing the config file
     UNIVERSAL::require - for loading the correct ILS interface module
     Clone - for running the test cases

LOGGING

SIPServer uses Koha::Logger for status and debugging messages.