/* wrapper for setuid script - Copyright (c) 1996 Steffen Beyer, software design & management GmbH & Co. KG */ #include #include #include #include #ifdef SOL2 #include #endif #include #include int main(int argc, char **argv) { /* define here the path and name of the script to execute with setuid: */ char cmd[4096] = "/opt/bin/greppr.suid"; int i; /* if parameters are passed, concatenate them: */ if (argc > 1) { for (i=1; i < argc; i++) { strcat(cmd, " "); /* if (index(argv[i], ' ') != NULL && index(argv[i], '"') == NULL) { */ if (index(argv[i], '"') == NULL) { strcat(cmd, "\""); strcat(cmd, argv[i]); strcat(cmd, "\""); } else { strcat(cmd, "'"); strcat(cmd, argv[i]); strcat(cmd, "'"); } } } /* (else no parameters at all) */ setuid(0); setgid(0); return(system(cmd)); }