summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/shared/dev-setup.c4
-rw-r--r--src/shared/label.c4
-rw-r--r--src/shared/mkdir-label.c4
-rw-r--r--src/shared/selinux-util.c28
-rw-r--r--src/shared/selinux-util.h34
-rw-r--r--src/shared/smack-util.c10
-rw-r--r--src/shared/smack-util.h10
-rw-r--r--src/udev/udev-node.c14
-rw-r--r--src/udev/udevadm.c4
-rw-r--r--src/udev/udevd.c4
-rw-r--r--test/test-udev.c4
11 files changed, 60 insertions, 60 deletions
diff --git a/src/shared/dev-setup.c b/src/shared/dev-setup.c
index 8199a26f73..10f74f0ccb 100644
--- a/src/shared/dev-setup.c
+++ b/src/shared/dev-setup.c
@@ -36,14 +36,14 @@ static int symlink_and_label(const char *old_path, const char *new_path) {
assert(old_path);
assert(new_path);
- r = label_context_set(new_path, S_IFLNK);
+ r = mac_selinux_context_set(new_path, S_IFLNK);
if (r < 0)
return r;
if (symlink(old_path, new_path) < 0)
r = -errno;
- label_context_clear();
+ mac_selinux_context_clear();
return r;
}
diff --git a/src/shared/label.c b/src/shared/label.c
index a129ea97a4..4b0960b96c 100644
--- a/src/shared/label.c
+++ b/src/shared/label.c
@@ -24,13 +24,13 @@ int label_fix(const char *path, bool ignore_enoent, bool ignore_erofs) {
int r = 0;
if (use_selinux()) {
- r = label_fix_selinux(path, ignore_enoent, ignore_erofs);
+ r = mac_selinux_fix(path, ignore_enoent, ignore_erofs);
if (r < 0)
return r;
}
if (use_smack()) {
- r = smack_relabel_in_dev(path);
+ r = mac_smack_relabel_in_dev(path);
if (r < 0)
return r;
}
diff --git a/src/shared/mkdir-label.c b/src/shared/mkdir-label.c
index 2fdcae4127..965ef7939f 100644
--- a/src/shared/mkdir-label.c
+++ b/src/shared/mkdir-label.c
@@ -34,7 +34,7 @@ static int label_mkdir(const char *path, mode_t mode) {
int r;
if (use_selinux()) {
- r = label_mkdir_selinux(path, mode);
+ r = mac_selinux_mkdir(path, mode);
if (r < 0)
return r;
}
@@ -44,7 +44,7 @@ static int label_mkdir(const char *path, mode_t mode) {
if (r < 0 && errno != EEXIST)
return -errno;
- r = smack_relabel_in_dev(path);
+ r = mac_smack_relabel_in_dev(path);
if (r < 0)
return r;
}
diff --git a/src/shared/selinux-util.c b/src/shared/selinux-util.c
index dd35b05e27..1860eeafa6 100644
--- a/src/shared/selinux-util.c
+++ b/src/shared/selinux-util.c
@@ -59,7 +59,7 @@ void retest_selinux(void) {
#endif
}
-int label_init(const char *prefix) {
+int mac_selinux_init(const char *prefix) {
int r = 0;
#ifdef HAVE_SELINUX
@@ -106,7 +106,7 @@ int label_init(const char *prefix) {
return r;
}
-int label_fix_selinux(const char *path, bool ignore_enoent, bool ignore_erofs) {
+int mac_selinux_fix(const char *path, bool ignore_enoent, bool ignore_erofs) {
int r = 0;
#ifdef HAVE_SELINUX
@@ -151,7 +151,7 @@ int label_fix_selinux(const char *path, bool ignore_enoent, bool ignore_erofs) {
return r;
}
-void label_finish(void) {
+void mac_selinux_finish(void) {
#ifdef HAVE_SELINUX
if (!use_selinux())
@@ -162,7 +162,7 @@ void label_finish(void) {
#endif
}
-int label_get_create_label_from_exe(const char *exe, char **label) {
+int mac_selinux_get_create_label_from_exe(const char *exe, char **label) {
int r = 0;
@@ -199,7 +199,7 @@ fail:
return r;
}
-int label_get_our_label(char **label) {
+int mac_selinux_get_our_label(char **label) {
int r = -EOPNOTSUPP;
#ifdef HAVE_SELINUX
@@ -215,7 +215,7 @@ int label_get_our_label(char **label) {
return r;
}
-int label_get_child_mls_label(int socket_fd, const char *exe, char **label) {
+int mac_selinux_get_child_mls_label(int socket_fd, const char *exe, char **label) {
int r = -EOPNOTSUPP;
#ifdef HAVE_SELINUX
@@ -307,7 +307,7 @@ out:
return r;
}
-int label_context_set(const char *path, mode_t mode) {
+int mac_selinux_context_set(const char *path, mode_t mode) {
int r = 0;
#ifdef HAVE_SELINUX
@@ -336,7 +336,7 @@ int label_context_set(const char *path, mode_t mode) {
return r;
}
-int label_socket_set(const char *label) {
+int mac_selinux_socket_set(const char *label) {
#ifdef HAVE_SELINUX
if (!use_selinux())
@@ -354,7 +354,7 @@ int label_socket_set(const char *label) {
return 0;
}
-void label_context_clear(void) {
+void mac_selinux_context_clear(void) {
#ifdef HAVE_SELINUX
PROTECT_ERRNO;
@@ -366,7 +366,7 @@ void label_context_clear(void) {
#endif
}
-void label_socket_clear(void) {
+void mac_selinux_socket_clear(void) {
#ifdef HAVE_SELINUX
PROTECT_ERRNO;
@@ -378,7 +378,7 @@ void label_socket_clear(void) {
#endif
}
-void label_free(const char *label) {
+void mac_selinux_free(const char *label) {
#ifdef HAVE_SELINUX
if (!use_selinux())
@@ -388,7 +388,7 @@ void label_free(const char *label) {
#endif
}
-int label_mkdir_selinux(const char *path, mode_t mode) {
+int mac_selinux_mkdir(const char *path, mode_t mode) {
int r = 0;
#ifdef HAVE_SELINUX
@@ -434,7 +434,7 @@ finish:
return r;
}
-int label_bind(int fd, const struct sockaddr *addr, socklen_t addrlen) {
+int mac_selinux_bind(int fd, const struct sockaddr *addr, socklen_t addrlen) {
/* Binds a socket and label its file system object according to the SELinux policy */
@@ -505,7 +505,7 @@ skipped:
return bind(fd, addr, addrlen) < 0 ? -errno : 0;
}
-int label_apply(const char *path, const char *label) {
+int mac_selinux_apply(const char *path, const char *label) {
int r = 0;
#ifdef HAVE_SELINUX
diff --git a/src/shared/selinux-util.h b/src/shared/selinux-util.h
index 8a52b6840c..e6637f3fe5 100644
--- a/src/shared/selinux-util.h
+++ b/src/shared/selinux-util.h
@@ -26,27 +26,27 @@
bool use_selinux(void);
void retest_selinux(void);
-int label_init(const char *prefix);
-int label_fix_selinux(const char *path, bool ignore_enoent, bool ignore_erofs);
-void label_finish(void);
+int mac_selinux_init(const char *prefix);
+int mac_selinux_fix(const char *path, bool ignore_enoent, bool ignore_erofs);
+void mac_selinux_finish(void);
-int label_socket_set(const char *label);
-void label_socket_clear(void);
+int mac_selinux_socket_set(const char *label);
+void mac_selinux_socket_clear(void);
-int label_context_set(const char *path, mode_t mode);
-void label_context_clear(void);
+int mac_selinux_context_set(const char *path, mode_t mode);
+void mac_selinux_context_clear(void);
-void label_free(const char *label);
-int label_mkdir_selinux(const char *path, mode_t mode);
+void mac_selinux_free(const char *label);
+int mac_selinux_mkdir(const char *path, mode_t mode);
-int label_get_create_label_from_exe(const char *exe, char **label);
-int label_get_our_label(char **label);
-int label_get_child_mls_label(int socket_fd, const char *exec, 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 *exec, char **label);
-int label_bind(int fd, const struct sockaddr *addr, socklen_t addrlen);
+int mac_selinux_bind(int fd, const struct sockaddr *addr, socklen_t addrlen);
-int label_apply(const char *path, const char *label);
+int mac_selinux_apply(const char *path, const char *label);
-int label_write_one_line_file_atomic(const char *fn, const char *line);
-int label_write_env_file(const char *fname, char **l);
-int label_fopen_temporary(const char *path, FILE **_f, char **_temp_path);
+int mac_selinux_write_one_line_file_atomic(const char *fn, const char *line);
+int mac_selinux_write_env_file(const char *fname, char **l);
+int mac_selinux_label_fopen_temporary(const char *path, FILE **_f, char **_temp_path);
diff --git a/src/shared/smack-util.c b/src/shared/smack-util.c
index 598e5b622d..1b9c7ec93d 100644
--- a/src/shared/smack-util.c
+++ b/src/shared/smack-util.c
@@ -41,7 +41,7 @@ bool use_smack(void) {
}
-int smack_label_path(const char *path, const char *label) {
+int mac_smack_set_path(const char *path, const char *label) {
#ifdef HAVE_SMACK
if (!use_smack())
return 0;
@@ -55,7 +55,7 @@ int smack_label_path(const char *path, const char *label) {
#endif
}
-int smack_label_fd(int fd, const char *label) {
+int mac_smack_set_fd(int fd, const char *label) {
#ifdef HAVE_SMACK
if (!use_smack())
return 0;
@@ -66,7 +66,7 @@ int smack_label_fd(int fd, const char *label) {
#endif
}
-int smack_label_ip_out_fd(int fd, const char *label) {
+int mac_smack_set_ip_out_fd(int fd, const char *label) {
#ifdef HAVE_SMACK
if (!use_smack())
return 0;
@@ -77,7 +77,7 @@ int smack_label_ip_out_fd(int fd, const char *label) {
#endif
}
-int smack_label_ip_in_fd(int fd, const char *label) {
+int mac_smack_set_ip_in_fd(int fd, const char *label) {
#ifdef HAVE_SMACK
if (!use_smack())
return 0;
@@ -88,7 +88,7 @@ int smack_label_ip_in_fd(int fd, const char *label) {
#endif
}
-int smack_relabel_in_dev(const char *path) {
+int mac_smack_relabel_in_dev(const char *path) {
int r = 0;
#ifdef HAVE_SMACK
diff --git a/src/shared/smack-util.h b/src/shared/smack-util.h
index 5b3d9a27a7..0ccb1fb87c 100644
--- a/src/shared/smack-util.h
+++ b/src/shared/smack-util.h
@@ -28,8 +28,8 @@
bool use_smack(void);
-int smack_label_path(const char *path, const char *label);
-int smack_label_fd(int fd, const char *label);
-int smack_label_ip_in_fd(int fd, const char *label);
-int smack_label_ip_out_fd(int fd, const char *label);
-int smack_relabel_in_dev(const char *path);
+int mac_smack_set_path(const char *path, const char *label);
+int mac_smack_set_fd(int fd, const char *label);
+int mac_smack_set_ip_in_fd(int fd, const char *label);
+int mac_smack_set_ip_out_fd(int fd, const char *label);
+int mac_smack_relabel_in_dev(const char *path);
diff --git a/src/udev/udev-node.c b/src/udev/udev-node.c
index 8ef788954d..3982ef9215 100644
--- a/src/udev/udev-node.c
+++ b/src/udev/udev-node.c
@@ -88,11 +88,11 @@ static int node_symlink(struct udev_device *dev, const char *node, const char *s
err = mkdir_parents_label(slink, 0755);
if (err != 0 && err != -ENOENT)
break;
- label_context_set(slink, S_IFLNK);
+ mac_selinux_context_set(slink, S_IFLNK);
err = symlink(target, slink);
if (err != 0)
err = -errno;
- label_context_clear();
+ mac_selinux_context_clear();
} while (err == -ENOENT);
if (err == 0)
goto exit;
@@ -105,11 +105,11 @@ static int node_symlink(struct udev_device *dev, const char *node, const char *s
err = mkdir_parents_label(slink_tmp, 0755);
if (err != 0 && err != -ENOENT)
break;
- label_context_set(slink_tmp, S_IFLNK);
+ mac_selinux_context_set(slink_tmp, S_IFLNK);
err = symlink(target, slink_tmp);
if (err != 0)
err = -errno;
- label_context_clear();
+ mac_selinux_context_clear();
} while (err == -ENOENT);
if (err != 0) {
log_error("symlink '%s' '%s' failed: %m", target, slink_tmp);
@@ -300,14 +300,14 @@ static int node_permissions_apply(struct udev_device *dev, bool apply,
if (streq(name, "selinux")) {
selinux = true;
- if (label_apply(devnode, label) < 0)
+ if (mac_selinux_apply(devnode, label) < 0)
log_error("SECLABEL: failed to set SELinux label '%s'", label);
else
log_debug("SECLABEL: set SELinux label '%s'", label);
} else if (streq(name, "smack")) {
smack = true;
- if (smack_label_path(devnode, label) < 0)
+ if (mac_smack_set_path(devnode, label) < 0)
log_error("SECLABEL: failed to set SMACK label '%s'", label);
else
log_debug("SECLABEL: set SMACK label '%s'", label);
@@ -320,7 +320,7 @@ static int node_permissions_apply(struct udev_device *dev, bool apply,
if (!selinux)
label_fix(devnode, true, false);
if (!smack)
- smack_label_path(devnode, NULL);
+ mac_smack_set_path(devnode, NULL);
}
/* always update timestamp when we re-use the node, like on media change events */
diff --git a/src/udev/udevadm.c b/src/udev/udevadm.c
index 1d2e7dd5d6..fda5aecd83 100644
--- a/src/udev/udevadm.c
+++ b/src/udev/udevadm.c
@@ -98,7 +98,7 @@ int main(int argc, char *argv[]) {
log_open();
udev_set_log_fn(udev, udev_main_log);
- label_init("/dev");
+ mac_selinux_init("/dev");
while ((c = getopt_long(argc, argv, "+dhV", options, NULL)) >= 0)
switch (c) {
@@ -136,7 +136,7 @@ int main(int argc, char *argv[]) {
fprintf(stderr, "%s: missing or unknown command\n", program_invocation_short_name);
rc = 2;
out:
- label_finish();
+ mac_selinux_finish();
udev_unref(udev);
log_close();
return rc;
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 0fbcb4faab..1c922ed1f2 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -1165,7 +1165,7 @@ int main(int argc, char *argv[]) {
goto exit;
}
- r = label_init("/dev");
+ r = mac_selinux_init("/dev");
if (r < 0) {
log_error("could not initialize labelling: %s", strerror(-r));
goto exit;
@@ -1558,7 +1558,7 @@ exit_daemonize:
udev_monitor_unref(monitor);
udev_ctrl_connection_unref(ctrl_conn);
udev_ctrl_unref(udev_ctrl);
- label_finish();
+ mac_selinux_finish();
udev_unref(udev);
log_close();
return rc;
diff --git a/test/test-udev.c b/test/test-udev.c
index 446849e4b0..d07962c285 100644
--- a/test/test-udev.c
+++ b/test/test-udev.c
@@ -110,7 +110,7 @@ int main(int argc, char *argv[]) {
return EXIT_FAILURE;
log_debug("version %s", VERSION);
- label_init("/dev");
+ mac_selinux_init("/dev");
sigprocmask(SIG_SETMASK, NULL, &sigmask_orig);
@@ -169,7 +169,7 @@ int main(int argc, char *argv[]) {
out:
if (event != NULL && event->fd_signal >= 0)
close(event->fd_signal);
- label_finish();
+ mac_selinux_finish();
return err ? EXIT_FAILURE : EXIT_SUCCESS;
}