From 7e6f37d00c525621bcf15bdcb9792a4e76d022aa Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Thu, 3 Jan 2008 09:01:00 +0000 Subject: [PATCH] Add define for selinux context attribute. Fix missing : -> :: namespace 2008-01-03 Alexander Larsson * gfileinfo.h: * glocalfileinfo.c: Add define for selinux context attribute. Fix missing : -> :: namespace separator change Fix missing _ -> - name change for xattr-sys. (#505058) svn path=/trunk/; revision=6235 --- gio/ChangeLog | 9 +++++++++ gio/gfileinfo.h | 16 ++++++++++++---- gio/glocalfileinfo.c | 14 +++++++------- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/gio/ChangeLog b/gio/ChangeLog index ecc140c..f1a7e6d 100644 --- a/gio/ChangeLog +++ b/gio/ChangeLog @@ -1,5 +1,14 @@ 2008-01-03 Alexander Larsson + * gfileinfo.h: + * glocalfileinfo.c: + Add define for selinux context attribute. + Fix missing : -> :: namespace separator change + Fix missing _ -> - name change for xattr-sys. + (#505058) + +2008-01-03 Alexander Larsson + * fam/Makefile.am: Link to libglib and libgobject directly (#504879) Patch from Sebastien Bacher diff --git a/gio/gfileinfo.h b/gio/gfileinfo.h index d59e40e..5840197 100644 --- a/gio/gfileinfo.h +++ b/gio/gfileinfo.h @@ -658,10 +658,9 @@ typedef enum { /** * G_FILE_ATTRIBUTE_FILESYSTEM_READONLY: - * - * A key in the "filesystem" namespace for checking if the file system is read only. - * Is set to %TRUE if the file system is read only. Corresponding - * #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN. + * * A key in the "filesystem" namespace for checking if the file system + * is read only. Is set to %TRUE if the file system is read only. + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN. **/ #define G_FILE_ATTRIBUTE_FILESYSTEM_READONLY "filesystem::readonly" /* boolean */ @@ -674,6 +673,15 @@ typedef enum { **/ #define G_FILE_ATTRIBUTE_GVFS_BACKEND "gvfs::backend" /* string */ +/** + * G_FILE_ATTRIBUTE_SELINUX_CONTEXT: + * + * A key in the "selinux" namespace for getting the file's SELinux + * context. Corresponding #GFileAttributeType is + * %G_FILE_ATTRIBUTE_TYPE_STRING. + **/ +#define G_FILE_ATTRIBUTE_SELINUX_CONTEXT "selinux::context" /* string */ + GType g_file_info_get_type (void) G_GNUC_CONST; GFileInfo * g_file_info_new (void); diff --git a/gio/glocalfileinfo.c b/gio/glocalfileinfo.c index 78f790c..1f9cc8f 100644 --- a/gio/glocalfileinfo.c +++ b/gio/glocalfileinfo.c @@ -185,7 +185,7 @@ get_selinux_context (const char *path, #ifdef HAVE_SELINUX char *context; - if (!g_file_attribute_matcher_matches (attribute_matcher, "selinux::context")) + if (!g_file_attribute_matcher_matches (attribute_matcher, G_FILE_ATTRIBUTE_SELINUX_CONTEXT)) return; if (is_selinux_enabled ()) @@ -203,8 +203,8 @@ get_selinux_context (const char *path, if (context) { - g_file_info_set_attribute_string (info, "selinux::context", context); - freecon(context); + g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_SELINUX_CONTEXT, context); + freecon (context); } } #endif @@ -445,7 +445,7 @@ get_xattrs (const char *path, if (user) all = g_file_attribute_matcher_enumerate_namespace (matcher, "xattr"); else - all = g_file_attribute_matcher_enumerate_namespace (matcher, "xattr_sys"); + all = g_file_attribute_matcher_enumerate_namespace (matcher, "xattr-sys"); if (all) { @@ -1633,14 +1633,14 @@ _g_local_file_info_get_from_fd (int fd, set_info_from_stat (info, &stat_buf, matcher); #ifdef HAVE_SELINUX - if (g_file_attribute_matcher_matches (matcher, "selinux:context") && + if (g_file_attribute_matcher_matches (matcher, G_FILE_ATTRIBUTE_SELINUX_CONTEXT) && is_selinux_enabled ()) { char *context; if (fgetfilecon_raw (fd, &context) >= 0) { - g_file_info_set_attribute_string (info, "selinux:context", context); - freecon(context); + g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_SELINUX_CONTEXT, context); + freecon (context); } } #endif -- 2.7.4