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

« back to all changes in this revision

Viewing changes to source3/librpc/gen_ndr/ndr_initshutdown_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_initshutdown.h"
 
3
 
 
4
/* initshutdown - dcerpc server boilerplate generated by pidl */
 
5
 
 
6
 
 
7
static NTSTATUS initshutdown__op_bind(struct dcesrv_call_state *dce_call, const struct dcesrv_interface *iface, uint32_t if_version)
 
8
{
 
9
#ifdef DCESRV_INTERFACE_INITSHUTDOWN_BIND
 
10
        return DCESRV_INTERFACE_INITSHUTDOWN_BIND(dce_call,iface);
 
11
#else
 
12
        return NT_STATUS_OK;
 
13
#endif
 
14
}
 
15
 
 
16
static void initshutdown__op_unbind(struct dcesrv_connection_context *context, const struct dcesrv_interface *iface)
 
17
{
 
18
#ifdef DCESRV_INTERFACE_INITSHUTDOWN_UNBIND
 
19
        DCESRV_INTERFACE_INITSHUTDOWN_UNBIND(context, iface);
 
20
#else
 
21
        return;
 
22
#endif
 
23
}
 
24
 
 
25
static NTSTATUS initshutdown__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_initshutdown.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_initshutdown.calls[opnum].struct_size,
 
39
                          "struct %s",
 
40
                          ndr_table_initshutdown.calls[opnum].name);
 
41
        NT_STATUS_HAVE_NO_MEMORY(*r);
 
42
 
 
43
        /* unravel the NDR for the packet */
 
44
        ndr_err = ndr_table_initshutdown.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_initshutdown, 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 initshutdown__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 initshutdown_Init *r2 = (struct initshutdown_Init *)r;
 
63
                if (DEBUGLEVEL >= 10) {
 
64
                        NDR_PRINT_FUNCTION_DEBUG(initshutdown_Init, NDR_IN, r2);
 
65
                }
 
66
                r2->out.result = dcesrv_initshutdown_Init(dce_call, mem_ctx, r2);
 
67
                if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
 
68
                        DEBUG(5,("function initshutdown_Init will reply async\n"));
 
69
                }
 
70
                break;
 
71
        }
 
72
        case 1: {
 
73
                struct initshutdown_Abort *r2 = (struct initshutdown_Abort *)r;
 
74
                if (DEBUGLEVEL >= 10) {
 
75
                        NDR_PRINT_FUNCTION_DEBUG(initshutdown_Abort, NDR_IN, r2);
 
76
                }
 
77
                r2->out.result = dcesrv_initshutdown_Abort(dce_call, mem_ctx, r2);
 
78
                if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
 
79
                        DEBUG(5,("function initshutdown_Abort will reply async\n"));
 
80
                }
 
81
                break;
 
82
        }
 
83
        case 2: {
 
84
                struct initshutdown_InitEx *r2 = (struct initshutdown_InitEx *)r;
 
85
                if (DEBUGLEVEL >= 10) {
 
86
                        NDR_PRINT_FUNCTION_DEBUG(initshutdown_InitEx, NDR_IN, r2);
 
87
                }
 
88
                r2->out.result = dcesrv_initshutdown_InitEx(dce_call, mem_ctx, r2);
 
89
                if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
 
90
                        DEBUG(5,("function initshutdown_InitEx will reply async\n"));
 
91
                }
 
92
                break;
 
93
        }
 
94
 
 
95
        default:
 
96
                dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
 
97
                break;
 
98
        }
 
99
 
 
100
        if (dce_call->fault_code != 0) {
 
101
                dcerpc_log_packet(dce_call->conn->packet_log_dir, 
 
102
                          &ndr_table_initshutdown, opnum, NDR_IN,
 
103
                                  &dce_call->pkt.u.request.stub_and_verifier);
 
104
                return NT_STATUS_NET_WRITE_FAULT;
 
105
        }
 
106
 
 
107
        return NT_STATUS_OK;
 
108
}
 
109
 
 
110
static NTSTATUS initshutdown__op_reply(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
 
111
{
 
112
        uint16_t opnum = dce_call->pkt.u.request.opnum;
 
113
 
 
114
        switch (opnum) {
 
115
        case 0: {
 
116
                struct initshutdown_Init *r2 = (struct initshutdown_Init *)r;
 
117
                if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
 
118
                        DEBUG(5,("function initshutdown_Init replied async\n"));
 
119
                }
 
120
                if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
 
121
                        NDR_PRINT_FUNCTION_DEBUG(initshutdown_Init, NDR_OUT | NDR_SET_VALUES, r2);
 
122
                }
 
123
                if (dce_call->fault_code != 0) {
 
124
                        DEBUG(2,("dcerpc_fault %s in initshutdown_Init\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
 
125
                }
 
126
                break;
 
127
        }
 
128
        case 1: {
 
129
                struct initshutdown_Abort *r2 = (struct initshutdown_Abort *)r;
 
130
                if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
 
131
                        DEBUG(5,("function initshutdown_Abort replied async\n"));
 
132
                }
 
133
                if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
 
134
                        NDR_PRINT_FUNCTION_DEBUG(initshutdown_Abort, NDR_OUT | NDR_SET_VALUES, r2);
 
135
                }
 
136
                if (dce_call->fault_code != 0) {
 
137
                        DEBUG(2,("dcerpc_fault %s in initshutdown_Abort\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
 
138
                }
 
139
                break;
 
140
        }
 
141
        case 2: {
 
142
                struct initshutdown_InitEx *r2 = (struct initshutdown_InitEx *)r;
 
143
                if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
 
144
                        DEBUG(5,("function initshutdown_InitEx replied async\n"));
 
145
                }
 
146
                if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
 
147
                        NDR_PRINT_FUNCTION_DEBUG(initshutdown_InitEx, NDR_OUT | NDR_SET_VALUES, r2);
 
148
                }
 
149
                if (dce_call->fault_code != 0) {
 
150
                        DEBUG(2,("dcerpc_fault %s in initshutdown_InitEx\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
 
151
                }
 
152
                break;
 
153
        }
 
154
 
 
155
        default:
 
156
                dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
 
157
                break;
 
158
        }
 
159
 
 
160
        if (dce_call->fault_code != 0) {
 
161
                dcerpc_log_packet(dce_call->conn->packet_log_dir,
 
162
                          &ndr_table_initshutdown, opnum, NDR_IN,
 
163
                                  &dce_call->pkt.u.request.stub_and_verifier);
 
164
                return NT_STATUS_NET_WRITE_FAULT;
 
165
        }
 
166
 
 
167
        return NT_STATUS_OK;
 
168
}
 
169
 
 
170
static NTSTATUS initshutdown__op_ndr_push(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_push *push, const void *r)
 
171
{
 
172
        enum ndr_err_code ndr_err;
 
173
        uint16_t opnum = dce_call->pkt.u.request.opnum;
 
174
 
 
175
        ndr_err = ndr_table_initshutdown.calls[opnum].ndr_push(push, NDR_OUT, r);
 
176
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
177
                dce_call->fault_code = DCERPC_FAULT_NDR;
 
178
                return NT_STATUS_NET_WRITE_FAULT;
 
179
        }
 
180
 
 
181
        return NT_STATUS_OK;
 
182
}
 
183
 
 
184
const struct dcesrv_interface dcesrv_initshutdown_interface = {
 
185
        .name           = "initshutdown",
 
186
        .syntax_id  = {{0x894de0c0,0x0d55,0x11d3,{0xa3,0x22},{0x00,0xc0,0x4f,0xa3,0x21,0xa1}},1.0},
 
187
        .bind           = initshutdown__op_bind,
 
188
        .unbind         = initshutdown__op_unbind,
 
189
        .ndr_pull       = initshutdown__op_ndr_pull,
 
190
        .dispatch       = initshutdown__op_dispatch,
 
191
        .reply          = initshutdown__op_reply,
 
192
        .ndr_push       = initshutdown__op_ndr_push
 
193
};
 
194
 
 
195
 
 
196
static NTSTATUS initshutdown__op_init_server(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint_server *ep_server)
 
197
{
 
198
        int i;
 
199
 
 
200
        for (i=0;i<ndr_table_initshutdown.endpoints->count;i++) {
 
201
                NTSTATUS ret;
 
202
                const char *name = ndr_table_initshutdown.endpoints->names[i];
 
203
 
 
204
                ret = dcesrv_interface_register(dce_ctx, name, &dcesrv_initshutdown_interface, NULL);
 
205
                if (!NT_STATUS_IS_OK(ret)) {
 
206
                        DEBUG(1,("initshutdown_op_init_server: failed to register endpoint '%s'\n",name));
 
207
                        return ret;
 
208
                }
 
209
        }
 
210
 
 
211
        return NT_STATUS_OK;
 
212
}
 
213
 
 
214
static bool initshutdown__op_interface_by_uuid(struct dcesrv_interface *iface, const struct GUID *uuid, uint32_t if_version)
 
215
{
 
216
        if (dcesrv_initshutdown_interface.syntax_id.if_version == if_version &&
 
217
                GUID_equal(&dcesrv_initshutdown_interface.syntax_id.uuid, uuid)) {
 
218
                memcpy(iface,&dcesrv_initshutdown_interface, sizeof(*iface));
 
219
                return true;
 
220
        }
 
221
 
 
222
        return false;
 
223
}
 
224
 
 
225
static bool initshutdown__op_interface_by_name(struct dcesrv_interface *iface, const char *name)
 
226
{
 
227
        if (strcmp(dcesrv_initshutdown_interface.name, name)==0) {
 
228
                memcpy(iface, &dcesrv_initshutdown_interface, sizeof(*iface));
 
229
                return true;
 
230
        }
 
231
 
 
232
        return false;   
 
233
}
 
234
        
 
235
NTSTATUS dcerpc_server_initshutdown_init(void)
 
236
{
 
237
        NTSTATUS ret;
 
238
        struct dcesrv_endpoint_server ep_server;
 
239
 
 
240
        /* fill in our name */
 
241
        ep_server.name = "initshutdown";
 
242
 
 
243
        /* fill in all the operations */
 
244
        ep_server.init_server = initshutdown__op_init_server;
 
245
 
 
246
        ep_server.interface_by_uuid = initshutdown__op_interface_by_uuid;
 
247
        ep_server.interface_by_name = initshutdown__op_interface_by_name;
 
248
 
 
249
        /* register ourselves with the DCERPC subsystem. */
 
250
        ret = dcerpc_register_ep_server(&ep_server);
 
251
 
 
252
        if (!NT_STATUS_IS_OK(ret)) {
 
253
                DEBUG(0,("Failed to register 'initshutdown' endpoint server!\n"));
 
254
                return ret;
 
255
        }
 
256
 
 
257
        return ret;
 
258
}
 
259