2 changed files with 51 additions and 8 deletions
@ -0,0 +1,30 @@
|
||||
|
||||
#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@/sbin/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; |
||||
} |
||||
|
||||
Loading…
Reference in new issue