Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
162864e
server/upsd.c: mainloop(): report chosen/seen socket counts per type …
jimklimov Mar 24, 2026
79c3de3
server/upsd.c: mainloop(): log how many hits polling returned (POSIX)…
jimklimov Mar 26, 2026
4bca811
server/upsd.c: mainloop(): log incoming connections/data events for P…
jimklimov Mar 26, 2026
bebdabf
server/upsd.c: mainloop(): add a comment for future rework of WIN32 l…
jimklimov Mar 26, 2026
f51f2ef
drivers/upsdrvctl.c: fix broken debug message and update comments
jimklimov Apr 1, 2026
3cfcc40
drivers/dummy-ups.c: pepper parse_data_file() with debug tracing logs…
jimklimov Mar 25, 2026
b71b4d8
server/netssl.c: try to get PR_ErrorToName()/PR_ErrorToString() for a…
jimklimov Mar 25, 2026
01820e8
server/netssl.c: nss_error(): only allocate buffer for PR_GetErrorTex…
jimklimov Mar 26, 2026
d954981
server/netssl.c: nss_error(): wrap printout lines to help sync with o…
jimklimov Mar 26, 2026
b729192
clients/upsclient.c: resync nss_error() implementation with server/ne…
jimklimov Mar 26, 2026
1c6e550
clients/nutclient.cpp: resync nss_error() implementation with server/…
jimklimov Mar 26, 2026
a245b7e
clients/upsclient.c: upscli_strerror(): detail NSS errors more [#3379…
jimklimov Mar 31, 2026
d6cf1a6
server/conf.c: parse_upsd_conf_args(): debug-log keywords that are re…
jimklimov Mar 26, 2026
7b22155
server/netssl.c: net_starttls(): debug-trace calls into NSS, to profi…
jimklimov Mar 31, 2026
d25a1a2
server/netssl.c: net_starttls(): update comment about SSL_ForceHandsh…
jimklimov Mar 31, 2026
bc64132
server/upsd.c: client_disconnect(): sleep a bit if dropping a semi-in…
jimklimov Mar 31, 2026
f02ca92
drivers/dstate.c: send_to_one(): revise log messages [#3302]
jimklimov Mar 30, 2026
8fef6a5
clients/upsclient.c: pepper read/write and SSL init operations with d…
jimklimov Mar 31, 2026
6cf0224
clients/upsclient.c: net_read()/net_write(): set ups->upserror=UPSCLI…
jimklimov Mar 31, 2026
f1ff222
clients/upsclient.c: upscli_select_write()/upscli_select_read(): trac…
jimklimov Mar 31, 2026
09ce833
clients/upsclient.c: upscli_sslinit(): track and report upscli_strerr…
jimklimov Mar 31, 2026
c7b49a8
clients/upsclient.c: upscli_sendline_timeout()/upscli_readline_timeou…
jimklimov Mar 31, 2026
fc6d27a
clients/upsclient.c: update comments about "built-in(blocking)" conne…
jimklimov Apr 1, 2026
6e0580b
clients/upsclient.c: upscli_disconnect(): after LOGOUT, let the serve…
jimklimov Mar 24, 2026
b198324
Introduce upscli_sendline_timeout_may_disconnect() and upscli_readlin…
jimklimov Mar 31, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 53 additions & 7 deletions clients/nutclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,14 +332,60 @@ SSL_CTX* Socket::_ssl_ctx = nullptr;
# endif /* WITH_OPENSSL */

# ifdef WITH_NSS
static void nss_error(const char* funcname)
{
char buffer[256];
PRInt32 length = PR_GetErrorText(buffer);
if (length > 0 && length < 256) {
std::cerr << "nss_error " << static_cast<long>(PR_GetError()) << " in " << funcname << " : " << buffer << std::endl;
/** Detail the currently raised NSS error code if possible, and debug-log
* it with caller-provided text (typically the calling function name). */
static void nss_error(const char* text)
{
std::string err_name_buf;
PRErrorCode err_num = PR_GetError();
const char *err_name = PR_ErrorToName(err_num);
PRInt32 err_len = PR_GetErrorTextLength();

if (err_name) {
err_name_buf << " (" << err_name << ")";
}

if (err_len > 0) {
char *buffer = (char *)calloc(err_len + 1, sizeof(char));
if (buffer) {
PR_GetErrorText(buffer);
std::cerr << "nss_error "
<< static_cast<long>(err_num)
<< err_name_buf
<< " in " << text
<< " : "
<< buffer
<< std::endl;
free(buffer);
} else {
std::cerr << "nss_error "
<< static_cast<long>(err_num)
<< err_name_buf
<< " in " << text
<< " : "
<< "Failed to allocate internal error buffer "
<< "for detailed error text, needs "
<< static_cast<long>(err_len) << " bytes"
<< std::endl;
}
} else {
std::cerr << "nss_error " << static_cast<long>(PR_GetError()) << " in " << funcname << std::endl;
/* The code above may be obsolete or not ubiquitous, try another way */
const char *err_text = PR_ErrorToString(err_num, PR_LANGUAGE_I_DEFAULT);
if (err_text && *err_text) {
std::cerr << "nss_error "
<< static_cast<long>(err_num)
<< err_name_buf
<< " in " << text
<< " : "
<< err_text
<< std::endl;
} else {
std::cerr << "nss_error "
<< static_cast<long>(err_num)
<< err_name_buf
<< " in " << text
<< std::endl;
}
}
}

Expand Down
Loading
Loading