CCL Home Page
Up Directory CCL apache_stop.c.txt
#include 
#include 

#define NUSERS 3

int main (int argc, char *argv[]) {
  char apache[]="/etc/rc.d/init.d/httpd.jkl stop";
  int i, authorize, authorized_uids[NUSERS] = {169, 500, 501};

  authorize = 0;
  for(i = 0; i < NUSERS; i++) {
    if((getuid() == authorized_uids[i]) || 
       (getuid() == 0)){
      authorize = 1;
      }
    }
  if(authorize == 0) {
    fprintf(stderr, "Sorry, you are not the chosen one...\n");
    exit(1);
    }
  
  setreuid(0,0);
  setregid(0,0);

  system(apache);

  exit(0);

}
Modified: Fri Jan 26 21:41:50 2001 GMT
Page accessed 334 times since Tue Mar 15 10:59:28 2005 GMT