~lefteris-nikoltsios/+junk/samba-lp1016895

« back to all changes in this revision

Viewing changes to source3/librpc/gen_ndr/ndr_dbgidl_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_dbgidl.h"
 
3
 
 
4
/* dbgidl - dcerpc server boilerplate generated by pidl */
 
5
 
 
6
 
 
7
static NTSTATUS dbgidl__op_bind(struct dcesrv_call_state *dce_call, const struct dcesrv_interface *iface, uint32_t if_version)
 
8
{
 
9
#ifdef DCESRV_INTERFACE_DBGIDL_BIND
 
10
        return DCESRV_INTERFACE_DBGIDL_BIND(dce_call,iface);
 
11
#else
 
12
        return NT_STATUS_OK;
 
13
#endif
 
14
}
 
15
 
 
16
static void dbgidl__op_unbind(struct dcesrv_connection_context *context, const struct dcesrv_interface *iface)
 
17
{
 
18
#ifdef DCESRV_INTERFACE_DBGIDL_UNBIND
 
19
        DCESRV_INTERFACE_DBGIDL_UNBIND(context, iface);
 
20
#else
 
21
        return;
 
22
#endif
 
23
}
 
24
 
 
25
static NTSTATUS dbgidl__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_dbgidl.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_dbgidl.calls[opnum].struct_size,
 
39
                          "struct %s",
 
40
                          ndr_table_dbgidl.calls[opnum].name);
 
41
        NT_STATUS_HAVE_NO_MEMORY(*r);
 
42
 
 
43
        /* unravel the NDR for the packet */
 
44
        ndr_err = ndr_table_dbgidl.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_dbgidl, 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 dbgidl__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 dummy_dbgidl *r2 = (struct dummy_dbgidl *)r;
 
63
                if (DEBUGLEVEL >= 10) {
 
64
                        NDR_PRINT_FUNCTION_DEBUG(dummy_dbgidl, NDR_IN, r2);
 
65
                }
 
66
                dcesrv_dummy_dbgidl(dce_call, mem_ctx, r2);
 
67
                if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
 
68
                        DEBUG(5,("function dummy_dbgidl will reply async\n"));
 
69
                }
 
70
                break;
 
71
        }
 
72
 
 
73
        default:
 
74
                dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
 
75
                break;
 
76
        }
 
77
 
 
78
        if (dce_call->fault_code != 0) {
 
79
                dcerpc_log_packet(dce_call->conn->packet_log_dir, 
 
80
                          &ndr_table_dbgidl, opnum, NDR_IN,
 
81
                                  &dce_call->pkt.u.request.stub_and_verifier);
 
82
                return NT_STATUS_NET_WRITE_FAULT;
 
83
        }
 
84
 
 
85
        return NT_STATUS_OK;
 
86
}
 
87
 
 
88
static NTSTATUS dbgidl__op_reply(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
 
89
{
 
90
        uint16_t opnum = dce_call->pkt.u.request.opnum;
 
91
 
 
92
        switch (opnum) {
 
93
        case 0: {
 
94
                struct dummy_dbgidl *r2 = (struct dummy_dbgidl *)r;
 
95
                if (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {
 
96
                        DEBUG(5,("function dummy_dbgidl replied async\n"));
 
97
                }
 
98
                if (DEBUGLEVEL >= 10 && dce_call->fault_code == 0) {
 
99
                        NDR_PRINT_FUNCTION_DEBUG(dummy_dbgidl, NDR_OUT | NDR_SET_VALUES, r2);
 
100
                }
 
101
                if (dce_call->fault_code != 0) {
 
102
                        DEBUG(2,("dcerpc_fault %s in dummy_dbgidl\n", dcerpc_errstr(mem_ctx, dce_call->fault_code)));
 
103
                }
 
104
                break;
 
105
        }
 
106
 
 
107
        default:
 
108
                dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
 
109
                break;
 
110
        }
 
111
 
 
112
        if (dce_call->fault_code != 0) {
 
113
                dcerpc_log_packet(dce_call->conn->packet_log_dir,
 
114
                          &ndr_table_dbgidl, opnum, NDR_IN,
 
115
                                  &dce_call->pkt.u.request.stub_and_verifier);
 
116
                return NT_STATUS_NET_WRITE_FAULT;
 
117
        }
 
118
 
 
119
        return NT_STATUS_OK;
 
120
}
 
121
 
 
122
static NTSTATUS dbgidl__op_ndr_push(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_push *push, const void *r)
 
123
{
 
124
        enum ndr_err_code ndr_err;
 
125
        uint16_t opnum = dce_call->pkt.u.request.opnum;
 
126
 
 
127
        ndr_err = ndr_table_dbgidl.calls[opnum].ndr_push(push, NDR_OUT, r);
 
128
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
 
129
                dce_call->fault_code = DCERPC_FAULT_NDR;
 
130
                return NT_STATUS_NET_WRITE_FAULT;
 
131
        }
 
132
 
 
133
        return NT_STATUS_OK;
 
134
}
 
135
 
 
136
const struct dcesrv_interface dcesrv_dbgidl_interface = {
 
137
        .name           = "dbgidl",
 
138
        .syntax_id  = {{0x1d55b526,0xc137,0x46c5,{0xab,0x79},{0x63,0x8f,0x2a,0x68,0xe8,0x69}},1.0},
 
139
        .bind           = dbgidl__op_bind,
 
140
        .unbind         = dbgidl__op_unbind,
 
141
        .ndr_pull       = dbgidl__op_ndr_pull,
 
142
        .dispatch       = dbgidl__op_dispatch,
 
143
        .reply          = dbgidl__op_reply,
 
144
        .ndr_push       = dbgidl__op_ndr_push
 
145
};
 
146
 
 
147
 
 
148
static NTSTATUS dbgidl__op_init_server(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint_server *ep_server)
 
149
{
 
150
        int i;
 
151
 
 
152
        for (i=0;i<ndr_table_dbgidl.endpoints->count;i++) {
 
153
                NTSTATUS ret;
 
154
                const char *name = ndr_table_dbgidl.endpoints->names[i];
 
155
 
 
156
                ret = dcesrv_interface_register(dce_ctx, name, &dcesrv_dbgidl_interface, NULL);
 
157
                if (!NT_STATUS_IS_OK(ret)) {
 
158
                        DEBUG(1,("dbgidl_op_init_server: failed to register endpoint '%s'\n",name));
 
159
                        return ret;
 
160
                }
 
161
        }
 
162
 
 
163
        return NT_STATUS_OK;
 
164
}
 
165
 
 
166
static bool dbgidl__op_interface_by_uuid(struct dcesrv_interface *iface, const struct GUID *uuid, uint32_t if_version)
 
167
{
 
168
        if (dcesrv_dbgidl_interface.syntax_id.if_version == if_version &&
 
169
                GUID_equal(&dcesrv_dbgidl_interface.syntax_id.uuid, uuid)) {
 
170
                memcpy(iface,&dcesrv_dbgidl_interface, sizeof(*iface));
 
171
                return true;
 
172
        }
 
173
 
 
174
        return false;
 
175
}
 
176
 
 
177
static bool dbgidl__op_interface_by_name(struct dcesrv_interface *iface, const char *name)
 
178
{
 
179
        if (strcmp(dcesrv_dbgidl_interface.name, name)==0) {
 
180
                memcpy(iface, &dcesrv_dbgidl_interface, sizeof(*iface));
 
181
                return true;
 
182
        }
 
183
 
 
184
        return false;   
 
185
}
 
186
        
 
187
NTSTATUS dcerpc_server_dbgidl_init(void)
 
188
{
 
189
        NTSTATUS ret;
 
190
        struct dcesrv_endpoint_server ep_server;
 
191
 
 
192
        /* fill in our name */
 
193
        ep_server.name = "dbgidl";
 
194
 
 
195
        /* fill in all the operations */
 
196
        ep_server.init_server = dbgidl__op_init_server;
 
197
 
 
198
        ep_server.interface_by_uuid = dbgidl__op_interface_by_uuid;
 
199
        ep_server.interface_by_name = dbgidl__op_interface_by_name;
 
200
 
 
201
        /* register ourselves with the DCERPC subsystem. */
 
202
        ret = dcerpc_register_ep_server(&ep_server);
 
203
 
 
204
        if (!NT_STATUS_IS_OK(ret)) {
 
205
                DEBUG(0,("Failed to register 'dbgidl' endpoint server!\n"));
 
206
                return ret;
 
207
        }
 
208
 
 
209
        return ret;
 
210
}
 
211