Ignore:
Timestamp:
May 24, 2009, 7:17:10 AM (17 years ago)
Author:
Herwig Bauernfeind
Message:

Update Samba 3.3 to 3.3.1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.3.x/source/registry/reg_backend_db.c

    r206 r221  
    537537
    538538        for (i=0; i<num_subkeys; i++) {
    539                 len += tdb_pack(buffer+len, buflen-len, "f",
    540                                 regsubkey_ctr_specific_key(ctr, i));
    541                 if (len > buflen) {
    542                         /* allocate some extra space */
    543                         buffer = (uint8 *)SMB_REALLOC(buffer, len*2);
     539                size_t thistime;
     540
     541                thistime = tdb_pack(buffer+len, buflen-len, "f",
     542                                    regsubkey_ctr_specific_key(ctr, i));
     543                if (len+thistime > buflen) {
     544                        size_t thistime2;
     545                        /*
     546                         * tdb_pack hasn't done anything because of the short
     547                         * buffer, allocate extra space.
     548                         */
     549                        buffer = SMB_REALLOC_ARRAY(buffer, uint8_t,
     550                                                   (len+thistime)*2);
    544551                        if(buffer == NULL) {
    545552                                DEBUG(0, ("regdb_store_keys: Failed to realloc "
    546                                           "memory of size [%d]\n", len*2));
     553                                          "memory of size [%u]\n",
     554                                          (unsigned int)(len+thistime)*2));
    547555                                ret = false;
    548556                                goto done;
    549557                        }
    550                         buflen = len*2;
    551                         len = tdb_pack(buffer+len, buflen-len, "f",
    552                                        regsubkey_ctr_specific_key(ctr, i));
    553                 }
     558                        buflen = (len+thistime)*2;
     559                        thistime2 = tdb_pack(
     560                                buffer+len, buflen-len, "f",
     561                                regsubkey_ctr_specific_key(ctr, i));
     562                        if (thistime2 != thistime) {
     563                                DEBUG(0, ("tdb_pack failed\n"));
     564                                ret = false;
     565                                goto done;
     566                        }
     567                }
     568                len += thistime;
    554569        }
    555570
     
    928943int regdb_fetch_keys(const char *key, REGSUBKEY_CTR *ctr)
    929944{
    930         WERROR werr;
    931945        uint32 num_items;
    932946        uint8 *buf;
     
    959973        len = tdb_unpack( buf, buflen, "d", &num_items);
    960974
     975
     976
     977
     978
     979
     980
     981
     982
     983
     984
     985
     986
     987
     988
     989
     990
     991
     992
     993
     994
     995
    961996        for (i=0; i<num_items; i++) {
    962997                len += tdb_unpack(buf+len, buflen-len, "f", subkeyname);
    963                 werr = regsubkey_ctr_addkey(ctr, subkeyname);
    964                 if (!W_ERROR_IS_OK(werr)) {
    965                         DEBUG(5, ("regdb_fetch_keys: regsubkey_ctr_addkey "
    966                                   "failed: %s\n", dos_errstr(werr)));
     998                ctr->subkeys[i] = talloc_strdup(ctr->subkeys, subkeyname);
     999                if (ctr->subkeys[i] == NULL) {
     1000                        DEBUG(5, ("regdb_fetch_keys: could not allocate "
     1001                                  "subkeyname\n"));
     1002                        TALLOC_FREE(ctr->subkeys);
     1003                        ctr->num_subkeys = 0;
    9671004                        goto done;
    9681005                }
Note: See TracChangeset for help on using the changeset viewer.