[gcr/nielsdg/rename-gcr-ssh-askpass] gcr: Rename gcr-ssh-askpass




commit c69b743368d58761942391a2a013feac3be341e5
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Mon Jun 27 17:20:03 2022 +0200

    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.

 gcr/gcr-ssh-askpass.c  | 18 ++++++++++--------
 gcr/meson.build        |  4 ++--
 gcr/test-ssh-askpass.c |  4 ----
 3 files changed, 12 insertions(+), 14 deletions(-)
---
diff --git a/gcr/gcr-ssh-askpass.c b/gcr/gcr-ssh-askpass.c
index 1a18589b..c432ea54 100644
--- a/gcr/gcr-ssh-askpass.c
+++ b/gcr/gcr-ssh-askpass.c
@@ -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;
        }
 
diff --git a/gcr/meson.build b/gcr/meson.build
index 9fbd67ce..7ccb6425 100644
--- a/gcr/meson.build
+++ b/gcr/meson.build
@@ -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: [
diff --git a/gcr/test-ssh-askpass.c b/gcr/test-ssh-askpass.c
index 936f48dd..02294369 100644
--- a/gcr/test-ssh-askpass.c
+++ b/gcr/test-ssh-askpass.c
@@ -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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]