[Libosinfo] [libosinfo PATCH] loader: refuse to load non-compliant named files
Daniel P. Berrangé
berrange at redhat.com
Wed Jan 9 09:59:45 UTC 2019
On Thu, Jan 03, 2019 at 03:56:27PM +0100, Fabiano Fidêncio wrote:
> There was a period of grace needed for backwards compatibility. After 3+
> years, we can safely remove the code instroduced as part of 09ae3cf09
> (which was released on 0.3.0).
>
> Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
> ---
> osinfo/osinfo_loader.c | 15 +++++++--------
> 1 file changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
> index 77ca5ea..372871e 100644
> --- a/osinfo/osinfo_loader.c
> +++ b/osinfo/osinfo_loader.c
> @@ -523,6 +523,7 @@ static gboolean osinfo_loader_check_id(const gchar *relpath,
> gchar *reldir;
> gboolean extension;
> gsize i;
> + gboolean ret = FALSE;
>
> if (!relpath)
> return TRUE;
> @@ -555,17 +556,15 @@ static gboolean osinfo_loader_check_id(const gchar *relpath,
> if (!g_str_equal(extension ? reldir : relpath, name)) {
> g_warning("Entity %s should be in file %s not %s",
> id, name, extension ? reldir : relpath);
This needs to be changed to "must" instead of "should" since this is
now mandatory.
> - g_free(reldir);
> - g_free(name);
> - return TRUE; /* In future switch to FALSE to refuse
> - * to load non-compliant named files.
> - * Need a period of grace for backcompat
> - * first though... Switch ETA Jan 2017
> - */
> + goto cleanup;
> }
> +
> + ret = TRUE;
> +
> + cleanup:
> g_free(reldir);
> g_free(name);
> - return TRUE;
> + return ret;
> }
>
>
> --
> 2.19.2
>
> _______________________________________________
> Libosinfo mailing list
> Libosinfo at redhat.com
> https://www.redhat.com/mailman/listinfo/libosinfo
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
More information about the Libosinfo
mailing list