Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/regfi.c
r252 r253 403 403 404 404 405 char* regfi_sid2str(WINSEC_DOM_SID* sid)406 {407 uint32_t i, size = WINSEC_MAX_SUBAUTHS*11 + 24;408 uint32_t left = size;409 uint8_t comps = sid->num_auths;410 char* ret_val = malloc(size);411 412 if(ret_val == NULL)413 return NULL;414 415 if(comps > WINSEC_MAX_SUBAUTHS)416 comps = WINSEC_MAX_SUBAUTHS;417 418 left -= sprintf(ret_val, "S-%u-%u", sid->sid_rev_num, sid->id_auth[5]);419 420 for (i = 0; i < comps; i++)421 left -= snprintf(ret_val+(size-left), left, "-%u", sid->sub_auths[i]);422 423 return ret_val;424 }425 426 427 405 char* regfi_get_acl(WINSEC_ACL* acl) 428 406 { … … 440 418 for (i = 0; i < acl->num_aces && !failed; i++) 441 419 { 442 sid_str = regfi_sid2str(acl->aces[i]->trustee);420 sid_str = winsec_sid2str(acl->aces[i]->trustee); 443 421 type_str = regfi_ace_type2str(acl->aces[i]->type); 444 422 perms_str = regfi_ace_perms2str(acl->aces[i]->access_mask); … … 505 483 char* regfi_get_owner(WINSEC_DESC *sec_desc) 506 484 { 507 return regfi_sid2str(sec_desc->owner_sid);485 return winsec_sid2str(sec_desc->owner_sid); 508 486 } 509 487 … … 511 489 char* regfi_get_group(WINSEC_DESC *sec_desc) 512 490 { 513 return regfi_sid2str(sec_desc->grp_sid);491 return winsec_sid2str(sec_desc->grp_sid); 514 492 } 515 493 … … 1500 1478 } 1501 1479 } 1480 else 1481 ret_val = talloc_reference(NULL, ret_val); 1502 1482 1503 1483 unlock: … … 2067 2047 2068 2048 return regfi_load_sk(file, key->sk_off + REGFI_REGF_SIZE, true); 2049 } 2050 2051 2052 /****************************************************************************** 2053 *****************************************************************************/ 2054 const REGFI_SK* regfi_next_sk(REGFI_FILE* file, const REGFI_SK* sk) 2055 { 2056 if(sk == NULL || sk->next_sk_off == REGFI_OFFSET_NONE) 2057 return NULL; 2058 2059 return regfi_load_sk(file, sk->next_sk_off + REGFI_REGF_SIZE, true); 2060 } 2061 2062 2063 /****************************************************************************** 2064 *****************************************************************************/ 2065 const REGFI_SK* regfi_prev_sk(REGFI_FILE* file, const REGFI_SK* sk) 2066 { 2067 if(sk == NULL || sk->prev_sk_off == REGFI_OFFSET_NONE) 2068 return NULL; 2069 2070 return regfi_load_sk(file, sk->prev_sk_off + REGFI_REGF_SIZE, true); 2069 2071 } 2070 2072 -
trunk/lib/winsec.c
r169 r253 226 226 ret_val->size = SVAL(buf, 0x2); 227 227 ret_val->access_mask = IVAL(buf, 0x4); 228 228 ret_val->obj_guid = NULL; 229 ret_val->inh_guid = NULL; 230 229 231 offset = 0x8; 230 232 … … 246 248 offset += sizeof(WINSEC_UUID); 247 249 } 248 else249 ret_val->obj_guid = NULL;250 250 251 251 if(ret_val->obj_flags & WINSEC_ACE_OBJECT_INHERITED_PRESENT) … … 260 260 offset += sizeof(WINSEC_UUID); 261 261 } 262 else263 ret_val->inh_guid = NULL;264 262 } 265 263 … … 410 408 411 409 /****************************************************************************** 410 ******************************************************************************/ 411 char* winsec_sid2str(const WINSEC_DOM_SID* sid) 412 { 413 uint32_t i, size = WINSEC_MAX_SUBAUTHS*11 + 24; 414 uint32_t left = size; 415 uint8_t comps = sid->num_auths; 416 char* ret_val = malloc(size); 417 418 if(ret_val == NULL) 419 return NULL; 420 421 if(comps > WINSEC_MAX_SUBAUTHS) 422 comps = WINSEC_MAX_SUBAUTHS; 423 424 left -= sprintf(ret_val, "S-%u-%u", sid->sid_rev_num, sid->id_auth[5]); 425 426 for (i = 0; i < comps; i++) 427 left -= snprintf(ret_val+(size-left), left, "-%u", sid->sub_auths[i]); 428 429 return ret_val; 430 } 431 432 433 /****************************************************************************** 412 434 * Compares two WINSEC_DESC structures. 413 435 ******************************************************************************/
Note: See TracChangeset
for help on using the changeset viewer.