
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>

#define RUN_DIR    L_PREFIX "/var/pks"
#define RUN_SCRIPT L_PREFIX "/libexec/pks/pks-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);
}

