Changeset 740 for vendor/current/libcli/nbt/nbtname.c
- Timestamp:
- Nov 14, 2012, 12:59:34 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/libcli/nbt/nbtname.c
r594 r740 28 28 #include "librpc/gen_ndr/ndr_misc.h" 29 29 #include "system/locale.h" 30 #include "lib/util/util_net.h" 30 31 31 32 /* don't allow an unlimited number of name components */ … … 49 50 { 50 51 uint8_t len; 51 u int_t loops = 0;52 unsigned int loops = 0; 52 53 while (loops < 5) { 53 54 if (*offset >= ndr->data_size) { … … 176 177 177 178 /* we need to make sure the length fits into 6 bytes */ 178 if (complen > =0x3F) {179 if (complen > 0x3F) { 179 180 return ndr_push_error(ndr, NDR_ERR_STRING, 180 "component length %u[%08X] > 0x0000 3F",181 "component length %u[%08X] > 0x0000003F", 181 182 (unsigned)complen, (unsigned)complen); 182 183 } … … 383 384 push a nbt name into a blob 384 385 */ 385 _PUBLIC_ NTSTATUS nbt_name_to_blob(TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience,DATA_BLOB *blob, struct nbt_name *name)386 _PUBLIC_ NTSTATUS nbt_name_to_blob(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, struct nbt_name *name) 386 387 { 387 388 enum ndr_err_code ndr_err; 388 389 389 ndr_err = ndr_push_struct_blob(blob, mem_ctx, iconv_convenience,name, (ndr_push_flags_fn_t)ndr_push_nbt_name);390 ndr_err = ndr_push_struct_blob(blob, mem_ctx, name, (ndr_push_flags_fn_t)ndr_push_nbt_name); 390 391 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { 391 392 return ndr_map_error2ntstatus(ndr_err); … … 402 403 enum ndr_err_code ndr_err; 403 404 404 ndr_err = ndr_pull_struct_blob(blob, mem_ctx, NULL,name,405 ndr_err = ndr_pull_struct_blob(blob, mem_ctx, name, 405 406 (ndr_pull_flags_fn_t)ndr_pull_nbt_name); 406 407 if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { … … 520 521 NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, namebuf, namebuf_len)); 521 522 523 if ((namebuf_len % 4) == 0) { 524 /* 525 * [MS-WINSRA] â v20091104 was wrong 526 * regarding section "2.2.10.1 Name Record" 527 * 528 * If the name buffer is already 4 byte aligned 529 * Windows (at least 2003 SP1 and 2008) add 4 extra 530 * bytes. This can happen when the name has a scope. 531 */ 532 uint32_t pad; 533 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &pad)); 534 } 535 522 536 NDR_PULL_ALLOC(ndr, r); 523 537 … … 548 562 if (!r->name) return ndr_pull_error(ndr, NDR_ERR_ALLOC, "out of memory"); 549 563 550 if (namebuf_len > 1 8) {551 r->scope = talloc_strndup(r, (char *)(namebuf+1 7), namebuf_len-17);564 if (namebuf_len > 17) { 565 r->scope = talloc_strndup(r, (char *)(namebuf+16), namebuf_len-17); 552 566 if (!r->scope) return ndr_pull_error(ndr, NDR_ERR_ALLOC, "out of memory"); 553 567 } else { … … 617 631 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, namebuf_len)); 618 632 NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, namebuf, namebuf_len)); 633 634 if ((namebuf_len % 4) == 0) { 635 /* 636 * [MS-WINSRA] â v20091104 was wrong 637 * regarding section "2.2.10.1 Name Record" 638 * 639 * If the name buffer is already 4 byte aligned 640 * Windows (at least 2003 SP1 and 2008) add 4 extra 641 * bytes. This can happen when the name has a scope. 642 */ 643 NDR_CHECK(ndr_push_zero(ndr, 4)); 644 } 619 645 620 646 talloc_free(namebuf);
Note:
See TracChangeset
for help on using the changeset viewer.