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/libcli/nbt/nbtname.c

    r594 r740  
    2828#include "librpc/gen_ndr/ndr_misc.h"
    2929#include "system/locale.h"
     30#include "lib/util/util_net.h"
    3031
    3132/* don't allow an unlimited number of name components */
     
    4950{
    5051        uint8_t len;
    51         uint_t loops = 0;
     52        unsigned int loops = 0;
    5253        while (loops < 5) {
    5354                if (*offset >= ndr->data_size) {
     
    176177
    177178                /* we need to make sure the length fits into 6 bytes */
    178                 if (complen >= 0x3F) {
     179                if (complen > 0x3F) {
    179180                        return ndr_push_error(ndr, NDR_ERR_STRING,
    180                                               "component length %u[%08X] > 0x00003F",
     181                                              "component length %u[%08X] > 0x0000003F",
    181182                                              (unsigned)complen, (unsigned)complen);
    182183                }
     
    383384  push a nbt name into a blob
    384385*/
    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)
    386387{
    387388        enum ndr_err_code ndr_err;
    388389
    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);
    390391        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
    391392                return ndr_map_error2ntstatus(ndr_err);
     
    402403        enum ndr_err_code ndr_err;
    403404
    404         ndr_err = ndr_pull_struct_blob(blob, mem_ctx, NULL, name,
     405        ndr_err = ndr_pull_struct_blob(blob, mem_ctx, name,
    405406                                       (ndr_pull_flags_fn_t)ndr_pull_nbt_name);
    406407        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
     
    520521        NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, namebuf, namebuf_len));
    521522
     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
    522536        NDR_PULL_ALLOC(ndr, r);
    523537
     
    548562        if (!r->name) return ndr_pull_error(ndr, NDR_ERR_ALLOC, "out of memory");
    549563
    550         if (namebuf_len > 18) {
    551                 r->scope = talloc_strndup(r, (char *)(namebuf+17), namebuf_len-17);
     564        if (namebuf_len > 17) {
     565                r->scope = talloc_strndup(r, (char *)(namebuf+16), namebuf_len-17);
    552566                if (!r->scope) return ndr_pull_error(ndr, NDR_ERR_ALLOC, "out of memory");
    553567        } else {
     
    617631        NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, namebuf_len));
    618632        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        }
    619645
    620646        talloc_free(namebuf);
Note: See TracChangeset for help on using the changeset viewer.