aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/fileio.c13
-rw-r--r--src/nvim/memfile.c3
-rw-r--r--src/nvim/os_unix.c53
-rw-r--r--src/nvim/undo.c4
4 files changed, 0 insertions, 73 deletions
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index 15d7a885d5..b468b7bb8c 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -2900,9 +2900,6 @@ buf_write (
#ifdef HAVE_ACL
mch_set_acl(backup, acl);
#endif
-#ifdef HAVE_SELINUX
- mch_copy_sec(fname, backup);
-#endif
break;
}
}
@@ -3385,13 +3382,6 @@ restore_backup:
end = 0;
}
-#ifdef HAVE_SELINUX
- // Probably need to set the security context.
- if (!backup_copy) {
- mch_copy_sec(backup, wfname);
- }
-#endif
-
#ifdef UNIX
// When creating a new file, set its owner/group to that of the original
// file. Get the new device and inode number.
@@ -4760,9 +4750,6 @@ int vim_rename(const char_u *from, const char_u *to)
mch_set_acl(to, acl);
mch_free_acl(acl);
#endif
-#ifdef HAVE_SELINUX
- mch_copy_sec(from, to);
-#endif
if (errmsg != NULL) {
EMSG2(errmsg, to);
return -1;
diff --git a/src/nvim/memfile.c b/src/nvim/memfile.c
index 0a16f8aafb..5a64c82e0e 100644
--- a/src/nvim/memfile.c
+++ b/src/nvim/memfile.c
@@ -785,9 +785,6 @@ static bool mf_do_open(memfile_T *mfp, char_u *fname, int flags)
}
(void)os_set_cloexec(mfp->mf_fd);
-#ifdef HAVE_SELINUX
- mch_copy_sec(fname, mfp->mf_fname);
-#endif
return true;
}
diff --git a/src/nvim/os_unix.c b/src/nvim/os_unix.c
index 351350d939..8180a2e8ac 100644
--- a/src/nvim/os_unix.c
+++ b/src/nvim/os_unix.c
@@ -45,12 +45,6 @@
#include "nvim/os/signal.h"
#include "nvim/msgpack_rpc/helpers.h"
-#ifdef HAVE_SELINUX
-# include <selinux/selinux.h>
-static int selinux_enabled = -1;
-#endif
-
-
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "os_unix.c.generated.h"
#endif
@@ -64,53 +58,6 @@ static int selinux_enabled = -1;
# endif
-#if defined(HAVE_SELINUX)
-// Copy security info from "from_file" to "to_file".
-void mch_copy_sec(char_u *from_file, char_u *to_file)
-{
- if (from_file == NULL)
- return;
-
- if (selinux_enabled == -1)
- selinux_enabled = is_selinux_enabled();
-
- if (selinux_enabled > 0) {
- security_context_t from_context = NULL;
- security_context_t to_context = NULL;
-
- if (getfilecon((char *)from_file, &from_context) < 0) {
- // If the filesystem doesn't support extended attributes,
- // the original had no special security context and the
- // target cannot have one either.
- if (errno == EOPNOTSUPP) {
- return;
- }
-
- MSG_PUTS(_("\nCould not get security context for "));
- msg_outtrans(from_file);
- msg_putchar('\n');
- return;
- }
- if (getfilecon((char *)to_file, &to_context) < 0) {
- MSG_PUTS(_("\nCould not get security context for "));
- msg_outtrans(to_file);
- msg_putchar('\n');
- freecon (from_context);
- return;
- }
- if (strcmp(from_context, to_context) != 0) {
- if (setfilecon((char *)to_file, from_context) < 0) {
- MSG_PUTS(_("\nCould not set security context for "));
- msg_outtrans(to_file);
- msg_putchar('\n');
- }
- }
- freecon(to_context);
- freecon(from_context);
- }
-}
-#endif // HAVE_SELINUX
-
// Return a pointer to the ACL of file "fname" in allocated memory.
// Return NULL if the ACL is not available for whatever reason.
vim_acl_T mch_get_acl(const char_u *fname)
diff --git a/src/nvim/undo.c b/src/nvim/undo.c
index 10996d99d5..2cc3e928f7 100644
--- a/src/nvim/undo.c
+++ b/src/nvim/undo.c
@@ -1169,10 +1169,6 @@ void u_write_undo(const char *const name, const bool forceit, buf_T *const buf,
&& os_fchown(fd, (uv_uid_t)-1, (uv_gid_t)file_info_old.stat.st_gid)) {
os_setperm(file_name, (perm & 0707) | ((perm & 07) << 3));
}
-# ifdef HAVE_SELINUX
- if (buf->b_ffname != NULL)
- mch_copy_sec(buf->b_ffname, file_name);
-# endif
#endif
fp = fdopen(fd, "w");