mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/virt-viewer
synced 2026-01-25 01:11:17 +00:00
ovirt: Allow to cancel authentication without showing error dialog
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1201604
This commit is contained in:
parent
0c8f07ea64
commit
0443bd113f
13
configure.ac
13
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])
|
||||
])
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user