diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2017-05-22 21:56:04 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2017-05-22 21:56:04 +0000 |
commit | 82d0f92ab8b84466ae20ab919c1f9c3577b5cecb (patch) | |
tree | 776015ae6c6a386125b2d39e13b62f91b99548f8 /sub/busybox/bbsuid-footer | |
download | lh-bootstrap-82d0f92ab8b84466ae20ab919c1f9c3577b5cecb.tar.xz |
Initial commit
Diffstat (limited to 'sub/busybox/bbsuid-footer')
-rw-r--r-- | sub/busybox/bbsuid-footer | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/sub/busybox/bbsuid-footer b/sub/busybox/bbsuid-footer new file mode 100644 index 0000000..699c6f8 --- /dev/null +++ b/sub/busybox/bbsuid-footer @@ -0,0 +1,21 @@ +} ; + +static int okay (char const *s) +{ + register char const **p = list ; + for (; *p ; p++) if (!str_diff(s, *p)) return 1 ; + return 0 ; +} + +int main (int argc, char const *const *argv, char const *const *envp) +{ + stralloc sa = STRALLOC_ZERO ; + PROG = "busybox-setuid" ; + if (!sabasename(&sa, argv[0], str_len(argv[0]))) + strerr_diefu2sys(111, "sabasename", argv[0]) ; + if (!stralloc_0(&sa)) strerr_diefu1sys(111, "stralloc_0") ; + if (!okay(sa.s)) strerr_dief2x(100, sa.s, " is not granted root privileges") ; + stralloc_free(&sa) ; + execve("/bin/busybox", (char *const *)argv, (char *const *)envp) ; + strerr_dieexec(111, "/bin/busybox") ; +} |