After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 656443 - Make GTlsInteraction ask_password cancellable
Make GTlsInteraction ask_password cancellable
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: network
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks: 656343
 
 
Reported: 2011-08-13 07:08 UTC by Stef Walter
Modified: 2011-08-26 05:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Make GTlsInteraction virtual methods cancellable (11.12 KB, patch)
2011-08-13 12:04 UTC, Stef Walter
none Details | Review
David, thanks for the review. Added error arguments to the ask_password (15.85 KB, patch)
2011-08-24 13:46 UTC, Stef Walter
accepted-commit_now Details | Review

Description Stef Walter 2011-08-13 07:08:24 UTC
After discussion in bug #656343, it's likely that the various TLS interactions will need to be cancellable.

This means changing the virtual ask_password* methods in GTlsInteraction. Since these just got merged, and haven't been in a stable release yet, we should be able to change them.
Comment 1 Stef Walter 2011-08-13 12:04:35 UTC
Created attachment 193758 [details] [review]
Make GTlsInteraction virtual methods cancellable

* Add cancellable argument to g_tls_interaction_ask_password
   and g_tls_interaction_ask_password_async.
 * This is API breakage, but this API has not yet been released
   in a stable release (and very unlikely used yet).
 * Since we're breaking unreleased API, expand amount of padding
   on GTlsInteractionClass because we're going to need it.
Comment 3 Stef Walter 2011-08-22 11:21:42 UTC
Dan or David, could one of you review this, so it can get in before the next release?

I believe this is necessary to support proper cancellation on GTlsConnection handshakes.
Comment 4 David Zeuthen (not reading bugmail) 2011-08-23 15:12:36 UTC
Looks good to me. One more thought, shouldn't g_tls_interaction_ask_password() or g_tls_interaction_ask_password_finish() take a GError? It seems reasonable to be able to return an error if there is e.g. no way to ask the user for the password (not in a desktop session or no controlling tty) ... or to convey that the user canceled the auth dialog.
Comment 5 Stef Walter 2011-08-23 15:15:44 UTC
I guess so. I was thinking it would return NULL if the user cancelled, and I imagined that errors would just act like a user cancelling. But I don't mind making it so that implementations can return more nuanced errors.
Comment 6 David Zeuthen (not reading bugmail) 2011-08-23 15:33:08 UTC
(In reply to comment #5)
> I guess so. I was thinking it would return NULL if the user cancelled, and I
> imagined that errors would just act like a user cancelling. But I don't mind
> making it so that implementations can return more nuanced errors.

I found that I needed that in PolicyKit-using applications - for example, udisks2 has three errors for this, see the _NOT_AUTHORIZED errors

 http://people.freedesktop.org/~david/udisks2-20110719/udisks2-UDisksError.html#UDisksError
Comment 7 Stef Walter 2011-08-24 13:46:03 UTC
Created attachment 194598 [details] [review]
David, thanks for the review. Added error arguments to the ask_password

method. 

Is this ready to merge now?

Make GTlsInteraction virtual methods cancellable

 * Add cancellable argument to g_tls_interaction_ask_password
   and g_tls_interaction_ask_password_async.
 * This is API breakage, but this API has not yet been released
   in a stable release (and very unlikely used yet).
 * Since we're breaking unreleased API, expand amount of padding
   on GTlsInteractionClass because we're going to need it.
Comment 8 Dan Winship 2011-08-26 00:13:48 UTC
Comment on attachment 194598 [details] [review]
David, thanks for the review. Added error arguments to the ask_password

looks good, except:

>+ * @cancellable: (allow-none): a #GCancellable cancellation object
>+ * @error: (allow-none): an optional location to place an error on failure

you don't need to specify (allow-none) for either of those
Comment 9 Stef Walter 2011-08-26 05:47:09 UTC
Made that change and merged. Thanks for looking it over.