Changeset 148 for trunk/lib/winsec.c


Ignore:
Timestamp:
02/22/09 18:22:59 (15 years ago)
Author:
tim
Message:

integrated talloc into range_list

fixed some uninitialized structure values in the winsec library

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/winsec.c

    r147 r148  
    5555  if (buf == NULL || buf_len <  WINSEC_DESC_HEADER_SIZE)
    5656    return NULL;
    57   /*
    58   if((ret_val = (WINSEC_DESC*)zalloc(sizeof(WINSEC_DESC))) == NULL)
    59     return NULL;
    60   */
     57
    6158  if((ret_val = talloc(talloc_ctx, WINSEC_DESC)) == NULL)
    6259    return NULL;
     
    8683  }
    8784
    88   if(ret_val->off_owner_sid != 0)
     85  if(ret_val->off_owner_sid == 0)
     86    ret_val->owner_sid = NULL;
     87  else
    8988  {
    9089    ret_val->owner_sid = winsec_parse_dom_sid(ret_val,
     
    9897  }
    9998
    100   if (ret_val->off_grp_sid != 0)
     99  if(ret_val->off_grp_sid == 0)
     100    ret_val->grp_sid = NULL;
     101  else
    101102  {
    102103    ret_val->grp_sid = winsec_parse_dom_sid(ret_val, buf + ret_val->off_grp_sid,
     
    109110  }
    110111
    111   if ((ret_val->control & WINSEC_DESC_SACL_PRESENT) && ret_val->off_sacl)
     112  if((ret_val->control & WINSEC_DESC_SACL_PRESENT) && ret_val->off_sacl)
    112113  {
    113114    ret_val->sacl = winsec_parse_acl(ret_val, buf + ret_val->off_sacl,
     
    119120    }
    120121  }
    121 
    122   if ((ret_val->control & WINSEC_DESC_DACL_PRESENT) && ret_val->off_dacl != 0)
     122  else
     123    ret_val->sacl = NULL;
     124
     125  if((ret_val->control & WINSEC_DESC_DACL_PRESENT) && ret_val->off_dacl != 0)
    123126  {
    124127    ret_val->dacl = winsec_parse_acl(ret_val, buf + ret_val->off_dacl,
     
    130133    }
    131134  }
     135  else
     136    ret_val->dacl = NULL;
    132137
    133138  return ret_val;
     
    150155  if (buf == NULL || buf_len < 8)
    151156    return NULL;
    152   /*
    153   if((ret_val = (WINSEC_ACL*)zalloc(sizeof(WINSEC_ACL))) == NULL)
    154     return NULL;
    155   */
     157
    156158  if((ret_val = talloc(talloc_ctx, WINSEC_ACL)) == NULL)
    157159    return NULL;
     
    175177   * (allow no access).
    176178   */
    177   /*  if((ret_val->aces = (WINSEC_ACE**)zcalloc(sizeof(WINSEC_ACE*),
    178                                            ret_val->num_aces+1)) == NULL)
    179   */
    180179  if((ret_val->aces = talloc_array(ret_val, WINSEC_ACE*,
    181180                                   ret_val->num_aces+1)) == NULL)
     
    203202    }
    204203  }
     204  ret_val->aces[ret_val->num_aces] = NULL;
    205205
    206206  return ret_val;
     
    219219  if(buf == NULL || buf_len < WINSEC_ACE_MIN_SIZE)
    220220    return NULL;
    221 
    222   /*  if((ret_val = (WINSEC_ACE*)zalloc(sizeof(WINSEC_ACE))) == NULL)*/
    223221
    224222  if((ret_val = talloc(talloc_ctx, WINSEC_ACE)) == NULL)
     
    249247      offset += sizeof(WINSEC_UUID);
    250248    }
     249    else
     250      ret_val->obj_guid = NULL;
    251251
    252252    if(ret_val->obj_flags & WINSEC_ACE_OBJECT_INHERITED_PRESENT)
     
    261261      offset += sizeof(WINSEC_UUID);
    262262    }
     263    else
     264      ret_val->inh_guid = NULL;
    263265  }
    264266
     
    322324    return false;
    323325
    324   /* if((ret_val = (WINSEC_UUID*)zalloc(sizeof(WINSEC_UUID))) == NULL)*/
    325326  if((ret_val = talloc(talloc_ctx, WINSEC_UUID)) == NULL)
    326327    return NULL;
Note: See TracChangeset for help on using the changeset viewer.