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.
31 lines
623 B
31 lines
623 B
|
|
#include <stdio.h> |
|
#include <stdlib.h> |
|
#include <string.h> |
|
#include <unistd.h> |
|
|
|
#define GITEA_BIN "@l_prefix@/sbin/gitea" |
|
#define GITEA_CMD "serv" |
|
|
|
int main(int argn, char **argv) |
|
{ |
|
if (setuid(geteuid()) == -1) { |
|
perror("setuid"); |
|
exit(1); |
|
} |
|
if (setgid(getegid()) == -1) { |
|
perror("setgid"); |
|
exit(1); |
|
} |
|
int i; |
|
char **args = malloc(sizeof(char *) * (argn + 2)); |
|
args[0] = GITEA_BIN; |
|
args[1] = GITEA_CMD; |
|
for (i = 1; i < argn; i++) |
|
args[i + 1] = argv[i]; |
|
args[i + 1] = NULL; |
|
if (execv(args[0], args) == -1) |
|
abort(); |
|
return 0; |
|
} |
|
|
|
|