Skip to content

Fix on_kerberos_inquiry Deadlock

Pedro Tôrres requested to merge t0rr3sp3dr0/gnome-online-accounts:master into master

When invoking krb5_get_init_creds_password, MIT Kerberos will call a krb5_prompter_fct when a ticket is successfully acquired by a user with a password expiration set with a message such as: Warning: Your password will expire in 87 days on Sat 29 Aug 2020 03:09:35 PM -03.

GNOME's implementation set on_kerberos_inquiry to be the krb5_prompter_fct (https://gitlab.gnome.org/GNOME/gnome-online-accounts/-/blob/master/src/goaidentity/goakerberosidentity.c#L1271-1281).

on_kerberos_inquiry invokes goa_kerberos_identity_inquiry_new regardless the value of number_of_prompts (https://gitlab.gnome.org/GNOME/gnome-online-accounts/-/blob/master/src/goaidentity/goakerberosidentity.c#L1051-1055).

As the warning doesn't require user interaction, it is purely informational, number_of_prompts is 0 when the function is invoked for this message.

goa_kerberos_identity_inquiry_new returns NULL when checks that number_of_prompts is not greater than 0 (https://gitlab.gnome.org/GNOME/gnome-online-accounts/-/blob/master/src/goaidentity/goakerberosidentityinquiry.c#L149).

on_kerberos_inquiry calls operation->inquiry_func with inquiry as NULL (https://gitlab.gnome.org/GNOME/gnome-online-accounts/-/blob/master/src/goaidentity/goakerberosidentity.c#L1057-1059).

Invoking operation->inquiry_func with inquiry as NULL causes a dead-lock on wait_for_inquiry_to_complete (https://gitlab.gnome.org/GNOME/gnome-online-accounts/-/blob/master/src/goaidentity/goakerberosidentitymanager.c#L769).

A solution to this problem is to just invoke https://gitlab.gnome.org/GNOME/gnome-online-accounts/-/blob/master/src/goaidentity/goakerberosidentity.c#L1051-1071 if number_of_prompts > 0, otherwise set error_code to 0.

Fixes #92 (closed)

Merge request reports