summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2012-06-26 11:57:06 +0100
committerRichard Hughes <richard@hughsie.com>2012-06-26 11:57:06 +0100
commita40f8bf98587416a94c97a631de6b41283c68f1d (patch)
treeab1f85edc3d96d7d1e222cba6aa1a89ad4224e4f
parentfca4196ed897e086fd917f489c38d95278e4b1df (diff)
downloadcolord-a40f8bf98587416a94c97a631de6b41283c68f1d.tar.gz
Check any files in /usr/share/color/icc have the content type application/vnd.iccprofile
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=833225
-rw-r--r--src/cd-profile-store.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/cd-profile-store.c b/src/cd-profile-store.c
index 66d1350..1d4eebe 100644
--- a/src/cd-profile-store.c
+++ b/src/cd-profile-store.c
@@ -181,8 +181,10 @@ cd_profile_store_add_profile (CdProfileStore *profile_store,
CdProfile *profile = NULL;
CdProfile *profile_tmp = NULL;
GError *error = NULL;
+ GFileInfo *info = NULL;
gchar *filename = NULL;
const gchar *checksum;
+ const gchar *type;
CdProfileStorePrivate *priv = profile_store->priv;
/* already added? */
@@ -191,6 +193,25 @@ cd_profile_store_add_profile (CdProfileStore *profile_store,
if (profile != NULL)
goto out;
+ /* check is ICC file */
+ info = g_file_query_info (file,
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+ G_FILE_QUERY_INFO_NONE,
+ NULL,
+ &error);
+ if (info == NULL) {
+ g_warning ("CdProfileStore: Failed to get content type of %s : %s",
+ filename, error->message);
+ g_error_free (error);
+ goto out;
+ }
+ type = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE);
+ if (g_strcmp0 (type, "application/vnd.iccprofile") != 0) {
+ g_debug ("CdProfileStore: Incorrect content type for %s, got %s",
+ filename, type);
+ goto out;
+ }
+
/* is system wide? */
profile = cd_profile_new ();
if (g_str_has_prefix (filename, "/usr/share/color") ||
@@ -228,6 +249,8 @@ out:
g_free (filename);
if (profile_tmp != NULL)
g_object_unref (profile_tmp);
+ if (info != NULL)
+ g_object_unref (info);
if (profile != NULL)
g_object_unref (profile);
return ret;