2022-09-02 00:07:34 +02:00
|
|
|
From be595e5e9e9bc8fa3fdd94358b1c92bd8b30b0eb Mon Sep 17 00:00:00 2001
|
|
|
|
From: Jim Fehlig <jfehlig@suse.com>
|
|
|
|
Date: Tue, 5 Jul 2022 11:21:45 -0600
|
|
|
|
Subject: util: Don't spawn pkttyagent when stdin is not a tty
|
2021-12-13 16:17:18 +01:00
|
|
|
|
|
|
|
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 being 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 that
|
|
|
|
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 =)
|
|
|
|
|
|
|
|
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
|
---
|
|
|
|
src/util/virpolkit.c | 3 +++
|
|
|
|
1 file changed, 3 insertions(+)
|
|
|
|
|
2023-01-18 23:49:05 +01:00
|
|
|
Index: libvirt-9.0.0/src/util/virpolkit.c
|
2021-12-13 16:17:18 +01:00
|
|
|
===================================================================
|
2023-01-18 23:49:05 +01:00
|
|
|
--- libvirt-9.0.0.orig/src/util/virpolkit.c
|
|
|
|
+++ libvirt-9.0.0/src/util/virpolkit.c
|
2022-07-06 19:18:39 +02:00
|
|
|
@@ -235,6 +235,9 @@ virPolkitAgentAvailable(void)
|
2021-12-13 16:17:18 +01:00
|
|
|
const char *termid = ctermid(NULL);
|
|
|
|
VIR_AUTOCLOSE fd = -1;
|
|
|
|
|
|
|
|
+ if (!isatty(STDIN_FILENO))
|
|
|
|
+ return false;
|
|
|
|
+
|
|
|
|
if (!virFileIsExecutable(PKTTYAGENT))
|
|
|
|
return false;
|
|
|
|
|