X Tutup
Skip to content

Commit cc56faf

Browse files
walyongpoettering
authored andcommitted
mac: rename apis with mac_{selinux/smack}_ prefix
1 parent 66b6d9d commit cc56faf

File tree

26 files changed

+114
-114
lines changed

26 files changed

+114
-114
lines changed

src/core/execute.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1681,7 +1681,7 @@ static int exec_child(ExecCommand *command,
16811681
if (params->selinux_context_net && socket_fd >= 0) {
16821682
_cleanup_free_ char *label = NULL;
16831683

1684-
err = label_get_child_mls_label(socket_fd, command->path, &label);
1684+
err = mac_selinux_get_child_mls_label(socket_fd, command->path, &label);
16851685
if (err < 0) {
16861686
*error = EXIT_SELINUX_CONTEXT;
16871687
return err;

src/core/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,7 +1308,7 @@ int main(int argc, char *argv[]) {
13081308
dual_timestamp_get(&security_finish_timestamp);
13091309
}
13101310

1311-
if (label_init(NULL) < 0)
1311+
if (mac_selinux_init(NULL) < 0)
13121312
goto finish;
13131313

13141314
if (!skip_setup) {
@@ -1830,7 +1830,7 @@ int main(int argc, char *argv[]) {
18301830
free(arg_start_timeout_reboot_arg);
18311831
arg_start_timeout_reboot_arg = NULL;
18321832

1833-
label_finish();
1833+
mac_selinux_finish();
18341834

18351835
if (reexecute) {
18361836
const char **args;

src/core/namespace.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,9 @@ static int mount_dev(BindMount *m) {
225225
goto fail;
226226
}
227227

228-
label_context_set(d, st.st_mode);
228+
mac_selinux_context_set(d, st.st_mode);
229229
r = mknod(dn, st.st_mode, st.st_rdev);
230-
label_context_clear();
230+
mac_selinux_context_clear();
231231

232232
if (r < 0) {
233233
r = -errno;

src/core/selinux-setup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ int selinux_setup(bool *loaded_policy) {
8787
retest_selinux();
8888

8989
/* Transition to the new context */
90-
r = label_get_create_label_from_exe(SYSTEMD_BINARY_PATH, &label);
90+
r = mac_selinux_get_create_label_from_exe(SYSTEMD_BINARY_PATH, &label);
9191
if (r < 0 || label == NULL) {
9292
log_open();
9393
log_error("Failed to compute init label, ignoring.");
@@ -98,7 +98,7 @@ int selinux_setup(bool *loaded_policy) {
9898
if (r < 0)
9999
log_error("Failed to transition into init label '%s', ignoring.", label);
100100

101-
label_free(label);
101+
mac_selinux_free(label);
102102
}
103103

104104
after_load = now(CLOCK_MONOTONIC);

src/core/socket.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -921,12 +921,12 @@ static void socket_apply_socket_options(Socket *s, int fd) {
921921
}
922922

923923
if (s->smack_ip_in)
924-
if (smack_label_ip_in_fd(fd, s->smack_ip_in) < 0)
925-
log_error_unit(UNIT(s)->id, "smack_label_ip_in_fd: %m");
924+
if (mac_smack_set_ip_in_fd(fd, s->smack_ip_in) < 0)
925+
log_error_unit(UNIT(s)->id, "mac_smack_set_ip_in_fd: %m");
926926

927927
if (s->smack_ip_out)
928-
if (smack_label_ip_out_fd(fd, s->smack_ip_out) < 0)
929-
log_error_unit(UNIT(s)->id, "smack_label_ip_out_fd: %m");
928+
if (mac_smack_set_ip_out_fd(fd, s->smack_ip_out) < 0)
929+
log_error_unit(UNIT(s)->id, "mac_smack_set_ip_out_fd: %m");
930930
}
931931

932932
static void socket_apply_fifo_options(Socket *s, int fd) {
@@ -939,8 +939,8 @@ static void socket_apply_fifo_options(Socket *s, int fd) {
939939
"F_SETPIPE_SZ: %m");
940940

941941
if (s->smack)
942-
if (smack_label_fd(fd, s->smack) < 0)
943-
log_error_unit(UNIT(s)->id, "smack_label_fd: %m");
942+
if (mac_smack_set_fd(fd, s->smack) < 0)
943+
log_error_unit(UNIT(s)->id, "mac_smack_set_fd: %m");
944944
}
945945

946946
static int fifo_address_create(
@@ -958,7 +958,7 @@ static int fifo_address_create(
958958

959959
mkdir_parents_label(path, directory_mode);
960960

961-
r = label_context_set(path, S_IFIFO);
961+
r = mac_selinux_context_set(path, S_IFIFO);
962962
if (r < 0)
963963
goto fail;
964964

@@ -981,7 +981,7 @@ static int fifo_address_create(
981981
goto fail;
982982
}
983983

984-
label_context_clear();
984+
mac_selinux_context_clear();
985985

986986
if (fstat(fd, &st) < 0) {
987987
r = -errno;
@@ -1001,7 +1001,7 @@ static int fifo_address_create(
10011001
return 0;
10021002

10031003
fail:
1004-
label_context_clear();
1004+
mac_selinux_context_clear();
10051005
safe_close(fd);
10061006

10071007
return r;
@@ -1131,7 +1131,7 @@ static int socket_open_fds(Socket *s) {
11311131

11321132
if (p->type == SOCKET_SOCKET) {
11331133
if (!know_label && s->selinux_context_from_net) {
1134-
r = label_get_our_label(&label);
1134+
r = mac_selinux_get_our_label(&label);
11351135
if (r < 0)
11361136
return r;
11371137
know_label = true;
@@ -1143,7 +1143,7 @@ static int socket_open_fds(Socket *s) {
11431143

11441144
if (UNIT_ISSET(s->service) &&
11451145
SERVICE(UNIT_DEREF(s->service))->exec_command[SERVICE_EXEC_START]) {
1146-
r = label_get_create_label_from_exe(SERVICE(UNIT_DEREF(s->service))->exec_command[SERVICE_EXEC_START]->path, &label);
1146+
r = mac_selinux_get_create_label_from_exe(SERVICE(UNIT_DEREF(s->service))->exec_command[SERVICE_EXEC_START]->path, &label);
11471147
if (r < 0 && r != -EPERM)
11481148
return r;
11491149
}
@@ -1204,12 +1204,12 @@ static int socket_open_fds(Socket *s) {
12041204
assert_not_reached("Unknown port type");
12051205
}
12061206

1207-
label_free(label);
1207+
mac_selinux_free(label);
12081208
return 0;
12091209

12101210
rollback:
12111211
socket_close_fds(s);
1212-
label_free(label);
1212+
mac_selinux_free(label);
12131213
return r;
12141214
}
12151215

src/hostname/hostnamed.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ int main(int argc, char *argv[]) {
684684
log_open();
685685

686686
umask(0022);
687-
label_init("/etc");
687+
mac_selinux_init("/etc");
688688

689689
if (argc != 1) {
690690
log_error("This program takes no arguments.");

src/locale/localed.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,7 @@ int main(int argc, char *argv[]) {
11411141
log_open();
11421142

11431143
umask(0022);
1144-
label_init("/etc");
1144+
mac_selinux_init("/etc");
11451145

11461146
if (argc != 1) {
11471147
log_error("This program takes no arguments.");

src/login/logind-dbus.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1143,7 +1143,7 @@ static int attach_device(Manager *m, const char *seat, const char *sysfs) {
11431143
return -ENOMEM;
11441144

11451145
mkdir_p_label("/etc/udev/rules.d", 0755);
1146-
label_init("/etc");
1146+
mac_selinux_init("/etc");
11471147
r = write_string_file_atomic_label(file, rule);
11481148
if (r < 0)
11491149
return r;

src/resolve/resolved.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ int main(int argc, char *argv[]) {
4747

4848
umask(0022);
4949

50-
r = label_init(NULL);
50+
r = mac_selinux_init(NULL);
5151
if (r < 0) {
5252
log_error("SELinux setup failed: %s", strerror(-r));
5353
goto finish;

src/shared/dev-setup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ static int symlink_and_label(const char *old_path, const char *new_path) {
3838
assert(old_path);
3939
assert(new_path);
4040

41-
r = label_context_set(new_path, S_IFLNK);
41+
r = mac_selinux_context_set(new_path, S_IFLNK);
4242
if (r < 0)
4343
return r;
4444

4545
if (symlink(old_path, new_path) < 0)
4646
r = -errno;
4747

48-
label_context_clear();
48+
mac_selinux_context_clear();
4949

5050
return r;
5151
}

0 commit comments

Comments
 (0)
X Tutup