"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "oci-authenticator/flatpak-oci-authenticator.c" between
flatpak-1.8.2.tar.xz and flatpak-1.8.3.tar.xz

About: Flatpak is a Linux application sandboxing and distribution framework.

flatpak-oci-authenticator.c  (flatpak-1.8.2.tar.xz):flatpak-oci-authenticator.c  (flatpak-1.8.3.tar.xz)
skipping to change at line 452 skipping to change at line 452
const gchar *arg_handle_token, const gchar *arg_handle_token,
GVariant *arg_authenticator_options, GVariant *arg_authenticator_options,
const gchar *arg_remote, const gchar *arg_remote,
const gchar *arg_remote_uri, const gchar *arg_remote_uri,
GVariant *arg_refs, GVariant *arg_refs,
GVariant *arg_options, GVariant *arg_options,
const gchar *arg_parent_window) const gchar *arg_parent_window)
{ {
g_autofree char *request_path = NULL; g_autofree char *request_path = NULL;
g_autoptr(GError) error = NULL; g_autoptr(GError) error = NULL;
g_autoptr(GError) anon_error = NULL;
g_autoptr(AutoFlatpakAuthenticatorRequest) request = NULL; g_autoptr(AutoFlatpakAuthenticatorRequest) request = NULL;
const char *auth = NULL; const char *auth = NULL;
gboolean have_auth; gboolean have_auth;
const char *oci_registry_uri = NULL; const char *oci_registry_uri = NULL;
gsize n_refs, i; gsize n_refs, i;
gboolean no_interaction = FALSE; gboolean no_interaction = FALSE;
g_autoptr(FlatpakOciRegistry) registry = NULL; g_autoptr(FlatpakOciRegistry) registry = NULL;
g_autofree char *first_token = NULL; g_autofree char *first_token = NULL;
GVariantBuilder tokens; GVariantBuilder tokens;
GVariantBuilder results; GVariantBuilder results;
skipping to change at line 520 skipping to change at line 521
} }
/* Try to see if we can get a token without presenting credentials */ /* Try to see if we can get a token without presenting credentials */
n_refs = g_variant_n_children (arg_refs); n_refs = g_variant_n_children (arg_refs);
if (!have_auth && n_refs > 0) if (!have_auth && n_refs > 0)
{ {
g_autoptr(GVariant) ref_data = g_variant_get_child_value (arg_refs, 0); g_autoptr(GVariant) ref_data = g_variant_get_child_value (arg_refs, 0);
g_debug ("Trying anonymous authentication"); g_debug ("Trying anonymous authentication");
first_token = get_token_for_ref (registry, ref_data, NULL, &error); first_token = get_token_for_ref (registry, ref_data, NULL, &anon_error);
if (first_token != NULL) if (first_token != NULL)
have_auth = TRUE; have_auth = TRUE;
else else
{ {
if (g_error_matches (error, FLATPAK_ERROR, FLATPAK_ERROR_NOT_AUTHORIZE D)) if (g_error_matches (anon_error, FLATPAK_ERROR, FLATPAK_ERROR_NOT_AUTH ORIZED))
{ {
g_debug ("Anonymous authentication failed: %s", error->message); g_debug ("Anonymous authentication failed: %s", anon_error->messag
g_clear_error (&error); e);
/* Continue trying with authentication below */ /* Continue trying with authentication below */
} }
else else
{ {
/* We failed with some weird reason (network issue maybe?) and it is unlikely /* We failed with some weird reason (network issue maybe?) and it is unlikely
* that adding some authentication will fix it. It will just cause a bad UX like * that adding some authentication will fix it. It will just cause a bad UX like
* described in #3753, so just return the error early. * described in #3753, so just return the error early.
*/ */
return error_request (request, sender, error); return error_request (request, sender, anon_error);
} }
} }
} }
/* Prompt the user for credentials */ /* Prompt the user for credentials */
n_refs = g_variant_n_children (arg_refs); n_refs = g_variant_n_children (arg_refs);
if (!have_auth && n_refs > 0 && if (!have_auth && n_refs > 0 &&
!no_interaction) !no_interaction)
{ {
g_autoptr(GVariant) ref_data = g_variant_get_child_value (arg_refs, 0); g_autoptr(GVariant) ref_data = g_variant_get_child_value (arg_refs, 0);
skipping to change at line 582 skipping to change at line 582
return error_request (request, sender, error); return error_request (request, sender, error);
else else
{ {
g_debug ("Auth failed getting token: %s", error->message); g_debug ("Auth failed getting token: %s", error->message);
/* Keep error for reporting below, or clear on next iteration start */ /* Keep error for reporting below, or clear on next iteration start */
} }
} }
} }
} }
if (!have_auth) if (!have_auth && n_refs > 0)
return error_request (request, sender, error); return error_request (request, sender, error ? error : anon_error);
g_variant_builder_init (&tokens, G_VARIANT_TYPE ("a{sas}")); g_variant_builder_init (&tokens, G_VARIANT_TYPE ("a{sas}"));
for (i = 0; i < n_refs; i++) for (i = 0; i < n_refs; i++)
{ {
g_autoptr(GVariant) ref_data = g_variant_get_child_value (arg_refs, i); g_autoptr(GVariant) ref_data = g_variant_get_child_value (arg_refs, i);
char *for_refs_strv[2] = { NULL, NULL}; char *for_refs_strv[2] = { NULL, NULL};
g_autofree char *token = NULL; g_autofree char *token = NULL;
if (i == 0 && first_token != NULL) if (i == 0 && first_token != NULL)
 End of changes. 6 change blocks. 
7 lines changed or deleted 8 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)