Skip to content

Commit 5b73154

Browse files
authored
Merge 88cb9b0 into e3079c6
2 parents e3079c6 + 88cb9b0 commit 5b73154

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1235
-132
lines changed

Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ all-libs-local/common: all-libs-local/include @dotMAKE@
250250
### Delivers: libupsclient.la libnutclient.la libnutclientstub.la
251251
### Delivers: libupsclient-version.h
252252
### LIB-Requires-ext: common/libcommonclient.la
253+
### Requires-ext: include/nut_version.h
253254
### Requires-ext: common/libcommon.la common/libcommonclient.la
254255
### Requires-ext: common/libcommonversion.la
255256
### Requires-ext: common/libparseconf.la

NEWS.adoc

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ NUT Release Notes
33
=================
44
endif::txt[]
55

6-
If you're upgrading from an earlier version, see the link:UPGRADING.adoc[] file.
6+
This document summarizes the practical side of changes coming with each
7+
newer release development, as compared to the preceding release.
8+
9+
If you're upgrading from an earlier version, or are a package maintainer,
10+
please see also the link:UPGRADING.adoc[] file about anticipated impacts
11+
of ongoing development on existing deployments and third-party consumers.
712

813
Please note that web and source document links, product and service names
914
listed in historic entries of past releases may no longer be relevant.
@@ -104,6 +109,16 @@ https://github.com/networkupstools/nut/milestone/12
104109
characters. Now it is evaluated at `configure` time (to check that the
105110
characters may be used), and if not -- during `nut_stdint.h` parsing to
106111
fit known `int`/`long`/`long long` types. [#3300]
112+
* Added new API methods and defined bitmap values for `libupsclient`
113+
C binding to query and report SSL capabilities of the current library
114+
build (none, OpenSSL, Mozilla NSS): `upscli_ssl_caps_descr()` and
115+
`upscli_ssl_caps()`. Updated common NUT clients to report this info
116+
in their detailed help banners. Done similarly for `upsd`. The NIT
117+
(NUT Integration Test) suite piggy-backs on this to add run-time
118+
dependent tests of SSL capability. Added `upscli_set_debug_level()`
119+
and `upscli_set_debug_level()` methods to facilitate NUT debugging
120+
for clients built with shared NUT private libraries. [issues #3328,
121+
#1771, #2800, PR #3330]
107122

108123
- NUT for Windows specific updates:
109124
* Revised detection of (relative) paths to program and configuration files
@@ -302,6 +317,11 @@ https://github.com/networkupstools/nut/milestone/12
302317
or Windows `HANDLE`'s at a time, and moving on to another chunk.
303318
The system-provided value can be further limited by `NUT_SYSMAXCONN_LIMIT`
304319
environment variable (e.g. in tests). [#3302]
320+
* Extended processing of `CERTREQUEST` setting to handle numeric or specific
321+
string values, to match both ways of reading ambiguous documentation.
322+
Added `configure --with-ssl-client-validation` toggle to expose the
323+
macro previously meant to be passed via `make` command line. [PR #3330,
324+
but beware issue #3329]
305325

306326
- `upsdrvctl` tool updates:
307327
* Make use of `setproctag()` and `getproctag()` to report parent/child
@@ -530,6 +550,10 @@ several `FSD` notifications into one executed action. [PR #3097]
530550
* Dropped the `compile` script from Git sources. It originates from automake
531551
and is added to work area (if missing) during `autogen.sh` rituals anyway.
532552
It is still distributed as part of `make dist` tarball. [#1209]
553+
* Extended `ci_build.sh` and `build-mingw-nut.sh` so that certain values
554+
of `NUT_SSL_VARIANTS=[yes, no, auto, ssl, nss, openssl]` can be used
555+
with generic builds to test a specific code path and not only the
556+
auto-detected one. [#1711]
533557

534558
- Upstreamed reference packaging recipes (DEB, RPM) from the 42ITy project
535559
which can be used with OBS (Open Build Service by SUSE), both to support

UPGRADING.adoc

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,15 @@ Upgrading notes
44
endif::txt[]
55

66
This file lists changes that affect users who installed older versions
7-
of this software. When upgrading from an older version, be sure to
8-
check this file to see if you need to make changes to your system.
7+
of this software, or third-party integrations and library or data consumers.
8+
When upgrading from an older NUT version, be sure to check this file to
9+
see if you need to make changes to your system.
10+
11+
We welcome feedback from package maintainers -- if you had to patch something
12+
out, or work around something in NUT code or recipes, please let us know in
13+
the issue tracker. Chances are, other distributions feel your pain, and some
14+
generalized solution belongs in the upstream project as an easy to use build
15+
configuration toggle to be shared by all interested downstream projects.
916

1017
[NOTE]
1118
======
@@ -35,6 +42,10 @@ Changes from 2.8.4 to 2.8.5
3542
library files to deliver with the packages (formally versioned and
3643
named by NUT release semantic version triplet). [issue #2800]
3744
45+
- Related to the above, `libupsclient` will remove the exported symbol for
46+
`nut_debug_level` variable in a later NUT release, and now introduces the
47+
`upscli_set_debug_level()` and `upscli_get_debug_level()` methods. [PR #3330]
48+
3849
- For ages, most recipes for building NUT had customized the `sysconfdir` to
3950
be `/etc/nut`, which is not exactly the *system* configuration directory.
4051
This is finally deprecated, with new `--with-confdir` configuration option
@@ -99,6 +110,10 @@ Changes from 2.8.4 to 2.8.5
99110
use `upsdrvquery_NOSIGPIPE=0` to disable neutering of the signal inside
100111
the API itself. [PR #3277]
101112
113+
- Added new API methods and defined bitmap values for `libupsclient` C binding
114+
to query and report SSL capabilities of the library build (none, OpenSSL,
115+
Mozilla NSS): `upscli_ssl_caps_descr()` and `upscli_ssl_caps()`. [PR #33xx]
116+
102117
- Fixed man page naming for `nutdrv_siemens-sitop(.8)` (dash vs. underscore)
103118
to match the driver program name. Packaging recipes may have to be updated.
104119
Follow-up from slightly botched renaming in original contribution. [PR #545]

appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ install:
6363
# versions of packages.
6464
- cmd: |
6565
REM Prerequisites for NUT per https://github.com/networkupstools/nut/blob/master/docs/config-prereqs.txt :
66-
C:\msys64\usr\bin\bash -lc "date -u; pacman --noconfirm -S --needed base-devel mingw-w64-x86_64-toolchain autoconf-wrapper automake-wrapper libtool mingw-w64-x86_64-libltdl gcc ccache mingw-w64-x86_64-ccache git aspell aspell-en python mingw-w64-x86_64-python-pygments mingw-w64-x86_64-winpthreads-git mingw-w64-x86_64-libusb mingw-w64-x86_64-libusb-compat-git mingw-w64-x86_64-neon libneon-devel mingw-w64-x86_64-libgd mingw-w64-x86_64-cppunit"
66+
C:\msys64\usr\bin\bash -lc "date -u; pacman --noconfirm -S --needed base-devel mingw-w64-x86_64-toolchain autoconf-wrapper automake-wrapper libtool mingw-w64-x86_64-libltdl gcc ccache mingw-w64-x86_64-ccache git aspell aspell-en python mingw-w64-x86_64-python-pygments mingw-w64-x86_64-winpthreads-git mingw-w64-x86_64-libusb mingw-w64-x86_64-libusb-compat-git mingw-w64-x86_64-neon libneon-devel mingw-w64-x86_64-libgd mingw-w64-x86_64-cppunit mingw-w64-x86_64-nss mingw-w64-x86_64-openssl"
6767
REM SKIP mingw-w64-x86_64-libmodbus-git : we custom-build one with USB support
6868
REM SKIP for now NUT-Monitor prereqs (runtime Python would require somilar modules; need to fix localization builds like "fr.po"): gettext mingw-w64-x86_64-python-pyqt6
6969
@@ -115,7 +115,7 @@ build_script:
115115
REM to find "nearby" program or configuration files (see common.c
116116
REM for current implementation). Hard-coded fallback strings may
117117
REM end up getting used in those cases.
118-
C:\msys64\usr\bin\bash -lc 'date -u; PATH="/mingw64/bin:$PATH" CI_SKIP_CHECK=true CANBUILD_WITH_LIBMODBUS_USB=yes WITH_LIBNUTPRIVATE=true ./ci_build.sh --with-docs=no'
118+
C:\msys64\usr\bin\bash -lc 'date -u; PATH="/mingw64/bin:$PATH" CI_SKIP_CHECK=true CANBUILD_WITH_LIBMODBUS_USB=yes WITH_LIBNUTPRIVATE=true NUT_SSL_VARIANTS=nss ./ci_build.sh --with-docs=no'
119119
120120
121121
after_build:

ci_build.sh

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ SCRIPT_ARGS=("$@")
3535
# in a different directory and then it would be used with a warning. This may
3636
# require that you `make distclean` the original source checkout first:
3737
# CI_BUILDDIR=obj BUILD_TYPE=default-all-errors ./ci_build.sh
38+
#
39+
# The NUT_SSL_VARIANTS=[yes, no, auto, ssl, nss, openssl] values can be used
40+
# with generic builds (not only iteration of a default-all-errors* matrix)
41+
# to set specific SSL options in tested NUT builds.
42+
#
3843
case "$BUILD_TYPE" in
3944
fightwarn) ;; # for default compiler
4045
fightwarn-all)
@@ -1947,7 +1952,20 @@ default|default-alldrv|default-alldrv:no-distcheck|default-all-errors|default-al
19471952
19481953
case "$BUILD_TYPE" in
19491954
"default-all-errors"*) ;; # Treated below
1950-
*) configure_nut ;;
1955+
*) # Final choices that can conflict with the matrix
1956+
# tried in default-all-errors* builds
1957+
case "${NUT_SSL_VARIANTS}" in
1958+
ssl|nss|openssl)
1959+
CONFIG_OPTS+=("--with-${NUT_SSL_VARIANTS}")
1960+
;;
1961+
yes) CONFIG_OPTS+=("--with-ssl") ;;
1962+
no) CONFIG_OPTS+=("--without-ssl") ;;
1963+
auto) CONFIG_OPTS+=("--with-ssl=auto") ;;
1964+
"") ;;
1965+
*) echo "WARNING: Unrecognized NUT_SSL_VARIANTS='${NUT_SSL_VARIANTS}' for a general deterministic build, ignored" >&2 ;;
1966+
esac
1967+
configure_nut
1968+
;;
19511969
esac
19521970
19531971
# NOTE: There is also a case "$BUILD_TYPE" above for setting CONFIG_OPTS
@@ -2842,6 +2860,17 @@ bindings)
28422860
CONFIG_OPTS+=("--enable-shared-private-libs")
28432861
fi
28442862
2863+
case "${NUT_SSL_VARIANTS}" in
2864+
ssl|nss|openssl)
2865+
CONFIG_OPTS+=("--with-${NUT_SSL_VARIANTS}")
2866+
;;
2867+
yes) CONFIG_OPTS+=("--with-ssl") ;;
2868+
no) CONFIG_OPTS+=("--without-ssl") ;;
2869+
auto) CONFIG_OPTS+=("--with-ssl=auto") ;;
2870+
"") ;;
2871+
*) echo "WARNING: Unrecognized NUT_SSL_VARIANTS='${NUT_SSL_VARIANTS}' for a general deterministic build, ignored" >&2 ;;
2872+
esac
2873+
28452874
if [ -n "${BUILD_DEBUGINFO-}" ]; then
28462875
CONFIG_OPTS+=("--with-debuginfo=${BUILD_DEBUGINFO}")
28472876
else
@@ -2987,6 +3016,8 @@ cross-windows-mingw*)
29873016
fi # else we have some value from caller
29883017
export WITH_LIBNUTPRIVATE
29893018
3019+
export NUT_SSL_VARIANTS
3020+
29903021
SOURCEMODE="out-of-tree" \
29913022
MAKEFLAGS="$PARMAKE_FLAGS" \
29923023
KEEP_NUT_REPORT_FEATURE="true" \

clients/Makefile.am

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,15 @@ upsstats_cgi_LDADD = $(LDADD_CLIENT) $(top_builddir)/common/libcommonstrjson.la
165165

166166
# not LDADD... why?
167167
libupsclient_la_SOURCES = upsclient.c upsclient.h
168+
upsclient.c: $(top_builddir)/include/nut_version.h
168169
# NOTE: The library does not require libcommonversion.la
170+
if ENABLE_SHARED_PRIVATE_LIBS
171+
libupsclient_la_LIBADD = \
172+
$(top_builddir)/common/libnutprivate-@NUT_SOURCE_GITREV_SEMVER_UNDERSCORES@-common-client.la
173+
else !ENABLE_SHARED_PRIVATE_LIBS
169174
libupsclient_la_LIBADD = \
170175
$(top_builddir)/common/libcommonclient.la
176+
endif !ENABLE_SHARED_PRIVATE_LIBS
171177
if HAVE_WINDOWS_SOCKETS
172178
libupsclient_la_LIBADD += -lws2_32
173179
endif HAVE_WINDOWS_SOCKETS
@@ -181,6 +187,15 @@ endif WITH_SSL
181187
# object .so names would differ)
182188

183189
# libupsclient version information
190+
# NOTE: with libnutprivate*common* builds dynamically linked into the same
191+
# program (a typical in-tree NUT client, not typical for out-of-tree third
192+
# party clients) we can end up with two copies of libcommon symbols present
193+
# in each library. It's recommended to explicitly call upscli_set_debug_level()
194+
# instead of ambiguously manipulating the nut_debug_level variable by name.
195+
# TOTHINK: Un-export nut_debug_level from this library to avoid ambiguity
196+
# for the run-time dynamic linker resolution? For now the shared-library
197+
# builds are "exotic", but it makes sense to deprecate this export in a
198+
# future release.
184199
libupsclient_la_LDFLAGS = -version-info 7:0:0
185200
libupsclient_la_LDFLAGS += -export-symbols-regex '^(upscli_|nut_debug_level)'
186201
#|s_upsdebug|fatalx|fatal_with_errno|xcalloc|xbasename|print_banner_once)'

clients/upsc.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
Copyright (C) 1999 Russell Kroll <rkroll@exploits.org>
44
Copyright (C) 2012 Arnaud Quette <arnaud.quette@free.fr>
5-
Copyright (C) 2020-2025 Jim Klimov <jimklimov+nut@gmail.com>
5+
Copyright (C) 2020-2026 Jim Klimov <jimklimov+nut@gmail.com>
66
77
This program is free software; you can redistribute it and/or modify
88
it under the terms of the GNU General Public License as published by
@@ -48,14 +48,14 @@ static void fatalx_error_json_simple(int msg_is_simple, const char *msg) {
4848
if (output_json) {
4949
if (msg_is_simple) {
5050
/* Caller knows there is nothing to escape here, pass through */
51-
printf("{\"error\": \"%s\"}\n", msg);
51+
printf("{\"error\": \"%s\"}\n", NUT_STRARG(msg));
5252
} else {
5353
printf("{\"error\": \"");
5454
json_print_esc(msg);
5555
printf("\"}\n");
5656
}
5757
}
58-
fatalx(EXIT_FAILURE, "Error: %s", msg);
58+
fatalx(EXIT_FAILURE, "Error: %s", NUT_STRARG(msg));
5959
}
6060

6161
static void usage(const char *prog)
@@ -91,6 +91,7 @@ static void usage(const char *prog)
9191
printf(" -h - display this help text\n");
9292

9393
nut_report_config_flags();
94+
upscli_report_build_details();
9495

9596
printf("\n%s", suggest_doc_links(prog, NULL));
9697
}
@@ -168,6 +169,8 @@ static void list_vars(void)
168169
int msg_is_simple = 1;
169170

170171
/* check for an old upsd */
172+
upsdebugx(1, "%s: got code %d, upserror %d",
173+
__func__, ret, upscli_upserror(ups));
171174
if (upscli_upserror(ups) == UPSCLI_ERR_UNKCOMMAND) {
172175
msg = "upsd is too old to support this query";
173176
} else {
@@ -177,14 +180,14 @@ static void list_vars(void)
177180

178181
if (output_json) {
179182
if (msg_is_simple) {
180-
printf(" \"error\": \"%s\"\n}\n", msg);
183+
printf(" \"error\": \"%s\"\n}\n", NUT_STRARG(msg));
181184
} else {
182185
printf(" \"error\": \"");
183186
json_print_esc(msg);
184187
printf("\"\n}\n");
185188
}
186189
}
187-
fatalx(EXIT_FAILURE, "Error: %s", msg);
190+
fatalx(EXIT_FAILURE, "Error: %s", NUT_STRARG(msg));
188191
}
189192

190193
while (upscli_list_next(ups, numq, query, &numa, &answer) == 1) {
@@ -237,6 +240,8 @@ static void list_upses(int verbose)
237240
int msg_is_simple = 1;
238241

239242
/* check for an old upsd */
243+
upsdebugx(1, "%s: got code %d, upserror %d",
244+
__func__, ret, upscli_upserror(ups));
240245
if (upscli_upserror(ups) == UPSCLI_ERR_UNKCOMMAND) {
241246
msg = "upsd is too old to support this query";
242247
} else {
@@ -394,6 +399,7 @@ int main(int argc, char **argv)
394399
s = getenv("NUT_DEBUG_LEVEL");
395400
if (s && str_to_int(s, &i, 10) && i > 0) {
396401
nut_debug_level = i;
402+
upscli_set_debug_level(nut_debug_level);
397403
}
398404
upsdebugx(1, "Starting NUT client: %s", prog);
399405

0 commit comments

Comments
 (0)