Changeset 78 for trunk/src/reglookup.c


Ignore:
Timestamp:
01/15/07 10:22:47 (17 years ago)
Author:
tim
Message:

beginning process of rewriting regfio interface.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/reglookup.c

    r77 r78  
    216216    {
    217217      tmp_err = strerror(-ret_err);
    218       str_type = regfio_type_val2str(type);
     218      str_type = regfi_type_val2str(type);
    219219      *error_msg = (char*)malloc(65+strlen(str_type)+strlen(tmp_err)+1);
    220220      if(*error_msg == NULL)
     
    385385{
    386386  void_stack* ret_val;
    387   void_stack* rev_ret = void_stack_new(1024);
     387  void_stack* rev_ret = void_stack_new(REGF_MAX_DEPTH);
    388388  const char* cur = s;
    389389  char* next = NULL;
     
    405405      memcpy(copy, cur, next-cur);
    406406      copy[next-cur] = '\0';
    407       void_stack_push(rev_ret, copy);
     407      if(!void_stack_push(rev_ret, copy))
     408        bailOut(2, "ERROR: Registry maximum depth exceeded.\n");
    408409    }
    409410    cur = next+1;
     
    412413  {
    413414    copy = strdup(cur);
    414     void_stack_push(rev_ret, copy);
     415    if(!void_stack_push(rev_ret, copy))
     416      bailOut(2, "ERROR: Registry maximum depth exceeded.\n");
    415417  }
    416418
     
    541543              "warning returned: %s\n", prefix, quoted_name, conv_error);
    542544
    543   str_type = regfio_type_val2str(vk->type);
     545  str_type = regfi_type_val2str(vk->type);
    544546  if(print_security)
    545547  {
     
    597599  if(print_security)
    598600  {
    599     owner = regfio_get_owner(k->sec_desc->sec_desc);
    600     group = regfio_get_group(k->sec_desc->sec_desc);
    601     sacl = regfio_get_sacl(k->sec_desc->sec_desc);
    602     dacl = regfio_get_dacl(k->sec_desc->sec_desc);
     601    owner = regfi_get_owner(k->sec_desc->sec_desc);
     602    group = regfi_get_group(k->sec_desc->sec_desc);
     603    sacl = regfi_get_sacl(k->sec_desc->sec_desc);
     604    dacl = regfi_get_dacl(k->sec_desc->sec_desc);
    603605    if(owner == NULL)
    604606      owner = empty_str;
     
    636638  uint32 path_len = 0;
    637639  uint32 prefix_len = strlen(prefix);
    638   int key_type = regfio_type_str2val("KEY");
     640  int key_type = regfi_type_str2val("KEY");
    639641 
    640642  if((cur = (REGF_NK_REC*)void_stack_cur(nk_stack)) != NULL)
     
    672674    while((cur = (REGF_NK_REC*)void_stack_cur(nk_stack)) != NULL)
    673675    {
    674       if((sub = regfio_fetch_subkey(f, cur)) == NULL)
     676      if((sub = regfi_fetch_subkey(f, cur)) == NULL)
    675677      {
    676678        sub = void_stack_pop(nk_stack);
     
    684686      {
    685687        sub->subkey_index = 0;
    686         void_stack_push(nk_stack, sub);
     688        if(!void_stack_push(nk_stack, sub))
     689          bailOut(2, "ERROR: Registry maximum depth exceeded.\n");
    687690        path = stack2Path(nk_stack);
    688691        if(path != NULL)
     
    753756    found_cur = false;
    754757    while(!found_cur &&
    755           (sub = regfio_fetch_subkey(f, cur)) != NULL)
     758          (sub = regfi_fetch_subkey(f, cur)) != NULL)
    756759    {
    757760      if(strcasecmp(sub->keyname, cur_str) == 0)
    758761      {
    759762        cur = sub;
    760         void_stack_push(nk_stack, sub);
     763        if(!void_stack_push(nk_stack, sub))
     764          bailOut(2, "ERROR: Registry maximum depth exceeded.\n");
     765
    761766        found_cur = true;
    762767      }
     
    802807                    " of specified path.\n");
    803808
    804   while((sub = regfio_fetch_subkey(f, cur)) != NULL)
     809  while((sub = regfi_fetch_subkey(f, cur)) != NULL)
    805810  {
    806811    if(strcasecmp(sub->keyname, cur_str) == 0)
    807812    {
    808       sub_nk_stack = void_stack_new(1024);
    809       void_stack_push(sub_nk_stack, sub);
     813      sub_nk_stack = void_stack_new(REGF_MAX_DEPTH);
     814      if(!void_stack_push(sub_nk_stack, sub))
     815        bailOut(2, "ERROR: Registry maximum depth exceeded.\n");
    810816      prefix = stack2Path(nk_stack);
    811817      prefix_len = strlen(prefix);
     
    890896        bailOut(1, "ERROR: '-t' option requires parameter.\n");
    891897      }
    892       if((type_filter = regfio_type_str2val(argv[argi])) < 0)
     898      if((type_filter = regfi_type_str2val(argv[argi])) < 0)
    893899      {
    894900        fprintf(stderr, "ERROR: Invalid type specified: %s.\n", argv[argi]);
     
    917923    bailOut(2, "ERROR: Memory allocation problem.\n");
    918924
    919   f = regfio_open(registry_file);
     925  f = regfi_open(registry_file);
    920926  if(f == NULL)
    921927  {
     
    924930  }
    925931
    926   root = regfio_rootkey(f);
    927   nk_stack = void_stack_new(1024);
     932  root = regfi_rootkey(f);
     933  nk_stack = void_stack_new(REGF_MAX_DEPTH);
    928934
    929935  if(void_stack_push(nk_stack, root))
     
    950956  }
    951957  else
    952     bailOut(2, "ERROR: Memory allocation problem.\n");
     958    bailOut(2, "ERROR: Registry maximum depth exceeded.\n");
    953959
    954960  void_stack_destroy_deep(nk_stack);
    955   regfio_close(f);
     961  regfi_close(f);
    956962
    957963  return 0;
Note: See TracChangeset for help on using the changeset viewer.