summaryrefslogtreecommitdiff
path: root/udev/udev_node.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2008-09-10 00:46:17 +0200
committerKay Sievers <kay.sievers@vrfy.org>2008-09-10 00:46:17 +0200
commit4f4b12c20388ff2cb158b040e3193f86cf7a3b96 (patch)
tree41449172690d16f6deba140d174343478f806d23 /udev/udev_node.c
parent6b12bdb62460a0bdc08d5e020a64c18bc1672bb1 (diff)
libudev: add selinux
Diffstat (limited to 'udev/udev_node.c')
-rw-r--r--udev/udev_node.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/udev/udev_node.c b/udev/udev_node.c
index 462f1b633b..079bb4e3b1 100644
--- a/udev/udev_node.c
+++ b/udev/udev_node.c
@@ -31,7 +31,6 @@
#include "udev.h"
#include "udev_rules.h"
-#include "udev_selinux.h"
#define TMP_FILE_EXT ".udev-tmp"
@@ -51,15 +50,15 @@ int udev_node_mknod(struct udevice *udevice, const char *file, dev_t devt, mode_
if (((stats.st_mode & S_IFMT) == (mode & S_IFMT)) && (stats.st_rdev == devt)) {
info(udevice->udev, "preserve file '%s', because it has correct dev_t\n", file);
preserve = 1;
- selinux_setfilecon(udevice->udev, file, udevice->dev->kernel, mode);
+ udev_selinux_lsetfilecon(udevice->udev, file, mode);
} else {
info(udevice->udev, "atomically replace existing file '%s'\n", file);
strlcpy(file_tmp, file, sizeof(file_tmp));
strlcat(file_tmp, TMP_FILE_EXT, sizeof(file_tmp));
unlink(file_tmp);
- selinux_setfscreatecon(udevice->udev, file_tmp, udevice->dev->kernel, mode);
+ udev_selinux_setfscreatecon(udevice->udev, file_tmp, mode);
err = mknod(file_tmp, mode, devt);
- selinux_resetfscreatecon(udevice->udev);
+ udev_selinux_resetfscreatecon(udevice->udev);
if (err != 0) {
err(udevice->udev, "mknod(%s, %#o, %u, %u) failed: %s\n",
file_tmp, mode, major(devt), minor(devt), strerror(errno));
@@ -73,9 +72,9 @@ int udev_node_mknod(struct udevice *udevice, const char *file, dev_t devt, mode_
}
} else {
info(udevice->udev, "mknod(%s, %#o, (%u,%u))\n", file, mode, major(devt), minor(devt));
- selinux_setfscreatecon(udevice->udev, file, udevice->dev->kernel, mode);
+ udev_selinux_setfscreatecon(udevice->udev, file, mode);
err = mknod(file, mode, devt);
- selinux_resetfscreatecon(udevice->udev);
+ udev_selinux_resetfscreatecon(udevice->udev);
if (err != 0) {
err(udevice->udev, "mknod(%s, %#o, (%u,%u) failed: %s\n",
file, mode, major(devt), minor(devt), strerror(errno));
@@ -151,16 +150,16 @@ static int node_symlink(struct udevice *udevice, const char *node, const char *s
buf[len] = '\0';
if (strcmp(target, buf) == 0) {
info(udevice->udev, "preserve already existing symlink '%s' to '%s'\n", slink, target);
- selinux_setfilecon(udevice->udev, slink, NULL, S_IFLNK);
+ udev_selinux_lsetfilecon(udevice->udev, slink, S_IFLNK);
goto exit;
}
}
}
} else {
info(udevice->udev, "creating symlink '%s' to '%s'\n", slink, target);
- selinux_setfscreatecon(udevice->udev, slink, NULL, S_IFLNK);
+ udev_selinux_setfscreatecon(udevice->udev, slink, S_IFLNK);
retval = symlink(target, slink);
- selinux_resetfscreatecon(udevice->udev);
+ udev_selinux_resetfscreatecon(udevice->udev);
if (retval == 0)
goto exit;
}
@@ -169,9 +168,9 @@ static int node_symlink(struct udevice *udevice, const char *node, const char *s
strlcpy(slink_tmp, slink, sizeof(slink_tmp));
strlcat(slink_tmp, TMP_FILE_EXT, sizeof(slink_tmp));
unlink(slink_tmp);
- selinux_setfscreatecon(udevice->udev, slink, NULL, S_IFLNK);
+ udev_selinux_setfscreatecon(udevice->udev, slink, S_IFLNK);
retval = symlink(target, slink_tmp);
- selinux_resetfscreatecon(udevice->udev);
+ udev_selinux_resetfscreatecon(udevice->udev);
if (retval != 0) {
err(udevice->udev, "symlink(%s, %s) failed: %s\n", target, slink_tmp, strerror(errno));
goto exit;