old_libs="$LIBS"
if test "$with_selinux" = "check"; then
AC_CHECK_HEADER([selinux/selinux.h],[],[with_selinux=no])
- AC_CHECK_LIB([selinux], [fgetfilecon],[],[with_selinux=no])
+ AC_CHECK_LIB([selinux], [fgetfilecon_raw],[],[with_selinux=no])
if test "$with_selinux" != "no"; then
with_selinux="yes"
fi
else
fail=0
AC_CHECK_HEADER([selinux/selinux.h],[],[fail=1])
- AC_CHECK_LIB([selinux], [fgetfilecon],[],[fail=1])
+ AC_CHECK_LIB([selinux], [fgetfilecon_raw],[],[fail=1])
test $fail = 1 &&
AC_MSG_ERROR([You must install the libselinux development package in order to compile libvirt with basic SELinux support])
fi
char *sens, *cat, *tmp;
int catMin, catMax, catRange;
- if (getcon(&ourSecContext) < 0) {
+ if (getcon_raw(&ourSecContext) < 0) {
virReportSystemError(errno, "%s",
_("Unable to get current process SELinux context"));
goto cleanup;
VIR_DEBUG("basecontext=%s mcs=%s isObjectContext=%d",
basecontext, mcs, isObjectContext);
- if (getcon(&ourSecContext) < 0) {
+ if (getcon_raw(&ourSecContext) < 0) {
virReportSystemError(errno, "%s",
_("Unable to get current process SELinux context"));
goto cleanup;
if (seclabel->type == VIR_DOMAIN_SECLABEL_STATIC)
return 0;
- if (getpidcon(pid, &pctx) == -1) {
+ if (getpidcon_raw(pid, &pctx) == -1) {
virReportSystemError(errno,
_("unable to get PID %d security context"), pid);
return -1;
{
security_context_t ctx;
- if (getpidcon(pid, &ctx) == -1) {
+ if (getpidcon_raw(pid, &ctx) == -1) {
virReportSystemError(errno,
_("unable to get PID %d security context"),
pid);
VIR_INFO("Setting SELinux context on '%s' to '%s'", path, tcon);
- if (setfilecon(path, tcon) < 0) {
+ if (setfilecon_raw(path, tcon) < 0) {
int setfilecon_errno = errno;
- if (getfilecon(path, &econ) >= 0) {
+ if (getfilecon_raw(path, &econ) >= 0) {
if (STREQ(tcon, econ)) {
freecon(econ);
/* It's alright, there's nothing to change anyway. */
VIR_INFO("Setting SELinux context on fd %d to '%s'", fd, tcon);
- if (fsetfilecon(fd, tcon) < 0) {
+ if (fsetfilecon_raw(fd, tcon) < 0) {
int fsetfilecon_errno = errno;
- if (fgetfilecon(fd, &econ) >= 0) {
+ if (fgetfilecon_raw(fd, &econ) >= 0) {
if (STREQ(tcon, econ)) {
freecon(econ);
/* It's alright, there's nothing to change anyway. */
return -1;
}
- if (setexeccon(secdef->label) == -1) {
+ if (setexeccon_raw(secdef->label) == -1) {
virReportSystemError(errno,
_("unable to set security context '%s'"),
secdef->label);
goto done;
}
- if (getcon(&scon) == -1) {
+ if (getcon_raw(&scon) == -1) {
virReportSystemError(errno,
_("unable to get current process context '%s'"),
secdef->label);
VIR_DEBUG("Setting VM %s socket context %s",
def->name, context_str(proccon));
- if (setsockcreatecon(context_str(proccon)) == -1) {
+ if (setsockcreatecon_raw(context_str(proccon)) == -1) {
virReportSystemError(errno,
_("unable to set socket security context '%s'"),
context_str(proccon));
VIR_DEBUG("Setting VM %s socket context %s",
vm->name, secdef->label);
- if (setsockcreatecon(secdef->label) == -1) {
+ if (setsockcreatecon_raw(secdef->label) == -1) {
virReportSystemError(errno,
_("unable to set socket security context '%s'"),
secdef->label);
return -1;
}
- if (setsockcreatecon(NULL) == -1) {
+ if (setsockcreatecon_raw(NULL) == -1) {
virReportSystemError(errno,
_("unable to clear socket security context '%s'"),
secdef->label);