From e3fd2af1face4f45efb8122ef3f90d74e3e5c8bb Mon Sep 17 00:00:00 2001 From: Parabola automatic package builder Date: Tue, 24 Jun 2014 00:37:53 +0000 Subject: Do no input validation in autobuild.c, pass that on to the shell script --- bin/autobuild.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/bin/autobuild.c b/bin/autobuild.c index 07e84e9..bb0de00 100644 --- a/bin/autobuild.c +++ b/bin/autobuild.c @@ -1,3 +1,4 @@ +/* Just a "stupid", secure SUID wrapper around autobuild.sh */ /* Copyright (C) 2014 Luke Shumaker * * This program is free software; you can redistribute it and/or modify @@ -19,17 +20,9 @@ #include /* for errno */ #include /* for error(3) */ #include /* for getpwuid(3) */ -#include /* for printf(3) */ #include /* for environment functions */ #include /* for strlen(3), strcpy(3) */ -#include /* for dup2(3), geteuid(3), execl(3) */ - -void -usage(const char *cmd) -{ - printf("Usage: %s PACKAGE\n", cmd); - printf("This command should be run from the git directory of the package source.\n"); -} +#include /* for geteuid(3), execv(3) */ void mysetenv(const char *name, const char *value) @@ -44,12 +37,6 @@ mysetenv(const char *name, const char *value) int main(int argc, char **argv) { - if (argc != 2) { - dup2(2,1); - usage(argv[0]); - return 1; - } - struct passwd *user = getpwuid(geteuid()); setreuid(geteuid(), -1); @@ -81,6 +68,6 @@ main(int argc, char **argv) strcpy(script, user->pw_dir); strcpy(&(script[strlen(user->pw_dir)]), script_suffix); - execl(script, script, argv[1], NULL); + execv(script, argv); error(127, errno, "%s", script); } -- cgit v1.2.2