You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
846 B
37 lines
846 B
9 years ago
|
|
||
|
#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;
|
||
|
}
|
||
|
|