dissect-image: make dissected_image_acquire_metadata() operate within a userns if possible

This opens the door for making the call work without privileges: if we
pass in a userns fd and DissectedImage that has mount fds then we can
acquire all information without privs.
This commit is contained in:
Lennart Poettering
2024-04-06 16:08:23 +02:00
parent 77740bddbe
commit 44e3097dff
4 changed files with 21 additions and 6 deletions
+1 -1
View File
@@ -875,7 +875,7 @@ static int action_dissect(DissectedImage *m, LoopDevice *d) {
fflush(stdout);
}
r = dissected_image_acquire_metadata(m, 0);
r = dissected_image_acquire_metadata(m, /* userns_fd= */ -EBADF, /* extra_flags= */ 0);
if (r == -ENXIO)
return log_error_errno(r, "No root partition discovered.");
if (r == -EUCLEAN)