From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id yGHJNGhMo2CfswAAgWs5BA (envelope-from ) for ; Tue, 18 May 2021 07:11:04 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id 2JiLMGhMo2AxOQAA1q6Kng (envelope-from ) for ; Tue, 18 May 2021 05:11:04 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [144.217.243.247]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 0B2B3B48F for ; Tue, 18 May 2021 07:11:04 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 9CA3A2AA43; Tue, 18 May 2021 01:10:56 -0400 (EDT) Received: from lahtoruutu.iki.fi (lahtoruutu.iki.fi [185.185.170.37]) by mail.notmuchmail.org (Postfix) with ESMTPS id 03FE32AA1C for ; Tue, 18 May 2021 01:10:53 -0400 (EDT) Received: from guru.guru-group.fi (unknown [IPv6:2a02:2380:1:9:5054:ff:feb7:a4bc]) (using TLSv1.2 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: too) by lahtoruutu.iki.fi (Postfix) with ESMTPSA id E7E341B001E8; Tue, 18 May 2021 08:10:49 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1621314650; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=PMYbr7YRXZL1ARBsxCI57WN+twH6QwKh4RAPFK2mC74=; b=U2FbcYWHf95+hNss6pGLTX0oHJ+VOZe8wyJgijytBSnT/SpTC8GGIY/GFmCU2sNMWwRmMn vJQOrvaAAHBkaw8QeUbrhLvEfKTv3K+SoczHS7u9WD6loNDrL9zTB+qg4CYZf8zg58qlPq 5ajb8Mi2P3xqg/oLxh3SQCEJvqMwI4Fc1PK7QEZ73fa4YVfwNdctxeoZKJYrhOYMNcMo8Z mtcFuVN4/ddB54YerrBU7iM7qvedJJli5nrJH7PQDRp29CyGkq8K4w6EQ3hSGwuJL350vw 1BhukUpzidoV9r0h1CA03/s48PsEsGSvpm/IQS5MJD7RdBw/fSNeoUJZSU4fCA== From: Tomi Ollila To: Felipe Contreras Subject: Re: [PATCH v2] test: replace notmuch_passwd_sanitize() with _libconfig_sanitize() In-Reply-To: References: <20210517193315.11343-1-tomi.ollila@iki.fi> User-Agent: Notmuch/0.32+21~gfdddd4c (https://notmuchmail.org) Emacs/27.1 X-Face: HhBM'cA~ MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1621314650; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=PMYbr7YRXZL1ARBsxCI57WN+twH6QwKh4RAPFK2mC74=; b=EA/CdHsxFa8p9ubbPwYNdN6C6t9PRJxAAGGydBgySLEZ90A8qgskDpFwU6NH4YvA+W/ma5 aD7yReqFUYEHfWYOwB9V2TW8wO1sooSxQdmQqnRstLgYjK4sSKVLxkHCrUvdefexxG8rz6 VFy6qAOSo9QX6aGaUr4fwtmCMZ+hCoJ5IaHZrcpWAINSrd45MPiifxhq/+qZvK4tofrQnq zoXZS18k8xIA8SsRXx7645hG3zvvwsiaPd8eLIEXSSFDmth87OP38MN557pucpNU40sJnL q4YhoanQjEEWQc80dTBVIvqXLfgVhSwqy9fUJ54Vd34yKnd8aEnPJgixXp25qA== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=too smtp.mailfrom=tomi.ollila@iki.fi ARC-Seal: i=1; s=lahtoruutu; d=iki.fi; t=1621314650; a=rsa-sha256; cv=none; b=S8irLrQInKS6uILxcq4Ok9+/jAXhu/gVCK6fZ4b+JiGYwjp3qIO4A638O98OGRpmyhlvd4 mZqrzmbIR3TyrVL5bWWanldLZTq8IUvR7yTqU8ogZxdq0WsCxp1Lh4yjN59w9oW+fHJWM2 SAZegRtSvBpiIiwbmun5RlXoqgU23vtkyfIz+9mTgg0oRYdULi2U5DsdZUlxjtyPB4YTpr oJmGa+f4fLHXWhBj4mIp3nBOBDOOdwMnCKBlHGGfvOQ4BdhQQ1JtBX0QMdUbd72thZd8Bh 145QsM2KG1OwzM2Pj5dOgn584OwI7uydiWbMm1Hw0oT/+TK9NZBe0GkvQcNhRQ== Message-ID-Hash: Z543CH5UVPVISCXEXMEFAZ6DW2DK4JFV X-Message-ID-Hash: Z543CH5UVPVISCXEXMEFAZ6DW2DK4JFV X-MailFrom: tomi.ollila@iki.fi X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: "notmuch@notmuchmail.org" X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1621314664; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=hg5HGnE/cATH4pa6leNskV0keQmJQpfP21tpaNzUnTg=; b=Q7Ap5uTzeWAyEPbyI3Qss0W3pO2eUcl9V3W48KUTM7FAYloxJPkFeKZ21aPqxWd1tjesl9 PftV/0hyV2HqQMLT91LbUcfd14OG4dQTnxl0V3mNMwGuKKulOlOHzSKePSvTldvaj9VfQU p0+OcKLQUi0yiK78Gt9U+I+dYggUA1bNfaH0R5KXxl8pUNzs0FVV7DE80aPjffTxaOToEY BLMks7QRJw3ZjZJ62e+E57cOIO1osnfthIsvAD6BmH+Qtsr1sLQxZK8KrIrRdhBJrm2mXN OQcdyXr01etshVIeGbsQsKkDz5qhKSXoanQUZQUr32ShB21o69GgvGn65RMazw== ARC-Seal: i=2; s=key1; d=yhetil.org; t=1621314664; a=rsa-sha256; cv=fail; b=HCy/pok2+k+QLRv3uWkAjwoOApSk2XuJ9GwY+MOd+tSDwX6dMaoiWt7zGbCtMZSniVUjma XQf77IouX4FllG/3l+PV9PeSZxTIf3d19S8A9v3VbmsQHf2boB/eZ3CcLwi5Q0ksB93I5P BFRt3fYU1aMt8jGQA4X9o3u4M4dnYeJGLCm/tduesn+Aht4RCx9ULpikCQ3ejhaODjUiEI A+MNun1xxj2M1QE3HULEiSBncmUEpzB6CQ/60QJLqhsHKqs4mspDqrv0J6kpigT/SsdMhv 618RixOxvV4iWL6SM19cSJSB8Gr1hFnWv4muSnRVkRegx38uUU5T51mUAf5JIA== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=iki.fi header.s=lahtoruutu header.b=U2FbcYWH; arc=reject ("signature check failed: fail, {[1] = sig:iki.fi:reject}"); dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: 0.92 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=iki.fi header.s=lahtoruutu header.b=U2FbcYWH; arc=reject ("signature check failed: fail, {[1] = sig:iki.fi:reject}"); dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 0B2B3B48F X-Spam-Score: 0.92 X-Migadu-Scanner: scn0.migadu.com X-TUID: yNudLF4+nIW0 On Mon, May 17 2021, Felipe Contreras wrote: > On Mon, May 17, 2021 at 2:33 PM Tomi Ollila wrote: >> >> 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... >> >> In addition to ".(none)" now also ".localdomain" if filtered from >> USERNAME@FQDN. >> --- >> >> Rebase of id:20210502181535.31292-1-tomi.ollila@iki.fi >> >> * 'fn () {' style change >> * added @ to fqdn replace, as it could be subset of user >> >> test/T590-libconfig.sh | 97 +++++++++++++++++++++++++----------------- >> test/test-lib.sh | 20 --------- >> 2 files changed, 59 insertions(+), 58 deletions(-) >> >> diff --git a/test/T590-libconfig.sh b/test/T590-libconfig.sh >> index 745e1bb4..8e70b7b2 100755 >> --- a/test/T590-libconfig.sh >> +++ b/test/T590-libconfig.sh >> @@ -5,6 +5,26 @@ test_description="library config API" >> >> add_email_corpus >> >> +_libconfig_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 l[:3] == "8: ": >> + # fqdn could be subset of user; therefore @ >> + l = l.replace(user, "USERNAME").replace("@" + fqdn, "@FQDN") >> + l = l.replace(".(none)", "").replace(".localdomain", "") >> + elif l[:3] == "a: ": >> + l = l.replace(name, "USER_FULL_NAME") > > This generates garbage when name is null. See ff5f141b (test: fix > passwd_sanitize(), 2021-05-01). You're right -- that was the reason I added ''s around, just forgot that part :/ Anyway, there are other problems, will fix that along... Thanks, Tomi > > At the very least we need to check for that, even better if we > generate the proper output: > > if name: > l = l.replace(name, "USER_FULL_NAME") > else: > l = "a: \'USER_FULL_NAME\'\\n" > > This makes the test pass with no geckos name, but we need to use bash > strings: $'string'. Otherwise we would need to do something much more > weird. > > Cheers. > > -- > Felipe Contreras