From 813f3dc7b302324a361326c2583f37b002100968 Mon Sep 17 00:00:00 2001 From: "Alfonso S. Siciliano" Date: Mon, 27 May 2024 19:51:37 +0200 Subject: [PATCH] contrib/bsddialog: Import version 1.0.3 Change --mixedform output to adapt to bsdinstall restoring dialog(1) behavior. Avoid to print the field value to output if is read-only (less than or equal to zero). This fixes passwords in wlanconfig, avoiding to print also SSID. To note --mixedform continues to print field value if is read-only. This avoids breaking netconfig and netconfig_ipv6. See /usr/src/contrib/bsddialog/CHANGELOG '2024-05-27 Version 1.0.3' for more detailed information. Reported by: garga --- CHANGELOG | 9 +++++++++ Makefile | 2 +- README.md | 4 +++- lib/bsddialog.h | 2 +- utility/bsddialog.1 | 7 ++++++- utility/util_builders.c | 7 ++++++- 6 files changed, 26 insertions(+), 5 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 0e75f847347..6877297d435 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,12 @@ +2024-05-27 1.0.3 + + Utility: + change: --form and --mixedform do not print field value to output fd if + is <= 0 (readonly). To note --mixedgauge continues + to print field value if = 2 (readonly) unless + is <= 0 (as described previously). + + 2024-04-11 Version 1.0.2 Utility: diff --git a/Makefile b/Makefile index e6ec9988c59..f1b2da675f9 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ # Written in 2023 by Alfonso Sabato Siciliano OUTPUT = bsddialog -export VERSION=1.0.2 +export VERSION=1.0.3 .CURDIR ?= ${CURDIR} LIBPATH = ${.CURDIR}/lib LIBBSDDIALOG = ${LIBPATH}/libbsddialog.so diff --git a/README.md b/README.md index a902f7fada7..f984b488b23 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# BSDDialog 1.0.2 +# BSDDialog 1.0.3 This project provides **bsddialog** and **libbsddialog**, an utility and a library to build scripts and tools with TUI dialogs and widgets. @@ -138,3 +138,5 @@ in the _Public Domain_ to build new projects: - fix --form "" 0 0 0 Label 1 0 Init 1 12 0 0 (with 0 editable field). - fix --mixedform "" 0 0 0 Label 1 0 Init 1 12 0 0 2 (with 0 editable field). - add *text* customization to --hmsg *help-message* + - check --passwordform *fieldlen* like --form and --mixedform. + diff --git a/lib/bsddialog.h b/lib/bsddialog.h index 08fb25b8701..c797f918fb8 100644 --- a/lib/bsddialog.h +++ b/lib/bsddialog.h @@ -30,7 +30,7 @@ #include -#define LIBBSDDIALOG_VERSION "1.0.2" +#define LIBBSDDIALOG_VERSION "1.0.3" /* Return values */ #define BSDDIALOG_ERROR -1 diff --git a/utility/bsddialog.1 b/utility/bsddialog.1 index fac17ef114b..4586ba16020 100644 --- a/utility/bsddialog.1 +++ b/utility/bsddialog.1 @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd April 7, 2024 +.Dd May 25, 2024 .Dt BSDDIALOG 1 .Os .Sh NAME @@ -495,6 +495,7 @@ if the field becomes readonly and its value is the .Ar init width. +The field input is not printed to output if it is readonly. .Ar maxletters is the maximum input length, if is .Dv 0 @@ -553,6 +554,10 @@ if the field becomes readonly and its value is the .Ar init width. +The field input is not printed to output if +.Ar fieldlen +is less than or equal to +.Dv 0 . .Ar maxletters is the maximum input length, if is .Dv 0 diff --git a/utility/util_builders.c b/utility/util_builders.c index 8c846819f4e..2e69994a0ec 100644 --- a/utility/util_builders.c +++ b/utility/util_builders.c @@ -581,7 +581,8 @@ print_form_items(int output, int nitems, struct bsddialog_formitem *items, } for (i = 0; i < nitems; i++) { - dprintf(opt->output_fd, "%s\n", items[i].value); + if (!(items[i].flags & BSDDIALOG_FIELDREADONLY)) + dprintf(opt->output_fd, "%s\n", items[i].value); free(items[i].value); } } @@ -715,6 +716,10 @@ int mixedform_builder(BUILDER_ARGS) focusitem = -1; output = bsddialog_form(conf, text, rows, cols, formheight, nitems, items, &focusitem); + for (i = 0; i < nitems; i++) { + if ((int)strtol(argv[i * sizeitem + 6], NULL, 10) > 0) + items[i].flags &= ~ BSDDIALOG_FIELDREADONLY; + } print_form_items(output, nitems, items, focusitem, opt); free(items);