From nobody Mon May 6 18:03:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639229056; cv=none; d=zohomail.com; s=zohoarc; b=U58oCII1kaJUZFseCbDjUIROmSStVvgRIpYx2CfyOzpJ+sUBrIjfJMIxCsjV5eAE73nPxJ1yzZws+xurGLnf5eLc7kb+vnRpdcuMXVo3vaN7aL5ZQ2oUXa2RlG8CqwCUd9NzYfCOctFCMIYffX7e5P4RYerJNpvuzO1yy5RqAZE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639229056; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aUMYx78L7HABwxtKKB/keEYNqyXhx2nNgdfY0D2LQBg=; b=XhY/VJAY1DP3Q9/YTvkMcSV9yVOeLA8B+w8swjospP8pjxXK319czjyLTrMyP2f6cuZuE0zoNK8+IhhAgjZ4D5Mg2xzcE1gPIY/5UEQ7AdGWnqtj7SmBo/dXsEzaF/UX0Fe4eguE7WSoNroyYilb0vy1Cg5B2Nol/cPe11BLMcc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1639229056397856.1101493405832; Sat, 11 Dec 2021 05:24:16 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-27-pakC_oMiMzCGah9HOiTeSA-1; Sat, 11 Dec 2021 08:24:11 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 02FB21030C20; Sat, 11 Dec 2021 13:24:04 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2D02560C82; Sat, 11 Dec 2021 13:24:00 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 999454BB7C; Sat, 11 Dec 2021 13:23:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BBDNnU6017590 for ; Sat, 11 Dec 2021 08:23:49 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9A4BE1121315; Sat, 11 Dec 2021 13:23:49 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9635B1121314 for ; Sat, 11 Dec 2021 13:23:44 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A562E811E76 for ; Sat, 11 Dec 2021 13:23:44 +0000 (UTC) Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-276-z6zTS9wUM8SfPKAplv3rYA-1; Sat, 11 Dec 2021 08:23:43 -0500 Received: by mail-ed1-f72.google.com with SMTP id y9-20020aa7c249000000b003e7bf7a1579so10458464edo.5 for ; Sat, 11 Dec 2021 05:23:43 -0800 (PST) Received: from carol.localdomain (k8r.cz. [95.82.177.71]) by smtp.gmail.com with ESMTPSA id w5sm3240268edc.58.2021.12.11.05.23.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Dec 2021 05:23:41 -0800 (PST) Received: from carol.redhat.com (carol.k8r.cz [IPv6:::1]) by carol.localdomain (Postfix) with ESMTP id E59F5C20051; Sat, 11 Dec 2021 14:23:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639229055; h=from:from:sender:sender: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; bh=aUMYx78L7HABwxtKKB/keEYNqyXhx2nNgdfY0D2LQBg=; b=aZpFLjhjvEC4x6v6jzv5QtIvuJbVekKuhD490sS0AyzJFJ0WMKPOIVA8hWwICjy04Bkwge 8N9ugtMFkOttgKCKrZGXu4av/doc0hin+w9NPJpuHiNE2BnXeOlX45OgCSGD5jHOgDGWFA Nv2siBbrbaBr+ckjAW4DSnfmLDT+LTE= X-MC-Unique: pakC_oMiMzCGah9HOiTeSA-1 X-MC-Unique: z6zTS9wUM8SfPKAplv3rYA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aUMYx78L7HABwxtKKB/keEYNqyXhx2nNgdfY0D2LQBg=; b=6E8YeEmOIss7fyVPBvP2g5XUdAGkD0svzltvrhsdAfjjXW61kcbHRwRAjik9jiCglx y77o+tg9ByxvcusUAH0j8aGqNm+X4WYp2ofm/EJKQDLB/ek/b2SUuEeNgtU2guYdOWlt smeVdJ4Ef6DWAFNH5WgTI2XuiZOpfOpj+JaldJpW/lesFQALBWVpZosI68xHx1h1qU2/ LIP/jEhJ6CHEWsiAiXK9bQiqtIrSQm76XqvOuwW5f5TJ+JaQeQLhEliwdVlhC9B7jsbU yCi3Jg5b6zAxFp/9F4QZj01O58EhS+X/c3aSyCU1cOMw+GEGkKcRdy6SLzitFVcH0dn6 i+OA== X-Gm-Message-State: AOAM53287HXQZUCDLfcgHREgT3q5WogYYXhp4p141peAacRtMRIQMixe mnxzxTrstmFppL2kbLO5xh3GCSEWMvWcX7rAqOfJ7IQOB7DGAHp9GM5fzxy3ZHV2XPoSstD/WHZ IngqphzsNaSTC274Fj9SVHUpCJqtFQzIE4Bm8ulRIuUprdEB0rE00XtellCQ2YmPIFuJlsfM= X-Received: by 2002:aa7:cd8a:: with SMTP id x10mr46985308edv.3.1639229022247; Sat, 11 Dec 2021 05:23:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJzv7WyDSejuJVtvrAbMwnO1aJsc8JRDyjAansLHRcLuxcNT2kq+FqWSV+S7TkWfBJq1k7GSmA== X-Received: by 2002:aa7:cd8a:: with SMTP id x10mr46985290edv.3.1639229021997; Sat, 11 Dec 2021 05:23:41 -0800 (PST) From: Martin Kletzander To: Jim Fehlig Subject: [PATCH] util: Don't spawn pkttyagent when stdin is not a tty Date: Sat, 11 Dec 2021 14:23:11 +0100 Message-Id: In-Reply-To: References: <6498ff1c90e21df99e46cd021adf1244d45b926c.1637449540.git.mkletzan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: libvir-list@redhat.com, Julie Cao X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639229058467100001 Content-Type: text/plain; charset="utf-8" My idea was that running pkttyagent unconditionally, modulo checks that pkttyagent itself does to make sure it does not fail, is not going to be an issue turned out to be wrong. Adding back the original check for stdin bei= ng a tty helps in some testing scenarios as reported by Jim Fehlig and does not really cause any issues. I originally wanted it in because it also made pkttyagent auth work with redirected input into virsh (with a connection th= at requires polkit authentication and without a session-wide polkit tty agent, basically making pkttyagent necessary to succeed). But anyone running virsh like that is asking for problems already anyway =3D) Signed-off-by: Martin Kletzander Reviewed-by: Michal Privoznik Tested-by: Jim Fehlig --- src/util/virpolkit.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/util/virpolkit.c b/src/util/virpolkit.c index 8970de192fe1..bb68b5a59614 100644 --- a/src/util/virpolkit.c +++ b/src/util/virpolkit.c @@ -237,6 +237,9 @@ virPolkitAgentAvailable(void) const char *termid =3D ctermid(NULL); VIR_AUTOCLOSE fd =3D -1; =20 + if (!isatty(STDIN_FILENO)) + return false; + if (!virFileIsExecutable(PKTTYAGENT)) return false; =20 --=20 2.34.1