Ignore:
Timestamp:
Nov 14, 2012, 12:59:34 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to 3.6.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source4/lib/registry/patchfile_preg.c

    r414 r740  
    3434        uint16_t v;
    3535
    36         if (read(fd, &v, 2) < 2) {
     36        if (read(fd, &v, ) {
    3737                return WERR_GENERAL_FAILURE;
    3838        }
     
    4242static WERROR preg_write_utf16(int fd, const char *string)
    4343{
    44         codepoint_t v;
    45         uint16_t i;
    46         size_t size;
     44        uint16_t v;
     45        size_t i, size;
    4746
    4847        for (i = 0; i < strlen(string); i+=size) {
    4948                v = next_codepoint(&string[i], &size);
    50                 if (write(fd, &v, 2) < 2) {
     49                if (write(fd, &v, ) {
    5150                        return WERR_GENERAL_FAILURE;
    5251                }
     
    8988        char *parent_name;
    9089        DATA_BLOB blob;
    91 
    92         parent_name = talloc_strndup(data->ctx, key_name, strrchr(key_name, '\\')-key_name);
    93         blob.data = (uint8_t *)talloc_strndup(data->ctx, key_name+(strrchr(key_name, '\\')-key_name)+1,
    94                         strlen(key_name)-(strrchr(key_name, '\\')-key_name));
     90        WERROR werr;
     91
     92        parent_name = talloc_strndup(data->ctx, key_name,
     93                                     strrchr(key_name, '\\')-key_name);
     94        W_ERROR_HAVE_NO_MEMORY(parent_name);
     95        blob.data = (uint8_t*)talloc_strndup(data->ctx,
     96                                             key_name+(strrchr(key_name, '\\')-key_name)+1,
     97                                             strlen(key_name)-(strrchr(key_name, '\\')-key_name));
     98        W_ERROR_HAVE_NO_MEMORY(blob.data);
    9599        blob.length = strlen((char *)blob.data)+1;
    96100       
    97101
    98102        /* FIXME: These values should be accumulated to be written at done(). */
    99         return reg_preg_diff_set_value(data, parent_name, "**DeleteKeys", REG_SZ, blob);
     103        werr = reg_preg_diff_set_value(data, parent_name, "**DeleteKeys",
     104                                       REG_SZ, blob);
     105
     106        talloc_free(parent_name);
     107        talloc_free(blob.data);
     108
     109        return werr;
    100110}
    101111
     
    106116        char *val;
    107117        DATA_BLOB blob;
     118
    108119
    109120        val = talloc_asprintf(data->ctx, "**Del.%s", value_name);
    110 
     121        W_ERROR_HAVE_NO_MEMORY(val);
    111122        blob.data = (uint8_t *)talloc(data->ctx, uint32_t);
    112         *(uint32_t *)blob.data = 0;
    113         blob.length = 4;
    114         return reg_preg_diff_set_value(data, key_name, val, REG_DWORD, blob);
     123        W_ERROR_HAVE_NO_MEMORY(blob.data);
     124        SIVAL(blob.data, 0, 0);
     125        blob.length = sizeof(uint32_t);
     126
     127        werr = reg_preg_diff_set_value(data, key_name, val, REG_DWORD, blob);
     128
     129        talloc_free(val);
     130        talloc_free(blob.data);
     131
     132        return werr;
    115133}
    116134
     
    119137        struct preg_data *data = (struct preg_data *)_data;
    120138        DATA_BLOB blob;
     139
    121140
    122141        blob.data = (uint8_t *)talloc(data->ctx, uint32_t);
    123         *(uint32_t *)blob.data = 0;     
    124         blob.length = 4;
    125 
    126         return reg_preg_diff_set_value(data, key_name, "**DelVals.", REG_DWORD, blob);
     142        W_ERROR_HAVE_NO_MEMORY(blob.data);
     143        SIVAL(blob.data, 0, 0);
     144        blob.length = sizeof(uint32_t);
     145
     146        werr = reg_preg_diff_set_value(data, key_name, "**DelVals.", REG_DWORD,
     147                                       blob);
     148
     149        talloc_free(blob.data);
     150
     151        return werr;
    127152}
    128153
     
    140165 */
    141166_PUBLIC_ WERROR reg_preg_diff_save(TALLOC_CTX *ctx, const char *filename,
    142                                    struct smb_iconv_convenience *ic,
    143167                                   struct reg_diff_callbacks **callbacks,
    144168                                   void **callback_data)
     
    165189
    166190        strncpy(preg_header.hdr, "PReg", 4);
    167         SIVAL(&preg_header, 4, 1);
    168         write(data->fd, (uint8_t *)&preg_header,8);
     191        SIVAL(&preg_header, 1);
     192        write(data->fd, (uint8_t *)&preg_header,);
    169193
    170194        data->ctx = ctx;
     
    185209 */
    186210_PUBLIC_ WERROR reg_preg_diff_load(int fd,
    187                                    struct smb_iconv_convenience *iconv_convenience,
    188211                                   const struct reg_diff_callbacks *callbacks,
    189212                                   void *callback_data)
     
    206229
    207230        /* Read first 8 bytes (the header) */
    208         if (read(fd, &preg_header, 8) != 8) {
     231        if (read(fd, &preg_header, ) {
    209232                DEBUG(0, ("Could not read PReg file: %s\n",
    210233                                strerror(errno)));
     
    255278
    256279                /* Get the type */
    257                 if (read(fd, &value_type, 4) < 4) {
     280                if (read(fd, &value_type, ) {
    258281                        DEBUG(0, ("Error while reading PReg\n"));
    259282                        ret = WERR_GENERAL_FAILURE;
     
    270293                        goto cleanup;
    271294                }
     295
    272296                /* Get data length */
    273                 if (read(fd, &length, 4) < 4) {
     297                if (read(fd, &length, ) {
    274298                        DEBUG(0, ("Error while reading PReg\n"));
    275299                        ret = WERR_GENERAL_FAILURE;
    276300                        goto cleanup;
    277301                }
     302
     303
    278304                /* Read past delimiter */
    279305                buf_ptr = buf;
     
    284310                        goto cleanup;
    285311                }
     312
    286313                /* Get the data */
    287314                buf_ptr = buf;
Note: See TracChangeset for help on using the changeset viewer.