147 lines
4.8 KiB
Diff
147 lines
4.8 KiB
Diff
From 432850e943d72daedb1d352a0332d3fdee6078e2 Mon Sep 17 00:00:00 2001
|
|
From: Ray Strode <rstrode@redhat.com>
|
|
Date: Sun, 24 Jan 2021 11:26:40 -0500
|
|
Subject: [PATCH 11/15] subman: Fix some build warnings
|
|
|
|
---
|
|
plugins/subman/gsd-subscription-manager.c | 8 ++++----
|
|
1 file changed, 4 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/plugins/subman/gsd-subscription-manager.c b/plugins/subman/gsd-subscription-manager.c
|
|
index 46f8d35c..1f9ca447 100644
|
|
--- a/plugins/subman/gsd-subscription-manager.c
|
|
+++ b/plugins/subman/gsd-subscription-manager.c
|
|
@@ -561,62 +561,62 @@ _client_register_with_keys (GsdSubscriptionManager *manager,
|
|
if (!_client_register_start (manager, error))
|
|
return FALSE;
|
|
g_debug ("spawning %s", LIBEXECDIR "/gsd-subman-helper");
|
|
subprocess = g_subprocess_new (G_SUBPROCESS_FLAGS_STDIN_PIPE | G_SUBPROCESS_FLAGS_STDERR_PIPE, error,
|
|
"pkexec", LIBEXECDIR "/gsd-subman-helper",
|
|
"--kind", "register-with-key",
|
|
"--address", priv->address,
|
|
"--hostname", hostname,
|
|
"--organisation", organisation,
|
|
NULL);
|
|
if (subprocess == NULL) {
|
|
g_prefix_error (error, "failed to find pkexec: ");
|
|
return FALSE;
|
|
}
|
|
|
|
if (!g_subprocess_communicate (subprocess, stdin_buf, NULL, NULL, &stderr_buf, error)) {
|
|
g_prefix_error (error, "failed to run pkexec: ");
|
|
return FALSE;
|
|
}
|
|
|
|
rc = g_subprocess_get_exit_status (subprocess);
|
|
if (rc != 0) {
|
|
if (g_bytes_get_size (stderr_buf) == 0) {
|
|
g_set_error_literal (error, G_IO_ERROR, rc,
|
|
"Failed to run helper without stderr");
|
|
return FALSE;
|
|
}
|
|
|
|
g_set_error (error, G_IO_ERROR, rc,
|
|
"%.*s",
|
|
- g_bytes_get_size (stderr_buf),
|
|
- g_bytes_get_data (stderr_buf, NULL));
|
|
+ (int) g_bytes_get_size (stderr_buf),
|
|
+ (char *) g_bytes_get_data (stderr_buf, NULL));
|
|
}
|
|
|
|
/* FIXME: also do on error? */
|
|
if (!_client_register_stop (manager, error))
|
|
return FALSE;
|
|
if (!_client_subscription_status_update (manager, error))
|
|
return FALSE;
|
|
_client_maybe__show_notification (manager);
|
|
|
|
/* success */
|
|
return TRUE;
|
|
}
|
|
|
|
static gboolean
|
|
_client_register (GsdSubscriptionManager *manager,
|
|
const gchar *hostname,
|
|
const gchar *organisation,
|
|
const gchar *username,
|
|
const gchar *password,
|
|
GError **error)
|
|
{
|
|
GsdSubscriptionManagerPrivate *priv = manager->priv;
|
|
g_autoptr(GSubprocess) subprocess = NULL;
|
|
g_autoptr(GBytes) stdin_buf = g_bytes_new (password, strlen (password) + 1);
|
|
g_autoptr(GBytes) stderr_buf = NULL;
|
|
gint rc;
|
|
|
|
/* fallback */
|
|
if (organisation == NULL)
|
|
organisation = "";
|
|
@@ -628,62 +628,62 @@ _client_register (GsdSubscriptionManager *manager,
|
|
g_debug ("spawning %s", LIBEXECDIR "/gsd-subman-helper");
|
|
subprocess = g_subprocess_new (G_SUBPROCESS_FLAGS_STDIN_PIPE | G_SUBPROCESS_FLAGS_STDERR_PIPE,
|
|
error,
|
|
"pkexec", LIBEXECDIR "/gsd-subman-helper",
|
|
"--kind", "register-with-username",
|
|
"--address", priv->address,
|
|
"--hostname", hostname,
|
|
"--organisation", organisation,
|
|
"--username", username,
|
|
NULL);
|
|
if (subprocess == NULL) {
|
|
g_prefix_error (error, "failed to find pkexec: ");
|
|
return FALSE;
|
|
}
|
|
|
|
if (!g_subprocess_communicate (subprocess, stdin_buf, NULL, NULL, &stderr_buf, error)) {
|
|
g_prefix_error (error, "failed to run pkexec: ");
|
|
return FALSE;
|
|
}
|
|
|
|
rc = g_subprocess_get_exit_status (subprocess);
|
|
if (rc != 0) {
|
|
if (g_bytes_get_size (stderr_buf) == 0) {
|
|
g_set_error_literal (error, G_IO_ERROR, rc,
|
|
"Failed to run helper without stderr");
|
|
return FALSE;
|
|
}
|
|
|
|
g_set_error (error, G_IO_ERROR, rc,
|
|
"%.*s",
|
|
- g_bytes_get_size (stderr_buf),
|
|
- g_bytes_get_data (stderr_buf, NULL));
|
|
+ (int) g_bytes_get_size (stderr_buf),
|
|
+ (char *) g_bytes_get_data (stderr_buf, NULL));
|
|
}
|
|
|
|
/* FIXME: also do on error? */
|
|
if (!_client_register_stop (manager, error))
|
|
return FALSE;
|
|
if (!_client_subscription_status_update (manager, error))
|
|
return FALSE;
|
|
_client_maybe__show_notification (manager);
|
|
return TRUE;
|
|
}
|
|
|
|
static gboolean
|
|
_client_unregister (GsdSubscriptionManager *manager, GError **error)
|
|
{
|
|
g_autoptr(GSubprocess) subprocess = NULL;
|
|
|
|
/* apparently: "we can't send registration credentials over the regular
|
|
* system or session bus since those aren't really locked down..." */
|
|
if (!_client_register_start (manager, error))
|
|
return FALSE;
|
|
g_debug ("spawning %s", LIBEXECDIR "/gsd-subman-helper");
|
|
subprocess = g_subprocess_new (G_SUBPROCESS_FLAGS_STDERR_PIPE, error,
|
|
"pkexec", LIBEXECDIR "/gsd-subman-helper",
|
|
"--kind", "unregister",
|
|
NULL);
|
|
if (subprocess == NULL) {
|
|
g_prefix_error (error, "failed to find pkexec: ");
|
|
return FALSE;
|
|
}
|
|
if (!_client_subprocess_wait_check (subprocess, error))
|
|
--
|
|
2.30.0
|
|
|