[SCM] Samba Shared Repository - branch master updated
Stefan Metzmacher
metze at samba.org
Tue Sep 28 19:36:03 MDT 2010
The branch, master has been updated
via e2c305d midltests/todo: add some random idl files I had tested month ago
via ad99711 midltests: add midltests-pipe-sync-ndr32-downgrade-01.idl example
via c5e221c midltests: add some usefull defines to midltests.idl
via 0610868 midltests: make it possible to allow downgrades to NDR32
from 115ad60 midltests: add a midltests_tcp.exe tool
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit e2c305deb1553ab8ba11fa687dcf1c08f2acd88a
Author: Stefan Metzmacher <metze at samba.org>
Date: Tue Sep 28 09:57:22 2010 +0200
midltests/todo: add some random idl files I had tested month ago
metze
commit ad99711f4968cb07b85cead5beb8351f63395004
Author: Stefan Metzmacher <metze at samba.org>
Date: Wed Sep 29 02:36:51 2010 +0200
midltests: add midltests-pipe-sync-ndr32-downgrade-01.idl example
metze
commit c5e221c5f88cbc557a6978bc062f5efef224b94a
Author: Stefan Metzmacher <metze at samba.org>
Date: Wed Sep 29 02:50:19 2010 +0200
midltests: add some usefull defines to midltests.idl
metze
commit 06108687e8949520b29e0016fb9605facfd6f073
Author: Stefan Metzmacher <metze at samba.org>
Date: Wed Sep 29 02:35:54 2010 +0200
midltests: make it possible to allow downgrades to NDR32
metze
-----------------------------------------------------------------------
Summary of changes:
testprogs/win32/midltests/midltests.idl | 273 ++++++++++++++++++-
testprogs/win32/midltests/midltests_tcp.c | 12 +-
.../win32/midltests/todo/midltests-array-range.idl | 39 +++
.../win32/midltests/todo/midltests-pipe-02.idl | 153 ++++++++++
.../midltests/todo/midltests-pipe-03-hyper.idl | 205 ++++++++++++++
.../midltests/todo/midltests-pipe-04-struct.idl | 272 ++++++++++++++++++
.../win32/midltests/todo/midltests-pipe-first.idl | 233 +++++++++++++++
.../midltests/todo/midltests-string-in-out-ref.idl | 33 +++
.../win32/midltests/todo/midltests-transmit-as.idl | 59 ++++
.../midltests/todo/midltests_pointer_default.idl | 20 ++
.../midltests-pipe-sync-ndr32-downgrade-01.idl | 296 ++++++++++++++++++++
.../midltests-pipe-sync-ndr32-downgrade-01.txt | 138 +++++++++
12 files changed, 1727 insertions(+), 6 deletions(-)
create mode 100644 testprogs/win32/midltests/todo/midltests-array-range.idl
create mode 100644 testprogs/win32/midltests/todo/midltests-pipe-02.idl
create mode 100644 testprogs/win32/midltests/todo/midltests-pipe-03-hyper.idl
create mode 100644 testprogs/win32/midltests/todo/midltests-pipe-04-struct.idl
create mode 100755 testprogs/win32/midltests/todo/midltests-pipe-first.idl
create mode 100644 testprogs/win32/midltests/todo/midltests-string-in-out-ref.idl
create mode 100755 testprogs/win32/midltests/todo/midltests-transmit-as.idl
create mode 100755 testprogs/win32/midltests/todo/midltests_pointer_default.idl
create mode 100644 testprogs/win32/midltests/valid/midltests-pipe-sync-ndr32-downgrade-01.idl
create mode 100644 testprogs/win32/midltests/valid/midltests-pipe-sync-ndr32-downgrade-01.txt
Changeset truncated at 500 lines:
diff --git a/testprogs/win32/midltests/midltests.idl b/testprogs/win32/midltests/midltests.idl
index b327657..26ef939 100644
--- a/testprogs/win32/midltests/midltests.idl
+++ b/testprogs/win32/midltests/midltests.idl
@@ -1,27 +1,296 @@
#ifndef MIDLTESTS_C_CODE
+/*
+ * For midltests_tcp.exe you may want to
+ * redirect the traffic via rinetd
+ * with a /etc/rinetd.conf like this:
+ *
+ * 172.31.9.1 5032 172.31.9.8 5032
+ * 172.31.9.1 5064 172.31.9.8 5064
+ *
+ * This is useful to watch the traffic with
+ * a network sniffer.
+ */
+/*
+cpp_quote("#define LISTEN_IP \"0.0.0.0\"")
+cpp_quote("#define FORWARD_IP \"127.0.0.1\"")
+cpp_quote("#define CONNECT_IP \"172.31.9.1\"")
+*/
+
+/*
+ * With midltests_tcp.exe NDR64 is enforced by default.
+ * For testing it might be needed to allow downgrades
+ * to NDR32. This is needed when you use 'pipe'.
+ */
+cpp_quote("#define DONOT_FORCE_NDR64 1")
+
[
uuid("225b9fcb-eb3d-497b-8b0b-591f049a2507"),
pointer_default(unique)
]
interface midltests
{
+ typedef pipe char pipe_char;
+ typedef pipe hyper pipe_hyper;
+ typedef struct {
+ long l;
+ short s;
+ } structtype;
+ typedef pipe structtype pipe_structtype;
+
+ struct msg {
+ long l;
+ [size_is(l)] char *m;
+ };
+
long midltests_fn(
+ [out,ref] struct msg *out1,
+ [out] pipe_structtype outp,
+ [in] pipe_structtype inp,
+ [in] struct msg in1
);
+
+ long midltests_ping( [in] struct msg in1);
+
}
#elif MIDLTESTS_C_CODE
+struct pipe_char_state {
+ const char *name;
+ unsigned long count;
+ unsigned long sleep;
+};
+
+void pipe_char_pull(
+ char * _state,
+ unsigned char * buf,
+ unsigned long esize,
+ unsigned long * ecount)
+{
+ struct pipe_char_state *state = (struct pipe_char_state *)_state;
+
+ printf("pull1:%s: esize[%u] ecount[%u]\n",
+ state->name, esize, *ecount);
+ *ecount = state->count--;
+ if (*ecount > esize) {
+ *ecount = esize;
+ }
+ memset(buf, 0xDD, *ecount * sizeof(*buf));
+ printf("pull2:%s: esize[%u] ecount[%u]\n",
+ state->name, esize, *ecount);
+}
+
+void pipe_char_push(
+ char * _state,
+ unsigned char * buf,
+ unsigned long ecount)
+{
+ struct pipe_char_state *state = (struct pipe_char_state *)_state;
+
+ printf("push:%s: ecount[%u]\n",
+ state->name, ecount);
+}
+
+void pipe_char_alloc(
+ char * _state,
+ unsigned long bsize,
+ unsigned char * * buf,
+ unsigned long * bcount)
+{
+ struct pipe_char_state *state = (struct pipe_char_state *)_state;
+
+ printf("alloc1:%s: bsize[%u], bcount[%u]\n",
+ state->name, bsize, *bcount);
+ *bcount = bsize / sizeof(**buf);
+ *buf = malloc(*bcount * sizeof(**buf));
+ printf("alloc2:%s: bsize[%u], bcount[%u]\n",
+ state->name, bsize, *bcount);
+}
+
+struct pipe_hyper_state {
+ const char *name;
+ unsigned long count;
+ unsigned long sleep;
+};
+
+void pipe_hyper_pull(
+ char * _state,
+ hyper * buf,
+ unsigned long esize,
+ unsigned long * ecount)
+{
+ struct pipe_hyper_state *state = (struct pipe_hyper_state *)_state;
+
+ printf("pull1:%s: esize[%u] ecount[%u]\n",
+ state->name, esize, *ecount);
+ *ecount = state->count--;
+ if (*ecount > esize) {
+ *ecount = esize;
+ }
+ memset(buf, 0xDD, *ecount * sizeof(*buf));
+ printf("pull2:%s: esize[%u] ecount[%u]\n",
+ state->name, esize, *ecount);
+}
+
+void pipe_hyper_push(
+ char * _state,
+ hyper * buf,
+ unsigned long ecount)
+{
+ struct pipe_hyper_state *state = (struct pipe_hyper_state *)_state;
+
+ printf("push:%s: ecount[%u]\n",
+ state->name, ecount);
+}
+
+void pipe_hyper_alloc(
+ char * _state,
+ unsigned long bsize,
+ hyper * * buf,
+ unsigned long * bcount)
+{
+ struct pipe_hyper_state *state = (struct pipe_hyper_state *)_state;
+
+ printf("alloc1:%s: bsize[%u], bcount[%u]\n",
+ state->name, bsize, *bcount);
+ *bcount = bsize / sizeof(**buf);
+ *buf = malloc(*bcount * sizeof(**buf));
+ printf("alloc2:%s: bsize[%u], bcount[%u]\n",
+ state->name, bsize, *bcount);
+}
+struct pipe_structtype_state {
+ const char *name;
+ unsigned long count;
+ unsigned long sleep;
+};
+
+void pipe_structtype_pull(
+ char * _state,
+ structtype * buf,
+ unsigned long esize,
+ unsigned long * ecount)
+{
+ struct pipe_structtype_state *state = (struct pipe_structtype_state *)_state;
+
+ printf("pull1:%s: esize[%u] ecount[%u]\n",
+ state->name, esize, *ecount);
+ *ecount = state->count--;
+ if (*ecount > esize) {
+ *ecount = esize;
+ }
+ memset(buf, 0xDD, *ecount * sizeof(*buf));
+ printf("pull2:%s: esize[%u] ecount[%u]\n",
+ state->name, esize, *ecount);
+}
+
+void pipe_structtype_push(
+ char * _state,
+ structtype * buf,
+ unsigned long ecount)
+{
+ struct pipe_structtype_state *state = (struct pipe_structtype_state *)_state;
+
+ printf("push:%s: ecount[%u]\n",
+ state->name, ecount);
+}
+
+void pipe_structtype_alloc(
+ char * _state,
+ unsigned long bsize,
+ structtype * * buf,
+ unsigned long * bcount)
+{
+ struct pipe_structtype_state *state = (struct pipe_structtype_state *)_state;
+
+ printf("alloc1:%s: bsize[%u], bcount[%u]\n",
+ state->name, bsize, *bcount);
+ *bcount = bsize / sizeof(**buf);
+ *buf = malloc(*bcount * sizeof(**buf));
+ printf("alloc2:%s: bsize[%u], bcount[%u]\n",
+ state->name, bsize, *bcount);
+}
static void midltests(void)
{
- cli_midltests_fn();
+ struct msg out1;
+ unsigned char out1b[3];
+ struct pipe_structtype_state outs;
+ pipe_structtype outp;
+ struct pipe_structtype_state ins;
+ pipe_structtype inp;
+ struct msg in1;
+ unsigned char in1b[3];
+
+ in1.l = sizeof(in1b);
+ memset(&in1b, 0xAA, sizeof(in1b));
+ in1.m = in1b;
+
+ memset(&outs, 0, sizeof(outs));
+ outs.name = "outp";
+ memset(&outp, 0, sizeof(outp));
+ outp.pull = pipe_structtype_pull;
+ outp.push = pipe_structtype_push;
+ outp.alloc = pipe_structtype_alloc;
+ outp.state = (char *)&outs;
+
+ memset(&ins, 0, sizeof(ins));
+ ins.name = "inp";
+ ins.count = 1;
+ memset(&inp, 0, sizeof(inp));
+ inp.pull = pipe_structtype_pull;
+ inp.push = pipe_structtype_push;
+ inp.alloc = pipe_structtype_alloc;
+ inp.state = (char *)&ins;
+
+ out1.l = sizeof(out1b);
+ memset(&out1b, 0xFF, sizeof(out1b));
+ out1.m = out1b;
+
+ cli_midltests_ping(in1);
+ cli_midltests_fn(&out1, outp, inp, in1);
}
-long srv_midltests_fn(void)
+long srv_midltests_fn(
+ /* [ref][out] */ struct msg *out1,
+ /* [out] */ pipe_structtype outp,
+ /* [in] */ pipe_structtype inp,
+ /* [in] */ struct msg in1)
{
+ structtype inb[500];
+ unsigned long inb_len = 0;
+ structtype *outb = NULL;
+ unsigned long outb_size = 0;
+ unsigned long outb_len = 0;
+
printf("srv_midltests_fn: Start\n");
+
+ do {
+ inp.pull(inp.state, inb, sizeof(inb), &inb_len);
+ printf("pull inp_len[%u]\n", inb_len);
+ } while (inb_len > 0);
+
+ outb_size = 5;
+ do {
+ outp.alloc(outp.state, outb_size, &outb, &outb_len);
+ memset(outb, 0xCC, outb_len * sizeof(*outb));
+ outp.push(outp.state, outb, outb_len);
+ printf("push outb_len[%u]\n", outb_len);
+ //Sleep(1000);
+ outb_size--;
+ } while (outb_len > 0);
+
+ out1->l = 3;
+ out1->m = (unsigned char *)malloc(out1->l);
+ memset(out1->m, 0xBB, out1->l);
printf("srv_midltests_fn: End\n");
return 0x65757254;
}
+long srv_midltests_ping(
+ /* [in] */ struct msg in1)
+{
+ printf("srv_midltests_fn: Start\n");
+ printf("srv_midltests_fn: End\n");
+ return 0x65757254;
+}
#endif
diff --git a/testprogs/win32/midltests/midltests_tcp.c b/testprogs/win32/midltests/midltests_tcp.c
index ca01c62..41a698c 100644
--- a/testprogs/win32/midltests/midltests_tcp.c
+++ b/testprogs/win32/midltests/midltests_tcp.c
@@ -197,13 +197,17 @@ static void change_packet(const char *ctx, BOOL ndr64,
buf[24+0x48] = 0xFF;
printf("%s: disable NDR64\n\n", ctx);
} else if (buf[24] < 3 && ndr64) {
- buf[24] = 0x00;
+ printf("\n%s: got NDR32 downgrade\n\n", ctx);
+#ifndef DONOT_FORCE_NDR64
printf("\n\tERROR!!!\n\n");
- printf("%s: disable NDR32\n", ctx);
- printf("\n");
+ buf[24] = 0x00;
printf("You may need to run 'vcvarsall.bat amd64' before 'nmake tcp'\n");
- } else {
+#endif
+ printf("\n");
+ } else if (buf[24] == 3 && ndr64) {
printf("%s: got NDR64\n\n", ctx);
+ } else {
+ printf("%s: got NDR32\n\n", ctx);
}
//printf("%s: bind with %u pres\n", ctx, buf[24]);
fflush(stdout);
diff --git a/testprogs/win32/midltests/todo/midltests-array-range.idl b/testprogs/win32/midltests/todo/midltests-array-range.idl
new file mode 100644
index 0000000..1d60fd6
--- /dev/null
+++ b/testprogs/win32/midltests/todo/midltests-array-range.idl
@@ -0,0 +1,39 @@
+#ifndef MIDLTESTS_C_CODE
+
+[
+ uuid("225b9fcb-eb3d-497b-8b0b-591f049a2507"),
+ pointer_default(unique)
+]
+interface midltests
+{
+ long midltests_fn(
+ [out,ref] long *count,
+ [out,ref,size_is(,*count),range(0,1)] long **array,
+ [out,ref] long *error
+ );
+}
+
+#elif MIDLTESTS_C_CODE
+
+static void midltests(void)
+{
+ long count;
+ long *array;
+ long error;
+
+ cli_midltests_fn(&count, &array, &error);
+}
+
+long srv_midltests_fn(long *count, long **array, long *error)
+{
+ printf("srv_midltests_fn: Start\n");
+ *count=2;
+ *array=(long *)malloc((*count) * sizeof(long));
+ (*array)[0] = 7;
+ (*array)[1] = 7;
+ *error=0;
+ printf("srv_midltests_fn: End\n");
+ return 0x65757254;
+}
+
+#endif
diff --git a/testprogs/win32/midltests/todo/midltests-pipe-02.idl b/testprogs/win32/midltests/todo/midltests-pipe-02.idl
new file mode 100644
index 0000000..e6be283
--- /dev/null
+++ b/testprogs/win32/midltests/todo/midltests-pipe-02.idl
@@ -0,0 +1,153 @@
+#ifndef MIDLTESTS_C_CODE
+
+[
+ uuid("225b9fcb-eb3d-497b-8b0b-591f049a2507"),
+ pointer_default(unique)
+]
+interface midltests
+{
+ typedef pipe char pipe_char;
+
+ struct msg {
+ long l;
+ [size_is(l)] char *m;
+ };
+
+ long midltests_fn(
+ [out,ref] struct msg *out1,
+ [out] pipe_char outp,
+ [in] pipe_char inp,
+ [in] struct msg in1
+ );
+}
+
+#elif MIDLTESTS_C_CODE
+
+struct pipe_char_state {
+ const char *name;
+ unsigned long count;
+ unsigned long sleep;
+};
+
+void pipe_char_pull(
+ char * _state,
+ unsigned char * buf,
+ unsigned long esize,
+ unsigned long * ecount)
+{
+ struct pipe_char_state *state = (struct pipe_char_state *)_state;
+
+ printf("pull1:%s: esize[%u] ecount[%u]\n",
+ state->name, esize, *ecount);
+ *ecount = state->count--;
+ if (*ecount > esize) {
+ *ecount = esize;
+ }
+ memset(buf, 0xDD, *ecount);
+ printf("pull2:%s: esize[%u] ecount[%u]\n",
+ state->name, esize, *ecount);
+}
+
+void pipe_char_push(
+ char * _state,
+ unsigned char * buf,
+ unsigned long ecount)
+{
+ struct pipe_char_state *state = (struct pipe_char_state *)_state;
+
+ printf("push:%s: ecount[%u]\n",
+ state->name, ecount);
+}
+
+void pipe_char_alloc(
+ char * _state,
+ unsigned long bsize,
+ unsigned char * * buf,
+ unsigned long * bcount)
+{
+ struct pipe_char_state *state = (struct pipe_char_state *)_state;
+
+ printf("alloc1:%s: bsize[%u], bcount[%u]\n",
+ state->name, bsize, *bcount);
+ *bcount = bsize / sizeof(**buf);
+ *buf = malloc(*bcount * sizeof(**buf));
+ printf("alloc2:%s: bsize[%u], bcount[%u]\n",
+ state->name, bsize, *bcount);
+}
+
+static void midltests(void)
+{
+ struct msg out1;
+ unsigned char out1b[3];
+ struct pipe_char_state outs;
+ pipe_char outp;
+ struct pipe_char_state ins;
+ pipe_char inp;
+ struct msg in1;
+ unsigned char in1b[3];
+
+ in1.l = sizeof(in1b);
+ memset(&in1b, 0xAA, sizeof(in1b));
+ in1.m = in1b;
+
+ memset(&outs, 0, sizeof(outs));
+ outs.name = "outp";
+ memset(&outp, 0, sizeof(outp));
+ outp.pull = pipe_char_pull;
+ outp.push = pipe_char_push;
+ outp.alloc = pipe_char_alloc;
+ outp.state = (char *)&outs;
+
+ memset(&ins, 0, sizeof(ins));
+ ins.name = "inp";
+ ins.count = 1;
+ memset(&inp, 0, sizeof(inp));
+ inp.pull = pipe_char_pull;
+ inp.push = pipe_char_push;
+ inp.alloc = pipe_char_alloc;
+ inp.state = (char *)&ins;
+
+ out1.l = sizeof(out1b);
+ memset(&out1b, 0xFF, sizeof(out1b));
+ out1.m = out1b;
+
+ cli_midltests_fn(&out1, outp, inp, in1);
+}
+
+long srv_midltests_fn(
+ /* [ref][out] */ struct msg *out1,
+ /* [out] */ pipe_char outp,
+ /* [in] */ pipe_char inp,
--
Samba Shared Repository
More information about the samba-cvs
mailing list