summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorParabola automatic package builder <dev@lists.parabolagnulinux.org>2014-06-24 00:37:53 +0000
committerParabola automatic package builder <dev@lists.parabolagnulinux.org>2014-06-24 00:37:53 +0000
commite3fd2af1face4f45efb8122ef3f90d74e3e5c8bb (patch)
tree92ea02230998d9e094708c24647ad64ff25a7012
parent1e846357687b46ff02e159af8b7da974cd647303 (diff)
Do no input validation in autobuild.c, pass that on to the shell script
-rw-r--r--bin/autobuild.c19
1 files 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 <lukeshu@sbcglobal.net>
*
* This program is free software; you can redistribute it and/or modify
@@ -19,17 +20,9 @@
#include <errno.h> /* for errno */
#include <error.h> /* for error(3) */
#include <pwd.h> /* for getpwuid(3) */
-#include <stdio.h> /* for printf(3) */
#include <stdlib.h> /* for environment functions */
#include <string.h> /* for strlen(3), strcpy(3) */
-#include <unistd.h> /* 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 <unistd.h> /* 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);
}