|
Lines 35-41
Link Here
|
| 35 |
|
35 |
|
| 36 |
#ifdef WITH_SELINUX |
36 |
#ifdef WITH_SELINUX |
| 37 |
#include <selinux/selinux.h> |
37 |
#include <selinux/selinux.h> |
| 38 |
#include <selinux/flask.h> |
|
|
| 39 |
#include <selinux/get_context_list.h> |
38 |
#include <selinux/get_context_list.h> |
| 40 |
|
39 |
|
| 41 |
#ifndef SSH_SELINUX_UNCONFINED_TYPE |
40 |
#ifndef SSH_SELINUX_UNCONFINED_TYPE |
|
Lines 141-146
ssh_selinux_setup_pty(char *pwname, const char *tty)
Link Here
|
| 141 |
security_context_t new_tty_ctx = NULL; |
140 |
security_context_t new_tty_ctx = NULL; |
| 142 |
security_context_t user_ctx = NULL; |
141 |
security_context_t user_ctx = NULL; |
| 143 |
security_context_t old_tty_ctx = NULL; |
142 |
security_context_t old_tty_ctx = NULL; |
|
|
143 |
security_class_t class; |
| 144 |
|
144 |
|
| 145 |
if (!ssh_selinux_enabled()) |
145 |
if (!ssh_selinux_enabled()) |
| 146 |
return; |
146 |
return; |
|
Lines 156-163
ssh_selinux_setup_pty(char *pwname, const char *tty)
Link Here
|
| 156 |
goto out; |
156 |
goto out; |
| 157 |
} |
157 |
} |
| 158 |
|
158 |
|
|
|
159 |
class = string_to_security_class("chr_file"); |
| 160 |
if (!class) { |
| 161 |
error("string_to_security_class failed to translate security class context"); |
| 162 |
goto out; |
| 163 |
} |
| 159 |
if (security_compute_relabel(user_ctx, old_tty_ctx, |
164 |
if (security_compute_relabel(user_ctx, old_tty_ctx, |
| 160 |
SECCLASS_CHR_FILE, &new_tty_ctx) != 0) { |
165 |
class, &new_tty_ctx) != 0) { |
| 161 |
error("%s: security_compute_relabel: %s", |
166 |
error("%s: security_compute_relabel: %s", |
| 162 |
__func__, strerror(errno)); |
167 |
__func__, strerror(errno)); |
| 163 |
goto out; |
168 |
goto out; |
|
Lines 210-216
ssh_selinux_change_context(const char *newname)
Link Here
|
| 210 |
strlcpy(newctx + len, newname, newlen - len); |
215 |
strlcpy(newctx + len, newname, newlen - len); |
| 211 |
if ((cx = index(cx + 1, ':'))) |
216 |
if ((cx = index(cx + 1, ':'))) |
| 212 |
strlcat(newctx, cx, newlen); |
217 |
strlcat(newctx, cx, newlen); |
| 213 |
debug3("%s: setting context from '%s' to '%s'", __func__, |
218 |
debug("%s: setting context from '%s' to '%s'", __func__, |
| 214 |
oldctx, newctx); |
219 |
oldctx, newctx); |
| 215 |
if (setcon(newctx) < 0) |
220 |
if (setcon(newctx) < 0) |
| 216 |
switchlog("%s: setcon %s from %s failed with %s", __func__, |
221 |
switchlog("%s: setcon %s from %s failed with %s", __func__, |
| 217 |
- |
|
|
| 218 |
-- |
| 219 |
openbsd-compat/port-linux.c | 22 ++++++++++++++++++++++ |
222 |
openbsd-compat/port-linux.c | 22 ++++++++++++++++++++++ |
| 220 |
openbsd-compat/port-linux.h | 2 ++ |
223 |
openbsd-compat/port-linux.h | 2 ++ |
| 221 |
session.c | 18 ++++++++++-------- |
224 |
session.c | 18 ++++++++++-------- |
| 222 |
3 files changed, 34 insertions(+), 8 deletions(-) |
225 |
3 files changed, 34 insertions(+), 8 deletions(-) |