Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
6ed111f
clients/upsc.c: move usage() to top like in other clients [#3378]
jimklimov Mar 27, 2026
724ba4b
Clients and daemons with command-line options: converge to using geto…
jimklimov Mar 27, 2026
9ee23d2
clients/ups{c,cmd,rw}.c: converge to naming the help() method same wa…
jimklimov Mar 27, 2026
53a8e26
Clients and daemons with command-line options: converge to using opt_…
jimklimov Mar 27, 2026
5bcfc01
clients/ups{c,cmd,rw}.c, man pages, NEWS.adoc: add "-D" option suppor…
jimklimov Mar 27, 2026
6a1acba
NEWS.adoc: rephrase change about upsset [#3164]
jimklimov Mar 27, 2026
2499ec0
Makefile.am: add {all,check,install}-quick goals integrated with NUT …
jimklimov Mar 28, 2026
315e39b
Makefile.am, NEWS.adoc: Added `make .libs-dev-PATH` recipe to help de…
jimklimov Mar 28, 2026
fd80163
common/common.c, include/common.h: introduce xbasename_no_ext() to re…
jimklimov Mar 27, 2026
1949cb3
clients/upsmon.c: refactor with xbasename_no_ext() [#3373]
jimklimov Mar 27, 2026
1cd13c9
drivers/main.c: refactor with xbasename_no_ext() [#3373]
jimklimov Mar 27, 2026
b09dcf2
server/upsd.c: refactor with xbasename_no_ext() [#3373]
jimklimov Mar 27, 2026
2fedb98
drivers/main.c: define optstring near help_msg() to match other sourc…
jimklimov Mar 27, 2026
2192271
drivers/main.c: comment the complexity of many debug-level vars [#3378]
jimklimov Mar 27, 2026
d115b44
drivers/main.c: rename "drv_pipe_name" for maintainability (WIN32) [#…
jimklimov Mar 27, 2026
c027677
common/common.c, include/common.h: introduce xbasename_no_ext_default…
jimklimov Mar 27, 2026
8362709
Refactor various NUT programs to use getprogname_argv0_default(), and…
jimklimov Mar 27, 2026
9b5af3e
tools/nut-scanner/nut-scanner.c, tools/nut-scanner/Makefile.am: refac…
jimklimov Mar 27, 2026
6bd4768
tools/nutconf/nutconf-cli.cpp: refactor to use getprogname_argv0_defa…
jimklimov Mar 27, 2026
1caea03
common/nutstream.cpp: NutSocket::Address::Address() copier: sanity-ch…
jimklimov Mar 26, 2026
cd533a2
drivers/main.c: refactor to use getprogname_argv0_default(), get rid …
jimklimov Mar 27, 2026
9811e99
clients/upslog.c: handle "-D" option before others, so it can impact …
jimklimov Mar 27, 2026
d05efaa
tools/nut-scanner/*, docs/man/*: introduce nutscan_{g,s}et_debug_leve…
jimklimov Mar 27, 2026
a2dca60
tools/nut-scanner/nut-scanner.c: stop using nut_debug_level directly:…
jimklimov Mar 27, 2026
fed66e0
tools/nutconf/nutconf-cli.cpp, docs: support "-D" and `NUT_DEBUG_LEVE…
jimklimov Mar 27, 2026
60fedc7
clients/upsclient.{c,h}, docs: expose upscli_{g,s}etproctag() [#3379]
jimklimov Mar 27, 2026
f3ef790
tools/nut-scanner/*, docs: expose nutscan_{g,s}etproctag() [#3379]
jimklimov Mar 27, 2026
6e18069
tools/nut-scanner/nut-scanner.c: convert to using nutscan_setproctag(…
jimklimov Mar 27, 2026
9a19e3c
tools/nutconf/nutconf-cli.cpp: convert to using nutscan_setproctag() …
jimklimov Mar 27, 2026
17ed855
common/common.c, include/common.h: refactor with upslog_start_sync() …
jimklimov Mar 27, 2026
3295054
clients/upsclient.{c,h}, docs: expose upscli_upslog_start_sync() [#3378]
jimklimov Mar 27, 2026
578a370
tools/nut-scanner/*, docs: expose nutscan_upslog_start_sync() [#3378]
jimklimov Mar 27, 2026
4717ca5
tools/nutconf/nutconf-cli.cpp: init common timestamps with *upslog_st…
jimklimov Mar 27, 2026
37ac756
Introduce private setproctag_lib() for libupsclient and libnutscan [#…
jimklimov Mar 28, 2026
ef8582e
common/common.c: debug first run of setproctag() and runs of proctag_…
jimklimov Mar 28, 2026
abf3fb8
tools/nut-scanner/scan_nut.c: nutscan_upscli*(): avoid calls after li…
jimklimov Mar 28, 2026
32209a1
common/common.c: xbasename_no_ext(): keep or even add ext for "nut.ex…
jimklimov Mar 28, 2026
d3ea1ad
common/common.c: vupslog(): only warn about buffer realloc at high ve…
jimklimov Mar 28, 2026
2c350ac
common/common.c: ensure that proctag_cleanup() does its work before p…
jimklimov Mar 28, 2026
19ee993
tools/nut-scanner/nutscan-init.c: debug-log starting/ending of nutsca…
jimklimov Mar 29, 2026
1763001
common/common.c: vupslog(): handle reported invalid inputs for vsnpri…
jimklimov Mar 29, 2026
2b889a6
common/common.c: track procname_cleanup_registered; report what conte…
jimklimov Mar 29, 2026
6785626
common/common.c: debug-log registrations of atexit() handlers [#3384]
jimklimov Mar 29, 2026
6083a8c
tools/nutconf/nutconf-cli.cpp: limit calls to nutscan_* to builds WIT…
jimklimov Mar 29, 2026
d91f613
common/common.c: introduce nut_common_atexit() to clean-up once and i…
jimklimov Mar 29, 2026
106c0a5
tools/nutconf/nutconf-cli.cpp: hack for early enough nutscan_free() t…
jimklimov Mar 29, 2026
cfc6106
common/common.c: proctag_cleanup(): clarify in log messages if it is …
jimklimov Mar 29, 2026
f5d66bf
common/common.c: proctag_cleanup()/procname_cleanup(): simplify "star…
jimklimov Mar 29, 2026
29ad53e
drivers/main.c: fix preprocessor macro indentation of DRIVERS_MAIN_WI…
jimklimov Mar 29, 2026
d826e43
clients/*.c: for consumers of libupsclient, start with initialization…
jimklimov Mar 29, 2026
439a418
common/common.c: proctag_cleanup()/procname_cleanup(): log "finished"…
jimklimov Mar 29, 2026
19c888b
clients/upsc.c: revise main processing loop to setproctag(prog) once …
jimklimov Mar 29, 2026
271e266
NUT common code, libupsclient, libnutscan: expose setmyprocname() to …
jimklimov Mar 29, 2026
b774830
NUT consumers of libupsclient/libnutscan: call *_setprocname() early …
jimklimov Mar 29, 2026
afaa8d1
clients/*.c: redefine setproctag() to cover both in-program common co…
jimklimov Mar 29, 2026
e0179db
drivers/dummy-ups.c: as a libupsclient consumer, use upscli_upslog_st…
jimklimov Mar 29, 2026
29351e0
drivers/main.c: setproctag(prognames[0]) as soon as we can, so CLI/CO…
jimklimov Mar 29, 2026
671ab21
common/common.c: satisfy compilers where default char is signed [#3379]
jimklimov Mar 29, 2026
9c6278d
clients/*.c: diligently call upscli_cleanup() to minimize valgrind al…
jimklimov Mar 30, 2026
024a1ec
Rename libnutscan and libupsclient API methods related to logging wit…
jimklimov Mar 30, 2026
11ecd94
drivers/dummy-ups.c: diligently call upscli_cleanup() to minimize val…
jimklimov Mar 30, 2026
7e4b163
drivers/dummy-ups.c: fix upsdrv_tweak_prognames() to only set upscli …
jimklimov Mar 30, 2026
bb1e5a4
drivers/main.{c,h}, drivers/dummy-ups.c: introduce *upsdrv_callback_s…
jimklimov Mar 30, 2026
32510ab
tools/nutconf/nutconf-cli.cpp: fix NULL=>nullptr [#3379]
jimklimov Mar 30, 2026
989ead9
common/common.c: xbasename_no_ext(): use ubiquitous strcasecmp() for …
jimklimov Mar 31, 2026
7cece04
drivers/upsdrvctl.c: refactor with forkexec_parent_analyze() and a re…
jimklimov Mar 24, 2026
860854d
drivers/upsdrvctl.c: refactor with forkexec_parent_analyze() and a re…
jimklimov Mar 24, 2026
bc0c570
drivers/upsdrvctl.c: update comments and loop messages
jimklimov Mar 24, 2026
5cf0653
server/upsd.c: mainloop(): report chosen/seen socket counts per type …
jimklimov Mar 24, 2026
c604d5e
clients/upsclient.c: after LOGOUT, let the server say OK Goodbye [#33…
jimklimov Mar 24, 2026
39747e6
drivers/dummy-ups.c: pepper parse_data_file() with debug tracing logs…
jimklimov Mar 25, 2026
4bf41b5
drivers/dstate.c: err on the safe side and set conn=NULL after sock_d…
jimklimov Mar 25, 2026
7da013f
drivers/dstate.c: sock_disconnect(): try to flush the buffer [#3368]
jimklimov Mar 30, 2026
1c9e5cb
server/netssl.c: try to get PR_ErrorToName()/PR_ErrorToString() for a…
jimklimov Mar 25, 2026
a79dcaf
server/netssl.c: nss_error(): only allocate buffer for PR_GetErrorTex…
jimklimov Mar 26, 2026
4a295fe
server/netssl.c: nss_error(): wrap printout lines to help sync with o…
jimklimov Mar 26, 2026
3771d05
clients/upsclient.c: resync nss_error() implementation with server/ne…
jimklimov Mar 26, 2026
2246ac3
clients/nutclient.cpp: resync nss_error() implementation with server/…
jimklimov Mar 26, 2026
c3e841f
server/conf.c: parse_upsd_conf_args(): debug-log keywords that are re…
jimklimov Mar 26, 2026
7964ee4
server/upsd.c: mainloop(): log how many hits polling returned (POSIX)…
jimklimov Mar 26, 2026
1b958ac
server/upsd.c: mainloop(): add a comment for future rework of WIN32 l…
jimklimov Mar 26, 2026
86de880
server/upsd.c: mainloop(): log incoming connections/data events for P…
jimklimov Mar 26, 2026
2016cc8
common/wincompat.c: log progress through pipe*() methods [#3302, #3368]
jimklimov Mar 26, 2026
7598625
docs/*: update dictionary and rephrase clumsy texts, cater to MSYS2 a…
jimklimov Mar 30, 2026
f086fe2
docs/config-prereqs.txt: update MSYS2 chapter with notes on symlink e…
jimklimov Mar 30, 2026
49a6089
drivers/dstate.c: sock_disconnect(): resync code with wincompat::pipe…
jimklimov Mar 30, 2026
a9f1599
drivers/dstate.c: send_to_one(): revise log messages [#3302]
jimklimov Mar 30, 2026
1c7e7ba
common/wincompat.c, drivers/dstate.c: fix style of CreateNamedPipe() …
jimklimov Mar 30, 2026
14817e9
drivers/dstate.c, NEWS.adoc: revise closing of connections and return…
jimklimov Mar 30, 2026
c4bfe91
clients/upsclient.c: upscli_disconnect(): revise collection and inter…
jimklimov Mar 31, 2026
0c72579
clients/upsclient.c: pepper read/write and SSL init operations with d…
jimklimov Mar 31, 2026
30324fb
server/upsd.{c,h}: introduce send_err_extra() [#3331]
jimklimov Mar 31, 2026
60641c1
clients/upsclient.c: net_read()/net_write(): set ups->upserror=UPSCLI…
jimklimov Mar 31, 2026
ab4b82f
clients/upsclient.c: upscli_strerror(): detail NSS errors more [#3379…
jimklimov Mar 31, 2026
1177313
clients/upsclient.c: upscli_select_write()/upscli_select_read(): trac…
jimklimov Mar 31, 2026
fb8e929
clients/upsclient.c: upscli_sslinit(): track and report upscli_strerr…
jimklimov Mar 31, 2026
82b0c4c
clients/upsclient.c: upscli_sendline_timeout()/upscli_readline_timeou…
jimklimov Mar 31, 2026
4de9244
server/netssl.c: net_starttls(): debug-trace calls into NSS, to profi…
jimklimov Mar 31, 2026
a3ff608
server/upsd.c: sendback(): adjust debug traces for write() vs ssl_wri…
jimklimov Mar 31, 2026
4d7045d
server/netssl.c: net_starttls(): update comment about SSL_ForceHandsh…
jimklimov Mar 31, 2026
04d3542
server/upsd.c: client_disconnect(): sleep a bit if dropping a semi-in…
jimklimov Mar 31, 2026
e9fcfc3
Introduce upscli_sendline_timeout_may_disconnect() and upscli_readlin…
jimklimov Mar 31, 2026
209138a
clients/upsclient.c: update comments about "built-in(blocking)" conne…
jimklimov Apr 1, 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ tags
/VERSION_FORCED
/VERSION_FORCED_SEMVER
/install-sh
/.libs-dev-PATH
/libtool
/ltmain.sh
/missing
Expand Down
5 changes: 3 additions & 2 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
# Everyone deserves credit, including those who haven't added any code.
# Ideas, clues, and helping out on the mailing lists all count too.
#
# This is a blatant ripoff of the fields found in the Linux kernel's CREDITS
# file. If we need more data, those fields can always be added later.
# This is a blatant ripoff of the fields found in the CREDITS file of
# the Linux kernel. If we need more data, those fields can always be
# added later.
#
# N = name, E = email, W = web address, D = description, P = PGP info,
# S = snailmail address, etc.
Expand Down
41 changes: 37 additions & 4 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ SUBDIR_MAKE_VERBOSE = default

# Run the standard build if going sequential (or with unknown MAKEFLAGS),
# or fanout if parallel (presuming GNU/BSD/Sun make at least):
CLEANFILES += include/.all.nut_version-generated.timestamp clients/.all.libupsclient_version-generated.timestamp
all-fanout-maybe: @dotMAKE@
CLEANFILES += .libs-dev-PATH include/.all.nut_version-generated.timestamp clients/.all.libupsclient_version-generated.timestamp
all-fanout-maybe: .libs-dev-PATH @dotMAKE@
@rm -f include/.all.nut_version-generated.timestamp \
clients/.all.libupsclient_version-generated.timestamp
+@if [ x"$(NUT_MAKE_SKIP_FANOUT)" = xtrue ] ; then \
Expand All @@ -190,6 +190,27 @@ all-fanout-maybe: @dotMAKE@
;; \
esac

.libs-dev-PATH: Makefile
echo '# Sourcable script for developers to run built progs with their shared libs:' > '$@'
echo 'for D in common clients drivers tools/nut-scanner ; do \
for S in "" "/.libs" ; do \
DN="$(abs_top_builddir)/$${D}$${S}" ; \
case "$${PATH}" in \
"$${DN}"|*:"$${DN}}"|"$${DN}":*|*:"$${DN}":*) ;; \
"") PATH="$${DN}" ;; \
*) PATH="$${DN}:$${PATH}" ;; \
esac ; \
case "$${LD_LIBRARY_PATH}" in \
"$${DN}"|*:"$${DN}}"|"$${DN}":*|*:"$${DN}":*) ;; \
"") LD_LIBRARY_PATH="$${DN}" ;; \
*) LD_LIBRARY_PATH="$${DN}:$${LD_LIBRARY_PATH}" ;; \
esac ; \
done ; \
done ; \
export PATH ; \
export LD_LIBRARY_PATH ; \
' >> '$@'

# We start with a pass to `make all` in `common` dir because our wild recipes
# (with other subdirs ensuring the libraries they need have been built) can
# sometimes cause parallel compilation and library generation for same files
Expand All @@ -208,7 +229,7 @@ all-fanout-staged: @dotMAKE@

all-fanout-subdirs: $(SUBDIRS_ALL_RECURSIVE)

all-fanout-libs all-libs-local: $(SUBDIRS_ALL_LIBS_LOCAL)
all-fanout-libs all-libs-local: $(SUBDIRS_ALL_LIBS_LOCAL) .libs-dev-PATH

#all all-am-local all-local: @dotMAKE@
# +@cd common && $(MAKE) $(AM_MAKEFLAGS) all
Expand Down Expand Up @@ -855,9 +876,21 @@ SET_PARMAKES_OPT = \
;; \
esac

all-quick: @dotMAKE@
+@$(SET_PARMAKES_OPT); \
$(MAKE) $(AM_MAKEFLAGS) -k -s $${PARMAKES_OPT} all

install-quick: @dotMAKE@
+@$(SET_PARMAKES_OPT); \
$(MAKE) $(AM_MAKEFLAGS) -k -s $${PARMAKES_OPT} install

check-quick: @dotMAKE@
+@$(SET_PARMAKES_OPT); \
$(MAKE) $(AM_MAKEFLAGS) -k -s $${PARMAKES_OPT} check

spellcheck-quick: @dotMAKE@
+@$(SET_PARMAKES_OPT); \
$(MAKE) $(AM_MAKEFLAGS) -k -s ${PARMAKES_OPT} spellcheck
$(MAKE) $(AM_MAKEFLAGS) -k -s $${PARMAKES_OPT} spellcheck

# Run auto-parallel recipe, and if something fails - re-run interactively:
spellcheck-interactive-quick: @dotMAKE@
Expand Down
18 changes: 15 additions & 3 deletions NEWS.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ but the `nutshutdown` script would bail out quickly and quietly. [PR #3008]
* Ported C client library `libupsclient` support logic for SSL connections
into C++ client library `libnutclient` and added tests for it. [issues
#1599, #1711, PR #3353]
* Added support for command-line debugging with `-D` option into `upsc`,
`upscmd` and `upsrw` command-line clients, and the `nutconf` tool.
Revised handling of `-D` and/or `NUT_DEBUG_LEVEL` environment variable
in other programs. Extended public API of libupsclient and libnutscan
to diligently arrange debug-logging when at run-time those libraries
actually have different copies of the methods and data involved. [#3378]
* Revised 'dstate' machinery to track socket connections closed mid-way
through a call, to avoid access after `free()`. [#3302]

- NUT for Windows specific updates:
* Revised detection of (relative) paths to program and configuration files
Expand Down Expand Up @@ -395,7 +403,8 @@ several `FSD` notifications into one executed action. [PR #3097]

- `upsc` has now optional JSON output [issue #3172, PR #3178]

- `upsset` should now recognize `RANGE NUMBER` and `NUMBER` types. [#3164]
- `upsset` CGI tool should now recognize `RANGE NUMBER` and `NUMBER` types.
[#3164]

- `upsstats` CGI tool updates:
* Now has JSON output mode via `?json` (or `&json`) CGI query parameter.
Expand Down Expand Up @@ -540,6 +549,9 @@ several `FSD` notifications into one executed action. [PR #3097]
which should now not re-check source texts that were okay with the previous
dictionary contents, in case some new terms have to be added. [PRs #3186,
#2871]
* Added `make .libs-dev-PATH` recipe to generate a file which developers
or CI scripts can source to prefer freshly built NUT libraries and some
tools in their `LD_LIBRARY_PATH` and `PATH`. [#3379]
* Introduced `make distcheck-completeness` goal to verify that our
distribution archives can exactly reproduce themselves. [#2829]
* Added a GitHub Actions CI job to generate, upload and recycle `make dist`
Expand Down Expand Up @@ -698,8 +710,8 @@ Release notes for NUT 2.8.4 - what's new since 2.8.3

- `upsdrvquery` API updates [#2969]:
* Added `upsdrvquery_oneshot_conn()` for issuing one-shot queries using an
existing `udq_pipe_conn_t *` connection. The caller manages the
connection's lifecycle, and the function includes a best-effort call to
existing `udq_pipe_conn_t *` connection. The caller manages the lifecycle
of the socket connection, and the function includes a best-effort call to
restore broadcast mode after the query to return the connection as it was.
* Added `upsdrvquery_oneshot_sockfn()` for initiating one-shot queries using
a socket filename. Shares internal logic with the existing
Expand Down
2 changes: 1 addition & 1 deletion clients/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ endif WITH_SSL
# for the run-time dynamic linker resolution? For now the shared-library
# builds are "exotic", but it makes sense to deprecate this export in a
# future release.
libupsclient_la_LDFLAGS = -version-info 7:0:0
libupsclient_la_LDFLAGS = -version-info 8:0:1
libupsclient_la_LDFLAGS += -export-symbols-regex '^(upscli_|nut_debug_level)'
#|s_upsdebug|fatalx|fatal_with_errno|xcalloc|xbasename|print_banner_once)'
if HAVE_WINDOWS
Expand Down
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 = 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