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.
 
 
 
 
 
 

30 lines
652 B

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define COS_BINDIR "@l_prefix@/bin"
#define COS_SBINDIR "@l_prefix@/bin"
#define COS_BIN "@l_prefix@/libexec/consul/consul-openpkg-service.sh"
int main(int argn, char **argv)
{
static char *env[] = {
"PATH=/bin:/usr/bin:/sbin:/usr/sbin:" COS_BINDIR ":" COS_SBINDIR,
NULL
};
if (setuid(geteuid()) == -1) {
perror("setuid");
exit(1);
}
if (setgid(getegid()) == -1) {
perror("setgid");
exit(1);
}
argv[0] = COS_BIN;
if (execve(argv[0], argv, env) == -1)
abort();
return 0;
}