Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1201604 --- Hi, it seems that changes in librest https://bugzilla.gnome.org/show_bug.cgi?id=746537 and libgovirt https://bugzilla.gnome.org/show_bug.cgi?id=746539 will be accepted, so I am resending the patch. I changed configure.ac this way, because I don't think it is needed to bump the libgovirt version. Thanks, Pavel --- configure.ac | 13 ++++++++++++- src/remote-viewer.c | 14 +++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 45b894d..f445b84 100644 --- a/configure.ac +++ b/configure.ac @@ -203,7 +203,18 @@ AS_IF([test "x$with_ovirt" != "xno"], [have_ovirt=no]) AS_IF([test "x$have_ovirt" = "xyes"], - [AC_DEFINE([HAVE_OVIRT], 1, [Have libgovirt?])], + [AC_DEFINE([HAVE_OVIRT], 1, [Have libgovirt?])] + [SAVED_CFLAGS=$CFLAGS + SAVED_LIBS=$LIBS + CFLAGS=$OVIRT_CFLAGS + LIBS=$OVIRT_LIBS + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <govirt/govirt.h>]], + [static int err = OVIRT_REST_CALL_ERROR_CANCELLED; + void *fun = rest_proxy_auth_cancel;])], + [AC_DEFINE([HAVE_OVIRT_CANCEL], 1, [Have rest_proxy_auth_cancel and OVIRT_REST_CALL_ERROR_CANCELLED?])], + []) + CFLAGS=$SAVED_CFLAGS + LIBS=$SAVED_LIBS], [AS_IF([test "x$with_ovirt" = "xyes"], [AC_MSG_ERROR([oVirt support requested but libgovirt not found]) ]) diff --git a/src/remote-viewer.c b/src/remote-viewer.c index b172056..67bb966 100644 --- a/src/remote-viewer.c +++ b/src/remote-viewer.c @@ -704,7 +704,7 @@ parse_ovirt_uri(const gchar *uri_str, char **rest_uri, char **name, char **usern } static gboolean -authenticate_cb(RestProxy *proxy, G_GNUC_UNUSED RestProxyAuth *auth, +authenticate_cb(RestProxy *proxy, RestProxyAuth *auth, G_GNUC_UNUSED gboolean retrying, gpointer user_data) { gchar *username = NULL; @@ -729,6 +729,10 @@ authenticate_cb(RestProxy *proxy, G_GNUC_UNUSED RestProxyAuth *auth, "username", username, "password", password, NULL); +#ifdef HAVE_OVIRT_CANCEL + } else { + rest_proxy_auth_cancel(auth); +#endif } g_free(username); @@ -863,6 +867,14 @@ create_ovirt_session(VirtViewerApp *app, const char *uri, GError **err) api = ovirt_proxy_fetch_api(proxy, &error); if (error != NULL) { g_debug("failed to get oVirt 'api' collection: %s", error->message); +#ifdef HAVE_OVIRT_CANCEL + if (g_error_matches(error, OVIRT_REST_CALL_ERROR, OVIRT_REST_CALL_ERROR_CANCELLED)) { + g_clear_error(&error); + g_set_error_literal(&error, + VIRT_VIEWER_ERROR, VIRT_VIEWER_ERROR_CANCELLED, + _("Authentication was cancelled")); + } +#endif goto error; } vms = ovirt_api_get_vms(api); -- 2.3.5 _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list