mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
daemon: Avoid dead code in polkit auth
This commit is contained in:
parent
fe64499dd1
commit
604ae65744
@ -2738,12 +2738,13 @@ remoteDispatchAuthPolkit(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
int status = -1;
|
int status = -1;
|
||||||
char *ident = NULL;
|
char *ident = NULL;
|
||||||
bool authdismissed = 0;
|
bool authdismissed = 0;
|
||||||
bool supportsuid = false;
|
|
||||||
char *pkout = NULL;
|
char *pkout = NULL;
|
||||||
struct daemonClientPrivate *priv =
|
struct daemonClientPrivate *priv =
|
||||||
virNetServerClientGetPrivateData(client);
|
virNetServerClientGetPrivateData(client);
|
||||||
virCommandPtr cmd = NULL;
|
virCommandPtr cmd = NULL;
|
||||||
|
# ifndef PKCHECK_SUPPORTS_UID
|
||||||
static bool polkitInsecureWarned;
|
static bool polkitInsecureWarned;
|
||||||
|
# endif
|
||||||
|
|
||||||
virMutexLock(&priv->lock);
|
virMutexLock(&priv->lock);
|
||||||
action = virNetServerClientGetReadonly(client) ?
|
action = virNetServerClientGetReadonly(client) ?
|
||||||
@ -2775,19 +2776,21 @@ remoteDispatchAuthPolkit(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
(long long) callerPid, callerUid);
|
(long long) callerPid, callerUid);
|
||||||
|
|
||||||
virCommandAddArg(cmd, "--process");
|
virCommandAddArg(cmd, "--process");
|
||||||
|
|
||||||
# ifdef PKCHECK_SUPPORTS_UID
|
# ifdef PKCHECK_SUPPORTS_UID
|
||||||
supportsuid = true;
|
virCommandAddArgFormat(cmd, "%lld,%llu,%lu",
|
||||||
# endif
|
(long long) callerPid,
|
||||||
if (supportsuid) {
|
timestamp,
|
||||||
virCommandAddArgFormat(cmd, "%lld,%llu,%lu",
|
(unsigned long) callerUid);
|
||||||
(long long) callerPid, timestamp, (unsigned long) callerUid);
|
# else
|
||||||
} else {
|
if (!polkitInsecureWarned) {
|
||||||
if (!polkitInsecureWarned) {
|
VIR_WARN("No support for caller UID with pkcheck. "
|
||||||
VIR_WARN("No support for caller UID with pkcheck. This deployment is known to be insecure.");
|
"This deployment is known to be insecure.");
|
||||||
polkitInsecureWarned = true;
|
polkitInsecureWarned = true;
|
||||||
}
|
|
||||||
virCommandAddArgFormat(cmd, "%lld,%llu", (long long) callerPid, timestamp);
|
|
||||||
}
|
}
|
||||||
|
virCommandAddArgFormat(cmd, "%lld,%llu", (long long) callerPid, timestamp);
|
||||||
|
# endif
|
||||||
|
|
||||||
virCommandAddArg(cmd, "--allow-user-interaction");
|
virCommandAddArg(cmd, "--allow-user-interaction");
|
||||||
|
|
||||||
if (virAsprintf(&ident, "pid:%lld,uid:%d",
|
if (virAsprintf(&ident, "pid:%lld,uid:%d",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user