e7ca5f820d6a1a8fe549a2966ac707a60e055ef4Timo Sirainen Copyright (C) Jakub Hrozek <jhrozek@redhat.com> 2010
02a54da28f376dd66d7939d8546a196a0045b486Timo Sirainen This program is free software; you can redistribute it and/or modify
7fb70daba4e571eab5b64f496d20b9e37e31141bTimo Sirainen it under the terms of the GNU General Public License as published by
7fb70daba4e571eab5b64f496d20b9e37e31141bTimo Sirainen the Free Software Foundation; either version 3 of the License, or
7fb70daba4e571eab5b64f496d20b9e37e31141bTimo Sirainen (at your option) any later version.
7fb70daba4e571eab5b64f496d20b9e37e31141bTimo Sirainen This program is distributed in the hope that it will be useful,
7fb70daba4e571eab5b64f496d20b9e37e31141bTimo Sirainen but WITHOUT ANY WARRANTY; without even the implied warranty of
7fb70daba4e571eab5b64f496d20b9e37e31141bTimo Sirainen MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7fb70daba4e571eab5b64f496d20b9e37e31141bTimo Sirainen GNU General Public License for more details.
7fb70daba4e571eab5b64f496d20b9e37e31141bTimo Sirainen You should have received a copy of the GNU General Public License
7fb70daba4e571eab5b64f496d20b9e37e31141bTimo Sirainen along with this program. If not, see <http://www.gnu.org/licenses/>.
7fb70daba4e571eab5b64f496d20b9e37e31141bTimo Sirainen * selinux_file_context - Set the security context before any file or
eb4d4f557fa75aa2a47639e9deb75a21f44eb42aTimo Sirainen * directory creation.
eb4d4f557fa75aa2a47639e9deb75a21f44eb42aTimo Sirainen * selinux_file_context () should be called before any creation of file,
2f122b4db3f0d4eeb59ff9d306e54b2009d72cf9Timo Sirainen * symlink, directory, ...
7fb70daba4e571eab5b64f496d20b9e37e31141bTimo Sirainen * Callers may have to Reset SELinux to create files with default
7fb70daba4e571eab5b64f496d20b9e37e31141bTimo Sirainen * reset_selinux_file_context();
2f122b4db3f0d4eeb59ff9d306e54b2009d72cf9Timo Sirainen /* Get the default security context for this file */
2f122b4db3f0d4eeb59ff9d306e54b2009d72cf9Timo Sirainen if (matchpathcon(dst_name, 0, &scontext) < 0) {
7fb70daba4e571eab5b64f496d20b9e37e31141bTimo Sirainen /* Set the security context for the next created file */
7fb70daba4e571eab5b64f496d20b9e37e31141bTimo Sirainen#else /* HAVE_SELINUX */
2f122b4db3f0d4eeb59ff9d306e54b2009d72cf9Timo Sirainen#endif /* HAVE_SELINUX */