}
static int log_unsafe_transition(int a, int b, const char *path, unsigned flags) {
- _cleanup_free_ char *n1 = NULL, *n2 = NULL;
+ _cleanup_free_ char *n1 = NULL, *n2 = NULL, *user_a = NULL, *user_b = NULL;
+ struct stat st;
if (!FLAGS_SET(flags, CHASE_WARN))
return -ENOLINK;
(void) fd_get_path(a, &n1);
(void) fd_get_path(b, &n2);
+ if (fstat(a, &st) == 0)
+ user_a = uid_to_name(st.st_uid);
+ if (fstat(b, &st) == 0)
+ user_b = uid_to_name(st.st_uid);
+
return log_warning_errno(SYNTHETIC_ERRNO(ENOLINK),
- "Detected unsafe path transition %s %s %s during canonicalization of %s.",
- strna(n1), special_glyph(SPECIAL_GLYPH_ARROW), strna(n2), path);
+ "Detected unsafe path transition %s (owned by %s) %s %s (owned by %s) during canonicalization of %s.",
+ strna(n1), strna(user_a), special_glyph(SPECIAL_GLYPH_ARROW), strna(n2), strna(user_b), path);
}
static int log_autofs_mount_point(int fd, const char *path, unsigned flags) {