Ignore:
Timestamp:
Nov 24, 2016, 1:14:11 PM (9 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to version 4.4.3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/registry/regfio.c

    r746 r988  
    2323#include "../librpc/gen_ndr/ndr_security.h"
    2424#include "../libcli/security/security_descriptor.h"
     25#include "../libcli/security/secdesc.h"
    2526
    2627#undef DBGC_CLASS
     
    4546static bool smb_io_time(const char *desc, NTTIME *nttime, prs_struct *ps, int depth)
    4647{
    47         uint32 low, high;
     48        uint32_t low, high;
    4849        if (nttime == NULL)
    4950                return False;
     
    7576*******************************************************************/
    7677
    77 static int write_block( REGF_FILE *file, prs_struct *ps, uint32 offset )
     78static int write_block( REGF_FILE *file, prs_struct *ps, uint32_t offset )
    7879{
    7980        int bytes_written, returned;
    8081        char *buffer = prs_data_p( ps );
    81         uint32 buffer_size = prs_data_size( ps );
     82        uint32_t buffer_size = prs_data_size( ps );
    8283        SMB_STRUCT_STAT sbuf;
    8384
     
    113114*******************************************************************/
    114115
    115 static int read_block( REGF_FILE *file, prs_struct *ps, uint32 file_offset, uint32 block_size )
     116static int read_block( REGF_FILE *file, prs_struct *ps, uint32_t file_offset, uint32_t block_size )
    116117{
    117118        int bytes_read, returned;
     
    199200
    200201        if ( hbin->free_off != REGF_OFFSET_NONE ) {
    201                 uint32 header = 0xffffffff;
    202 
    203                 if ( !prs_set_offset( &hbin->ps, hbin->free_off-sizeof(uint32) ) )
     202                uint32_t header = 0xffffffff;
     203
     204                if ( !prs_set_offset( &hbin->ps, hbin->free_off-sizeof(uint32_t) ) )
    204205                        return False;
    205206                if ( !prs_uint32( "free_size", &hbin->ps, 0, &hbin->free_size ) )
     
    224225
    225226        for ( p=file->block_list; p && p!=hbin; p=p->next )
    226                 ;;
     227                ;
    227228
    228229        if ( p == hbin ) {
     
    246247        depth++;
    247248       
    248         if ( !prs_uint8s( True, "header", ps, depth, (uint8*)file->header, sizeof( file->header )) )
     249        if ( !prs_uint8s( True, "header", ps, depth, (uint8_t *)file->header, sizeof( file->header )) )
    249250                return False;
    250251       
     
    303304static bool prs_hbin_block( const char *desc, prs_struct *ps, int depth, REGF_HBIN *hbin )
    304305{
    305         uint32 block_size2;
     306        uint32_t block_size2;
    306307
    307308        prs_debug(ps, depth, desc, "prs_regf_block");
    308309        depth++;
    309310       
    310         if ( !prs_uint8s( True, "header", ps, depth, (uint8*)hbin->header, sizeof( hbin->header )) )
     311        if ( !prs_uint8s( True, "header", ps, depth, (uint8_t*)hbin->header, sizeof( hbin->header )) )
    311312                return False;
    312313
     
    338339static bool prs_nk_rec( const char *desc, prs_struct *ps, int depth, REGF_NK_REC *nk )
    339340{
    340         uint16 class_length, name_length;
    341         uint32 start;
    342         uint32 data_size, start_off, end_off;
    343         uint32 unknown_off = REGF_OFFSET_NONE;
     341        uint16_t class_length, name_length;
     342        uint32_t start;
     343        uint32_t data_size, start_off, end_off;
     344        uint32_t unknown_off = REGF_OFFSET_NONE;
    344345
    345346        nk->hbin_off = prs_offset( ps );
     
    351352        /* back up and get the data_size */
    352353       
    353         if ( !prs_set_offset( ps, prs_offset(ps)-sizeof(uint32)) )
     354        if ( !prs_set_offset( ps, prs_offset(ps)-sizeof(uint32_t)) )
    354355                return False;
    355356        start_off = prs_offset( ps );
     
    357358                return False;
    358359       
    359         if ( !prs_uint8s( True, "header", ps, depth, (uint8*)nk->header, sizeof( nk->header )) )
     360        if ( !prs_uint8s( True, "header", ps, depth, (uint8_t *)nk->header, sizeof( nk->header )) )
    360361                return False;
    361362               
     
    418419                }
    419420
    420                 if ( !prs_uint8s( True, "name", ps, depth, (uint8*)nk->keyname, name_length) )
     421                if ( !prs_uint8s( True, "name", ps, depth, (uint8_t *)nk->keyname, name_length) )
    421422                        return False;
    422423
     
    442443*******************************************************************/
    443444
    444 static uint32 regf_block_checksum( prs_struct *ps )
     445static uint32_t regf_block_checksum( prs_struct *ps )
    445446{
    446447        char *buffer = prs_data_p( ps );
    447         uint32 checksum, x;
     448        uint32_t checksum, x;
    448449        int i;
    449450
     
    466467{
    467468        prs_struct ps;
    468         uint32 checksum;
     469        uint32_t checksum;
    469470       
    470471        /* grab the first block from the file */
     
    496497{
    497498        REGF_HBIN *hbin;
    498         uint32 record_size, curr_off, block_size, header;
    499        
    500         if ( !(hbin = TALLOC_ZERO_P(file->mem_ctx, REGF_HBIN)) )
     499        uint32_t record_size, curr_off, block_size, header;
     500       
     501        if ( !(hbin = talloc_zero(file->mem_ctx, REGF_HBIN)) )
    501502                return NULL;
    502503        hbin->file_off = offset;
     
    521522        /* remember that the record_size is in the 4 bytes preceeding the record itself */
    522523
    523         if ( !prs_set_offset( &hbin->ps, file->data_offset+HBIN_HDR_SIZE-sizeof(uint32) ) )
    524                 return False;
     524        if ( !prs_set_offset( &hbin->ps, file->data_offset+HBIN_HDR_SIZE-sizeof(uint32_t) ) )
     525                return NULL;
    525526
    526527        record_size = 0;
     
    545546
    546547                if ( !prs_set_offset( &hbin->ps, curr_off) )
    547                         return False;
     548                        return NULL;
    548549
    549550                if ( !prs_uint32( "rec_size", &hbin->ps, 0, &record_size ) )
    550                         return False;
     551                        return NULL;
    551552                if ( !prs_uint32( "header", &hbin->ps, 0, &header ) )
    552                         return False;
     553                        return NULL;
    553554               
    554555                SMB_ASSERT( record_size != 0 );
     
    567568                   record header */
    568569
    569                 hbin->free_off = curr_off + sizeof(uint32);
     570                hbin->free_off = curr_off + sizeof(uint32_t);
    570571                hbin->free_size = record_size;
    571572        }
     
    574575
    575576        if ( !prs_set_offset( &hbin->ps, file->data_offset+HBIN_HDR_SIZE )  )
    576                 return False;
     577                return NULL;
    577578       
    578579        return hbin;
     
    584585*******************************************************************/
    585586
    586 static bool hbin_contains_offset( REGF_HBIN *hbin, uint32 offset )
     587static bool hbin_contains_offset( REGF_HBIN *hbin, uint32_t offset )
    587588{
    588589        if ( !hbin )
     
    600601*******************************************************************/
    601602
    602 static REGF_HBIN* lookup_hbin_block( REGF_FILE *file, uint32 offset )
     603static REGF_HBIN* lookup_hbin_block( REGF_FILE *file, uint32_t offset )
    603604{
    604605        REGF_HBIN *hbin = NULL;
    605         uint32 block_off;
     606        uint32_t block_off;
    606607
    607608        /* start with the open list */
     
    659660        int i;
    660661        REGF_LF_REC *lf = &nk->subkeys;
    661         uint32 data_size, start_off, end_off;
     662        uint32_t data_size, start_off, end_off;
    662663
    663664        prs_debug(&hbin->ps, depth, desc, "prs_lf_records");
     
    676677        /* backup and get the data_size */
    677678       
    678         if ( !prs_set_offset( &hbin->ps, prs_offset(&hbin->ps)-sizeof(uint32)) )
     679        if ( !prs_set_offset( &hbin->ps, prs_offset(&hbin->ps)-sizeof(uint32_t)) )
    679680                return False;
    680681        start_off = prs_offset( &hbin->ps );
     
    682683                return False;
    683684
    684         if ( !prs_uint8s( True, "header", &hbin->ps, depth, (uint8*)lf->header, sizeof( lf->header )) )
     685        if ( !prs_uint8s( True, "header", &hbin->ps, depth, (uint8_t *)lf->header, sizeof( lf->header )) )
    685686                return False;
    686687               
     
    722723{
    723724        prs_struct *ps = &hbin->ps;
    724         uint16 tag = 0xFFFF;
    725         uint32 data_size, start_off, end_off;
     725        uint16_t tag = 0xFFFF;
     726        uint32_t data_size, start_off, end_off;
    726727
    727728
     
    734735        /* backup and get the data_size */
    735736       
    736         if ( !prs_set_offset( &hbin->ps, prs_offset(&hbin->ps)-sizeof(uint32)) )
     737        if ( !prs_set_offset( &hbin->ps, prs_offset(&hbin->ps)-sizeof(uint32_t)) )
    737738                return False;
    738739        start_off = prs_offset( &hbin->ps );
     
    740741                return False;
    741742
    742         if ( !prs_uint8s( True, "header", ps, depth, (uint8*)sk->header, sizeof( sk->header )) )
     743        if ( !prs_uint8s( True, "header", ps, depth, (uint8_t *)sk->header, sizeof( sk->header )) )
    743744                return False;
    744745        if ( !prs_uint16( "tag", ps, depth, &tag))
     
    768769                                return False;
    769770                } else {
    770                         blob = data_blob_const(prs_data_p(&hbin->ps),
    771                                                prs_data_size(&hbin->ps));
     771                        blob = data_blob_const(
     772                                prs_data_p(&hbin->ps) + prs_offset(&hbin->ps),
     773                                prs_data_size(&hbin->ps) - prs_offset(&hbin->ps)
     774                               );
    772775                        status = unmarshall_sec_desc(mem_ctx,
    773776                                                     blob.data, blob.length,
     
    798801static bool hbin_prs_vk_rec( const char *desc, REGF_HBIN *hbin, int depth, REGF_VK_REC *vk, REGF_FILE *file )
    799802{
    800         uint32 offset;
    801         uint16 name_length;
     803        uint32_t offset;
     804        uint16_t name_length;
    802805        prs_struct *ps = &hbin->ps;
    803         uint32 data_size, start_off, end_off;
     806        uint32_t data_size, start_off, end_off;
    804807
    805808        prs_debug(ps, depth, desc, "prs_vk_rec");
     
    808811        /* backup and get the data_size */
    809812       
    810         if ( !prs_set_offset( &hbin->ps, prs_offset(&hbin->ps)-sizeof(uint32)) )
     813        if ( !prs_set_offset( &hbin->ps, prs_offset(&hbin->ps)-sizeof(uint32_t)) )
    811814                return False;
    812815        start_off = prs_offset( &hbin->ps );
     
    814817                return False;
    815818
    816         if ( !prs_uint8s( True, "header", ps, depth, (uint8*)vk->header, sizeof( vk->header )) )
     819        if ( !prs_uint8s( True, "header", ps, depth, (uint8_t *)vk->header, sizeof( vk->header )) )
    817820                return False;
    818821
     
    843846                                return False;
    844847                }
    845                 if ( !prs_uint8s( True, "name", ps, depth, (uint8*)vk->valuename, name_length ) )
     848                if ( !prs_uint8s( True, "name", ps, depth, (uint8_t *)vk->valuename, name_length ) )
    846849                        return False;
    847850        }
     
    861864                if ( !(vk->data_size & VK_DATA_IN_OFFSET) ) {
    862865                        REGF_HBIN *hblock = hbin;
    863                         uint32 data_rec_size;
     866                        uint32_t data_rec_size;
    864867
    865868                        if ( UNMARSHALLING(&hbin->ps) ) {
    866                                 if ( !(vk->data = PRS_ALLOC_MEM( ps, uint8, vk->data_size) ) )
     869                                if ( !(vk->data = PRS_ALLOC_MEM( ps, uint8_t, vk->data_size) ) )
    867870                                        return False;
    868871                        }
     
    873876                                        return False;
    874877                        }
    875                         if ( !(prs_set_offset( &hblock->ps, (vk->data_off+HBIN_HDR_SIZE-hblock->first_hbin_off)-sizeof(uint32) )) )
     878                        if ( !(prs_set_offset( &hblock->ps, (vk->data_off+HBIN_HDR_SIZE-hblock->first_hbin_off)-sizeof(uint32_t) )) )
    876879                                return False;
    877880
    878881                        if ( MARSHALLING(&hblock->ps) ) {
    879                                 data_rec_size = ( (vk->data_size+sizeof(uint32)) & 0xfffffff8 ) + 8;
     882                                data_rec_size = ( (vk->data_size+sizeof(uint32_t)) & 0xfffffff8 ) + 8;
    880883                                data_rec_size = ( data_rec_size - 1 ) ^ 0xFFFFFFFF;
    881884                        }
     
    889892                }
    890893                else {
    891                         if ( !(vk->data = PRS_ALLOC_MEM( ps, uint8, 4 ) ) )
     894                        if ( !(vk->data = PRS_ALLOC_MEM( ps, uint8_t, 4 ) ) )
    892895                                return False;
    893896                        SIVAL( vk->data, 0, vk->data_off );
     
    916919{
    917920        int i;
    918         uint32 record_size;
     921        uint32_t record_size;
    919922
    920923        prs_debug(&hbin->ps, depth, desc, "prs_vk_records");
     
    933936        /* convert the offset to something relative to this HBIN block */
    934937       
    935         if ( !prs_set_offset( &hbin->ps, nk->values_off+HBIN_HDR_SIZE-hbin->first_hbin_off-sizeof(uint32)) )
     938        if ( !prs_set_offset( &hbin->ps, nk->values_off+HBIN_HDR_SIZE-hbin->first_hbin_off-sizeof(uint32_t)) )
    936939                return False;
    937940
    938941        if ( MARSHALLING( &hbin->ps) ) {
    939                 record_size = ( ( nk->num_values * sizeof(uint32) ) & 0xfffffff8 ) + 8;
     942                record_size = ( ( nk->num_values * sizeof(uint32_t) ) & 0xfffffff8 ) + 8;
    940943                record_size = (record_size - 1) ^ 0xFFFFFFFF;
    941944        }
     
    951954        for ( i=0; i<nk->num_values; i++ ) {
    952955                REGF_HBIN *sub_hbin = hbin;
    953                 uint32 new_offset;
     956                uint32_t new_offset;
    954957       
    955958                if ( !hbin_contains_offset( hbin, nk->values[i].rec_off ) ) {
     
    980983*******************************************************************/
    981984
    982 static REGF_SK_REC* find_sk_record_by_offset( REGF_FILE *file, uint32 offset )
     985static REGF_SK_REC* find_sk_record_by_offset( REGF_FILE *file, uint32_t offset )
    983986{
    984987        REGF_SK_REC *p_sk;
     
    10671070                        sub_hbin = lookup_hbin_block( file, nk->sk_off );
    10681071                        if ( !sub_hbin ) {
    1069                                 DEBUG(0,("hbin_prs_key: Failed to find HBIN block containing sk_offset [0x%x]\n",
    1070                                         nk->subkeys_off));
     1072                                DEBUG(0,("hbin_prs_key: Failed to find HBIN block containing sk_off [0x%x]\n",
     1073                                        nk->sk_off));
    10711074                                return False;
    10721075                        }
    10731076                }
    10741077               
    1075                 if ( !(nk->sec_desc = TALLOC_ZERO_P( file->mem_ctx, REGF_SK_REC )) )
     1078                if ( !(nk->sec_desc = talloc_zero( file->mem_ctx, REGF_SK_REC )) )
    10761079                        return False;
    10771080                nk->sec_desc->sk_off = nk->sk_off;
     
    10931096static bool next_record( REGF_HBIN *hbin, const char *hdr, bool *eob )
    10941097{
    1095         uint8 header[REC_HDR_SIZE];
    1096         uint32 record_size;
    1097         uint32 curr_off, block_size;
     1098        uint8_t header[REC_HDR_SIZE];
     1099        uint32_t record_size;
     1100        uint32_t curr_off, block_size;
    10981101        bool found = False;
    10991102        prs_struct *ps = &hbin->ps;
     
    11061109           and we need to backup to read the record size */
    11071110
    1108         curr_off -= sizeof(uint32);
     1111        curr_off -= sizeof(uint32_t);
    11091112
    11101113        block_size = prs_data_size( ps );
    11111114        record_size = 0;
    1112         memset( header, 0x0, sizeof(uint8)*REC_HDR_SIZE );
     1115        memset( header, 0x0, sizeof(uint8_t)*REC_HDR_SIZE );
    11131116        while ( !found ) {
    11141117
     
    11321135                if ( memcmp( header, hdr, REC_HDR_SIZE ) == 0 ) {
    11331136                        found = True;
    1134                         curr_off += sizeof(uint32);
     1137                        curr_off += sizeof(uint32_t);
    11351138                }
    11361139        }
     
    13721375        REGF_NK_REC *nk;
    13731376        REGF_HBIN   *hbin;
    1374         uint32      offset = REGF_BLOCKSIZE;
     1377        uint32_t      offset = REGF_BLOCKSIZE;
    13751378        bool        found = False;
    13761379        bool        eob;
     
    13791382                return NULL;
    13801383               
    1381         if ( !(nk = TALLOC_ZERO_P( file->mem_ctx, REGF_NK_REC )) ) {
     1384        if ( !(nk = talloc_zero( file->mem_ctx, REGF_NK_REC )) ) {
    13821385                DEBUG(0,("regfio_rootkey: talloc() failed!\n"));
    13831386                return NULL;
     
    14271430        REGF_NK_REC *subkey;
    14281431        REGF_HBIN   *hbin;
    1429         uint32      nk_offset;
     1432        uint32_t      nk_offset;
    14301433
    14311434        /* see if there is anything left to report */
     
    14471450               
    14481451        nk->subkey_index++;
    1449         if ( !(subkey = TALLOC_ZERO_P( file->mem_ctx, REGF_NK_REC )) )
     1452        if ( !(subkey = talloc_zero( file->mem_ctx, REGF_NK_REC )) )
    14501453                return NULL;
    14511454               
     
    14601463*******************************************************************/
    14611464
    1462 static REGF_HBIN* regf_hbin_allocate( REGF_FILE *file, uint32 block_size )
     1465static REGF_HBIN* regf_hbin_allocate( REGF_FILE *file, uint32_t block_size )
    14631466{
    14641467        REGF_HBIN *hbin;
    14651468        SMB_STRUCT_STAT sbuf;
    14661469
    1467         if ( !(hbin = TALLOC_ZERO_P( file->mem_ctx, REGF_HBIN )) )
     1470        if ( !(hbin = talloc_zero( file->mem_ctx, REGF_HBIN )) )
    14681471                return NULL;
    14691472
     
    14791482
    14801483        hbin->free_off       = HBIN_HEADER_REC_SIZE;
    1481         hbin->free_size      = block_size - hbin->free_off + sizeof(uint32);
     1484        hbin->free_size      = block_size - hbin->free_off + sizeof(uint32_t);
    14821485
    14831486        hbin->block_size     = block_size;
     
    15011504*******************************************************************/
    15021505
    1503 static void update_free_space( REGF_HBIN *hbin, uint32 size_used )
     1506static void update_free_space( REGF_HBIN *hbin, uint32_t size_used )
    15041507{
    15051508        hbin->free_off  += size_used;
     
    15161519*******************************************************************/
    15171520
    1518 static REGF_HBIN* find_free_space( REGF_FILE *file, uint32 size )
     1521static REGF_HBIN* find_free_space( REGF_FILE *file, uint32_t size )
    15191522{
    15201523        REGF_HBIN *hbin, *p_hbin;
    1521         uint32 block_off;
     1524        uint32_t block_off;
    15221525        bool cached;
    15231526
     
    15751578
    15761579        if ( !hbin ) {
    1577                 uint32 alloc_size;
     1580                uint32_t alloc_size;
    15781581
    15791582                /* allocate in multiples of REGF_ALLOC_BLOCK; make sure (size + hbin_header) fits */
     
    15911594        /* set the offset to be ready to write */
    15921595
    1593         if ( !prs_set_offset( &hbin->ps, hbin->free_off-sizeof(uint32) ) )
     1596        if ( !prs_set_offset( &hbin->ps, hbin->free_off-sizeof(uint32_t) ) )
    15941597                return NULL;
    15951598
     
    15991602
    16001603        if ( !prs_uint32("allocated_size", &hbin->ps, 0, &size) )
    1601                 return False;
     1604                return NULL;
    16021605
    16031606        update_free_space( hbin, size );
     
    16091612*******************************************************************/
    16101613
    1611 static uint32 sk_record_data_size( struct security_descriptor * sd )
    1612 {
    1613         uint32 size, size_mod8;
     1614static uint32_t sk_record_data_size( struct security_descriptor * sd )
     1615{
     1616        uint32_t size, size_mod8;
    16141617
    16151618        size_mod8 = 0;
     
    16171620        /* the record size is sizeof(hdr) + name + static members + data_size_field */
    16181621
    1619         size = sizeof(uint32)*5 + ndr_size_security_descriptor(sd, 0) + sizeof(uint32);
     1622        size = sizeof(uint32_t)*5 + ndr_size_security_descriptor(sd, 0) + sizeof(uint32_t);
    16201623
    16211624        /* multiple of 8 */
     
    16301633*******************************************************************/
    16311634
    1632 static uint32 vk_record_data_size( REGF_VK_REC *vk )
    1633 {
    1634         uint32 size, size_mod8;
     1635static uint32_t vk_record_data_size( REGF_VK_REC *vk )
     1636{
     1637        uint32_t size, size_mod8;
    16351638
    16361639        size_mod8 = 0;
     
    16381641        /* the record size is sizeof(hdr) + name + static members + data_size_field */
    16391642
    1640         size = REC_HDR_SIZE + (sizeof(uint16)*3) + (sizeof(uint32)*3) + sizeof(uint32);
     1643        size = REC_HDR_SIZE + (sizeof(uint16_t)*3) + (sizeof(uint32_t)*3) + sizeof(uint32_t);
    16411644
    16421645        if ( vk->valuename )
     
    16541657*******************************************************************/
    16551658
    1656 static uint32 lf_record_data_size( uint32 num_keys )
    1657 {
    1658         uint32 size, size_mod8;
     1659static uint32_t lf_record_data_size( uint32_t num_keys )
     1660{
     1661        uint32_t size, size_mod8;
    16591662
    16601663        size_mod8 = 0;
    16611664
    1662         /* the record size is sizeof(hdr) + num_keys + sizeof of hash_array + data_size_uint32 */
    1663 
    1664         size = REC_HDR_SIZE + sizeof(uint16) + (sizeof(REGF_HASH_REC) * num_keys) + sizeof(uint32);
     1665        /* the record size is sizeof(hdr) + num_keys + sizeof of hash_array + data_size_uint32_t */
     1666
     1667        size = REC_HDR_SIZE + sizeof(uint16_t) + (sizeof(REGF_HASH_REC) * num_keys) + sizeof(uint32_t);
    16651668
    16661669        /* multiple of 8 */
     
    16751678*******************************************************************/
    16761679
    1677 static uint32 nk_record_data_size( REGF_NK_REC *nk )
    1678 {
    1679         uint32 size, size_mod8;
     1680static uint32_t nk_record_data_size( REGF_NK_REC *nk )
     1681{
     1682        uint32_t size, size_mod8;
    16801683
    16811684        size_mod8 = 0;
    16821685
    1683         /* the record size is static + length_of_keyname + length_of_classname + data_size_uint32 */
    1684 
    1685         size = 0x4c + strlen(nk->keyname) + sizeof(uint32);
     1686        /* the record size is static + length_of_keyname + length_of_classname + data_size_uint32_t */
     1687
     1688        size = 0x4c + strlen(nk->keyname) + sizeof(uint32_t);
    16861689
    16871690        if ( nk->classname )
     
    17171720        vk->type      = regval_type( value );
    17181721
    1719         if ( vk->data_size > sizeof(uint32) ) {
    1720                 uint32 data_size = ( (vk->data_size+sizeof(uint32)) & 0xfffffff8 ) + 8;
    1721 
    1722                 vk->data = (uint8 *)TALLOC_MEMDUP( file->mem_ctx,
     1722        if ( vk->data_size > sizeof(uint32_t) ) {
     1723                uint32_t data_size = ( (vk->data_size+sizeof(uint32_t)) & 0xfffffff8 ) + 8;
     1724
     1725                vk->data = (uint8_t *)talloc_memdup( file->mem_ctx,
    17231726                                                   regval_data_p(value),
    17241727                                                   vk->data_size );
     
    17391742
    17401743                if ( vk->data_size != 0 )
    1741                         memcpy( &vk->data_off, regval_data_p(value), sizeof(uint32) );
     1744                        memcpy( &vk->data_off, regval_data_p(value), vk->data_size);
    17421745                vk->data_size |= VK_DATA_IN_OFFSET;             
    17431746        }
     
    17511754static int hashrec_cmp( REGF_HASH_REC *h1, REGF_HASH_REC *h2 )
    17521755{
    1753         return StrCaseCmp( h1->fullname, h2->fullname );
     1756        return strcasecmp_m( h1->fullname, h2->fullname );
    17541757}
    17551758
     
    17631766        REGF_NK_REC *nk;
    17641767        REGF_HBIN *vlist_hbin = NULL;
    1765         uint32 size;
    1766 
    1767         if ( !(nk = TALLOC_ZERO_P( file->mem_ctx, REGF_NK_REC )) )
     1768        uint32_t size;
     1769
     1770        if ( !(nk = talloc_zero( file->mem_ctx, REGF_NK_REC )) )
    17681771                return NULL;
    17691772
     
    18041807
    18051808                hash->nk_off = prs_offset( &nk->hbin->ps ) + nk->hbin->first_hbin_off - HBIN_HDR_SIZE;
    1806                 memcpy( hash->keycheck, name, sizeof(uint32) );
     1809                memcpy(hash->keycheck, name, MIN(strlen(name),sizeof(uint32_t)));
    18071810                hash->fullname = talloc_strdup( file->mem_ctx, name );
    18081811                parent->subkey_index++;
     
    18121815
    18131816                if ( !hbin_prs_lf_records( "lf_rec", parent->subkeys.hbin, 0, parent ) )
    1814                         return False;
     1817                        return NULL;
    18151818        }
    18161819
     
    18191822        nk->sk_off = REGF_OFFSET_NONE;
    18201823        if ( sec_desc ) {
    1821                 uint32 sk_size = sk_record_data_size( sec_desc );
     1824                uint32_t sk_size = sk_record_data_size( sec_desc );
    18221825                REGF_HBIN *sk_hbin;
    18231826
     
    18311834                        }
    18321835
    1833                         if ( !(nk->sec_desc = TALLOC_ZERO_P( file->mem_ctx, REGF_SK_REC )) )
     1836                        if ( !(nk->sec_desc = talloc_zero( file->mem_ctx, REGF_SK_REC )) )
    18341837                                return NULL;
    18351838       
     
    18481851                        /* size value must be self-inclusive */
    18491852                        nk->sec_desc->size      = ndr_size_security_descriptor(sec_desc, 0)
    1850                                 + sizeof(uint32);
    1851 
    1852                         DLIST_ADD_END( file->sec_desc_list, nk->sec_desc, REGF_SK_REC *);
     1853                                + sizeof(uint32_t);
     1854
     1855                        DLIST_ADD_END( file->sec_desc_list, nk->sec_desc);
    18531856
    18541857                        /* update the offsets for us and the previous sd in the list.
     
    18831886        nk->subkeys_off = REGF_OFFSET_NONE;
    18841887        if ( (nk->num_subkeys = regsubkey_ctr_numkeys( subkeys )) != 0 ) {
    1885                 uint32 lf_size = lf_record_data_size( nk->num_subkeys );
    1886                 uint32 namelen;
     1888                uint32_t lf_size = lf_record_data_size( nk->num_subkeys );
     1889                uint32_t namelen;
    18871890                int i;
    18881891               
     
    18981901                nk->subkeys.num_keys = nk->num_subkeys;
    18991902                if (nk->subkeys.num_keys) {
    1900                         if ( !(nk->subkeys.hashes = TALLOC_ZERO_ARRAY( file->mem_ctx, REGF_HASH_REC, nk->subkeys.num_keys )) )
     1903                        if ( !(nk->subkeys.hashes = talloc_zero_array( file->mem_ctx, REGF_HASH_REC, nk->subkeys.num_keys )) )
    19011904                                return NULL;
    19021905                } else {
     
    19171920        nk->values_off = REGF_OFFSET_NONE;
    19181921        if ( (nk->num_values = regval_ctr_numvals( values )) != 0 ) {
    1919                 uint32 vlist_size = ( ( nk->num_values * sizeof(uint32) ) & 0xfffffff8 ) + 8;
     1922                uint32_t vlist_size = ( ( nk->num_values * sizeof(uint32_t) ) & 0xfffffff8 ) + 8;
    19201923                int i;
    19211924               
     
    19261929       
    19271930                if (nk->num_values) {
    1928                         if ( !(nk->values = TALLOC_ARRAY( file->mem_ctx, REGF_VK_REC, nk->num_values )) )
     1931                        if ( !(nk->values = talloc_array( file->mem_ctx, REGF_VK_REC, nk->num_values )) )
    19291932                                return NULL;
    19301933                } else {
     
    19351938
    19361939                for ( i=0; i<nk->num_values; i++ ) {
    1937                         uint32 vk_size, namelen, datalen;
     1940                        uint32_t vk_size, namelen, datalen;
    19381941                        struct regval_blob *r;
    19391942
     
    19641967        prs_set_offset( &nk->hbin->ps, nk->hbin_off );
    19651968        if ( !prs_nk_rec( "nk_rec", &nk->hbin->ps, 0, nk ) )
    1966                 return False;
     1969                return NULL;
    19671970
    19681971        if ( nk->num_values ) {
    19691972                if ( !hbin_prs_vk_records( "vk_records", vlist_hbin, 0, nk, file ) )
    1970                         return False;
     1973                        return NULL;
    19711974        }
    19721975
Note: See TracChangeset for help on using the changeset viewer.