chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[2/5] Apply missing fixes from upstream
[elogind.git]
/
src
/
basic
/
selinux-util.c
diff --git
a/src/basic/selinux-util.c
b/src/basic/selinux-util.c
index 69885d9fc9b8456f19518171c7e93cbc18eaa6ec..239900b79560671e4c780ab5abefc8f8f6ae3f3b 100644
(file)
--- a/
src/basic/selinux-util.c
+++ b/
src/basic/selinux-util.c
@@
-57,11
+57,14
@@
bool mac_selinux_use(void) {
#endif
}
#endif
}
+/// UNNEEDED by elogind
+#if 0
void mac_selinux_retest(void) {
#ifdef HAVE_SELINUX
cached_use = -1;
#endif
}
void mac_selinux_retest(void) {
#ifdef HAVE_SELINUX
cached_use = -1;
#endif
}
+#endif // 0
int mac_selinux_init(const char *prefix) {
int r = 0;
int mac_selinux_init(const char *prefix) {
int r = 0;
@@
-109,6
+112,8
@@
int mac_selinux_init(const char *prefix) {
return r;
}
return r;
}
+/// UNNEEDED by elogind
+#if 0
void mac_selinux_finish(void) {
#ifdef HAVE_SELINUX
void mac_selinux_finish(void) {
#ifdef HAVE_SELINUX
@@
-119,6
+124,7
@@
void mac_selinux_finish(void) {
label_hnd = NULL;
#endif
}
label_hnd = NULL;
#endif
}
+#endif // 0
int mac_selinux_fix(const char *path, bool ignore_enoent, bool ignore_erofs) {
int mac_selinux_fix(const char *path, bool ignore_enoent, bool ignore_erofs) {
@@
-187,7
+193,6
@@
int mac_selinux_apply(const char *path, const char *label) {
#endif
return 0;
}
#endif
return 0;
}
-#endif // 0
int mac_selinux_get_create_label_from_exe(const char *exe, char **label) {
int r = -EOPNOTSUPP;
int mac_selinux_get_create_label_from_exe(const char *exe, char **label) {
int r = -EOPNOTSUPP;
@@
-202,11
+207,11
@@
int mac_selinux_get_create_label_from_exe(const char *exe, char **label) {
if (!mac_selinux_use())
return -EOPNOTSUPP;
if (!mac_selinux_use())
return -EOPNOTSUPP;
- r = getcon(&mycon);
+ r = getcon
_raw
(&mycon);
if (r < 0)
return -errno;
if (r < 0)
return -errno;
- r = getfilecon(exe, &fcon);
+ r = getfilecon
_raw
(exe, &fcon);
if (r < 0)
return -errno;
if (r < 0)
return -errno;
@@
-228,7
+233,7
@@
int mac_selinux_get_our_label(char **label) {
if (!mac_selinux_use())
return -EOPNOTSUPP;
if (!mac_selinux_use())
return -EOPNOTSUPP;
- r = getcon(label);
+ r = getcon
_raw
(label);
if (r < 0)
return -errno;
#endif
if (r < 0)
return -errno;
#endif
@@
-252,7
+257,7
@@
int mac_selinux_get_child_mls_label(int socket_fd, const char *exe, const char *
if (!mac_selinux_use())
return -EOPNOTSUPP;
if (!mac_selinux_use())
return -EOPNOTSUPP;
- r = getcon(&mycon);
+ r = getcon
_raw
(&mycon);
if (r < 0)
return -errno;
if (r < 0)
return -errno;
@@
-263,7
+268,7
@@
int mac_selinux_get_child_mls_label(int socket_fd, const char *exe, const char *
if (!exec_label) {
/* If there is no context set for next exec let's use context
of target executable */
if (!exec_label) {
/* If there is no context set for next exec let's use context
of target executable */
- r = getfilecon(exe, &fcon);
+ r = getfilecon
_raw
(exe, &fcon);
if (r < 0)
return -errno;
}
if (r < 0)
return -errno;
}
@@
-298,15
+303,22
@@
int mac_selinux_get_child_mls_label(int socket_fd, const char *exe, const char *
return r;
}
return r;
}
-
void
mac_selinux_free(char *label) {
+
char*
mac_selinux_free(char *label) {
#ifdef HAVE_SELINUX
#ifdef HAVE_SELINUX
+ if (!label)
+ return NULL;
+
if (!mac_selinux_use())
if (!mac_selinux_use())
- return;
+ return NULL;
+
freecon((security_context_t) label);
#endif
freecon((security_context_t) label);
#endif
+
+ return NULL;
}
}
+#endif // 0
int mac_selinux_create_file_prepare(const char *path, mode_t mode) {
int r = 0;
int mac_selinux_create_file_prepare(const char *path, mode_t mode) {
int r = 0;
@@
-364,6
+376,8
@@
void mac_selinux_create_file_clear(void) {
#endif
}
#endif
}
+/// UNNEEDED by elogind
+#if 0
int mac_selinux_create_socket_prepare(const char *label) {
#ifdef HAVE_SELINUX
int mac_selinux_create_socket_prepare(const char *label) {
#ifdef HAVE_SELINUX
@@
-463,3
+477,4
@@
skipped:
#endif
return bind(fd, addr, addrlen) < 0 ? -errno : 0;
}
#endif
return bind(fd, addr, addrlen) < 0 ? -errno : 0;
}
+#endif // 0