~ubuntu-branches/ubuntu/vivid/samba/vivid

« back to all changes in this revision

Viewing changes to testprogs/win32/midltests/valid/midltests-pipe-sync-ndr32-downgrade-02.idl

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2011-12-21 13:18:04 UTC
  • mfrom: (0.39.21 sid)
  • Revision ID: package-import@ubuntu.com-20111221131804-xtlr39wx6njehxxr
Tags: 2:3.6.1-3ubuntu1
* Merge from Debian testing.  Remaining changes:
  + debian/patches/VERSION.patch:
    - set SAMBA_VERSION_SUFFIX to Ubuntu.
  + debian/patches/error-trans.fix-276472:
    - Add the translation of Unix Error code -ENOTSUP to NT Error Code
    - NT_STATUS_NOT_SUPPORTED to prevent the Permission denied error.
  + debian/smb.conf:
    - add "(Samba, Ubuntu)" to server string.
    - comment out the default [homes] share, and add a comment about
      "valid users = %S" to show users how to restrict access to
      \\server\username to only username.
    - Set 'usershare allow guests', so that usershare admins are 
      allowed to create public shares in addition to authenticated
      ones.
    - add map to guest = Bad user, maps bad username to guest access.
  + debian/samba-common.config:
    - Do not change priority to high if dhclient3 is installed.
    - Use priority medium instead of high for the workgroup question.
  + debian/control:
    - Don't build against or suggest ctdb.
    - Add dependency on samba-common-bin to samba.
  + Add ufw integration:
    - Created debian/samba.ufw.profile
    - debian/rules, debian/samba.dirs, debian/samba.files: install
      profile
    - debian/control: have samba suggest ufw
  + Add apport hook:
    - Created debian/source_samba.py.
    - debian/rules, debian/samba.dirs, debian/samba-common-bin.files: install
  + Switch to upstart:
    - Add debian/samba.{nmbd,smbd}.upstart.
  + debian/samba.logrotate, debian/samba-common.dhcp, debian/samba.if-up:
    - Make them upstart compatible
  + debian/samba.postinst: 
    - Avoid scary pdbedit warnings on first import.
  + debian/samba-common.postinst: Add more informative error message for
    the case where smb.conf was manually deleted
  + debian/patches/fix-debuglevel-name-conflict.patch: don't use 'debug_level'
    as a global variable name in an NSS module 
  + Dropped:
    - debian/patches/error-trans.fix-276472
    - debian/patches/fix-debuglevel-name-conflict.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef MIDLTESTS_C_CODE
 
2
 
 
3
/*
 
4
 * For midltests_tcp.exe you may want to
 
5
 * redirect the traffic via rinetd
 
6
 * with a /etc/rinetd.conf like this:
 
7
 *
 
8
 * 172.31.9.1 5032 172.31.9.8 5032
 
9
 * 172.31.9.1 5064 172.31.9.8 5064
 
10
 *
 
11
 * This is useful to watch the traffic with
 
12
 * a network sniffer.
 
13
 */
 
14
/*
 
15
cpp_quote("#define LISTEN_IP \"0.0.0.0\"")
 
16
cpp_quote("#define FORWARD_IP \"127.0.0.1\"")
 
17
cpp_quote("#define CONNECT_IP \"172.31.9.1\"")
 
18
*/
 
19
 
 
20
/*
 
21
 * With midltests_tcp.exe NDR64 is enforced by default.
 
22
 * For testing it might be needed to allow downgrades
 
23
 * to NDR32. This is needed when you use 'pipe'.
 
24
 */
 
25
cpp_quote("#define DONOT_FORCE_NDR64 1")
 
26
 
 
27
[
 
28
  uuid("225b9fcb-eb3d-497b-8b0b-591f049a2507"),
 
29
  pointer_default(unique)
 
30
]
 
31
interface midltests
 
32
{
 
33
        typedef pipe char pipe_char;
 
34
        typedef pipe hyper pipe_hyper;
 
35
        typedef struct {
 
36
                long l;
 
37
                short s;
 
38
        } structtype;
 
39
        typedef pipe structtype pipe_structtype;
 
40
 
 
41
        struct msg {
 
42
                long l;
 
43
                [size_is(l)] char *m;
 
44
        };
 
45
 
 
46
        long midltests_fn(
 
47
                [out,ref] struct msg *out1,
 
48
                [out] pipe_structtype outp,
 
49
                [in] pipe_structtype inp,
 
50
                [in] struct msg in1
 
51
        );
 
52
 
 
53
        long midltests_ping( [in] struct msg in1);
 
54
 
 
55
}
 
56
 
 
57
#elif MIDLTESTS_C_CODE
 
58
 
 
59
struct pipe_char_state {
 
60
        const char *name;
 
61
        unsigned long count;
 
62
        unsigned long sleep;
 
63
};
 
64
 
 
65
void pipe_char_pull(
 
66
            char * _state,
 
67
            unsigned char * buf,
 
68
            unsigned long esize,
 
69
            unsigned long * ecount)
 
70
{
 
71
        struct pipe_char_state *state = (struct pipe_char_state *)_state;
 
72
 
 
73
        printf("pull1:%s: esize[%u] ecount[%u]\n",
 
74
                state->name, esize, *ecount);
 
75
        *ecount = state->count--;
 
76
        if (*ecount > esize) {
 
77
                *ecount = esize;
 
78
        }
 
79
        memset(buf, 0xDD, *ecount * sizeof(*buf));
 
80
        printf("pull2:%s: esize[%u] ecount[%u]\n",
 
81
                state->name, esize, *ecount);
 
82
}
 
83
 
 
84
void pipe_char_push(
 
85
            char * _state,
 
86
            unsigned char * buf,
 
87
            unsigned long ecount)
 
88
{
 
89
        struct pipe_char_state *state = (struct pipe_char_state *)_state;
 
90
 
 
91
        printf("push:%s: ecount[%u]\n",
 
92
                state->name, ecount);
 
93
}
 
94
 
 
95
void pipe_char_alloc(
 
96
            char * _state,
 
97
            unsigned long bsize,
 
98
            unsigned char * * buf,
 
99
            unsigned long * bcount)
 
100
{
 
101
        struct pipe_char_state *state = (struct pipe_char_state *)_state;
 
102
 
 
103
        printf("alloc1:%s: bsize[%u], bcount[%u]\n",
 
104
                state->name, bsize, *bcount);
 
105
        *bcount = bsize / sizeof(**buf);
 
106
        *buf = malloc(*bcount * sizeof(**buf));
 
107
        printf("alloc2:%s: bsize[%u], bcount[%u]\n",
 
108
                state->name, bsize, *bcount);
 
109
}
 
110
 
 
111
struct pipe_hyper_state {
 
112
        const char *name;
 
113
        unsigned long count;
 
114
        unsigned long sleep;
 
115
};
 
116
 
 
117
void pipe_hyper_pull(
 
118
            char * _state,
 
119
            hyper * buf,
 
120
            unsigned long esize,
 
121
            unsigned long * ecount)
 
122
{
 
123
        struct pipe_hyper_state *state = (struct pipe_hyper_state *)_state;
 
124
 
 
125
        printf("pull1:%s: esize[%u] ecount[%u]\n",
 
126
                state->name, esize, *ecount);
 
127
        *ecount = state->count--;
 
128
        if (*ecount > esize) {
 
129
                *ecount = esize;
 
130
        }
 
131
        memset(buf, 0xDD, *ecount * sizeof(*buf));
 
132
        printf("pull2:%s: esize[%u] ecount[%u]\n",
 
133
                state->name, esize, *ecount);
 
134
}
 
135
 
 
136
void pipe_hyper_push(
 
137
            char * _state,
 
138
            hyper * buf,
 
139
            unsigned long ecount)
 
140
{
 
141
        struct pipe_hyper_state *state = (struct pipe_hyper_state *)_state;
 
142
 
 
143
        printf("push:%s: ecount[%u]\n",
 
144
                state->name, ecount);
 
145
}
 
146
 
 
147
void pipe_hyper_alloc(
 
148
            char * _state,
 
149
            unsigned long bsize,
 
150
            hyper * * buf,
 
151
            unsigned long * bcount)
 
152
{
 
153
        struct pipe_hyper_state *state = (struct pipe_hyper_state *)_state;
 
154
 
 
155
        printf("alloc1:%s: bsize[%u], bcount[%u]\n",
 
156
                state->name, bsize, *bcount);
 
157
        *bcount = bsize / sizeof(**buf);
 
158
        *buf = malloc(*bcount * sizeof(**buf));
 
159
        printf("alloc2:%s: bsize[%u], bcount[%u]\n",
 
160
                state->name, bsize, *bcount);
 
161
}
 
162
struct pipe_structtype_state {
 
163
        const char *name;
 
164
        unsigned long count;
 
165
        unsigned long sleep;
 
166
};
 
167
 
 
168
void pipe_structtype_pull(
 
169
            char * _state,
 
170
            structtype * buf,
 
171
            unsigned long esize,
 
172
            unsigned long * ecount)
 
173
{
 
174
        struct pipe_structtype_state *state = (struct pipe_structtype_state *)_state;
 
175
 
 
176
        printf("pull1:%s: esize[%u] ecount[%u]\n",
 
177
                state->name, esize, *ecount);
 
178
        *ecount = state->count--;
 
179
        if (*ecount > esize) {
 
180
                *ecount = esize;
 
181
        }
 
182
        memset(buf, 0xDD, *ecount * sizeof(*buf));
 
183
        printf("pull2:%s: esize[%u] ecount[%u]\n",
 
184
                state->name, esize, *ecount);
 
185
}
 
186
 
 
187
void pipe_structtype_push(
 
188
            char * _state,
 
189
            structtype * buf,
 
190
            unsigned long ecount)
 
191
{
 
192
        struct pipe_structtype_state *state = (struct pipe_structtype_state *)_state;
 
193
 
 
194
        printf("push:%s: ecount[%u]\n",
 
195
                state->name, ecount);
 
196
}
 
197
 
 
198
void pipe_structtype_alloc(
 
199
            char * _state,
 
200
            unsigned long bsize,
 
201
            structtype * * buf,
 
202
            unsigned long * bcount)
 
203
{
 
204
        struct pipe_structtype_state *state = (struct pipe_structtype_state *)_state;
 
205
 
 
206
        printf("alloc1:%s: bsize[%u], bcount[%u]\n",
 
207
                state->name, bsize, *bcount);
 
208
        *bcount = bsize / sizeof(**buf);
 
209
        *buf = malloc(*bcount * sizeof(**buf));
 
210
        printf("alloc2:%s: bsize[%u], bcount[%u]\n",
 
211
                state->name, bsize, *bcount);
 
212
}
 
213
static void midltests(void)
 
214
{
 
215
        struct msg out1;
 
216
        unsigned char out1b[3];
 
217
        struct pipe_structtype_state outs;
 
218
        pipe_structtype outp;
 
219
        struct pipe_structtype_state ins;
 
220
        pipe_structtype inp;
 
221
        struct msg in1;
 
222
        unsigned char in1b[3000];
 
223
 
 
224
        in1.l = sizeof(in1b);
 
225
        memset(&in1b, 0xAA, sizeof(in1b));
 
226
        in1.m = in1b;
 
227
 
 
228
        memset(&outs, 0, sizeof(outs));
 
229
        outs.name = "outp";
 
230
        memset(&outp, 0, sizeof(outp));
 
231
        outp.pull = pipe_structtype_pull;
 
232
        outp.push = pipe_structtype_push;
 
233
        outp.alloc = pipe_structtype_alloc;
 
234
        outp.state = (char *)&outs;
 
235
 
 
236
        memset(&ins, 0, sizeof(ins));
 
237
        ins.name = "inp";
 
238
        ins.count = 35;
 
239
        memset(&inp, 0, sizeof(inp));
 
240
        inp.pull = pipe_structtype_pull;
 
241
        inp.push = pipe_structtype_push;
 
242
        inp.alloc = pipe_structtype_alloc;
 
243
        inp.state = (char *)&ins;
 
244
 
 
245
        out1.l = sizeof(out1b);
 
246
        memset(&out1b, 0xFF, sizeof(out1b));
 
247
        out1.m = out1b;
 
248
 
 
249
        cli_midltests_ping(in1);
 
250
        cli_midltests_fn(&out1, outp, inp, in1);
 
251
}
 
252
 
 
253
long srv_midltests_fn(
 
254
            /* [ref][out] */ struct msg *out1,
 
255
    /* [out] */ pipe_structtype outp,
 
256
    /* [in] */ pipe_structtype inp,
 
257
    /* [in] */ struct msg in1)
 
258
{
 
259
        structtype inb[2500];
 
260
        unsigned long inb_len = 0;
 
261
        structtype *outb = NULL;
 
262
        unsigned long outb_size = 0;
 
263
        unsigned long outb_len = 0;
 
264
 
 
265
        printf("srv_midltests_fn: Start\n");
 
266
        fflush(stdout);
 
267
 
 
268
        do {
 
269
                inp.pull(inp.state, inb, sizeof(inb), &inb_len);
 
270
                printf("pull inp_len[%u]\n", inb_len);
 
271
                fflush(stdout);
 
272
        } while (inb_len > 0);
 
273
 
 
274
        outb_size = 50;
 
275
        do {
 
276
                outp.alloc(outp.state, outb_size, &outb, &outb_len);
 
277
                memset(outb, 0xCC, outb_len * sizeof(*outb));
 
278
                printf("push outb_len[%u]\n", outb_len);
 
279
                fflush(stdout);
 
280
                outp.push(outp.state, outb, outb_len);
 
281
                //Sleep(1000);
 
282
                outb_size--;
 
283
        } while (outb_len > 0);
 
284
 
 
285
        out1->l = 3;
 
286
        out1->m = (unsigned char *)malloc(out1->l);
 
287
        memset(out1->m, 0xBB, out1->l);
 
288
        printf("srv_midltests_fn: End\n");
 
289
        fflush(stdout);
 
290
        return 0x65757254;
 
291
}
 
292
 
 
293
long srv_midltests_ping(
 
294
    /* [in] */ struct msg in1)
 
295
{
 
296
        printf("srv_midltests_fn: Start\n");
 
297
        printf("srv_midltests_fn: End\n");
 
298
        return 0x65757254;
 
299
}
 
300
#endif