code.fastix.org

Dateiansicht:

Datei:Projekte -> PHP:check_blocked_ip -> fwlist.c
md5:6bb55b5a9fbe9d361904378c38a743cf
sha1:2a74e493e9a3d64e1bd75e9882259378e9efb316
Download-Link:Download
  1. /*
  2.  *  fwlist.c
  3.  *  change the path to the script in line 14
  4.  *  compile with:               gcc fwlist.c -o fwlist
  5.  *  then set the owner root:    sudo chown root:root fwlist
  6.  *  then enable the suid-right: sudo chmod 4755 fwlist
  7. */
  8.  
  9. #include <unistd.h>
  10. #include <errno.h>
  11.  
  12. int main( int argc, char ** argv, char ** envp )
  13. {
  14.     char script[]="/opt/fwlist.sh";
  15.     if( setgid(getegid()) )     perror( "setgid" );
  16.     if( setuid(geteuid()) )     perror( "setuid" );
  17.     envp = 0;
  18.     system( script, argv, envp );
  19.     if ( errno )                perror( argv[0] );
  20.     return errno;
  21. }
  22.