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

« back to all changes in this revision

Viewing changes to source3/librpc/gen_ndr/ndr_rot_s.c

  • 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
/* server functions auto-generated by pidl */
 
2
#include "librpc/gen_ndr/ndr_rot.h"
 
3
 
 
4
/* rot - dcerpc server boilerplate generated by pidl */
 
5
 
 
6
 
 
7
static NTSTATUS rot__op_bind(struct dcesrv_call_state *dce_call, const struct dcesrv_interface *iface, uint32_t if_version)
 
8
{
 
9
#ifdef DCESRV_INTERFACE_ROT_BIND
 
10
        return DCESRV_INTERFACE_ROT_BIND(dce_call,iface);
 
11
#else
 
12
        return NT_STATUS_OK;
 
13
#endif
 
14
}
 
15
 
 
16
static void rot__op_unbind(struct dcesrv_connection_context *context, const struct dcesrv_interface *iface)
 
17
{
 
18
#ifdef DCESRV_INTERFACE_ROT_UNBIND
 
19
        DCESRV_INTERFACE_ROT_UNBIND(context, iface);
 
20
#else
 
21
        return;
 
22
#endif
 
23
}
 
24
 
 
25
static NTSTATUS rot__op_ndr_pull(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_pull *pull, void **r)
 
26
{
 
27
        enum ndr_err_code ndr_err;
 
28
        uint16_t opnum = dce_call->pkt.u.request.opnum;
 
29
 
 
30
        dce_call->fault_code = 0;
 
31
 
 
32
        if (opnum >= ndr_table_rot.num_calls) {
 
33
                dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
 
34
                return NT_STATUS_NET_WRITE_FAULT;
 
35
        }
 
36
 
 
37
        *r = talloc_named(mem_ctx,
 
38
                          ndr_table_rot.calls[opnum].struct_size,
 
39
                          "struct %s",
 
40
                          ndr_table_rot.calls[opnum].name);
 
41
        NT_STATUS_HAVE_NO_MEMORY(*r);
 
42
 
 
43
        /* unravel the NDR for the packet */
 
44
        ndr_err = ndr_table_rot.calls[opnum].ndr_pull(pull, NDR_IN, *r);
 
45
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
46
                dcerpc_log_packet(dce_call->conn->packet_log_dir, 
 
47
                                  &ndr_table_rot, opnum, NDR_IN,
 
48
                                  &dce_call->pkt.u.request.stub_and_verifier);
 
49
                dce_call->fault_code = DCERPC_FAULT_NDR;
 
50
                return NT_STATUS_NET_WRITE_FAULT;
 
51
        }
 
52
 
 
53
        return NT_STATUS_OK;
 
54
}
 
55
 
 
56
static NTSTATUS rot__op_dispatch(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
 
57
{
 
58
        uint16_t opnum = dce_call->pkt.u.request.opnum;
 
59
 
 
60
        switch (opnum) {
 
61
        case 0: {
 
62
                struct rot_add *r2 = (struct rot_add *)r;
 
63
                if (DEBUGLEVEL >= 10) {
 
64
                        NDR_PRINT_FUNCTION_DEBUG(rot_add, NDR_IN, r2);
 
65
                }
 
66
                r2->out.result = dcesrv_rot_add(dce_call, mem_ctx, r2);
 
67
                if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
 
68
                        DEBUG(5,("function rot_add will reply async\n"));
 
69
                }
 
70
                break;
 
71
        }
 
72
        case 1: {
 
73
                struct rot_remove *r2 = (struct rot_remove *)r;
 
74
                if (DEBUGLEVEL >= 10) {
 
75
                        NDR_PRINT_FUNCTION_DEBUG(rot_remove, NDR_IN, r2);
 
76
                }
 
77
                r2->out.result = dcesrv_rot_remove(dce_call, mem_ctx, r2);
 
78
                if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
 
79
                        DEBUG(5,("function rot_remove will reply async\n"));
 
80
                }
 
81
                break;
 
82
        }
 
83
        case 2: {
 
84
                struct rot_is_listed *r2 = (struct rot_is_listed *)r;
 
85
                if (DEBUGLEVEL >= 10) {
 
86
                        NDR_PRINT_FUNCTION_DEBUG(rot_is_listed, NDR_IN, r2);
 
87
                }
 
88
                r2->out.result = dcesrv_rot_is_listed(dce_call, mem_ctx, r2);
 
89
                if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
 
90
                        DEBUG(5,("function rot_is_listed will reply async\n"));
 
91
                }
 
92
                break;
 
93
        }
 
94
        case 3: {
 
95
                struct rot_get_interface_pointer *r2 = (struct rot_get_interface_pointer *)r;
 
96
                if (DEBUGLEVEL >= 10) {
 
97
                        NDR_PRINT_FUNCTION_DEBUG(rot_get_interface_pointer, NDR_IN, r2);
 
98
                }
 
99
                r2->out.result = dcesrv_rot_get_interface_pointer(dce_call, mem_ctx, r2);
 
100
                if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
 
101
                        DEBUG(5,("function rot_get_interface_pointer will reply async\n"));
 
102
                }
 
103
                break;
 
104
        }
 
105
        case 4: {
 
106
                struct rot_set_modification_time *r2 = (struct rot_set_modification_time *)r;
 
107
                if (DEBUGLEVEL >= 10) {
 
108
                        NDR_PRINT_FUNCTION_DEBUG(rot_set_modification_time, NDR_IN, r2);
 
109
                }
 
110
                r2->out.result = dcesrv_rot_set_modification_time(dce_call, mem_ctx, r2);
 
111
                if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
 
112
                        DEBUG(5,("function rot_set_modification_time will reply async\n"));
 
113
                }
 
114
                break;
 
115
        }
 
116
        case 5: {
 
117
                struct rot_get_modification_time *r2 = (struct rot_get_modification_time *)r;
 
118
                if (DEBUGLEVEL >= 10) {
 
119
                        NDR_PRINT_FUNCTION_DEBUG(rot_get_modification_time, NDR_IN, r2);
 
120
                }
 
121
                r2->out.result = dcesrv_rot_get_modification_time(dce_call, mem_ctx, r2);
 
122
                if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
 
123
                        DEBUG(5,("function rot_get_modification_time will reply async\n"));
 
124
                }
 
125
                break;
 
126
        }
 
127
        case 6: {
 
128
                struct rot_enum *r2 = (struct rot_enum *)r;
 
129
                if (DEBUGLEVEL >= 10) {
 
130
                        NDR_PRINT_FUNCTION_DEBUG(rot_enum, NDR_IN, r2);
 
131
                }
 
132
                r2->out.result = dcesrv_rot_enum(dce_call, mem_ctx, r2);
 
133
                if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
 
134
                        DEBUG(5,("function rot_enum will reply async\n"));
 
135
                }
 
136
                break;
 
137
        }
 
138
 
 
139
        default:
 
140
                dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
 
141
                break;
 
142
        }
 
143
 
 
144
        if (dce_call->fault_code != 0) {
 
145
                dcerpc_log_packet(dce_call->conn->packet_log_dir, 
 
146
                          &ndr_table_rot, opnum, NDR_IN,
 
147
                                  &dce_call->pkt.u.request.stub_and_verifier);
 
148
                return NT_STATUS_NET_WRITE_FAULT;
 
149
        }
 
150
 
 
151
        return NT_STATUS_OK;
 
152
}
 
153
 
 
154
static NTSTATUS rot__op_reply(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
 
155
{
 
156
        uint16_t opnum = dce_call->pkt.u.request.opnum;
 
157
 
 
158
        switch (opnum) {
 
159
        case 0: {
 
160
                struct rot_add *r2 = (struct rot_add *)r;
 
161
                if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
 
162
                        DEBUG(5,("function rot_add replied async\n"));
 
163
                }
 
164
                if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
 
165
                        NDR_PRINT_FUNCTION_DEBUG(rot_add, NDR_OUT | NDR_SET_VALUES, r2);
 
166
                }
 
167
                if (dce_call->fault_code != 0) {
 
168
                        DEBUG(2,("dcerpc_fault %s in rot_add\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
 
169
                }
 
170
                break;
 
171
        }
 
172
        case 1: {
 
173
                struct rot_remove *r2 = (struct rot_remove *)r;
 
174
                if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
 
175
                        DEBUG(5,("function rot_remove replied async\n"));
 
176
                }
 
177
                if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
 
178
                        NDR_PRINT_FUNCTION_DEBUG(rot_remove, NDR_OUT | NDR_SET_VALUES, r2);
 
179
                }
 
180
                if (dce_call->fault_code != 0) {
 
181
                        DEBUG(2,("dcerpc_fault %s in rot_remove\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
 
182
                }
 
183
                break;
 
184
        }
 
185
        case 2: {
 
186
                struct rot_is_listed *r2 = (struct rot_is_listed *)r;
 
187
                if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
 
188
                        DEBUG(5,("function rot_is_listed replied async\n"));
 
189
                }
 
190
                if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
 
191
                        NDR_PRINT_FUNCTION_DEBUG(rot_is_listed, NDR_OUT | NDR_SET_VALUES, r2);
 
192
                }
 
193
                if (dce_call->fault_code != 0) {
 
194
                        DEBUG(2,("dcerpc_fault %s in rot_is_listed\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
 
195
                }
 
196
                break;
 
197
        }
 
198
        case 3: {
 
199
                struct rot_get_interface_pointer *r2 = (struct rot_get_interface_pointer *)r;
 
200
                if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
 
201
                        DEBUG(5,("function rot_get_interface_pointer replied async\n"));
 
202
                }
 
203
                if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
 
204
                        NDR_PRINT_FUNCTION_DEBUG(rot_get_interface_pointer, NDR_OUT | NDR_SET_VALUES, r2);
 
205
                }
 
206
                if (dce_call->fault_code != 0) {
 
207
                        DEBUG(2,("dcerpc_fault %s in rot_get_interface_pointer\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
 
208
                }
 
209
                break;
 
210
        }
 
211
        case 4: {
 
212
                struct rot_set_modification_time *r2 = (struct rot_set_modification_time *)r;
 
213
                if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
 
214
                        DEBUG(5,("function rot_set_modification_time replied async\n"));
 
215
                }
 
216
                if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
 
217
                        NDR_PRINT_FUNCTION_DEBUG(rot_set_modification_time, NDR_OUT | NDR_SET_VALUES, r2);
 
218
                }
 
219
                if (dce_call->fault_code != 0) {
 
220
                        DEBUG(2,("dcerpc_fault %s in rot_set_modification_time\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
 
221
                }
 
222
                break;
 
223
        }
 
224
        case 5: {
 
225
                struct rot_get_modification_time *r2 = (struct rot_get_modification_time *)r;
 
226
                if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
 
227
                        DEBUG(5,("function rot_get_modification_time replied async\n"));
 
228
                }
 
229
                if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
 
230
                        NDR_PRINT_FUNCTION_DEBUG(rot_get_modification_time, NDR_OUT | NDR_SET_VALUES, r2);
 
231
                }
 
232
                if (dce_call->fault_code != 0) {
 
233
                        DEBUG(2,("dcerpc_fault %s in rot_get_modification_time\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
 
234
                }
 
235
                break;
 
236
        }
 
237
        case 6: {
 
238
                struct rot_enum *r2 = (struct rot_enum *)r;
 
239
                if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
 
240
                        DEBUG(5,("function rot_enum replied async\n"));
 
241
                }
 
242
                if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
 
243
                        NDR_PRINT_FUNCTION_DEBUG(rot_enum, NDR_OUT | NDR_SET_VALUES, r2);
 
244
                }
 
245
                if (dce_call->fault_code != 0) {
 
246
                        DEBUG(2,("dcerpc_fault %s in rot_enum\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
 
247
                }
 
248
                break;
 
249
        }
 
250
 
 
251
        default:
 
252
                dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
 
253
                break;
 
254
        }
 
255
 
 
256
        if (dce_call->fault_code != 0) {
 
257
                dcerpc_log_packet(dce_call->conn->packet_log_dir,
 
258
                          &ndr_table_rot, opnum, NDR_IN,
 
259
                                  &dce_call->pkt.u.request.stub_and_verifier);
 
260
                return NT_STATUS_NET_WRITE_FAULT;
 
261
        }
 
262
 
 
263
        return NT_STATUS_OK;
 
264
}
 
265
 
 
266
static NTSTATUS rot__op_ndr_push(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_push *push, const void *r)
 
267
{
 
268
        enum ndr_err_code ndr_err;
 
269
        uint16_t opnum = dce_call->pkt.u.request.opnum;
 
270
 
 
271
        ndr_err = ndr_table_rot.calls[opnum].ndr_push(push, NDR_OUT, r);
 
272
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
273
                dce_call->fault_code = DCERPC_FAULT_NDR;
 
274
                return NT_STATUS_NET_WRITE_FAULT;
 
275
        }
 
276
 
 
277
        return NT_STATUS_OK;
 
278
}
 
279
 
 
280
const struct dcesrv_interface dcesrv_rot_interface = {
 
281
        .name           = "rot",
 
282
        .syntax_id  = {{0xb9e79e60,0x3d52,0x11ce,{0xaa,0xa1},{0x00,0x00,0x69,0x01,0x29,0x3f}},0.2},
 
283
        .bind           = rot__op_bind,
 
284
        .unbind         = rot__op_unbind,
 
285
        .ndr_pull       = rot__op_ndr_pull,
 
286
        .dispatch       = rot__op_dispatch,
 
287
        .reply          = rot__op_reply,
 
288
        .ndr_push       = rot__op_ndr_push
 
289
};
 
290
 
 
291
 
 
292
static NTSTATUS rot__op_init_server(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint_server *ep_server)
 
293
{
 
294
        int i;
 
295
 
 
296
        for (i=0;i<ndr_table_rot.endpoints->count;i++) {
 
297
                NTSTATUS ret;
 
298
                const char *name = ndr_table_rot.endpoints->names[i];
 
299
 
 
300
                ret = dcesrv_interface_register(dce_ctx, name, &dcesrv_rot_interface, NULL);
 
301
                if (!NT_STATUS_IS_OK(ret)) {
 
302
                        DEBUG(1,("rot_op_init_server: failed to register endpoint '%s'\n",name));
 
303
                        return ret;
 
304
                }
 
305
        }
 
306
 
 
307
        return NT_STATUS_OK;
 
308
}
 
309
 
 
310
static bool rot__op_interface_by_uuid(struct dcesrv_interface *iface, const struct GUID *uuid, uint32_t if_version)
 
311
{
 
312
        if (dcesrv_rot_interface.syntax_id.if_version == if_version &&
 
313
                GUID_equal(&dcesrv_rot_interface.syntax_id.uuid, uuid)) {
 
314
                memcpy(iface,&dcesrv_rot_interface, sizeof(*iface));
 
315
                return true;
 
316
        }
 
317
 
 
318
        return false;
 
319
}
 
320
 
 
321
static bool rot__op_interface_by_name(struct dcesrv_interface *iface, const char *name)
 
322
{
 
323
        if (strcmp(dcesrv_rot_interface.name, name)==0) {
 
324
                memcpy(iface, &dcesrv_rot_interface, sizeof(*iface));
 
325
                return true;
 
326
        }
 
327
 
 
328
        return false;   
 
329
}
 
330
        
 
331
NTSTATUS dcerpc_server_rot_init(void)
 
332
{
 
333
        NTSTATUS ret;
 
334
        struct dcesrv_endpoint_server ep_server;
 
335
 
 
336
        /* fill in our name */
 
337
        ep_server.name = "rot";
 
338
 
 
339
        /* fill in all the operations */
 
340
        ep_server.init_server = rot__op_init_server;
 
341
 
 
342
        ep_server.interface_by_uuid = rot__op_interface_by_uuid;
 
343
        ep_server.interface_by_name = rot__op_interface_by_name;
 
344
 
 
345
        /* register ourselves with the DCERPC subsystem. */
 
346
        ret = dcerpc_register_ep_server(&ep_server);
 
347
 
 
348
        if (!NT_STATUS_IS_OK(ret)) {
 
349
                DEBUG(0,("Failed to register 'rot' endpoint server!\n"));
 
350
                return ret;
 
351
        }
 
352
 
 
353
        return ret;
 
354
}
 
355