From 73b51f9bf487297f2af061992b0b9ba06354dced Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Fri, 22 Aug 2014 07:40:45 +0200 Subject: [PATCH] trigger: fix regex used in default triggers to hide passwords (closes #172) "\S" is not supported on *BSD, so it is replaced by "[^ ]" (which should be enough, since there should be no tabs or other whitespace different from spaces in command line). (cherry picked from commit 333253e5b9ba3431ee0ea1242d8195ddb1fa5c62) --- ChangeLog.asciidoc | 2 ++ src/plugins/trigger/trigger-config.c | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ChangeLog.asciidoc b/ChangeLog.asciidoc index dab2426c2..33353f55c 100644 --- a/ChangeLog.asciidoc +++ b/ChangeLog.asciidoc @@ -22,6 +22,8 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] * tests: fix memory leak in tests launcher * aspell: fix crash with command "/aspell addword" if no word is given (closes #164, closes #165) +* trigger: fix regex used in default triggers to hide passwords ("\S" is not + supported on *BSD) (closes #172) == Version 1.0 (2014-08-15) diff --git a/src/plugins/trigger/trigger-config.c b/src/plugins/trigger/trigger-config.c index 57d84c871..2b75e2bea 100644 --- a/src/plugins/trigger/trigger-config.c +++ b/src/plugins/trigger/trigger-config.c @@ -64,11 +64,11 @@ char *trigger_config_default_list[][1 + TRIGGER_NUM_OPTIONS] = "", "==^(" "(/(msg|quote) +nickserv " - "+(id|identify|register|ghost +\\S+|release +\\S+|regain +\\S+) +)|" - "/oper +\\S+ +|" + "+(id|identify|register|ghost +[^ ]+|release +[^ ]+|regain +[^ ]+) +)|" + "/oper +[^ ]+ +|" "/quote +pass +|" - "/set +\\S*password\\S* +|" - "/secure +(passphrase|decrypt|set +\\S+) +)" + "/set +[^ ]*password[^ ]* +|" + "/secure +(passphrase|decrypt|set +[^ ]+) +)" "(.*)" "==$1$.*+", "", @@ -78,7 +78,7 @@ char *trigger_config_default_list[][1 + TRIGGER_NUM_OPTIONS] = "modifier", "5000|irc_message_auth", "", - "==^(.*(id|identify|register|ghost +\\S+|release +\\S+) +)(.*)==$1$.*+", + "==^(.*(id|identify|register|ghost +[^ ]+|release +[^ ]+) +)(.*)==$1$.*+", "", "" }, /* hide server password in commands /server and /connect */ @@ -86,7 +86,7 @@ char *trigger_config_default_list[][1 + TRIGGER_NUM_OPTIONS] = "modifier", "5000|input_text_display;5000|history_add", "", - "==^(/(server|connect) .*-(sasl_)?password=)(\\S+)(.*)==$1$.*4$5" + "==^(/(server|connect) .*-(sasl_)?password=)([^ ]+)(.*)==$1$.*4$5" "", "" }, { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL },