mirror of
https://github.com/systemd/systemd.git
synced 2025-01-31 05:47:30 +03:00
selinux: kill mac_selinux_free()
It was a redundant wrapper around freecon. test-selinux needs to be adjusted because it now needs to be linked to libselinux, instead of pulling it in via libshared.
This commit is contained in:
parent
5c672e90a6
commit
6623c64a02
@ -63,7 +63,7 @@ int mac_selinux_setup(bool *loaded_policy) {
|
||||
before_load = now(CLOCK_MONOTONIC);
|
||||
r = selinux_init_load_policy(&enforce);
|
||||
if (r == 0) {
|
||||
_cleanup_(mac_selinux_freep) char *label = NULL;
|
||||
_cleanup_freecon_ char *label = NULL;
|
||||
|
||||
mac_selinux_retest();
|
||||
|
||||
|
@ -1615,7 +1615,7 @@ DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(Socket *, socket_close_fds, NULL);
|
||||
|
||||
static int socket_open_fds(Socket *orig_s) {
|
||||
_cleanup_(socket_close_fdsp) Socket *s = orig_s;
|
||||
_cleanup_(mac_selinux_freep) char *label = NULL;
|
||||
_cleanup_freecon_ char *label = NULL;
|
||||
bool know_label = false;
|
||||
int r;
|
||||
|
||||
|
@ -267,7 +267,7 @@ static int extract_now(
|
||||
|
||||
FOREACH_DIRENT(de, d, return log_debug_errno(errno, "Failed to read directory: %m")) {
|
||||
_cleanup_(portable_metadata_unrefp) PortableMetadata *m = NULL;
|
||||
_cleanup_(mac_selinux_freep) char *con = NULL;
|
||||
_cleanup_freecon_ char *con = NULL;
|
||||
_cleanup_close_ int fd = -EBADF;
|
||||
struct stat st;
|
||||
|
||||
|
@ -532,17 +532,6 @@ int mac_selinux_get_child_mls_label(int socket_fd, const char *exe, const char *
|
||||
#endif
|
||||
}
|
||||
|
||||
char* mac_selinux_free(char *label) {
|
||||
|
||||
#if HAVE_SELINUX
|
||||
freecon(label);
|
||||
#else
|
||||
assert(!label);
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if HAVE_SELINUX
|
||||
static int selinux_create_file_prepare_abspath(const char *abspath, mode_t mode) {
|
||||
_cleanup_freecon_ char *filecon = NULL;
|
||||
|
@ -13,9 +13,15 @@
|
||||
#include <selinux/selinux.h>
|
||||
|
||||
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(char*, freecon, NULL);
|
||||
#define _cleanup_freecon_ _cleanup_(freeconp)
|
||||
#else
|
||||
static inline char* freeconp(char **p) {
|
||||
assert(*p == NULL);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define _cleanup_freecon_ _cleanup_(freeconp)
|
||||
|
||||
bool mac_selinux_use(void);
|
||||
void mac_selinux_retest(void);
|
||||
bool mac_selinux_enforcing(void);
|
||||
@ -33,7 +39,6 @@ int mac_selinux_apply_fd(int fd, const char *path, const char *label);
|
||||
int mac_selinux_get_create_label_from_exe(const char *exe, char **label);
|
||||
int mac_selinux_get_our_label(char **label);
|
||||
int mac_selinux_get_child_mls_label(int socket_fd, const char *exe, const char *exec_label, char **label);
|
||||
char* mac_selinux_free(char *label);
|
||||
|
||||
int mac_selinux_create_file_prepare_at(int dirfd, const char *path, mode_t mode);
|
||||
static inline int mac_selinux_create_file_prepare(const char *path, mode_t mode) {
|
||||
@ -46,5 +51,3 @@ int mac_selinux_create_socket_prepare(const char *label);
|
||||
void mac_selinux_create_socket_clear(void);
|
||||
|
||||
int mac_selinux_bind(int fd, const struct sockaddr *addr, socklen_t addrlen);
|
||||
|
||||
DEFINE_TRIVIAL_CLEANUP_FUNC(char*, mac_selinux_free);
|
||||
|
@ -156,7 +156,6 @@ simple_tests += files(
|
||||
'test-sd-hwdb.c',
|
||||
'test-sd-path.c',
|
||||
'test-secure-bits.c',
|
||||
'test-selinux.c',
|
||||
'test-serialize.c',
|
||||
'test-set.c',
|
||||
'test-sha256.c',
|
||||
@ -404,6 +403,10 @@ executables += [
|
||||
'dependencies' : libseccomp,
|
||||
'conditions' : ['HAVE_SECCOMP'],
|
||||
},
|
||||
test_template + {
|
||||
'sources' : files('test-selinux.c'),
|
||||
'dependencies' : libselinux,
|
||||
},
|
||||
test_template + {
|
||||
'sources' : files('test-set-disable-mempool.c'),
|
||||
'dependencies' : threads,
|
||||
|
@ -54,7 +54,7 @@ static void test_cleanup(void) {
|
||||
}
|
||||
|
||||
static void test_misc(const char* fname) {
|
||||
_cleanup_(mac_selinux_freep) char *label = NULL, *label2 = NULL, *label3 = NULL;
|
||||
_cleanup_freecon_ char *label = NULL, *label2 = NULL, *label3 = NULL;
|
||||
int r;
|
||||
_cleanup_close_ int fd = -EBADF;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user