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

« back to all changes in this revision

Viewing changes to source3/librpc/gen_ndr/py_initshutdown.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_initshutdown.h"
 
9
#include "librpc/gen_ndr/ndr_initshutdown_c.h"
 
10
 
 
11
#include "librpc/gen_ndr/lsa.h"
 
12
staticforward PyTypeObject initshutdown_InterfaceType;
 
13
 
 
14
void initinitshutdown(void);static PyTypeObject *lsa_StringLarge_Type;
 
15
static PyTypeObject *ClientConnection_Type;
 
16
 
 
17
static bool pack_py_initshutdown_Init_args_in(PyObject *args, PyObject *kwargs, struct initshutdown_Init *r)
 
18
{
 
19
        PyObject *py_hostname;
 
20
        PyObject *py_message;
 
21
        PyObject *py_timeout;
 
22
        PyObject *py_force_apps;
 
23
        PyObject *py_do_reboot;
 
24
        const char *kwnames[] = {
 
25
                "hostname", "message", "timeout", "force_apps", "do_reboot", NULL
 
26
        };
 
27
 
 
28
        if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOO:initshutdown_Init", discard_const_p(char *, kwnames), &py_hostname, &py_message, &py_timeout, &py_force_apps, &py_do_reboot)) {
 
29
                return false;
 
30
        }
 
31
 
 
32
        if (py_hostname == Py_None) {
 
33
                r->in.hostname = NULL;
 
34
        } else {
 
35
                r->in.hostname = talloc_ptrtype(r, r->in.hostname);
 
36
                PY_CHECK_TYPE(&PyInt_Type, py_hostname, return false;);
 
37
                *r->in.hostname = PyInt_AsLong(py_hostname);
 
38
        }
 
39
        if (py_message == Py_None) {
 
40
                r->in.message = NULL;
 
41
        } else {
 
42
                r->in.message = NULL;
 
43
                PY_CHECK_TYPE(lsa_StringLarge_Type, py_message, return false;);
 
44
                if (talloc_reference(r, py_talloc_get_mem_ctx(py_message)) == NULL) {
 
45
                        PyErr_NoMemory();
 
46
                        return false;
 
47
                }
 
48
                r->in.message = (struct lsa_StringLarge *)py_talloc_get_ptr(py_message);
 
49
        }
 
50
        PY_CHECK_TYPE(&PyInt_Type, py_timeout, return false;);
 
51
        r->in.timeout = PyInt_AsLong(py_timeout);
 
52
        PY_CHECK_TYPE(&PyInt_Type, py_force_apps, return false;);
 
53
        r->in.force_apps = PyInt_AsLong(py_force_apps);
 
54
        PY_CHECK_TYPE(&PyInt_Type, py_do_reboot, return false;);
 
55
        r->in.do_reboot = PyInt_AsLong(py_do_reboot);
 
56
        return true;
 
57
}
 
58
 
 
59
static PyObject *unpack_py_initshutdown_Init_args_out(struct initshutdown_Init *r)
 
60
{
 
61
        PyObject *result;
 
62
        result = Py_None;
 
63
        Py_INCREF(result);
 
64
        if (!W_ERROR_IS_OK(r->out.result)) {
 
65
                PyErr_SetWERROR(r->out.result);
 
66
                return NULL;
 
67
        }
 
68
 
 
69
        return result;
 
70
}
 
71
 
 
72
static bool pack_py_initshutdown_Abort_args_in(PyObject *args, PyObject *kwargs, struct initshutdown_Abort *r)
 
73
{
 
74
        PyObject *py_server;
 
75
        const char *kwnames[] = {
 
76
                "server", NULL
 
77
        };
 
78
 
 
79
        if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:initshutdown_Abort", discard_const_p(char *, kwnames), &py_server)) {
 
80
                return false;
 
81
        }
 
82
 
 
83
        if (py_server == Py_None) {
 
84
                r->in.server = NULL;
 
85
        } else {
 
86
                r->in.server = talloc_ptrtype(r, r->in.server);
 
87
                PY_CHECK_TYPE(&PyInt_Type, py_server, return false;);
 
88
                *r->in.server = PyInt_AsLong(py_server);
 
89
        }
 
90
        return true;
 
91
}
 
92
 
 
93
static PyObject *unpack_py_initshutdown_Abort_args_out(struct initshutdown_Abort *r)
 
94
{
 
95
        PyObject *result;
 
96
        result = Py_None;
 
97
        Py_INCREF(result);
 
98
        if (!W_ERROR_IS_OK(r->out.result)) {
 
99
                PyErr_SetWERROR(r->out.result);
 
100
                return NULL;
 
101
        }
 
102
 
 
103
        return result;
 
104
}
 
105
 
 
106
static bool pack_py_initshutdown_InitEx_args_in(PyObject *args, PyObject *kwargs, struct initshutdown_InitEx *r)
 
107
{
 
108
        PyObject *py_hostname;
 
109
        PyObject *py_message;
 
110
        PyObject *py_timeout;
 
111
        PyObject *py_force_apps;
 
112
        PyObject *py_do_reboot;
 
113
        PyObject *py_reason;
 
114
        const char *kwnames[] = {
 
115
                "hostname", "message", "timeout", "force_apps", "do_reboot", "reason", NULL
 
116
        };
 
117
 
 
118
        if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOOOOO:initshutdown_InitEx", discard_const_p(char *, kwnames), &py_hostname, &py_message, &py_timeout, &py_force_apps, &py_do_reboot, &py_reason)) {
 
119
                return false;
 
120
        }
 
121
 
 
122
        if (py_hostname == Py_None) {
 
123
                r->in.hostname = NULL;
 
124
        } else {
 
125
                r->in.hostname = talloc_ptrtype(r, r->in.hostname);
 
126
                PY_CHECK_TYPE(&PyInt_Type, py_hostname, return false;);
 
127
                *r->in.hostname = PyInt_AsLong(py_hostname);
 
128
        }
 
129
        if (py_message == Py_None) {
 
130
                r->in.message = NULL;
 
131
        } else {
 
132
                r->in.message = NULL;
 
133
                PY_CHECK_TYPE(lsa_StringLarge_Type, py_message, return false;);
 
134
                if (talloc_reference(r, py_talloc_get_mem_ctx(py_message)) == NULL) {
 
135
                        PyErr_NoMemory();
 
136
                        return false;
 
137
                }
 
138
                r->in.message = (struct lsa_StringLarge *)py_talloc_get_ptr(py_message);
 
139
        }
 
140
        PY_CHECK_TYPE(&PyInt_Type, py_timeout, return false;);
 
141
        r->in.timeout = PyInt_AsLong(py_timeout);
 
142
        PY_CHECK_TYPE(&PyInt_Type, py_force_apps, return false;);
 
143
        r->in.force_apps = PyInt_AsLong(py_force_apps);
 
144
        PY_CHECK_TYPE(&PyInt_Type, py_do_reboot, return false;);
 
145
        r->in.do_reboot = PyInt_AsLong(py_do_reboot);
 
146
        PY_CHECK_TYPE(&PyInt_Type, py_reason, return false;);
 
147
        r->in.reason = PyInt_AsLong(py_reason);
 
148
        return true;
 
149
}
 
150
 
 
151
static PyObject *unpack_py_initshutdown_InitEx_args_out(struct initshutdown_InitEx *r)
 
152
{
 
153
        PyObject *result;
 
154
        result = Py_None;
 
155
        Py_INCREF(result);
 
156
        if (!W_ERROR_IS_OK(r->out.result)) {
 
157
                PyErr_SetWERROR(r->out.result);
 
158
                return NULL;
 
159
        }
 
160
 
 
161
        return result;
 
162
}
 
163
 
 
164
const struct PyNdrRpcMethodDef py_ndr_initshutdown_methods[] = {
 
165
        { "Init", "S.Init(hostname, message, timeout, force_apps, do_reboot) -> None", (py_dcerpc_call_fn)dcerpc_initshutdown_Init_r, (py_data_pack_fn)pack_py_initshutdown_Init_args_in, (py_data_unpack_fn)unpack_py_initshutdown_Init_args_out, 0, &ndr_table_initshutdown },
 
166
        { "Abort", "S.Abort(server) -> None", (py_dcerpc_call_fn)dcerpc_initshutdown_Abort_r, (py_data_pack_fn)pack_py_initshutdown_Abort_args_in, (py_data_unpack_fn)unpack_py_initshutdown_Abort_args_out, 1, &ndr_table_initshutdown },
 
167
        { "InitEx", "S.InitEx(hostname, message, timeout, force_apps, do_reboot, reason) -> None", (py_dcerpc_call_fn)dcerpc_initshutdown_InitEx_r, (py_data_pack_fn)pack_py_initshutdown_InitEx_args_in, (py_data_unpack_fn)unpack_py_initshutdown_InitEx_args_out, 2, &ndr_table_initshutdown },
 
168
        { NULL }
 
169
};
 
170
 
 
171
static PyObject *interface_initshutdown_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
 
172
{
 
173
        return py_dcerpc_interface_init_helper(type, args, kwargs, &ndr_table_initshutdown);
 
174
}
 
175
 
 
176
#define PY_DOC_INITSHUTDOWN "Init shutdown service"
 
177
static PyTypeObject initshutdown_InterfaceType = {
 
178
        PyObject_HEAD_INIT(NULL) 0,
 
179
        .tp_name = "initshutdown.initshutdown",
 
180
        .tp_basicsize = sizeof(dcerpc_InterfaceObject),
 
181
        .tp_doc = "initshutdown(binding, lp_ctx=None, credentials=None) -> connection\n"
 
182
"\n"
 
183
"binding should be a DCE/RPC binding string (for example: ncacn_ip_tcp:127.0.0.1)\n"
 
184
"lp_ctx should be a path to a smb.conf file or a param.LoadParm object\n"
 
185
"credentials should be a credentials.Credentials object.\n\n"PY_DOC_INITSHUTDOWN,
 
186
        .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
 
187
        .tp_new = interface_initshutdown_new,
 
188
};
 
189
 
 
190
static PyMethodDef initshutdown_methods[] = {
 
191
        { NULL, NULL, 0, NULL }
 
192
};
 
193
 
 
194
void initinitshutdown(void)
 
195
{
 
196
        PyObject *m;
 
197
        PyObject *dep_samba_dcerpc_base;
 
198
        PyObject *dep_samba_dcerpc_lsa;
 
199
 
 
200
        dep_samba_dcerpc_base = PyImport_ImportModule("samba.dcerpc.base");
 
201
        if (dep_samba_dcerpc_base == NULL)
 
202
                return;
 
203
 
 
204
        dep_samba_dcerpc_lsa = PyImport_ImportModule("samba.dcerpc.lsa");
 
205
        if (dep_samba_dcerpc_lsa == NULL)
 
206
                return;
 
207
 
 
208
        lsa_StringLarge_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_lsa, "StringLarge");
 
209
        if (lsa_StringLarge_Type == NULL)
 
210
                return;
 
211
 
 
212
        ClientConnection_Type = (PyTypeObject *)PyObject_GetAttrString(dep_samba_dcerpc_base, "ClientConnection");
 
213
        if (ClientConnection_Type == NULL)
 
214
                return;
 
215
 
 
216
        initshutdown_InterfaceType.tp_base = ClientConnection_Type;
 
217
 
 
218
        if (PyType_Ready(&initshutdown_InterfaceType) < 0)
 
219
                return;
 
220
        if (!PyInterface_AddNdrRpcMethods(&initshutdown_InterfaceType, py_ndr_initshutdown_methods))
 
221
                return;
 
222
 
 
223
#ifdef PY_INITSHUTDOWN_PATCH
 
224
        PY_INITSHUTDOWN_PATCH(&initshutdown_InterfaceType);
 
225
#endif
 
226
 
 
227
        m = Py_InitModule3("initshutdown", initshutdown_methods, "initshutdown DCE/RPC");
 
228
        if (m == NULL)
 
229
                return;
 
230
 
 
231
        PyModule_AddObject(m, "SHTDN_REASON_MINOR_NETWORK_CONNECTIVITY", PyInt_FromLong(SHTDN_REASON_MINOR_NETWORK_CONNECTIVITY));
 
232
        PyModule_AddObject(m, "SHTDN_REASON_MAJOR_OPERATINGSYSTEM", PyInt_FromLong(SHTDN_REASON_MAJOR_OPERATINGSYSTEM));
 
233
        PyModule_AddObject(m, "SHTDN_REASON_MAJOR_HARDWARE", PyInt_FromLong(SHTDN_REASON_MAJOR_HARDWARE));
 
234
        PyModule_AddObject(m, "SHTDN_REASON_MINOR_HUNG", PyInt_FromLong(SHTDN_REASON_MINOR_HUNG));
 
235
        PyModule_AddObject(m, "SHTDN_REASON_MINOR_BLUESCREEN", PyInt_FromLong(SHTDN_REASON_MINOR_BLUESCREEN));
 
236
        PyModule_AddObject(m, "SHTDN_REASON_MINOR_HARDWARE_DRIVER", PyInt_FromLong(SHTDN_REASON_MINOR_HARDWARE_DRIVER));
 
237
        PyModule_AddObject(m, "SHTDN_REASON_MINOR_POWER_SUPPLY", PyInt_FromLong(SHTDN_REASON_MINOR_POWER_SUPPLY));
 
238
        PyModule_AddObject(m, "SHTDN_REASON_MINOR_SERVICEPACK", PyInt_FromLong(SHTDN_REASON_MINOR_SERVICEPACK));
 
239
        PyModule_AddObject(m, "SHTDN_REASON_MINOR_ENVIRONMENT", PyInt_FromLong(SHTDN_REASON_MINOR_ENVIRONMENT));
 
240
        PyModule_AddObject(m, "SHTDN_REASON_MINOR_UPGRADE", PyInt_FromLong(SHTDN_REASON_MINOR_UPGRADE));
 
241
        PyModule_AddObject(m, "SHTDN_REASON_MINOR_TERMSRV", PyInt_FromLong(SHTDN_REASON_MINOR_TERMSRV));
 
242
        PyModule_AddObject(m, "SHTDN_REASON_MINOR_NETWORKCARD", PyInt_FromLong(SHTDN_REASON_MINOR_NETWORKCARD));
 
243
        PyModule_AddObject(m, "SHTDN_REASON_MINOR_SERVICEPACK_UNINSTALL", PyInt_FromLong(SHTDN_REASON_MINOR_SERVICEPACK_UNINSTALL));
 
244
        PyModule_AddObject(m, "SHTDN_REASON_MINOR_INSTALLATION", PyInt_FromLong(SHTDN_REASON_MINOR_INSTALLATION));
 
245
        PyModule_AddObject(m, "SHTDN_REASON_MINOR_SECURITYFIX", PyInt_FromLong(SHTDN_REASON_MINOR_SECURITYFIX));
 
246
        PyModule_AddObject(m, "SHTDN_REASON_MINOR_HOTFIX", PyInt_FromLong(SHTDN_REASON_MINOR_HOTFIX));
 
247
        PyModule_AddObject(m, "SHTDN_REASON_MAJOR_LEGACY_API", PyInt_FromLong(SHTDN_REASON_MAJOR_LEGACY_API));
 
248
        PyModule_AddObject(m, "SHTDN_REASON_MINOR_OTHER", PyInt_FromLong(SHTDN_REASON_MINOR_OTHER));
 
249
        PyModule_AddObject(m, "SHTDN_REASON_MINOR_HOTFIX_UNINSTALL", PyInt_FromLong(SHTDN_REASON_MINOR_HOTFIX_UNINSTALL));
 
250
        PyModule_AddObject(m, "SHTDN_REASON_MINOR_SECURITY", PyInt_FromLong(SHTDN_REASON_MINOR_SECURITY));
 
251
        PyModule_AddObject(m, "SHTDN_REASON_MINOR_RECONFIG", PyInt_FromLong(SHTDN_REASON_MINOR_RECONFIG));
 
252
        PyModule_AddObject(m, "SHTDN_REASON_MINOR_MMC", PyInt_FromLong(SHTDN_REASON_MINOR_MMC));
 
253
        PyModule_AddObject(m, "SHTDN_REASON_MINOR_DISK", PyInt_FromLong(SHTDN_REASON_MINOR_DISK));
 
254
        PyModule_AddObject(m, "SHTDN_REASON_MINOR_PROCESSOR", PyInt_FromLong(SHTDN_REASON_MINOR_PROCESSOR));
 
255
        PyModule_AddObject(m, "SHTDN_REASON_MINOR_SECURITYFIX_UNINSTALL", PyInt_FromLong(SHTDN_REASON_MINOR_SECURITYFIX_UNINSTALL));
 
256
        PyModule_AddObject(m, "SHTDN_REASON_MAJOR_OTHER", PyInt_FromLong(SHTDN_REASON_MAJOR_OTHER));
 
257
        PyModule_AddObject(m, "SHTDN_REASON_MINOR_CORDUNPLUGGED", PyInt_FromLong(SHTDN_REASON_MINOR_CORDUNPLUGGED));
 
258
        PyModule_AddObject(m, "SHTDN_REASON_FLAG_PLANNED", PyInt_FromLong(SHTDN_REASON_FLAG_PLANNED));
 
259
        PyModule_AddObject(m, "SHTDN_REASON_MINOR_MAINTENANCE", PyInt_FromLong(SHTDN_REASON_MINOR_MAINTENANCE));
 
260
        PyModule_AddObject(m, "SHTDN_REASON_FLAG_USER_DEFINED", PyInt_FromLong(SHTDN_REASON_FLAG_USER_DEFINED));
 
261
        PyModule_AddObject(m, "SHTDN_REASON_MAJOR_SOFTWARE", PyInt_FromLong(SHTDN_REASON_MAJOR_SOFTWARE));
 
262
        PyModule_AddObject(m, "SHTDN_REASON_MAJOR_APPLICATION", PyInt_FromLong(SHTDN_REASON_MAJOR_APPLICATION));
 
263
        PyModule_AddObject(m, "SHTDN_REASON_MINOR_UNSTABLE", PyInt_FromLong(SHTDN_REASON_MINOR_UNSTABLE));
 
264
        PyModule_AddObject(m, "SHTDN_REASON_MAJOR_POWER", PyInt_FromLong(SHTDN_REASON_MAJOR_POWER));
 
265
        PyModule_AddObject(m, "SHTDN_REASON_MINOR_WMI", PyInt_FromLong(SHTDN_REASON_MINOR_WMI));
 
266
        PyModule_AddObject(m, "SHTDN_REASON_MINOR_OTHERDRIVER", PyInt_FromLong(SHTDN_REASON_MINOR_OTHERDRIVER));
 
267
        PyModule_AddObject(m, "SHTDN_REASON_MAJOR_SYSTEM", PyInt_FromLong(SHTDN_REASON_MAJOR_SYSTEM));
 
268
        Py_INCREF((PyObject *)(void *)&initshutdown_InterfaceType);
 
269
        PyModule_AddObject(m, "initshutdown", (PyObject *)(void *)&initshutdown_InterfaceType);
 
270
#ifdef PY_MOD_INITSHUTDOWN_PATCH
 
271
        PY_MOD_INITSHUTDOWN_PATCH(m);
 
272
#endif
 
273
 
 
274
}