public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Tomas Bzatek <tbzatek@fedoraproject.org>
To: git-commits@fedoraproject.org
Subject: [rpms/glib2] cve-2026-58016-f44: - Add support for GIO to set selinux attributes (gnome #529694)
Date: Tue, 11 Aug 2026 10:33:45 GMT	[thread overview]
Message-ID: <178644442531.1.13914176584151091922.rpms-glib2-9ac10ee4c749@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/glib2
Branch : cve-2026-58016-f44
Commit : 9ac10ee4c749026e6684094bd1effc1b414ce028
Author : Tomas Bzatek <tbzatek@fedoraproject.org>
Date   : 2008-04-24T14:12:57+00:00
Stats  : +128/-1 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/glib2/c/9ac10ee4c749026e6684094bd1effc1b414ce028?branch=cve-2026-58016-f44

Log:
- Add support for GIO to set selinux attributes (gnome #529694)

---
diff --git a/gio-2.16-selinux-set-support.diff b/gio-2.16-selinux-set-support.diff
new file mode 100644
index 0000000..4058d6d
--- /dev/null
+++ b/gio-2.16-selinux-set-support.diff
@@ -0,0 +1,120 @@
+Index: gio/glocalfileinfo.c
+===================================================================
+--- gio/glocalfileinfo.c	(revision 6871)
++++ gio/glocalfileinfo.c	(working copy)
+@@ -1706,6 +1706,24 @@
+ #endif
+ 
+ static gboolean
++get_string (const GFileAttributeValue  *value,
++	    const char                **val_out,
++	    GError                    **error)
++{
++  if (value->type != G_FILE_ATTRIBUTE_TYPE_STRING)
++    {
++      g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
++		   _("Invalid attribute type (byte string expected)"));
++      return FALSE;
++    }
++
++  *val_out = value->u.string;
++  
++  return TRUE;
++}
++
++
++static gboolean
+ set_unix_mode (char                       *filename,
+ 	       const GFileAttributeValue  *value,
+ 	       GError                    **error)
+@@ -1948,6 +1966,52 @@
+ }
+ #endif
+ 
++
++static gboolean
++set_selinux_context (char                       *filename,
++		 const GFileAttributeValue  *value,
++		 GError                    **error)
++{
++  const char *val;
++
++  if (!get_string (value, &val, error))
++    return FALSE;
++
++  if (val == NULL)
++  {
++    g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
++               _("SELinux context must be non-NULL"));
++    return FALSE;
++  }
++
++#ifdef HAVE_SELINUX
++  if (is_selinux_enabled ()) {
++	security_context_t val_s;
++	
++	val_s = g_strdup (val);
++	
++	if (setfilecon_raw (filename, val_s) < 0)
++	{
++            int errsv = errno;
++            
++            g_set_error (error, G_IO_ERROR,
++                         g_io_error_from_errno (errsv),
++                	_("Error setting SELinux context: %s"),
++                         g_strerror (errsv));
++            return FALSE;
++        }
++        g_free (val_s);
++  } else {
++    g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
++               _("SELinux is not enabled on this system"));
++    return FALSE;
++  }
++#endif 
++                                                     
++  return TRUE;
++}
++
++
+ gboolean
+ _g_local_file_info_set_attribute (char                 *filename,
+ 				  const char           *attribute,
+@@ -1993,6 +2057,11 @@
+   else if (g_str_has_prefix (attribute, "xattr-sys::"))
+     return set_xattr (filename, attribute, &value, error);
+ #endif
++
++#ifdef HAVE_SELINUX 
++  else if (strcmp (attribute, G_FILE_ATTRIBUTE_SELINUX_CONTEXT) == 0)
++    return set_selinux_context (filename, &value, error);
++#endif
+   
+   g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
+ 	       _("Setting attribute %s not supported"), attribute);
+@@ -2110,5 +2179,25 @@
+ 
+   /* xattrs are handled by default callback */
+ 
++
++  /*  SELinux context */
++#ifdef HAVE_SELINUX 
++  if (is_selinux_enabled ()) {
++    value = _g_file_info_get_attribute_value (info, G_FILE_ATTRIBUTE_SELINUX_CONTEXT);
++    if (value)
++    {
++      if (!set_selinux_context (filename, value, error))
++        {
++          value->status = G_FILE_ATTRIBUTE_STATUS_ERROR_SETTING;
++          res = FALSE;
++          /* Don't set error multiple times */
++          error = NULL;
++        }
++      else
++        value->status = G_FILE_ATTRIBUTE_STATUS_SET;
++    }
++  }
++#endif
++
+   return res;
+ }

diff --git a/glib2.spec b/glib2.spec
index 91de2d3..bfcf3d8 100644
--- a/glib2.spec
+++ b/glib2.spec
@@ -3,7 +3,7 @@
 Summary: A library of handy utility functions
 Name: glib2
 Version: 2.16.3
-Release: 4%{?dist}
+Release: 5%{?dist}
 License: LGPLv2+
 Group: System Environment/Libraries
 URL: http://www.gtk.org
@@ -29,6 +29,9 @@ Patch1: revert-316221.patch
 # https://bugzilla.redhat.com/show_bug.cgi?id=442835
 Patch2: gio-2.16-only-pass-uri-to-gio-apps.patch
 
+# https://bugzilla.gnome.org/show_bug.cgi?id=529694
+Patch3: gio-2.16-selinux-set-support.diff
+
 %description 
 GLib is the low-level core library that forms the basis
 for projects such as GTK+ and GNOME. It provides data structure
@@ -63,6 +66,7 @@ of version 2 of the GLib library.
 %patch0 -p1 -b .appinfo
 %patch1 -R -p1 -b .revert-316221
 %patch2 -p0 -b .only-pass-uri-to-gio-apps
+%patch3 -p0 -b .selinux
 
 %build
 %configure --disable-gtk-doc --enable-static 
@@ -135,6 +139,9 @@ rm -rf $RPM_BUILD_ROOT
 %{_libdir}/lib*.a
 
 %changelog
+* Thu Apr 24 2008 Tomas Bzatek <tbzatek@redhat.com> - 2.16.3-5
+- Add support for GIO to set selinux attributes (gnome #529694)
+
 * Thu Apr 17 2008 David Zeuthen <davidz@redhat.com> - 2.16.3-4
 - Only pass URI's for gio apps (#442835)
 

                 reply	other threads:[~2026-08-11 10:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178644442531.1.13914176584151091922.rpms-glib2-9ac10ee4c749@fedoraproject.org \
    --to=tbzatek@fedoraproject.org \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox