~lefteris-nikoltsios/+junk/samba-lp1016895

« back to all changes in this revision

Viewing changes to source3/librpc/gen_ndr/ndr_krb5pac_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_krb5pac.h"
 
3
 
 
4
/* krb5pac - dcerpc server boilerplate generated by pidl */
 
5
 
 
6
 
 
7
static NTSTATUS krb5pac__op_bind(struct dcesrv_call_state *dce_call, const struct dcesrv_interface *iface, uint32_t if_version)
 
8
{
 
9
#ifdef DCESRV_INTERFACE_KRB5PAC_BIND
 
10
        return DCESRV_INTERFACE_KRB5PAC_BIND(dce_call,iface);
 
11
#else
 
12
        return NT_STATUS_OK;
 
13
#endif
 
14
}
 
15
 
 
16
static void krb5pac__op_unbind(struct dcesrv_connection_context *context, const struct dcesrv_interface *iface)
 
17
{
 
18
#ifdef DCESRV_INTERFACE_KRB5PAC_UNBIND
 
19
        DCESRV_INTERFACE_KRB5PAC_UNBIND(context, iface);
 
20
#else
 
21
        return;
 
22
#endif
 
23
}
 
24
 
 
25
static NTSTATUS krb5pac__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_krb5pac.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_krb5pac.calls[opnum].struct_size,
 
39
                          "struct %s",
 
40
                          ndr_table_krb5pac.calls[opnum].name);
 
41
        NT_STATUS_HAVE_NO_MEMORY(*r);
 
42
 
 
43
        /* unravel the NDR for the packet */
 
44
        ndr_err = ndr_table_krb5pac.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_krb5pac, 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 krb5pac__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 decode_pac *r2 = (struct decode_pac *)r;
 
63
                if (DEBUGLEVEL >= 10) {
 
64
                        NDR_PRINT_FUNCTION_DEBUG(decode_pac, NDR_IN, r2);
 
65
                }
 
66
                dcesrv_decode_pac(dce_call, mem_ctx, r2);
 
67
                if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
 
68
                        DEBUG(5,("function decode_pac will reply async\n"));
 
69
                }
 
70
                break;
 
71
        }
 
72
        case 1: {
 
73
                struct decode_pac_raw *r2 = (struct decode_pac_raw *)r;
 
74
                if (DEBUGLEVEL >= 10) {
 
75
                        NDR_PRINT_FUNCTION_DEBUG(decode_pac_raw, NDR_IN, r2);
 
76
                }
 
77
                dcesrv_decode_pac_raw(dce_call, mem_ctx, r2);
 
78
                if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
 
79
                        DEBUG(5,("function decode_pac_raw will reply async\n"));
 
80
                }
 
81
                break;
 
82
        }
 
83
        case 2: {
 
84
                struct decode_login_info *r2 = (struct decode_login_info *)r;
 
85
                if (DEBUGLEVEL >= 10) {
 
86
                        NDR_PRINT_FUNCTION_DEBUG(decode_login_info, NDR_IN, r2);
 
87
                }
 
88
                dcesrv_decode_login_info(dce_call, mem_ctx, r2);
 
89
                if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
 
90
                        DEBUG(5,("function decode_login_info will reply async\n"));
 
91
                }
 
92
                break;
 
93
        }
 
94
        case 3: {
 
95
                struct decode_login_info_ctr *r2 = (struct decode_login_info_ctr *)r;
 
96
                if (DEBUGLEVEL >= 10) {
 
97
                        NDR_PRINT_FUNCTION_DEBUG(decode_login_info_ctr, NDR_IN, r2);
 
98
                }
 
99
                dcesrv_decode_login_info_ctr(dce_call, mem_ctx, r2);
 
100
                if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
 
101
                        DEBUG(5,("function decode_login_info_ctr will reply async\n"));
 
102
                }
 
103
                break;
 
104
        }
 
105
        case 4: {
 
106
                struct decode_pac_validate *r2 = (struct decode_pac_validate *)r;
 
107
                if (DEBUGLEVEL >= 10) {
 
108
                        NDR_PRINT_FUNCTION_DEBUG(decode_pac_validate, NDR_IN, r2);
 
109
                }
 
110
                dcesrv_decode_pac_validate(dce_call, mem_ctx, r2);
 
111
                if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
 
112
                        DEBUG(5,("function decode_pac_validate will reply async\n"));
 
113
                }
 
114
                break;
 
115
        }
 
116
 
 
117
        default:
 
118
                dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
 
119
                break;
 
120
        }
 
121
 
 
122
        if (dce_call->fault_code != 0) {
 
123
                dcerpc_log_packet(dce_call->conn->packet_log_dir, 
 
124
                          &ndr_table_krb5pac, opnum, NDR_IN,
 
125
                                  &dce_call->pkt.u.request.stub_and_verifier);
 
126
                return NT_STATUS_NET_WRITE_FAULT;
 
127
        }
 
128
 
 
129
        return NT_STATUS_OK;
 
130
}
 
131
 
 
132
static NTSTATUS krb5pac__op_reply(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
 
133
{
 
134
        uint16_t opnum = dce_call->pkt.u.request.opnum;
 
135
 
 
136
        switch (opnum) {
 
137
        case 0: {
 
138
                struct decode_pac *r2 = (struct decode_pac *)r;
 
139
                if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
 
140
                        DEBUG(5,("function decode_pac replied async\n"));
 
141
                }
 
142
                if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
 
143
                        NDR_PRINT_FUNCTION_DEBUG(decode_pac, NDR_OUT | NDR_SET_VALUES, r2);
 
144
                }
 
145
                if (dce_call->fault_code != 0) {
 
146
                        DEBUG(2,("dcerpc_fault %s in decode_pac\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
 
147
                }
 
148
                break;
 
149
        }
 
150
        case 1: {
 
151
                struct decode_pac_raw *r2 = (struct decode_pac_raw *)r;
 
152
                if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
 
153
                        DEBUG(5,("function decode_pac_raw replied async\n"));
 
154
                }
 
155
                if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
 
156
                        NDR_PRINT_FUNCTION_DEBUG(decode_pac_raw, NDR_OUT | NDR_SET_VALUES, r2);
 
157
                }
 
158
                if (dce_call->fault_code != 0) {
 
159
                        DEBUG(2,("dcerpc_fault %s in decode_pac_raw\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
 
160
                }
 
161
                break;
 
162
        }
 
163
        case 2: {
 
164
                struct decode_login_info *r2 = (struct decode_login_info *)r;
 
165
                if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
 
166
                        DEBUG(5,("function decode_login_info replied async\n"));
 
167
                }
 
168
                if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
 
169
                        NDR_PRINT_FUNCTION_DEBUG(decode_login_info, NDR_OUT | NDR_SET_VALUES, r2);
 
170
                }
 
171
                if (dce_call->fault_code != 0) {
 
172
                        DEBUG(2,("dcerpc_fault %s in decode_login_info\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
 
173
                }
 
174
                break;
 
175
        }
 
176
        case 3: {
 
177
                struct decode_login_info_ctr *r2 = (struct decode_login_info_ctr *)r;
 
178
                if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
 
179
                        DEBUG(5,("function decode_login_info_ctr replied async\n"));
 
180
                }
 
181
                if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
 
182
                        NDR_PRINT_FUNCTION_DEBUG(decode_login_info_ctr, NDR_OUT | NDR_SET_VALUES, r2);
 
183
                }
 
184
                if (dce_call->fault_code != 0) {
 
185
                        DEBUG(2,("dcerpc_fault %s in decode_login_info_ctr\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
 
186
                }
 
187
                break;
 
188
        }
 
189
        case 4: {
 
190
                struct decode_pac_validate *r2 = (struct decode_pac_validate *)r;
 
191
                if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
 
192
                        DEBUG(5,("function decode_pac_validate replied async\n"));
 
193
                }
 
194
                if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
 
195
                        NDR_PRINT_FUNCTION_DEBUG(decode_pac_validate, NDR_OUT | NDR_SET_VALUES, r2);
 
196
                }
 
197
                if (dce_call->fault_code != 0) {
 
198
                        DEBUG(2,("dcerpc_fault %s in decode_pac_validate\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
 
199
                }
 
200
                break;
 
201
        }
 
202
 
 
203
        default:
 
204
                dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
 
205
                break;
 
206
        }
 
207
 
 
208
        if (dce_call->fault_code != 0) {
 
209
                dcerpc_log_packet(dce_call->conn->packet_log_dir,
 
210
                          &ndr_table_krb5pac, opnum, NDR_IN,
 
211
                                  &dce_call->pkt.u.request.stub_and_verifier);
 
212
                return NT_STATUS_NET_WRITE_FAULT;
 
213
        }
 
214
 
 
215
        return NT_STATUS_OK;
 
216
}
 
217
 
 
218
static NTSTATUS krb5pac__op_ndr_push(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_push *push, const void *r)
 
219
{
 
220
        enum ndr_err_code ndr_err;
 
221
        uint16_t opnum = dce_call->pkt.u.request.opnum;
 
222
 
 
223
        ndr_err = ndr_table_krb5pac.calls[opnum].ndr_push(push, NDR_OUT, r);
 
224
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
225
                dce_call->fault_code = DCERPC_FAULT_NDR;
 
226
                return NT_STATUS_NET_WRITE_FAULT;
 
227
        }
 
228
 
 
229
        return NT_STATUS_OK;
 
230
}
 
231
 
 
232
const struct dcesrv_interface dcesrv_krb5pac_interface = {
 
233
        .name           = "krb5pac",
 
234
        .syntax_id  = {{0x12345778,0x1234,0xabcd,{0x00,0x00},{0x00,0x00,0x00,0x00}},0.0},
 
235
        .bind           = krb5pac__op_bind,
 
236
        .unbind         = krb5pac__op_unbind,
 
237
        .ndr_pull       = krb5pac__op_ndr_pull,
 
238
        .dispatch       = krb5pac__op_dispatch,
 
239
        .reply          = krb5pac__op_reply,
 
240
        .ndr_push       = krb5pac__op_ndr_push
 
241
};
 
242
 
 
243
 
 
244
static NTSTATUS krb5pac__op_init_server(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint_server *ep_server)
 
245
{
 
246
        int i;
 
247
 
 
248
        for (i=0;i<ndr_table_krb5pac.endpoints->count;i++) {
 
249
                NTSTATUS ret;
 
250
                const char *name = ndr_table_krb5pac.endpoints->names[i];
 
251
 
 
252
                ret = dcesrv_interface_register(dce_ctx, name, &dcesrv_krb5pac_interface, NULL);
 
253
                if (!NT_STATUS_IS_OK(ret)) {
 
254
                        DEBUG(1,("krb5pac_op_init_server: failed to register endpoint '%s'\n",name));
 
255
                        return ret;
 
256
                }
 
257
        }
 
258
 
 
259
        return NT_STATUS_OK;
 
260
}
 
261
 
 
262
static bool krb5pac__op_interface_by_uuid(struct dcesrv_interface *iface, const struct GUID *uuid, uint32_t if_version)
 
263
{
 
264
        if (dcesrv_krb5pac_interface.syntax_id.if_version == if_version &&
 
265
                GUID_equal(&dcesrv_krb5pac_interface.syntax_id.uuid, uuid)) {
 
266
                memcpy(iface,&dcesrv_krb5pac_interface, sizeof(*iface));
 
267
                return true;
 
268
        }
 
269
 
 
270
        return false;
 
271
}
 
272
 
 
273
static bool krb5pac__op_interface_by_name(struct dcesrv_interface *iface, const char *name)
 
274
{
 
275
        if (strcmp(dcesrv_krb5pac_interface.name, name)==0) {
 
276
                memcpy(iface, &dcesrv_krb5pac_interface, sizeof(*iface));
 
277
                return true;
 
278
        }
 
279
 
 
280
        return false;   
 
281
}
 
282
        
 
283
NTSTATUS dcerpc_server_krb5pac_init(void)
 
284
{
 
285
        NTSTATUS ret;
 
286
        struct dcesrv_endpoint_server ep_server;
 
287
 
 
288
        /* fill in our name */
 
289
        ep_server.name = "krb5pac";
 
290
 
 
291
        /* fill in all the operations */
 
292
        ep_server.init_server = krb5pac__op_init_server;
 
293
 
 
294
        ep_server.interface_by_uuid = krb5pac__op_interface_by_uuid;
 
295
        ep_server.interface_by_name = krb5pac__op_interface_by_name;
 
296
 
 
297
        /* register ourselves with the DCERPC subsystem. */
 
298
        ret = dcerpc_register_ep_server(&ep_server);
 
299
 
 
300
        if (!NT_STATUS_IS_OK(ret)) {
 
301
                DEBUG(0,("Failed to register 'krb5pac' endpoint server!\n"));
 
302
                return ret;
 
303
        }
 
304
 
 
305
        return ret;
 
306
}
 
307