aboutsummaryrefslogtreecommitdiff
path: root/sub/busybox/bbsuid-footer
diff options
context:
space:
mode:
Diffstat (limited to 'sub/busybox/bbsuid-footer')
-rw-r--r--sub/busybox/bbsuid-footer21
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") ;
+}