[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3master/var/cache/se3_install/admind/ -> admind.c (source)

   1  /*
   2  admind projet SE3
   3  
   4  Equipe Tice académie de Caen
   5  V 0.1 maj : 15/11/2002
   6  Distribué selon les termes de la licence GPL
   7  
   8  */
   9  
  10  #include <stdio.h>
  11  #include <unistd.h>
  12  #include <syslog.h>
  13  
  14  
  15  main()
  16  {
  17    int fd;
  18    char str[12];
  19    FILE *tbp;
  20    int childpid;
  21  
  22    /* openlog("admind_SE3", LOG_PERROR | LOG_PID, LOG_USER); */
  23    umask (022);
  24    chdir ("/tmp");
  25  
  26    /* Lock File du daemon
  27    fd = open ("/tmp/admind.lock", 0640);
  28    if (fd < 0) exit (0);
  29    if (lockf (fd, F_TLOCK, 0) < 0 ) {
  30      snprintf (str, 12, "%d\n", getpid ());
  31      write (fd, str, strlen (str));
  32    }
  33    */
  34  
  35    while(1) {
  36      tbp = fopen("/home/remote_adm/admin.sh","r");
  37      if (tbp != NULL) {
  38        fclose(tbp);
  39        if((childpid = fork()) < 0) system("/usr/bin/logger -t admind fork error");
  40        else if(childpid == 0) {
  41             system ("/home/remote_adm/admin.sh");
  42             system ("/bin/rm /home/remote_adm/admin.sh");
  43             /*syslog (LOG_INFO, "execution admin.sh");*/
  44             exit(0);
  45        }
  46        while (childpid !=wait(0));
  47      }
  48      sleep(1);
  49    }
  50  }


Generated: Tue Mar 17 22:47:18 2015 Cross-referenced by PHPXref 0.7.1