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.
 
 
 
 
 
 

29 lines
584 B

#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#define RUN_DIR L_PREFIX "/var/sks"
#define RUN_SCRIPT L_PREFIX "/sbin/sks_add_mail"
int main(int argc, char *argv[])
{
static char *const exec_env[] = {
"PATH=/bin:/usr/bin:/sbin:/usr/sbin",
NULL
};
if (chdir(RUN_DIR) == -1) {
perror("chdir");
exit(1);
}
if (setuid(geteuid()) == -1) {
perror("setuid");
exit(1);
}
if (setgid(getegid()) == -1) {
perror("setgid");
exit(1);
}
execve(RUN_SCRIPT, argv, exec_env);
}