a simple C wrapper for setuid cgi-bin invocations
david nicol
whatever at davidnicol.com
Wed May 19 05:03:53 CDT 2004
/* C wrapper to invoke a specific command
*/
#include <stdio.h>
int shelldo(char *c){
FILE *F;
F = popen(c,"w");
return pclose(F);
fflush(NULL);
};
int main(){
FILE *F;
printf("Content-Type: text/plainnn");
fflush(NULL);
/* popen will use our STDOUT in sub-shell * /
shelldo("echo transferring $QUERY_STRING");
shelldo("whoami");
shelldo("echo EUID is $EUID UID is $UID");
shelldo("something system-dependent");
/* */
shelldo("the thing I want to run setuid");
};
--
david nicol
"People used to be able to read my thoughts, but
it doesn't appear to work any more. Should I eat less cheese?"
-- Elizabeth Woods
More information about the Kclug
mailing list