Changeset 740 for vendor/current/source4/lib/registry/patchfile_preg.c
- Timestamp:
- Nov 14, 2012, 12:59:34 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source4/lib/registry/patchfile_preg.c
r414 r740 34 34 uint16_t v; 35 35 36 if (read(fd, &v, 2) < 2) {36 if (read(fd, &v, ) { 37 37 return WERR_GENERAL_FAILURE; 38 38 } … … 42 42 static WERROR preg_write_utf16(int fd, const char *string) 43 43 { 44 codepoint_t v; 45 uint16_t i; 46 size_t size; 44 uint16_t v; 45 size_t i, size; 47 46 48 47 for (i = 0; i < strlen(string); i+=size) { 49 48 v = next_codepoint(&string[i], &size); 50 if (write(fd, &v, 2) < 2) {49 if (write(fd, &v, ) { 51 50 return WERR_GENERAL_FAILURE; 52 51 } … … 89 88 char *parent_name; 90 89 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); 95 99 blob.length = strlen((char *)blob.data)+1; 96 100 97 101 98 102 /* 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; 100 110 } 101 111 … … 106 116 char *val; 107 117 DATA_BLOB blob; 118 108 119 109 120 val = talloc_asprintf(data->ctx, "**Del.%s", value_name); 110 121 W_ERROR_HAVE_NO_MEMORY(val); 111 122 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; 115 133 } 116 134 … … 119 137 struct preg_data *data = (struct preg_data *)_data; 120 138 DATA_BLOB blob; 139 121 140 122 141 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; 127 152 } 128 153 … … 140 165 */ 141 166 _PUBLIC_ WERROR reg_preg_diff_save(TALLOC_CTX *ctx, const char *filename, 142 struct smb_iconv_convenience *ic,143 167 struct reg_diff_callbacks **callbacks, 144 168 void **callback_data) … … 165 189 166 190 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,); 169 193 170 194 data->ctx = ctx; … … 185 209 */ 186 210 _PUBLIC_ WERROR reg_preg_diff_load(int fd, 187 struct smb_iconv_convenience *iconv_convenience,188 211 const struct reg_diff_callbacks *callbacks, 189 212 void *callback_data) … … 206 229 207 230 /* Read first 8 bytes (the header) */ 208 if (read(fd, &preg_header, 8) != 8) {231 if (read(fd, &preg_header, ) { 209 232 DEBUG(0, ("Could not read PReg file: %s\n", 210 233 strerror(errno))); … … 255 278 256 279 /* Get the type */ 257 if (read(fd, &value_type, 4) < 4) {280 if (read(fd, &value_type, ) { 258 281 DEBUG(0, ("Error while reading PReg\n")); 259 282 ret = WERR_GENERAL_FAILURE; … … 270 293 goto cleanup; 271 294 } 295 272 296 /* Get data length */ 273 if (read(fd, &length, 4) < 4) {297 if (read(fd, &length, ) { 274 298 DEBUG(0, ("Error while reading PReg\n")); 275 299 ret = WERR_GENERAL_FAILURE; 276 300 goto cleanup; 277 301 } 302 303 278 304 /* Read past delimiter */ 279 305 buf_ptr = buf; … … 284 310 goto cleanup; 285 311 } 312 286 313 /* Get the data */ 287 314 buf_ptr = buf;
Note:
See TracChangeset
for help on using the changeset viewer.
