/***************************************************************************** trigger-make.c John Simpson 2007-08-19 runs "make" as root in the "/service/tinydns/root" directory ****************************************************************************** Copyright (C) 2007 John Simpson. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 or version 3 of the license, at your option. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . *****************************************************************************/ #include #include #define DIR "/service/tinydns/root" #define MAKE "/usr/bin/make" #define PATH "/usr/bin:/bin:/usr/local/bin" char *cmd[] = { MAKE , NULL } ; char *env[] = { "PATH=" PATH , "SHELL=/bin/sh" , NULL } ; int main ( int argc , char *argv[] ) { if ( setuid ( 0 ) ) { perror ( "setuid" ) ; return 1 ; } if ( seteuid ( 0 ) ) { perror ( "seteuid" ) ; return 1 ; } if ( chdir ( DIR ) ) { perror ( "chdir" ) ; return 1 ; } execve ( cmd[0] , cmd , env ) ; perror ( "execve" ) ; return 1 ; }