mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-26 20:22:11 +01:00
Merge branch 'selinux-warning' into 'master'
gio: ‘security_context_t’ is deprecated See merge request GNOME/glib!1776
This commit is contained in:
commit
9a519c8bf0
@ -2699,8 +2699,8 @@ set_mtime_atime (char *filename,
|
|||||||
#ifdef HAVE_SELINUX
|
#ifdef HAVE_SELINUX
|
||||||
static gboolean
|
static gboolean
|
||||||
set_selinux_context (char *filename,
|
set_selinux_context (char *filename,
|
||||||
const GFileAttributeValue *value,
|
const GFileAttributeValue *value,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
const char *val;
|
const char *val;
|
||||||
|
|
||||||
@ -2708,34 +2708,30 @@ set_selinux_context (char *filename,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (val == NULL)
|
if (val == NULL)
|
||||||
{
|
{
|
||||||
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
|
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
|
||||||
_("SELinux context must be non-NULL"));
|
_("SELinux context must be non-NULL"));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_selinux_enabled ()) {
|
if (!is_selinux_enabled ())
|
||||||
security_context_t val_s;
|
{
|
||||||
|
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
|
||||||
val_s = g_strdup (val);
|
_("SELinux is not enabled on this system"));
|
||||||
|
return FALSE;
|
||||||
if (setfilecon_raw (filename, val_s) < 0)
|
}
|
||||||
{
|
|
||||||
int errsv = errno;
|
if (setfilecon_raw (filename, val) < 0)
|
||||||
|
{
|
||||||
|
int errsv = errno;
|
||||||
|
|
||||||
g_set_error (error, G_IO_ERROR,
|
g_set_error (error, G_IO_ERROR,
|
||||||
g_io_error_from_errno (errsv),
|
g_io_error_from_errno (errsv),
|
||||||
_("Error setting SELinux context: %s"),
|
_("Error setting SELinux context: %s"),
|
||||||
g_strerror (errsv));
|
g_strerror (errsv));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
g_free (val_s);
|
|
||||||
} else {
|
|
||||||
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
|
|
||||||
_("SELinux is not enabled on this system"));
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -2063,7 +2063,7 @@ endif
|
|||||||
|
|
||||||
selinux_dep = []
|
selinux_dep = []
|
||||||
if host_system == 'linux'
|
if host_system == 'linux'
|
||||||
selinux_dep = dependency('libselinux', required: get_option('selinux'))
|
selinux_dep = dependency('libselinux', version: '>=2.2', required: get_option('selinux'))
|
||||||
|
|
||||||
glib_conf.set('HAVE_SELINUX', selinux_dep.found())
|
glib_conf.set('HAVE_SELINUX', selinux_dep.found())
|
||||||
endif
|
endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user