diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-11-09 16:06:33 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-11-09 16:06:33 +0100 |
commit | 1b510900e24459353922a1bc83c0b58bc8bafe1c (patch) | |
tree | 191b7ef59be2b29ffa44b0a1a08f27acbad22a90 | |
parent | b5a0d9d8673f8c84c0135fbc6227680ee874d261 (diff) | |
download | busybox-w32-1b510900e24459353922a1bc83c0b58bc8bafe1c.tar.gz busybox-w32-1b510900e24459353922a1bc83c0b58bc8bafe1c.tar.bz2 busybox-w32-1b510900e24459353922a1bc83c0b58bc8bafe1c.zip |
unshare: -r should map root to user, not the other way around
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | util-linux/unshare.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/util-linux/unshare.c b/util-linux/unshare.c index a4bbb8c9e..7c295da1f 100644 --- a/util-linux/unshare.c +++ b/util-linux/unshare.c | |||
@@ -339,7 +339,7 @@ int unshare_main(int argc UNUSED_PARAM, char **argv) | |||
339 | } | 339 | } |
340 | 340 | ||
341 | if (opts & OPT_map_root) { | 341 | if (opts & OPT_map_root) { |
342 | char uidmap_buf[sizeof("%u 0 1") + sizeof(int)*3]; | 342 | char uidmap_buf[sizeof("0 %u 1") + sizeof(int)*3]; |
343 | 343 | ||
344 | /* | 344 | /* |
345 | * Since Linux 3.19 unprivileged writing of /proc/self/gid_map | 345 | * Since Linux 3.19 unprivileged writing of /proc/self/gid_map |
@@ -348,9 +348,9 @@ int unshare_main(int argc UNUSED_PARAM, char **argv) | |||
348 | * in that user namespace. | 348 | * in that user namespace. |
349 | */ | 349 | */ |
350 | xopen_xwrite_close(PATH_PROC_SETGROUPS, "deny"); | 350 | xopen_xwrite_close(PATH_PROC_SETGROUPS, "deny"); |
351 | sprintf(uidmap_buf, "%u 0 1", (unsigned)reuid); | 351 | sprintf(uidmap_buf, "0 %u 1", (unsigned)reuid); |
352 | xopen_xwrite_close(PATH_PROC_UIDMAP, uidmap_buf); | 352 | xopen_xwrite_close(PATH_PROC_UIDMAP, uidmap_buf); |
353 | sprintf(uidmap_buf, "%u 0 1", (unsigned)regid); | 353 | sprintf(uidmap_buf, "0 %u 1", (unsigned)regid); |
354 | xopen_xwrite_close(PATH_PROC_GIDMAP, uidmap_buf); | 354 | xopen_xwrite_close(PATH_PROC_GIDMAP, uidmap_buf); |
355 | } else | 355 | } else |
356 | if (setgrp_str) { | 356 | if (setgrp_str) { |