Commit c69b7433 authored by Niels De Graef's avatar Niels De Graef 😁
Browse files

gcr: Rename gcr-ssh-askpass

`gcr-ssh-askpass` is provided by both gcr3 and gcr4, so add our version
number so we can parallel install both.
parent 022837ad
Pipeline #412219 failed with stages
in 5 minutes and 44 seconds
......@@ -31,8 +31,10 @@
#include <errno.h>
#include <unistd.h>
#define GCR_SSH_ASKPASS_BIN "gcr4-ssh-askpass"
/* Used from tests to override location */
const char *gcr_ssh_askpass_executable = LIBEXECDIR "/gcr-ssh-askpass";
const char *gcr_ssh_askpass_executable = LIBEXECDIR "/" GCR_SSH_ASKPASS_BIN;
/**
* GcrSshAskpass:
......@@ -141,7 +143,7 @@ read_all_into_string (gint fd)
ret = read (fd, input->str + len, 256);
if (ret < 0) {
if (errno != EINTR && errno != EAGAIN) {
g_critical ("couldn't read from gcr-ssh-askpass: %s", g_strerror (errno));
g_critical ("couldn't read from " GCR_SSH_ASKPASS_BIN ": %s", g_strerror (errno));
g_string_free (input, TRUE);
return NULL;
}
......@@ -190,9 +192,9 @@ askpass_thread (gpointer data)
if (res == G_TLS_INTERACTION_HANDLED) {
value = g_tls_password_get_value (password, &length);
if (write_all (ctx->fd, (const guchar *)value, length))
g_debug ("password written to gcr-ssh-askpass");
g_debug ("password written to " GCR_SSH_ASKPASS_BIN);
else
g_message ("failed to write password to gcr-ssh-askpass");
g_message ("failed to write password to " GCR_SSH_ASKPASS_BIN);
success = TRUE;
} else if (error && !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
g_warning ("couldn't prompt for password: %s", error->message);
......@@ -202,7 +204,7 @@ askpass_thread (gpointer data)
out:
if (!success) {
g_debug ("writing failure to gcr-ssh-askpass");
g_debug ("writing failure to " GCR_SSH_ASKPASS_BIN);
write_all (ctx->fd, (const guchar *)"\xff", 1);
}
if (password)
......@@ -239,7 +241,7 @@ askpass_accept (gint fd,
return TRUE;
}
g_debug ("accepted new connection from gcr-ssh-askpass");
g_debug ("accepted new connection from " GCR_SSH_ASKPASS_BIN);
ctx = g_new0 (AskpassContext, 1);
ctx->fd = new_fd;
......@@ -290,7 +292,7 @@ gcr_ssh_askpass_constructed (GObject *obj)
return;
}
g_debug ("listening for gcr-ssh-askpass at: %s", self->socket);
g_debug ("listening for " GCR_SSH_ASKPASS_BIN " at: %s", self->socket);
self->source = g_unix_fd_add (self->fd, G_IO_IN, askpass_accept, self);
}
......@@ -449,7 +451,7 @@ main (int argc,
path = g_getenv ("GCR_SSH_ASKPASS_SOCKET");
if (path == NULL) {
g_printerr ("gcr-ssh-askpass: this program is not meant to be run directly");
g_printerr (GCR_SSH_ASKPASS_BIN ": this program is not meant to be run directly");
return 2;
}
......
......@@ -209,8 +209,8 @@ pkgconfig.generate(gcr_lib,
description: 'GObject and GUI library for high level crypto parsing and display',
)
# gcr-ssh-askpass binary
gcr_ssh_askpass = executable('gcr-ssh-askpass',
# gcr4-ssh-askpass binary
gcr_ssh_askpass = executable('gcr4-ssh-askpass',
'gcr-ssh-askpass.c',
dependencies: [ glib_deps, libegg_dep ],
c_args: [
......
......@@ -163,11 +163,7 @@ main (int argc, char **argv)
g_test_init (&argc, &argv, NULL);
g_set_prgname ("test-ssh-askpass");
#ifdef _GCR_TEST_SSH_ASKPASS_PATH
gcr_ssh_askpass_executable = _GCR_TEST_SSH_ASKPASS_PATH;
#else
gcr_ssh_askpass_executable = BUILDDIR "/gcr-ssh-askpass";
#endif
g_test_add ("/gcr/ssh-askpass/ssh-keygen", Test, "booo", setup, test_ssh_keygen, teardown);
g_test_add ("/gcr/ssh-askpass/cancelled", Test, NULL, setup, test_cancelled, teardown);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment