1 changed files with 36 additions and 0 deletions
@ -0,0 +1,36 @@
|
||||
|
||||
#include <stdio.h> |
||||
#include <stdlib.h> |
||||
#include <string.h> |
||||
#include <unistd.h> |
||||
|
||||
#define ACMETOOL_BINDIR "@l_prefix@/bin" |
||||
#define ACMETOOL_SBINDIR "@l_prefix@/sbin" |
||||
#define ACMETOOL_BIN "@l_prefix@/libexec/acmetool/acmetool" |
||||
|
||||
int main(int argn, char **argv) |
||||
{ |
||||
static char *env[] = { |
||||
"PATH=/bin:/usr/bin:/sbin:/usr/sbin:" ACMETOOL_BINDIR ":" ACMETOOL_SBINDIR, |
||||
NULL, |
||||
NULL |
||||
}; |
||||
if (setuid(geteuid()) == -1) { |
||||
perror("setuid"); |
||||
exit(1); |
||||
} |
||||
if (setgid(getegid()) == -1) { |
||||
perror("setgid"); |
||||
exit(1); |
||||
} |
||||
char *term; |
||||
if ((term = getenv("TERM")) == NULL) |
||||
term = "vt100"; |
||||
env[1] = malloc(strlen("TERM=") + strlen(term) + 1); |
||||
strcpy(env[1], term); |
||||
argv[0] = ACMETOOL_BIN; |
||||
if (execve(argv[0], argv, env) == -1) |
||||
abort(); |
||||
return 0; |
||||
} |
||||
|
Loading…
Reference in new issue