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

#define NUSERS 3

int main (int argc, char *argv[]) {
  char apache[]="/etc/rc.d/init.d/httpd.jkl start";
  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:22 2001 GMT
Page accessed 3716 times since Tue Feb 4 15:23:43 2003 GMT