/* * * postfixwrapper.c * wrapper to start/stop postfix as unprivileged user * executable must be SUID root! * * 2000-12-07, stefan@epy.co.at * */ #include #include const char* mtactl = "/usr/sbin/postfix"; const char* start = "start"; const char* stop = "stop"; int main( int argc, char** argv ) { // decouple from Zope if ( fork() != 0 ) exit( 0 ); // do the bad stuff (cough) setreuid( 0, 0 ); // start/stop postfix safely (cough, cough) if ( strcmp(argv[1], start) == 0 ) execl( mtactl, mtactl, start, NULL ); else if ( strcmp(argv[1], stop) == 0 ) execl( mtactl, mtactl, stop, NULL ); else return 1; return 0; }