Skip to content
Myr

config: setting password-character should not enable password mode

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Before this patch, setting password-character in fuzzel.ini would auto-enable password mode. This is incorrect. The correct behavior is: * password mode is only enabled when --password=[CHAR] is used * password-character from fuzzel.ini is only used when --password is used without argument. Closes #241

authored by Daniel Eklöf · committed by Daniel Eklöf · parent 8b54951 · Browse files · 5 files+27 added−9 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

5 files+27 added−9 removed

  • other:+27 added−9 removed

5 files+27 added−9 removed

modified:CHANGELOG.md+3 added
37 unmodified lines
3839* Last line sometimes not being rendered ([#234][234]).40* `key-bindings.cursor-right-word` not being recognized as a valid41 action.42* `password-character` being set in `fuzzel.ini` incorrectly enabling43 password mode ([#241][241]).4445[234]: https://codeberg.org/dnkl/fuzzel/issues/23446[241]: https://codeberg.org/dnkl/fuzzel/issues/241474849### Security50### Contributors
497 unmodified lines
modified:config.c+5 added-2 removed
753 unmodified lines
754 free(password_chars);755 return false;756 }757758 conf->password = password_chars[0];758 conf->password_mode.character = password_chars[0];759 free(password_chars);760 return true;761 }762
626 unmodified lines
1389 bool ret = !errors_are_fatal;1390 *conf = (struct config) {1391 .output = NULL,1392 .prompt = c32dup(U"> "),1393 .password = U'\0',1393 .match_fields = MATCH_FILENAME | MATCH_NAME | MATCH_GENERIC,1394 .password_mode = {1395 .character = U'\0',1396 .enabled = false,1397 },1398 .terminal = NULL,1399 .launch_prefix = NULL,1400 .font = strdup("monospace"),1401 .dpi_aware = DPI_AWARE_AUTO,
121 unmodified lines
modified:config.h+5 added-1 removed
71 unmodified lines
7273struct config {74 char *output;75 char32_t *prompt;76 char32_t password;76 enum match_fields match_fields;7778 struct {79 char32_t character;80 bool enabled;81 } password_mode;8283 char *terminal;84 char *launch_prefix;8586 char *font;
67 unmodified lines
modified:main.c+12 added-4 removed
755 unmodified lines
756 break;757 }758759 case OPT_PASSWORD: {760 char32_t password_char = U'*';760 char32_t password_char = U'\0';761 if (optarg != NULL) {762 char32_t *wide_optarg = ambstoc32(optarg);763 if (c32len(wide_optarg) != 1) {764 fprintf(
5 unmodified lines
770 }771 password_char = wide_optarg[0];772 free(wide_optarg);773 }774 cmdline_overrides.conf.password = password_char;774 cmdline_overrides.conf.password_mode.enabled = true;775 cmdline_overrides.conf.password_mode.character = password_char;776 break;777 }778779 case 'T':
390 unmodified lines
1170 if (cmdline_overrides.conf.prompt != NULL) {1171 free(conf.prompt);1172 conf.prompt = cmdline_overrides.conf.prompt;1173 }1173 if (cmdline_overrides.conf.password != U'\0')1174 conf.password = cmdline_overrides.conf.password;1174 if (cmdline_overrides.conf.password_mode.enabled) {1175 conf.password_mode.enabled = true;1176 conf.password_mode.character =1177 cmdline_overrides.conf.password_mode.character != U'\0'1178 ? cmdline_overrides.conf.password_mode.character1179 : conf.password_mode.character != U'\0'1180 ? conf.password_mode.character1181 : U'*';1182 }1183 if (cmdline_overrides.conf.terminal != NULL) {1184 free(conf.terminal);1185 conf.terminal = strdup(cmdline_overrides.conf.terminal);1186 }
293 unmodified lines
modified:render.c+2 added-2 removed
231 unmodified lines
232233 for (size_t i = 0; i < prompt_len + text_len; i++) {234 char32_t wc = i < prompt_len235 ? pprompt[i]236 : (conf->password != 0237 ? conf->password236 : (conf->password_mode.enabled237 ? conf->password_mode.character238 : ptext[i - prompt_len]);239240 const struct fcft_glyph *glyph = fcft_rasterize_char_utf32(241 font, wc, subpixel);
616 unmodified lines