#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>

int main(int argc, const char **argv) {
    if (setuid(0) != 0) {
        fprintf(stderr, "setuid error\n");
        return 1;
    }
    char *oldpath = getenv("PATH");
    char *tmp = malloc(sizeof(char) * strlen(oldpath) + 100);
    tmp[0] = '\0';
    strcat(tmp, oldpath);
    strcat(tmp, ":/sbin:/usr/sbin");
    setenv("PATH", tmp, 1);
    free(tmp);
    execl("/usr/bin/pon", "/usr/bin/pon", "myvpn", NULL);
    return 0;
}

gcc conn_vpn.c -o conn_vpn
sudo chown root:root conn_vpn
sudo chmod +s conn_vpn