Skip to content

Commit

Permalink
- (djm) [openbsd-compat/port-linux.c] Check whether SELinux is enabled
Browse files Browse the repository at this point in the history
   before attempting setfscreatecon(). Check whether matchpathcon()
   succeeded before using its result. Patch from cjwatson AT debian.org;
   bz#1851
  • Loading branch information
djmdjm committed Jan 27, 2011
1 parent 648f876 commit d4a5504
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
20110128
- (djm) [openbsd-compat/port-linux.c] Check whether SELinux is enabled
before attempting setfscreatecon(). Check whether matchpathcon()
succeeded before using its result. Patch from cjwatson AT debian.org;
bz#1851

20110127
- (tim) [config.guess config.sub] Sync with upstream.
- (tim) [configure.ac] Consistent M4 quoting throughout, updated obsolete
Expand Down
16 changes: 9 additions & 7 deletions openbsd-compat/port-linux.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $Id: port-linux.c,v 1.12 2011/01/25 01:16:18 djm Exp $ */
/* $Id: port-linux.c,v 1.13 2011/01/27 23:30:20 djm Exp $ */

/*
* Copyright (c) 2005 Daniel Walsh <[email protected]>
Expand Down Expand Up @@ -209,13 +209,15 @@ ssh_selinux_change_context(const char *newname)
void
ssh_selinux_setfscreatecon(const char *path)
{
security_context_t context;
security_context_t context;

if (path == NULL) {
setfscreatecon(NULL);
return;
}
matchpathcon(path, 0700, &context);
if (!ssh_selinux_enabled())
return;
if (path == NULL)
setfscreatecon(NULL);
return;
}
if (matchpathcon(path, 0700, &context) == 0)
setfscreatecon(context);
}

Expand Down

0 comments on commit d4a5504

Please sign in to comment.