diff options
author | WaLyong Cho <walyong.cho@samsung.com> | 2014-10-23 10:23:46 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-10-23 17:13:15 +0200 |
commit | cc56fafeebf814ef035e549115cf1850e6473fa5 (patch) | |
tree | 7bc8ec26fb250eb21180cdcd30bdc9072a0ac132 /src/shared | |
parent | label: rearrange mandatory access control(MAC) apis (diff) | |
download | systemd-cc56fafeebf814ef035e549115cf1850e6473fa5.tar.xz systemd-cc56fafeebf814ef035e549115cf1850e6473fa5.zip |
mac: rename apis with mac_{selinux/smack}_ prefix
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/dev-setup.c | 4 | ||||
-rw-r--r-- | src/shared/fileio-label.c | 12 | ||||
-rw-r--r-- | src/shared/label.c | 4 | ||||
-rw-r--r-- | src/shared/mkdir-label.c | 4 | ||||
-rw-r--r-- | src/shared/selinux-util.c | 28 | ||||
-rw-r--r-- | src/shared/selinux-util.h | 34 | ||||
-rw-r--r-- | src/shared/smack-util.c | 10 | ||||
-rw-r--r-- | src/shared/smack-util.h | 10 | ||||
-rw-r--r-- | src/shared/socket-label.c | 6 |
9 files changed, 56 insertions, 56 deletions
diff --git a/src/shared/dev-setup.c b/src/shared/dev-setup.c index 1a565d5470..96934a9fad 100644 --- a/src/shared/dev-setup.c +++ b/src/shared/dev-setup.c @@ -38,14 +38,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/fileio-label.c b/src/shared/fileio-label.c index d5ce24c0d9..b117c32cf2 100644 --- a/src/shared/fileio-label.c +++ b/src/shared/fileio-label.c @@ -30,13 +30,13 @@ int write_string_file_atomic_label(const char *fn, const char *line) { int r; - r = label_context_set(fn, S_IFREG); + r = mac_selinux_context_set(fn, S_IFREG); if (r < 0) return r; r = write_string_file_atomic(fn, line); - label_context_clear(); + mac_selinux_context_clear(); return r; } @@ -44,13 +44,13 @@ int write_string_file_atomic_label(const char *fn, const char *line) { int write_env_file_label(const char *fname, char **l) { int r; - r = label_context_set(fname, S_IFREG); + r = mac_selinux_context_set(fname, S_IFREG); if (r < 0) return r; r = write_env_file(fname, l); - label_context_clear(); + mac_selinux_context_clear(); return r; } @@ -59,13 +59,13 @@ int fopen_temporary_label(const char *target, const char *path, FILE **f, char **temp_path) { int r; - r = label_context_set(target, S_IFREG); + r = mac_selinux_context_set(target, S_IFREG); if (r < 0) return r; r = fopen_temporary(path, f, temp_path); - label_context_clear(); + mac_selinux_context_clear(); return r; } diff --git a/src/shared/label.c b/src/shared/label.c index b48a4ff6f8..bee9635731 100644 --- a/src/shared/label.c +++ b/src/shared/label.c @@ -26,13 +26,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 c41045e5b5..89af392819 100644 --- a/src/shared/mkdir-label.c +++ b/src/shared/mkdir-label.c @@ -36,7 +36,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; } @@ -46,7 +46,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 05ed61c6dc..a277dad357 100644 --- a/src/shared/selinux-util.c +++ b/src/shared/selinux-util.c @@ -61,7 +61,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 @@ -108,7 +108,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 @@ -153,7 +153,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()) @@ -164,7 +164,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; @@ -201,7 +201,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 @@ -217,7 +217,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 @@ -309,7 +309,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 @@ -338,7 +338,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()) @@ -356,7 +356,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; @@ -368,7 +368,7 @@ void label_context_clear(void) { #endif } -void label_socket_clear(void) { +void mac_selinux_socket_clear(void) { #ifdef HAVE_SELINUX PROTECT_ERRNO; @@ -380,7 +380,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()) @@ -390,7 +390,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 @@ -436,7 +436,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 */ @@ -507,7 +507,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 bdde8f5a24..b23a77950b 100644 --- a/src/shared/selinux-util.h +++ b/src/shared/selinux-util.h @@ -28,27 +28,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 04ee217d2f..33e1cd849e 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 87d64346ba..91b141ad7d 100644 --- a/src/shared/smack-util.h +++ b/src/shared/smack-util.h @@ -30,8 +30,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/shared/socket-label.c b/src/shared/socket-label.c index bd3ceefb93..6f9aeeea5d 100644 --- a/src/shared/socket-label.c +++ b/src/shared/socket-label.c @@ -64,7 +64,7 @@ int socket_address_listen( return -EAFNOSUPPORT; if (label) { - r = label_socket_set(label); + r = mac_selinux_socket_set(label); if (r < 0) return r; } @@ -73,7 +73,7 @@ int socket_address_listen( r = fd < 0 ? -errno : 0; if (label) - label_socket_clear(); + mac_selinux_socket_clear(); if (r < 0) return r; @@ -119,7 +119,7 @@ int socket_address_listen( /* Include the original umask in our mask */ umask(~socket_mode | old_mask); - r = label_bind(fd, &a->sockaddr.sa, a->size); + r = mac_selinux_bind(fd, &a->sockaddr.sa, a->size); if (r < 0 && errno == EADDRINUSE) { /* Unlink and try again */ |