~lefteris-nikoltsios/+junk/samba-lp1016895

« back to all changes in this revision

Viewing changes to source3/librpc/gen_ndr/py_remact.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
 
 
2
/* Python wrapper functions auto-generated by pidl */
 
3
#include <Python.h>
 
4
#include "includes.h"
 
5
#include <pytalloc.h>
 
6
#include "librpc/rpc/pyrpc.h"
 
7
#include "librpc/rpc/pyrpc_util.h"
 
8
#include "librpc/gen_ndr/ndr_remact.h"
 
9
#include "librpc/gen_ndr/ndr_remact_c.h"
 
10
 
 
11
#include "librpc/gen_ndr/misc.h"
 
12
#include "librpc/gen_ndr/orpc.h"
 
13
staticforward PyTypeObject IRemoteActivation_InterfaceType;
 
14
 
 
15
void initremact(void);static PyTypeObject *MInterfacePointer_Type;
 
16
static PyTypeObject *DUALSTRINGARRAY_Type;
 
17
static PyTypeObject *ORPCTHAT_Type;
 
18
static PyTypeObject *GUID_Type;
 
19
static PyTypeObject *ClientConnection_Type;
 
20
static PyTypeObject *COMVERSION_Type;
 
21
static PyTypeObject *ORPCTHIS_Type;
 
22
 
 
23
static bool pack_py_RemoteActivation_args_in(PyObject *args, PyObject *kwargs, struct RemoteActivation *r)
 
24
{
 
25
        PyObject *py_this_object;
 
26
        PyObject *py_Clsid;
 
27
        PyObject *py_pwszObjectName;
 
28
        PyObject *py_pObjectStorage;
 
29
        PyObject *py_ClientImpLevel;
 
30
        PyObject *py_Mode;
 
31
        PyObject *py_pIIDs;
 
32
        PyObject *py_protseq;
 
33
        const char *kwnames[] = {
 
34
                "this_object", "Clsid", "pwszObjectName", "pObjectStorage", "ClientImpLevel", "Mode", "pIIDs", "protseq", NULL
 
35
        };
 
36
 
 
37
        if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOOOOO:RemoteActivation", discard_const_p(char *, kwnames), &py_this_object, &py_Clsid, &py_pwszObjectName, &py_pObjectStorage, &py_ClientImpLevel, &py_Mode, &py_pIIDs, &py_protseq)) {
 
38
                return false;
 
39
        }
 
40
 
 
41
        PY_CHECK_TYPE(ORPCTHIS_Type, py_this_object, return false;);
 
42
        if (talloc_reference(r, py_talloc_get_mem_ctx(py_this_object)) == NULL) {
 
43
                PyErr_NoMemory();
 
44
                return false;
 
45
        }
 
46
        r->in.this_object = *(struct ORPCTHIS *)py_talloc_get_ptr(py_this_object);
 
47
        PY_CHECK_TYPE(GUID_Type, py_Clsid, return false;);
 
48
        if (talloc_reference(r, py_talloc_get_mem_ctx(py_Clsid)) == NULL) {
 
49
                PyErr_NoMemory();
 
50
                return false;
 
51
        }
 
52
        r->in.Clsid = *(struct GUID *)py_talloc_get_ptr(py_Clsid);
 
53
        r->in.pwszObjectName = talloc_ptrtype(r, r->in.pwszObjectName);
 
54
        if (PyUnicode_Check(py_pwszObjectName)) {
 
55
                r->in.pwszObjectName = PyString_AS_STRING(PyUnicode_AsEncodedString(py_pwszObjectName, "utf-8", "ignore"));
 
56
        } else if (PyString_Check(py_pwszObjectName)) {
 
57
                r->in.pwszObjectName = PyString_AS_STRING(py_pwszObjectName);
 
58
        } else {
 
59
                PyErr_Format(PyExc_TypeError, "Expected string or unicode object, got %s", Py_TYPE(py_pwszObjectName)->tp_name);
 
60
                return false;
 
61
        }
 
62
        r->in.pObjectStorage = talloc_ptrtype(r, r->in.pObjectStorage);
 
63
        PY_CHECK_TYPE(MInterfacePointer_Type, py_pObjectStorage, return false;);
 
64
        if (talloc_reference(r, py_talloc_get_mem_ctx(py_pObjectStorage)) == NULL) {
 
65
                PyErr_NoMemory();
 
66
                return false;
 
67
        }
 
68
        r->in.pObjectStorage = (struct MInterfacePointer *)py_talloc_get_ptr(py_pObjectStorage);
 
69
        PY_CHECK_TYPE(&PyInt_Type, py_ClientImpLevel, return false;);
 
70
        r->in.ClientImpLevel = PyInt_AsLong(py_ClientImpLevel);
 
71
        PY_CHECK_TYPE(&PyInt_Type, py_Mode, return false;);
 
72
        r->in.Mode = PyInt_AsLong(py_Mode);
 
73
        PY_CHECK_TYPE(&PyList_Type, py_pIIDs, return false;);
 
74
        r->in.Interfaces = PyList_GET_SIZE(py_pIIDs);
 
75
        r->in.pIIDs = talloc_ptrtype(r, r->in.pIIDs);
 
76
        PY_CHECK_TYPE(&PyList_Type, py_pIIDs, return false;);
 
77
        {
 
78
                int pIIDs_cntr_1;
 
79
                r->in.pIIDs = talloc_array_ptrtype(r, r->in.pIIDs, PyList_GET_SIZE(py_pIIDs));
 
80
                if (!r->in.pIIDs) { return false;; }
 
81
                talloc_set_name_const(r->in.pIIDs, "ARRAY: r->in.pIIDs");
 
82
                for (pIIDs_cntr_1 = 0; pIIDs_cntr_1 < PyList_GET_SIZE(py_pIIDs); pIIDs_cntr_1++) {
 
83
                        PY_CHECK_TYPE(GUID_Type, PyList_GET_ITEM(py_pIIDs, pIIDs_cntr_1), return false;);
 
84
                        if (talloc_reference(r->in.pIIDs, py_talloc_get_mem_ctx(PyList_GET_ITEM(py_pIIDs, pIIDs_cntr_1))) == NULL) {
 
85
                                PyErr_NoMemory();
 
86
                                return false;
 
87
                        }
 
88
                        r->in.pIIDs[pIIDs_cntr_1] = *(struct GUID *)py_talloc_get_ptr(PyList_GET_ITEM(py_pIIDs, pIIDs_cntr_1));
 
89
                }
 
90
        }
 
91
        PY_CHECK_TYPE(&PyList_Type, py_protseq, return false;);
 
92
        r->in.num_protseqs = PyList_GET_SIZE(py_protseq);
 
93
        PY_CHECK_TYPE(&PyList_Type, py_protseq, return false;);
 
94
        {
 
95
                int protseq_cntr_0;
 
96
                r->in.protseq = talloc_array_ptrtype(r, r->in.protseq, PyList_GET_SIZE(py_protseq));
 
97
                if (!r->in.protseq) { return false;; }
 
98
                talloc_set_name_const(r->in.protseq, "ARRAY: r->in.protseq");
 
99
                for (protseq_cntr_0 = 0; protseq_cntr_0 < PyList_GET_SIZE(py_protseq); protseq_cntr_0++) {
 
100
                        PY_CHECK_TYPE(&PyInt_Type, PyList_GET_ITEM(py_protseq, protseq_cntr_0), return false;);
 
101
                        r->in.protseq[protseq_cntr_0] = PyInt_AsLong(PyList_GET_ITEM(py_protseq, protseq_cntr_0));
 
102
                }
 
103
        }
 
104
        return true;
 
105
}
 
106
 
 
107
static PyObject *unpack_py_RemoteActivation_args_out(struct RemoteActivation *r)
 
108
{
 
109
        PyObject *result;
 
110
        PyObject *py_that;
 
111
        PyObject *py_pOxid;
 
112
        PyObject *py_pdsaOxidBindings;
 
113
        PyObject *py_ipidRemUnknown;
 
114
        PyObject *py_AuthnHint;
 
115
        PyObject *py_ServerVersion;
 
116
        PyObject *py_hr;
 
117
        PyObject *py_ifaces;
 
118
        PyObject *py_results;
 
119
        result = PyTuple_New(9);
 
120
        py_that = py_talloc_reference_ex(ORPCTHAT_Type, r->out.that, r->out.that);
 
121
        PyTuple_SetItem(result, 0, py_that);
 
122
        py_pOxid = PyLong_FromLongLong(*r->out.pOxid);
 
123
        PyTuple_SetItem(result, 1, py_pOxid);
 
124
        py_pdsaOxidBindings = py_talloc_reference_ex(DUALSTRINGARRAY_Type, r->out.pdsaOxidBindings, r->out.pdsaOxidBindings);
 
125
        PyTuple_SetItem(result, 2, py_pdsaOxidBindings);
 
126
        py_ipidRemUnknown = py_talloc_reference_ex(GUID_Type, r->out.ipidRemUnknown, r->out.ipidRemUnknown);
 
127
        PyTuple_SetItem(result, 3, py_ipidRemUnknown);
 
128
        py_AuthnHint = PyInt_FromLong(*r->out.AuthnHint);
 
129
        PyTuple_SetItem(result, 4, py_AuthnHint);
 
130
        py_ServerVersion = py_talloc_reference_ex(COMVERSION_Type, r->out.ServerVersion, r->out.ServerVersion);
 
131
        PyTuple_SetItem(result, 5, py_ServerVersion);
 
132
        py_hr = PyErr_FromWERROR(*r->out.hr);
 
133
        PyTuple_SetItem(result, 6, py_hr);
 
134
        py_ifaces = PyList_New(r->in.Interfaces);
 
135
        if (py_ifaces == NULL) {
 
136
                return NULL;
 
137
        }
 
138
        {
 
139
                int ifaces_cntr_0;
 
140
                for (ifaces_cntr_0 = 0; ifaces_cntr_0 < r->in.Interfaces; ifaces_cntr_0++) {
 
141
                        PyObject *py_ifaces_0;
 
142
                        py_ifaces_0 = py_talloc_reference_ex(MInterfacePointer_Type, r->out.ifaces[ifaces_cntr_0], r->out.ifaces[ifaces_cntr_0]);
 
143
                        PyList_SetItem(py_ifaces, ifaces_cntr_0, py_ifaces_0);
 
144
                }
 
145
        }
 
146
        PyTuple_SetItem(result, 7, py_ifaces);
 
147
        py_results = PyList_New(r->in.Interfaces);
 
148
        if (py_results == NULL) {
 
149
                return NULL;
 
150
        }
 
151
        {
 
152
                int results_cntr_0;
 
153
                for (results_cntr_0 = 0; results_cntr_0 < r->in.Interfaces; results_cntr_0++) {
 
154
                        PyObject *py_results_0;
 
155
                        py_results_0 = PyErr_FromWERROR(r->out.results[results_cntr_0]);
 
156
                        PyList_SetItem(py_results, results_cntr_0, py_results_0);
 
157
                }
 
158
        }
 
159
        PyTuple_SetItem(result, 8, py_results);
 
160
        if (!W_ERROR_IS_OK(r->out.result)) {
 
161
                PyErr_SetWERROR(r->out.result);
 
162
                return NULL;
 
163
        }
 
164
 
 
165
        return result;
 
166
}
 
167
 
 
168
const struct PyNdrRpcMethodDef py_ndr_IRemoteActivation_methods[] = {
 
169
        { "RemoteActivation", "S.RemoteActivation(this_object, Clsid, pwszObjectName, pObjectStorage, ClientImpLevel, Mode, pIIDs, protseq) -> (that, pOxid, pdsaOxidBindings, ipidRemUnknown, AuthnHint, ServerVersion, hr, ifaces, results)", (py_dcerpc_call_fn)dcerpc_RemoteActivation_r, (py_data_pack_fn)pack_py_RemoteActivation_args_in, (py_data_unpack_fn)unpack_py_RemoteActivation_args_out, 0, &ndr_table_IRemoteActivation },
 
170
        { NULL }
 
171
};
 
172
 
 
173
static PyObject *interface_IRemoteActivation_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
 
174
{
 
175
        return py_dcerpc_interface_init_helper(type, args, kwargs, &ndr_table_IRemoteActivation);
 
176
}
 
177
 
 
178
static PyTypeObject IRemoteActivation_InterfaceType = {
 
179
        PyObject_HEAD_INIT(NULL) 0,
 
180
        .tp_name = "remact.IRemoteActivation",
 
181
        .tp_basicsize = sizeof(dcerpc_InterfaceObject),
 
182
        .tp_doc = "IRemoteActivation(binding, lp_ctx=None, credentials=None) -> connection\n"
 
183
"\n"
 
184
"binding should be a DCE/RPC binding string (for example: ncacn_ip_tcp:127.0.0.1)\n"
 
185
"lp_ctx should be a path to a smb.conf file or a param.LoadParm object\n"
 
186
"credentials should be a credentials.Credentials object.\n\n",
 
187
        .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
 
188
        .tp_new = interface_IRemoteActivation_new,
 
189
};
 
190
 
 
191
static PyMethodDef remact_methods[] = {
 
192
        { NULL, NULL, 0, NULL }
 
193
};
 
194
 
 
195
void initremact(void)
 
196
{
 
197
        PyObject *m;
 
198
        PyObject *dep_samba_dcerpc_misc;
 
199
        PyObject *dep_samba_dcerpc_base;
 
200
        PyObject *dep_samba_dcerpc_orpc;
 
201
 
 
202
        dep_samba_dcerpc_misc = PyImport_ImportModule("samba.dcerpc.misc");
 
203
        if (dep_samba_dcerpc_misc == NULL)
 
204
                return;
 
205
 
 
206
        dep_samba_dcerpc_base = PyImport_ImportModule("samba.dcerpc.base");
 
207
        if (dep_samba_dcerpc_base == NULL)
 
208
                return;
 
209
 
 
210
        dep_samba_dcerpc_orpc = PyImport_ImportModule("samba.dcerpc.orpc");
 
211
        if (dep_samba_dcerpc_orpc == NULL)
 
212
                return;
 
213
 
 
214
        MInterfacePointer_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_orpc, "MInterfacePointer");
 
215
        if (MInterfacePointer_Type == NULL)
 
216
                return;
 
217
 
 
218
        DUALSTRINGARRAY_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_orpc, "DUALSTRINGARRAY");
 
219
        if (DUALSTRINGARRAY_Type == NULL)
 
220
                return;
 
221
 
 
222
        ORPCTHAT_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_orpc, "ORPCTHAT");
 
223
        if (ORPCTHAT_Type == NULL)
 
224
                return;
 
225
 
 
226
        GUID_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_misc, "GUID");
 
227
        if (GUID_Type == NULL)
 
228
                return;
 
229
 
 
230
        ClientConnection_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_base, "ClientConnection");
 
231
        if (ClientConnection_Type == NULL)
 
232
                return;
 
233
 
 
234
        COMVERSION_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_orpc, "COMVERSION");
 
235
        if (COMVERSION_Type == NULL)
 
236
                return;
 
237
 
 
238
        ORPCTHIS_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_orpc, "ORPCTHIS");
 
239
        if (ORPCTHIS_Type == NULL)
 
240
                return;
 
241
 
 
242
        IRemoteActivation_InterfaceType.tp_base = ClientConnection_Type;
 
243
 
 
244
        if (PyType_Ready(&IRemoteActivation_InterfaceType) < 0)
 
245
                return;
 
246
        if (!PyInterface_AddNdrRpcMethods(&IRemoteActivation_InterfaceType, py_ndr_IRemoteActivation_methods))
 
247
                return;
 
248
 
 
249
#ifdef PY_IREMOTEACTIVATION_PATCH
 
250
        PY_IREMOTEACTIVATION_PATCH(&IRemoteActivation_InterfaceType);
 
251
#endif
 
252
 
 
253
        m = Py_InitModule3("remact", remact_methods, "remact DCE/RPC");
 
254
        if (m == NULL)
 
255
                return;
 
256
 
 
257
        PyModule_AddObject(m, "RPC_C_IMP_LEVEL_DEFAULT", PyInt_FromLong(RPC_C_IMP_LEVEL_DEFAULT));
 
258
        PyModule_AddObject(m, "RPC_C_IMP_LEVEL_IMPERSONATE", PyInt_FromLong(RPC_C_IMP_LEVEL_IMPERSONATE));
 
259
        PyModule_AddObject(m, "RPC_C_IMP_LEVEL_ANONYMOUS", PyInt_FromLong(RPC_C_IMP_LEVEL_ANONYMOUS));
 
260
        PyModule_AddObject(m, "RPC_C_IMP_LEVEL_IDENTIFY", PyInt_FromLong(RPC_C_IMP_LEVEL_IDENTIFY));
 
261
        PyModule_AddObject(m, "MODE_GET_CLASS_OBJECT", PyInt_FromLong(0xffffffff));
 
262
        PyModule_AddObject(m, "RPC_C_IMP_LEVEL_DELEGATE", PyInt_FromLong(RPC_C_IMP_LEVEL_DELEGATE));
 
263
        Py_INCREF((PyObject *)(void *)&IRemoteActivation_InterfaceType);
 
264
        PyModule_AddObject(m, "IRemoteActivation", (PyObject *)(void *)&IRemoteActivation_InterfaceType);
 
265
#ifdef PY_MOD_REMACT_PATCH
 
266
        PY_MOD_REMACT_PATCH(m);
 
267
#endif
 
268
 
 
269
}