chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
61b1477
)
mount-setup: don't complain if we try to fix the label of a dir beneath a mount but...
author
Lennart Poettering
<lennart@poettering.net>
Tue, 3 Jul 2012 14:25:50 +0000
(16:25 +0200)
committer
Lennart Poettering
<lennart@poettering.net>
Tue, 3 Jul 2012 14:25:50 +0000
(16:25 +0200)
src/core/automount.c
patch
|
blob
|
history
src/core/mount-setup.c
patch
|
blob
|
history
src/shared/label.c
patch
|
blob
|
history
src/shared/label.h
patch
|
blob
|
history
src/tmpfiles/tmpfiles.c
patch
|
blob
|
history
src/udev/udev-node.c
patch
|
blob
|
history
diff --git
a/src/core/automount.c
b/src/core/automount.c
index 64b6cff72ed39bc69cbb2e8af5e76a78108b8223..697dfa1548cb31e2b601fef57ba1a7dd79b7bfb7 100644
(file)
--- a/
src/core/automount.c
+++ b/
src/core/automount.c
@@
-314,7
+314,7
@@
static int open_dev_autofs(Manager *m) {
if (m->dev_autofs_fd >= 0)
return m->dev_autofs_fd;
if (m->dev_autofs_fd >= 0)
return m->dev_autofs_fd;
- label_fix("/dev/autofs", false);
+ label_fix("/dev/autofs", false
, false
);
if ((m->dev_autofs_fd = open("/dev/autofs", O_CLOEXEC|O_RDONLY)) < 0) {
log_error("Failed to open /dev/autofs: %s", strerror(errno));
if ((m->dev_autofs_fd = open("/dev/autofs", O_CLOEXEC|O_RDONLY)) < 0) {
log_error("Failed to open /dev/autofs: %s", strerror(errno));
diff --git
a/src/core/mount-setup.c
b/src/core/mount-setup.c
index cdbee1440827f99dcd0adc393f9bde773ffbbd4a..07794df049adb65da3c8fe6e8c7add99973ac408 100644
(file)
--- a/
src/core/mount-setup.c
+++ b/
src/core/mount-setup.c
@@
-121,7
+121,7
@@
static int mount_one(const MountPoint *p, bool relabel) {
/* Relabel first, just in case */
if (relabel)
/* Relabel first, just in case */
if (relabel)
- label_fix(p->where, true);
+ label_fix(p->where, true
, true
);
if ((r = path_is_mount_point(p->where, true)) < 0)
return r;
if ((r = path_is_mount_point(p->where, true)) < 0)
return r;
@@
-150,7
+150,7
@@
static int mount_one(const MountPoint *p, bool relabel) {
/* Relabel again, since we now mounted something fresh here */
if (relabel)
/* Relabel again, since we now mounted something fresh here */
if (relabel)
- label_fix(p->where, false);
+ label_fix(p->where, false
, false
);
return 1;
}
return 1;
}
@@
-347,7
+347,7
@@
static int nftw_cb(
if (_unlikely_(ftwbuf->level == 0))
return FTW_CONTINUE;
if (_unlikely_(ftwbuf->level == 0))
return FTW_CONTINUE;
- label_fix(fpath,
tru
e);
+ label_fix(fpath,
false, fals
e);
/* /run/initramfs is static data and big, no need to
* dynamically relabel its contents at boot... */
/* /run/initramfs is static data and big, no need to
* dynamically relabel its contents at boot... */
@@
-391,7
+391,7
@@
int mount_setup(bool loaded_policy) {
/* Explicitly relabel these */
NULSTR_FOREACH(j, relabel)
/* Explicitly relabel these */
NULSTR_FOREACH(j, relabel)
- label_fix(j, true);
+ label_fix(j, true
, false
);
after_relabel = now(CLOCK_MONOTONIC);
after_relabel = now(CLOCK_MONOTONIC);
diff --git
a/src/shared/label.c
b/src/shared/label.c
index 9a5f79d7aef91d928d448557fc5a55bb15443006..7aa362106e39871077a6d1e6c47d27e41bd2bf17 100644
(file)
--- a/
src/shared/label.c
+++ b/
src/shared/label.c
@@
-99,7
+99,7
@@
int label_init(const char *prefix) {
return r;
}
return r;
}
-int label_fix(const char *path, bool ignore_enoent) {
+int label_fix(const char *path, bool ignore_enoent
, bool ignore_erofs
) {
int r = 0;
#ifdef HAVE_SELINUX
int r = 0;
#ifdef HAVE_SELINUX
@@
-132,6
+132,9
@@
int label_fix(const char *path, bool ignore_enoent) {
if (ignore_enoent && errno == ENOENT)
return 0;
if (ignore_enoent && errno == ENOENT)
return 0;
+ if (ignore_erofs && errno == EROFS)
+ return 0;
+
log_full(security_getenforce() == 1 ? LOG_ERR : LOG_DEBUG,
"Unable to fix label of %s: %m", path);
r = security_getenforce() == 1 ? -errno : 0;
log_full(security_getenforce() == 1 ? LOG_ERR : LOG_DEBUG,
"Unable to fix label of %s: %m", path);
r = security_getenforce() == 1 ? -errno : 0;
diff --git
a/src/shared/label.h
b/src/shared/label.h
index 4f404b2f206bd4303e1ea60846dee8bd68fa3f89..8d832f9a598c38849425dc2da331c7d0c4d6a9ad 100644
(file)
--- a/
src/shared/label.h
+++ b/
src/shared/label.h
@@
-29,7
+29,7
@@
int label_init(const char *prefix);
void label_finish(void);
int label_init(const char *prefix);
void label_finish(void);
-int label_fix(const char *path, bool ignore_enoent);
+int label_fix(const char *path, bool ignore_enoent
, bool ignore_erofs
);
int label_socket_set(const char *label);
void label_socket_clear(void);
int label_socket_set(const char *label);
void label_socket_clear(void);
diff --git
a/src/tmpfiles/tmpfiles.c
b/src/tmpfiles/tmpfiles.c
index dfe3daa7f72fc01abb6854c01d00702359b07526..e0b0e94664622306fd95fda4432d52ca68735c15 100644
(file)
--- a/
src/tmpfiles/tmpfiles.c
+++ b/
src/tmpfiles/tmpfiles.c
@@
-469,7
+469,7
@@
static int item_set_perms(Item *i, const char *path) {
return -errno;
}
return -errno;
}
- return label_fix(path, false);
+ return label_fix(path, false
, false
);
}
static int recursive_relabel_children(Item *i, const char *path) {
}
static int recursive_relabel_children(Item *i, const char *path) {
diff --git
a/src/udev/udev-node.c
b/src/udev/udev-node.c
index aee84a92f1cd4984a87aa5f10fea8dfdccd9101e..1bef5212e6c136e289f00249bfec3b2966d9b252 100644
(file)
--- a/
src/udev/udev-node.c
+++ b/
src/udev/udev-node.c
@@
-91,7
+91,7
@@
static int node_symlink(struct udev *udev, const char *node, const char *slink)
buf[len] = '\0';
if (strcmp(target, buf) == 0) {
log_debug("preserve already existing symlink '%s' to '%s'\n", slink, target);
buf[len] = '\0';
if (strcmp(target, buf) == 0) {
log_debug("preserve already existing symlink '%s' to '%s'\n", slink, target);
- label_fix(slink, true);
+ label_fix(slink, true
, false
);
utimensat(AT_FDCWD, slink, NULL, AT_SYMLINK_NOFOLLOW);
goto exit;
}
utimensat(AT_FDCWD, slink, NULL, AT_SYMLINK_NOFOLLOW);
goto exit;
}
@@
-307,7
+307,7
@@
static int node_fixup(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid
* something else has set a custom context in the meantime.
*/
if (strcmp(udev_device_get_action(dev), "add") == 0)
* something else has set a custom context in the meantime.
*/
if (strcmp(udev_device_get_action(dev), "add") == 0)
-
label_fix(devnode, tru
e);
+
label_fix(devnode, true, fals
e);
/* always update timestamp when we re-use the node, like on media change events */
utimensat(AT_FDCWD, devnode, NULL, 0);
/* always update timestamp when we re-use the node, like on media change events */
utimensat(AT_FDCWD, devnode, NULL, 0);