Changeset 160 for trunk/src/reglookup.c


Ignore:
Timestamp:
12/06/09 20:00:58 (14 years ago)
Author:
tim
Message:

reorganized classname parsing and interpretation code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/reglookup.c

    r159 r160  
    282282  char* dacl = NULL;
    283283  char* quoted_classname;
    284   char* error_msg = NULL;
    285284  char mtime[20];
    286285  time_t tmp_time[1];
     
    288287  const REGFI_SK_REC* sk;
    289288  const REGFI_NK_REC* k = regfi_iterator_cur_key(iter);
     289  REGFI_CLASSNAME* classname;
    290290
    291291  *tmp_time = nt_time_to_unix(&k->mtime);
     
    308308      dacl = empty_str;
    309309
    310     if(k->classname != NULL)
    311     {
    312       quoted_classname = quote_unicode((uint8*)k->classname, k->classname_length,
    313                                        key_special_chars, &error_msg);
     310    classname = regfi_iterator_fetch_classname(iter, k);
     311    printMsgs(iter->f);
     312    if(classname != NULL)
     313    {
     314      if(classname->interpreted == NULL)
     315      {
     316        fprintf(stderr, "WARN: Could not convert class name"
     317                " charset for key '%s'.  Quoting raw...\n", full_path);
     318        quoted_classname = quote_buffer(classname->raw, classname->size,
     319                                        key_special_chars);
     320      }
     321      else
     322        quoted_classname = quote_string(classname->interpreted,
     323                                        key_special_chars);
     324
    314325      if(quoted_classname == NULL)
    315326      {
    316         if(error_msg == NULL)
    317           fprintf(stderr, "ERROR: Could not quote classname"
    318                   " for key '%s' due to unknown error.\n", full_path);
    319         else
    320         {
    321           fprintf(stderr, "ERROR: Could not quote classname"
    322                   " for key '%s' due to error: %s\n", full_path, error_msg);
    323           free(error_msg);
    324         }
    325       }
    326       else if (error_msg != NULL)
    327       {
    328         if(print_verbose)
    329           fprintf(stderr, "INFO: While converting classname"
    330                   " for key '%s': %s.\n", full_path, error_msg);
    331         free(error_msg);
     327        fprintf(stderr, "ERROR: Could not quote classname"
     328                " for key '%s' due to unknown error.\n", full_path);
     329        quoted_classname = empty_str;
    332330      }
    333331    }
    334332    else
    335333      quoted_classname = empty_str;
     334    regfi_free_classname(classname);
    336335
    337336    printMsgs(iter->f);
Note: See TracChangeset for help on using the changeset viewer.