updated .gitignore and main.c
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Make (push) Successful in 5s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-CMake (push) Successful in 10s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Meson (push) Successful in 8s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Make (push) Successful in 5s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-CMake (push) Successful in 10s
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Meson (push) Successful in 8s
This commit is contained in:
@@ -4,3 +4,5 @@ sudo.pkg
|
||||
sudo.pkg.gz
|
||||
build
|
||||
.cache
|
||||
*.o
|
||||
sudo
|
||||
|
||||
+3
-6
@@ -16,17 +16,14 @@ void die(char *argv0, char *obj, char *msg) {
|
||||
int main(int argc, char *argv[]) {
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
// char *endp;
|
||||
/* Command line parsing */
|
||||
if (argc <= 1) {
|
||||
fprintf(stderr, "Usage: %s COMMAND [ARG...]\n",
|
||||
argv[0]==NULL ? "sugexec" : argv[0]);
|
||||
exit(127);
|
||||
}
|
||||
uid = 0;//strtoul(argv[1], &endp, 0);
|
||||
// if (*endp) die(argv[0], argv[1], "Bad uid");
|
||||
gid = 0;//strtoul(argv[2], &endp, 0);
|
||||
// if (*endp) die(argv[0], argv[2], "Bad gid");
|
||||
uid = 0;
|
||||
gid = 0;
|
||||
/* Drop to specified user and group */
|
||||
if (setgid(gid)) die(argv[0], "setgid", NULL);
|
||||
if (setgroups(0, NULL)) die(argv[0], "setgroups", NULL);
|
||||
@@ -34,4 +31,4 @@ int main(int argc, char *argv[]) {
|
||||
/* Execute the command */
|
||||
execvp(argv[1], argv+1);
|
||||
die(argv[0], argv[1], NULL);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user