Changeset 178 for trunk/src/reglookup.c


Ignore:
Timestamp:
03/13/10 12:56:36 (14 years ago)
Author:
tim
Message:

reworked I/O to use callback functions

fixed a bug in mtime validation and consolidated time formatting code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/reglookup.c

    r172 r178  
    296296  char* sacl = NULL;
    297297  char* dacl = NULL;
     298  char mtime[24];
    298299  char* quoted_classname;
    299   char mtime[20];
    300   time_t tmp_time[1];
    301   struct tm* tmp_time_s = NULL;
    302300  const REGFI_SK_REC* sk;
    303301  const REGFI_NK_REC* k = regfi_iterator_cur_key(iter);
    304302  REGFI_CLASSNAME* classname;
    305303
    306   *tmp_time = regfi_nt2unix_time(&k->mtime);
    307   tmp_time_s = gmtime(tmp_time);
    308   strftime(mtime, sizeof(mtime), "%Y-%m-%d %H:%M:%S", tmp_time_s);
     304  formatTime(&k->mtime, mtime);
    309305
    310306  if(print_security && (sk=regfi_iterator_cur_sk(iter)))
     
    563559  char** path = NULL;
    564560  REGFI_ITERATOR* iter;
    565   int retr_path_ret;
     561  int retr_path_ret, fd;
    566562  uint32_t argi, arge;
    567563
     
    624620    bailOut(REGLOOKUP_EXIT_OSERR, "ERROR: Memory allocation problem.\n");
    625621
    626   f = regfi_open(registry_file);
    627   if(f == NULL)
     622  fd = openHive(registry_file);
     623  if(fd < 0)
    628624  {
    629625    fprintf(stderr, "ERROR: Couldn't open registry file: %s\n", registry_file);
    630626    bailOut(REGLOOKUP_EXIT_NOINPUT, "");
     627  }
     628
     629  f = regfi_alloc(fd);
     630  if(f == NULL)
     631  {
     632    close(fd);
     633    bailOut(REGLOOKUP_EXIT_NOINPUT, "ERROR: Failed to create REGFI_FILE structure.\n");
    631634  }
    632635
     
    675678
    676679  regfi_iterator_free(iter);
    677   regfi_close(f);
     680  regfi_free(f);
     681  close(fd);
    678682
    679683  return 0;
Note: See TracChangeset for help on using the changeset viewer.