diff options
| author | Tomi Ollila <tomi.ollila@iki.fi> | 2021-05-22 16:39:57 +0300 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2021-05-22 11:51:29 -0300 |
| commit | 8675be1d307bc2df882107744641f6a7858e65ad (patch) | |
| tree | d7838780517218f73c4a9a6e831316e2d1077195 /test/test-lib.sh | |
| parent | 3baa61e0e58402bc50c5df529fcf669bf4b2facb (diff) | |
test: replace notmuch_passwd_sanitize() with _libconfig_sanitize()
notmuch_passwd_sanitize() in test-lib.sh is too generic, it cannot
work in many cases...
The more specific version _libconfig_sanitize() replaces it in
T590-libconfig.sh and the code that uses it is modified to output
the keys (ascending numbers printed in hex) so the sanitizer knows
what to sanitize in which lines...
"@" + fqdn -> "@FQDN" replacement is used as fqdn could
-- in theory -- be substring of 'USERNAME'.
'user -> 'USER_FULL_NAME replacement to work in cases where user
is empty -- as only first ' is replaced that works as expected.
In addition to ".(none)" now also ".localdomain" is filtered from
USERNAME@FQDN.
/dev/fd/{n} is not defined in posix, but it is portable enough
(if it weren't it is easy to fix -- now code looks clearer).
Diffstat (limited to 'test/test-lib.sh')
| -rw-r--r-- | test/test-lib.sh | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/test/test-lib.sh b/test/test-lib.sh index 89eb744d..c379d140 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -564,26 +564,6 @@ notmuch_built_with_sanitize () { sed 's/^built_with[.]\(.*\)=.*$/built_with.\1=something/' } -notmuch_passwd_sanitize () { - ${NOTMUCH_PYTHON} -c' -import os, sys, pwd, socket - -pw = pwd.getpwuid(os.getuid()) -user = pw.pw_name -name = pw.pw_gecos.partition(",")[0] -fqdn = socket.getaddrinfo(socket.gethostname(), 0, 0, socket.SOCK_STREAM, 0, socket.AI_CANONNAME)[0][3] - -for l in sys.stdin: - if user: - l = l.replace(user, "USERNAME") - if fqdn: - l = l.replace(fqdn, "FQDN").replace(".(none)","") - if name: - l = l.replace(name, "USER_FULL_NAME") - sys.stdout.write(l) -' -} - notmuch_config_sanitize () { notmuch_dir_sanitize | notmuch_built_with_sanitize } |
