Re: [PATCH virt-viewer v3 2/2] ovirt: Allow to cancel authentication without showing error dialog

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

 



>
> Hey,
> 
> 
> librest merely wraps
> https://developer.gnome.org/libsoup/stable/SoupSession.html#SoupSession-authenticate
> It seems with libsoup, one would be able to use
> soup_session_cancel_message() from the authenticate callback to
> return
> an error code:
> https://developer.gnome.org/libsoup/stable/SoupSession.html#soup-session-cancel-message
> 
> Christophe
> 

Thank you Christophe, I am able to get CANCELLED from ovirt_proxy_fetch_api() using a patch:

diff --git a/rest/rest-proxy.c b/rest/rest-proxy.c
index 81d487d..87b53e5 100644
--- a/rest/rest-proxy.c
+++ b/rest/rest-proxy.c
@@ -236,8 +236,12 @@ authenticate (RestProxy   *self,
 
   rest_auth = rest_proxy_auth_new (self, session, msg, soup_auth);
   g_signal_emit(self, signals[AUTHENTICATE], 0, rest_auth, retrying, &try_auth);
-  if (try_auth && !rest_proxy_auth_is_paused (rest_auth))
-    soup_auth_authenticate (soup_auth, priv->username, priv->password);
+  if (try_auth && !rest_proxy_auth_is_paused (rest_auth)) {
+    if (priv->username != NULL && priv->password != NULL)
+      soup_auth_authenticate (soup_auth, priv->username, priv->password);
+    else
+      soup_session_cancel_message (session, msg, SOUP_STATUS_CANCELLED);
+  }
   g_object_unref (G_OBJECT (rest_auth));
 }

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux