| 170 | 
   | 
         } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 171 | 
   | 
 } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 172 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 | 173 | 
 – | 
 /* Takes many pointers, checks if they are NULL or not, and then free's them */ | 
 
 
 
 
 
 
 
 
 
 | 174 | 
 – | 
 /* Deprciated - and i only wrote it today! :) | 
 
 
 
 
 
 
 
 
 
 | 175 | 
 – | 
 void m_free(int num_pointers, ...){ | 
 
 
 
 
 
 
 
 
 
 | 176 | 
 – | 
         int x=0; | 
 
 
 
 
 
 
 
 
 
 | 177 | 
 – | 
         va_list ap; | 
 
 
 
 
 
 
 
 
 
 | 178 | 
 – | 
         void *p; | 
 
 
 
 
 
 
 
 
 
 | 179 | 
 – | 
  | 
 
 
 
 
 
 
 
 
 
 | 180 | 
 – | 
         va_start(ap, num_pointers); | 
 
 
 
 
 
 
 
 
 
 | 181 | 
 – | 
         for(;x<num_pointers;x++){ | 
 
 
 
 
 
 
 
 
 
 | 182 | 
 – | 
                 p=va_arg(ap, void*); | 
 
 
 
 
 
 
 
 
 
 | 183 | 
 – | 
                 if(p!=NULL){ | 
 
 
 
 
 
 
 
 
 
 | 184 | 
 – | 
                         free(p); | 
 
 
 
 
 
 
 
 
 
 | 185 | 
 – | 
                 } | 
 
 
 
 
 
 
 
 
 
 | 186 | 
 – | 
         } | 
 
 
 
 
 
 
 
 
 
 | 187 | 
 – | 
         va_end(ap); | 
 
 
 
 
 
 
 
 
 
 | 188 | 
 – | 
 } | 
 
 
 
 
 
 
 
 
 
 | 189 | 
 – | 
 */ | 
 
 
 
 
 
 
 
 
 
 | 190 | 
 – | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 173 | 
   | 
 int create_udp_sockinfo(udp_sockinfo_t *udp_sockinfo, char *hostname, int port){ | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 174 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 175 | 
   | 
         struct in_addr haddr; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 241 | 
   | 
         *response=fpgetline(f); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 242 | 
   | 
         fseek(f, 0, SEEK_CUR); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 243 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 | 244 | 
 < | 
         if(*response!=NULL) log_msg(LOG_DEBUG, "Recieved %s", *response); | 
 
 
 
 
 
 
 
 
 
 | 244 | 
 > | 
         if(*response!=NULL) log_msg(LOG_DEBUG, "Received %s", *response); | 
 
 
 
 
 
 
 
 
 
 
 
 | 245 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 246 | 
   | 
         if( (*response==NULL) || (strcmp(*response, "ERROR")==0) ) return -1; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 247 | 
   | 
          | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 369 | 
   | 
                         goto error; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 370 | 
   | 
                 } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 371 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 | 390 | 
 – | 
                 /*printf("string : %s\n", response_ptr);*/ | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 372 | 
   | 
                 server_udp_port=atoi(response_ptr); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 373 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 374 | 
   | 
                 if (server_udp_port==0){ | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 741 | 
   | 
         ihost_state.file_list=NULL; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 742 | 
   | 
         ihost_state.last_modified=NULL; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 743 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 | 744 | 
 < | 
         while((cmdopt=getopt(argc, argv, "vfhVs:i:")) != -1){ | 
 
 
 
 
 
 
 
 
 
 | 744 | 
 > | 
         while((cmdopt=getopt(argc, argv, "vfVn:i:s:p:h")) != -1){ | 
 
 
 
 
 
 
 
 
 
 
 
 | 745 | 
   | 
                 switch(cmdopt){ | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 746 | 
   | 
                         case 'v': | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 747 | 
   | 
                                 ihost_config.verbose++; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 827 | 
   | 
         log_msg(LOG_INFO, "Starting ihost..."); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 828 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 829 | 
   | 
         log_msg(LOG_DEBUG, "Running statgrab_init()"); | 
 
 
 
 
 
 
 
 
 
 
 
 | 830 | 
 < | 
         if(!statgrab_init()){ | 
 
 
 
 
 
 
 
 
 
 | 830 | 
 > | 
         if(statgrab_init()){ | 
 
 
 
 
 
 
 
 
 
 
 
 | 831 | 
   | 
                 log_msg(LOG_CRIT, "statgrab_init failed (%m)"); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 832 | 
   | 
                 exit(1); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 833 | 
   | 
         } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 847 | 
   | 
                 } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 848 | 
   | 
         } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 849 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 | 869 | 
 – | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 850 | 
   | 
         /* Get the initial config from the filter manager. Should this fail,  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 851 | 
   | 
          * wait, and then try again. */ | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 852 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 858 | 
   | 
                 sleep(10); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 859 | 
   | 
         } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 860 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 | 881 | 
 – | 
         /*printf("%s\n%d\n", ihost_state.server_fqdn, ihost_state.server_udp_port);*/ | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 861 | 
   | 
         while((create_udp_sockinfo(&udp_sockinfo, ihost_state.server_fqdn, ihost_state.server_udp_port))!=0){ | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 862 | 
   | 
                 log_msg(LOG_ERR, "Failed to create udp socket");         | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 863 | 
   | 
                 sleep(10); |