mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-22 17:08:53 +02:00
Add define for selinux context attribute. Fix missing : -> :: namespace
2008-01-03 Alexander Larsson <alexl@redhat.com> * 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
This commit is contained in:
committed by
Alexander Larsson
parent
a59fb762e6
commit
7e6f37d00c
@@ -1,3 +1,12 @@
|
|||||||
|
2008-01-03 Alexander Larsson <alexl@redhat.com>
|
||||||
|
|
||||||
|
* 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 <alexl@redhat.com>
|
2008-01-03 Alexander Larsson <alexl@redhat.com>
|
||||||
|
|
||||||
* fam/Makefile.am:
|
* fam/Makefile.am:
|
||||||
|
@@ -658,10 +658,9 @@ typedef enum {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* G_FILE_ATTRIBUTE_FILESYSTEM_READONLY:
|
* G_FILE_ATTRIBUTE_FILESYSTEM_READONLY:
|
||||||
*
|
* * A key in the "filesystem" namespace for checking if the file system
|
||||||
* A key in the "filesystem" namespace for checking if the file system is read only.
|
* is read only. Is set to %TRUE if the file system is read only.
|
||||||
* Is set to %TRUE if the file system is read only. Corresponding
|
* Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
|
||||||
* #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN.
|
|
||||||
**/
|
**/
|
||||||
#define G_FILE_ATTRIBUTE_FILESYSTEM_READONLY "filesystem::readonly" /* 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 */
|
#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;
|
GType g_file_info_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
GFileInfo * g_file_info_new (void);
|
GFileInfo * g_file_info_new (void);
|
||||||
|
@@ -185,7 +185,7 @@ get_selinux_context (const char *path,
|
|||||||
#ifdef HAVE_SELINUX
|
#ifdef HAVE_SELINUX
|
||||||
char *context;
|
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;
|
return;
|
||||||
|
|
||||||
if (is_selinux_enabled ())
|
if (is_selinux_enabled ())
|
||||||
@@ -203,8 +203,8 @@ get_selinux_context (const char *path,
|
|||||||
|
|
||||||
if (context)
|
if (context)
|
||||||
{
|
{
|
||||||
g_file_info_set_attribute_string (info, "selinux::context", context);
|
g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_SELINUX_CONTEXT, context);
|
||||||
freecon(context);
|
freecon (context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -445,7 +445,7 @@ get_xattrs (const char *path,
|
|||||||
if (user)
|
if (user)
|
||||||
all = g_file_attribute_matcher_enumerate_namespace (matcher, "xattr");
|
all = g_file_attribute_matcher_enumerate_namespace (matcher, "xattr");
|
||||||
else
|
else
|
||||||
all = g_file_attribute_matcher_enumerate_namespace (matcher, "xattr_sys");
|
all = g_file_attribute_matcher_enumerate_namespace (matcher, "xattr-sys");
|
||||||
|
|
||||||
if (all)
|
if (all)
|
||||||
{
|
{
|
||||||
@@ -1633,14 +1633,14 @@ _g_local_file_info_get_from_fd (int fd,
|
|||||||
set_info_from_stat (info, &stat_buf, matcher);
|
set_info_from_stat (info, &stat_buf, matcher);
|
||||||
|
|
||||||
#ifdef HAVE_SELINUX
|
#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 ())
|
is_selinux_enabled ())
|
||||||
{
|
{
|
||||||
char *context;
|
char *context;
|
||||||
if (fgetfilecon_raw (fd, &context) >= 0)
|
if (fgetfilecon_raw (fd, &context) >= 0)
|
||||||
{
|
{
|
||||||
g_file_info_set_attribute_string (info, "selinux:context", context);
|
g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_SELINUX_CONTEXT, context);
|
||||||
freecon(context);
|
freecon (context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user