diff options
author | Stefan Metzmacher <metze@samba.org> | 2010-09-29 06:03:08 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2010-09-29 10:49:39 +0200 |
commit | 25e19287f01bec1390ef91ce2f617d78175531be (patch) | |
tree | e5829fd7335b2905fb471ff3f541f268f3e55fe6 /testprogs | |
parent | 437db1452265a27e30fbba1c046ce14d0cffaa64 (diff) | |
download | samba-25e19287f01bec1390ef91ce2f617d78175531be.tar.gz samba-25e19287f01bec1390ef91ce2f617d78175531be.tar.bz2 samba-25e19287f01bec1390ef91ce2f617d78175531be.zip |
midltests: improve NDR64 downgrade
metze
Diffstat (limited to 'testprogs')
-rw-r--r-- | testprogs/win32/midltests/midltests_tcp.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/testprogs/win32/midltests/midltests_tcp.c b/testprogs/win32/midltests/midltests_tcp.c index 41a698c3a9..306a23b377 100644 --- a/testprogs/win32/midltests/midltests_tcp.c +++ b/testprogs/win32/midltests/midltests_tcp.c @@ -168,6 +168,11 @@ static void change_packet(const char *ctx, BOOL ndr64, unsigned char *buf, int len) { struct dcerpc_header *hdr = (struct dcerpc_header *)buf; + BOOL is_ndr64 = FALSE; + const unsigned char ndr64_buf[] = { + 0x33, 0x05, 0x71, 0x71, 0xBA, 0xBE, 0x37, 0x49, + 0x83, 0x19, 0xB5, 0xDB, 0xEF, 0x9C, 0xCC, 0x36 + }; if (len < sizeof(struct dcerpc_header)) { printf("%s: invalid dcerpc pdu len(%d)\n", @@ -193,18 +198,30 @@ static void change_packet(const char *ctx, BOOL ndr64, switch (hdr->ptype) { case 11: /* bind */ - if (buf[24] == 3 && !ndr64) { + case 14: /* alter_req */ + + if (buf[24] >= 2) { + int ret; + + ret = memcmp(&buf[0x60], ndr64_buf, 16); + if (ret == 0) { + is_ndr64 = TRUE; + } + } + + if (is_ndr64 && !ndr64) { buf[24+0x48] = 0xFF; + memset(&buf[0x60], 0xFF, 16); printf("%s: disable NDR64\n\n", ctx); - } else if (buf[24] < 3 && ndr64) { + } else if (!is_ndr64 && ndr64) { printf("\n%s: got NDR32 downgrade\n\n", ctx); #ifndef DONOT_FORCE_NDR64 printf("\n\tERROR!!!\n\n"); - buf[24] = 0x00; + memset(&buf[0x34], 0xFF, 16); printf("You may need to run 'vcvarsall.bat amd64' before 'nmake tcp'\n"); #endif printf("\n"); - } else if (buf[24] == 3 && ndr64) { + } else if (is_ndr64) { printf("%s: got NDR64\n\n", ctx); } else { printf("%s: got NDR32\n\n", ctx); |