summaryrefslogtreecommitdiff
path: root/source3/python
diff options
context:
space:
mode:
Diffstat (limited to 'source3/python')
-rw-r--r--source3/python/py_lsa.c40
-rw-r--r--source3/python/py_samba.c56
-rw-r--r--source3/python/py_spoolss.c163
-rw-r--r--source3/python/py_spoolss_printers.c16
-rw-r--r--source3/python/py_srvsvc.c40
-rw-r--r--source3/python/py_srvsvc.h4
-rw-r--r--source3/python/py_srvsvc_conv.c2
-rw-r--r--source3/python/py_tdb.c8
-rw-r--r--source3/python/py_tdbpack.c178
-rw-r--r--source3/python/py_winbind.c190
-rw-r--r--source3/python/py_winreg.h3
-rwxr-xr-xsource3/python/setup.py13
12 files changed, 396 insertions, 317 deletions
diff --git a/source3/python/py_lsa.c b/source3/python/py_lsa.c
index c063dcba81..22db29665a 100644
--- a/source3/python/py_lsa.c
+++ b/source3/python/py_lsa.c
@@ -383,32 +383,32 @@ static PyMethodDef lsa_methods[] = {
{ "setup_logging", (PyCFunction)py_setup_logging,
METH_VARARGS | METH_KEYWORDS,
- "Set up debug logging.\n"
-"\n"
-"Initialises Samba's debug logging system. One argument is expected which\n"
-"is a boolean specifying whether debugging is interactive and sent to stdout\n"
-"or logged to a file.\n"
-"\n"
-"Example:\n"
-"\n"
-">>> spoolss.setup_logging(interactive = 1)" },
+ "Set up debug logging.
+
+Initialises Samba's debug logging system. One argument is expected which
+is a boolean specifying whether debugging is interactive and sent to stdout
+or logged to a file.
+
+Example:
+
+>>> spoolss.setup_logging(interactive = 1)" },
{ "get_debuglevel", (PyCFunction)get_debuglevel,
METH_VARARGS,
- "Set the current debug level.\n"
-"\n"
-"Example:\n"
-"\n"
-">>> spoolss.get_debuglevel()\n"
-"0" },
+ "Set the current debug level.
+
+Example:
+
+>>> spoolss.get_debuglevel()
+0" },
{ "set_debuglevel", (PyCFunction)set_debuglevel,
METH_VARARGS,
- "Get the current debug level.\n"
-"\n"
-"Example:\n"
-"\n"
-">>> spoolss.set_debuglevel(10)" },
+ "Get the current debug level.
+
+Example:
+
+>>> spoolss.set_debuglevel(10)" },
{ NULL }
};
diff --git a/source3/python/py_samba.c b/source3/python/py_samba.c
new file mode 100644
index 0000000000..c0ade12f65
--- /dev/null
+++ b/source3/python/py_samba.c
@@ -0,0 +1,56 @@
+/*
+ Python wrappers for DCERPC/SMB client routines.
+
+ Copyright (C) Tim Potter, 2002
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "Python.h"
+#include "python/py_common.h"
+
+/*
+ * Module initialisation
+ */
+
+static PyObject *lsa_open_policy(PyObject *self, PyObject *args,
+ PyObject *kw)
+{
+ return NULL;
+}
+
+static PyMethodDef samba_methods[] = {
+ { NULL }
+};
+
+static PyMethodDef cheepy_methods[] = {
+ { "open_policy", (PyCFunction)lsa_open_policy, METH_VARARGS|METH_KEYWORDS,
+ "Foo"},
+ { NULL }
+};
+
+void initsamba(void)
+{
+ PyObject *module, *new_module, *dict;
+
+ /* Initialise module */
+
+ module = Py_InitModule("samba", samba_methods);
+ dict = PyModule_GetDict(module);
+
+ /* Do samba initialisation */
+
+ py_samba_init();
+}
diff --git a/source3/python/py_spoolss.c b/source3/python/py_spoolss.c
index b8df5cbf11..7b0a102b31 100644
--- a/source3/python/py_spoolss.c
+++ b/source3/python/py_spoolss.c
@@ -33,22 +33,22 @@ static PyMethodDef spoolss_methods[] = {
/* Open/close printer handles */
{ "openprinter", (PyCFunction)spoolss_openprinter, METH_VARARGS | METH_KEYWORDS,
- "Open a printer by name in UNC format.\n"
-"\n"
-"Optionally a dictionary of (domain, username, password) may be given in\n"
-"which case they are used when opening the RPC pipe. An access mask may\n"
-"also be given which defaults to MAXIMUM_ALLOWED_ACCESS.\n"
-"\n"
-"Example:\n"
-"\n"
-">>> hnd = spoolss.openprinter(\"\\\\\\\\NPSD-PDC2\\\\meanie\")"},
+ "Open a printer by name in UNC format.
+
+Optionally a dictionary of (domain, username, password) may be given in
+which case they are used when opening the RPC pipe. An access mask may
+also be given which defaults to MAXIMUM_ALLOWED_ACCESS.
+
+Example:
+
+>>> hnd = spoolss.openprinter(\"\\\\\\\\NPSD-PDC2\\\\meanie\")"},
{ "closeprinter", spoolss_closeprinter, METH_VARARGS,
- "Close a printer handle opened with openprinter or addprinter.\n"
-"\n"
-"Example:\n"
-"\n"
-">>> spoolss.closeprinter(hnd)"},
+ "Close a printer handle opened with openprinter or addprinter.
+
+Example:
+
+>>> spoolss.closeprinter(hnd)"},
{ "addprinterex", (PyCFunction)spoolss_addprinterex, METH_VARARGS,
"addprinterex()"},
@@ -57,77 +57,76 @@ static PyMethodDef spoolss_methods[] = {
{ "enumprinters", (PyCFunction)spoolss_enumprinters,
METH_VARARGS | METH_KEYWORDS,
- "Enumerate printers on a print server.\n"
-"\n"
-"Return a list of printers on a print server. The credentials, info level\n"
-"and flags may be specified as keyword arguments.\n"
-"\n"
-"Example:\n"
-"\n"
-">>> print spoolss.enumprinters(\"\\\\\\\\npsd-pdc2\")\n"
-"[{'comment': 'i am a comment', 'printer_name': 'meanie', 'flags': 8388608, \n"
-" 'description': 'meanie,Generic / Text Only,i am a location'}, \n"
-" {'comment': '', 'printer_name': 'fileprint', 'flags': 8388608, \n"
-" 'description': 'fileprint,Generic / Text Only,'}]"},
+ "Enumerate printers on a print server.
+
+Return a list of printers on a print server. The credentials, info level
+and flags may be specified as keyword arguments.
+
+Example:
+
+>>> print spoolss.enumprinters(\"\\\\\\\\npsd-pdc2\")
+[{'comment': 'i am a comment', 'printer_name': 'meanie', 'flags': 8388608,
+ 'description': 'meanie,Generic / Text Only,i am a location'},
+ {'comment': '', 'printer_name': 'fileprint', 'flags': 8388608,
+ 'description': 'fileprint,Generic / Text Only,'}]"},
{ "enumports", (PyCFunction)spoolss_enumports,
METH_VARARGS | METH_KEYWORDS,
- "Enumerate ports on a print server.\n"
-"\n"
-"Return a list of ports on a print server.\n"
-"\n"
-"Example:\n"
-"\n"
-">>> print spoolss.enumports(\"\\\\\\\\npsd-pdc2\")\n"
-"[{'name': 'LPT1:'}, {'name': 'LPT2:'}, {'name': 'COM1:'}, \n"
-"{'name': 'COM2:'}, {'name': 'FILE:'}, {'name': '\\\\nautilus1\\zpekt3r'}]"},
+ "Enumerate ports on a print server.
+
+Return a list of ports on a print server.
+
+Example:
+
+>>> print spoolss.enumports(\"\\\\\\\\npsd-pdc2\")
+[{'name': 'LPT1:'}, {'name': 'LPT2:'}, {'name': 'COM1:'}, {'name': 'COM2:'},
+ {'name': 'FILE:'}, {'name': '\\\\nautilus1\\zpekt3r'}]"},
{ "enumprinterdrivers", (PyCFunction)spoolss_enumprinterdrivers,
METH_VARARGS | METH_KEYWORDS,
- "Enumerate printer drivers on a print server.\n"
-"\n"
-"Return a list of printer drivers."},
+ "Enumerate printer drivers on a print server.
+Return a list of printer drivers."},
/* Miscellaneous other commands */
{ "getprinterdriverdir", (PyCFunction)spoolss_getprinterdriverdir,
METH_VARARGS | METH_KEYWORDS,
- "Return printer driver directory.\n"
-"\n"
-"Return the printer driver directory for a given architecture. The\n"
-"architecture defaults to \"Windows NT x86\"."},
+ "Return printer driver directory.
+
+Return the printer driver directory for a given architecture. The
+architecture defaults to \"Windows NT x86\"."},
/* Other stuff - this should really go into a samba config module
but for the moment let's leave it here. */
{ "setup_logging", (PyCFunction)py_setup_logging,
METH_VARARGS | METH_KEYWORDS,
- "Set up debug logging.\n"
-"\n"
-"Initialises Samba's debug logging system. One argument is expected which\n"
-"is a boolean specifying whether debugging is interactive and sent to stdout\n"
-"or logged to a file.\n"
-"\n"
-"Example:\n"
-"\n"
-">>> spoolss.setup_logging(interactive = 1)" },
+ "Set up debug logging.
+
+Initialises Samba's debug logging system. One argument is expected which
+is a boolean specifying whether debugging is interactive and sent to stdout
+or logged to a file.
+
+Example:
+
+>>> spoolss.setup_logging(interactive = 1)" },
{ "get_debuglevel", (PyCFunction)get_debuglevel,
METH_VARARGS,
- "Set the current debug level.\n"
-"\n"
-"Example:\n"
-"\n"
-">>> spoolss.get_debuglevel()\n"
-"0" },
+ "Set the current debug level.
+
+Example:
+
+>>> spoolss.get_debuglevel()
+0" },
{ "set_debuglevel", (PyCFunction)set_debuglevel,
METH_VARARGS,
- "Get the current debug level.\n"
-"\n"
-"Example:\n"
-"\n"
-">>> spoolss.set_debuglevel(10)" },
+ "Get the current debug level.
+
+Example:
+
+>>> spoolss.set_debuglevel(10)" },
/* Printer driver routines */
@@ -158,16 +157,16 @@ static PyMethodDef spoolss_hnd_methods[] = {
{ "getprinter", (PyCFunction)spoolss_hnd_getprinter,
METH_VARARGS | METH_KEYWORDS,
- "Get printer information.\n"
-"\n"
-"Return a dictionary of print information. The info level defaults to 1.\n"
-"\n"
-"Example:\n"
-"\n"
-">>> hnd.getprinter()\n"
-"{'comment': 'i am a comment', 'printer_name': '\\\\NPSD-PDC2\\meanie',\n"
-" 'description': '\\\\NPSD-PDC2\\meanie,Generic / Text Only,i am a location',\n"
-" 'flags': 8388608}"},
+ "Get printer information.
+
+Return a dictionary of print information. The info level defaults to 1.
+
+Example:
+
+>>> hnd.getprinter()
+{'comment': 'i am a comment', 'printer_name': '\\\\NPSD-PDC2\\meanie',
+ 'description': '\\\\NPSD-PDC2\\meanie,Generic / Text Only,i am a location',
+ 'flags': 8388608}"},
{ "setprinter", (PyCFunction)spoolss_hnd_setprinter,
METH_VARARGS | METH_KEYWORDS,
@@ -177,24 +176,24 @@ static PyMethodDef spoolss_hnd_methods[] = {
{ "getprinterdriver", (PyCFunction)spoolss_hnd_getprinterdriver,
METH_VARARGS | METH_KEYWORDS,
- "Return printer driver information.\n"
-"\n"
-"Return a dictionary of printer driver information for the printer driver\n"
-"bound to this printer."},
+ "Return printer driver information.
+
+Return a dictionary of printer driver information for the printer driver
+bound to this printer."},
/* Forms */
{ "enumforms", (PyCFunction)spoolss_hnd_enumforms,
METH_VARARGS | METH_KEYWORDS,
- "Enumerate supported forms.\n"
-"\n"
-"Return a list of forms supported by this printer or print server."},
+ "Enumerate supported forms.
+
+Return a list of forms supported by this printer or print server."},
{ "setform", (PyCFunction)spoolss_hnd_setform,
METH_VARARGS | METH_KEYWORDS,
- "Set form data.\n"
-"\n"
-"Set the form given by the dictionary argument."},
+ "Set form data.
+
+Set the form given by the dictionary argument."},
{ "addform", (PyCFunction)spoolss_hnd_addform,
METH_VARARGS | METH_KEYWORDS,
diff --git a/source3/python/py_spoolss_printers.c b/source3/python/py_spoolss_printers.c
index d011681acc..929442ab67 100644
--- a/source3/python/py_spoolss_printers.c
+++ b/source3/python/py_spoolss_printers.c
@@ -173,6 +173,22 @@ PyObject *spoolss_hnd_getprinter(PyObject *self, PyObject *args, PyObject *kw)
case 3:
py_from_PRINTER_INFO_3(&result, ctr.printers_3);
break;
+
+ /* These info levels are supported by NT4 and higher
+ but don't seem to be used by any clients we know of. */
+
+ case 4:
+ case 5:
+ case 6:
+ break;
+
+ /* These info levels are only supported by Windows 2000
+ and higher. */
+
+ case 7:
+ case 8:
+ case 9:
+ break;
}
Py_INCREF(result);
diff --git a/source3/python/py_srvsvc.c b/source3/python/py_srvsvc.c
index 3e5a42be23..8ec2430285 100644
--- a/source3/python/py_srvsvc.c
+++ b/source3/python/py_srvsvc.c
@@ -158,32 +158,32 @@ static PyMethodDef srvsvc_methods[] = {
{ "setup_logging", (PyCFunction)py_setup_logging,
METH_VARARGS | METH_KEYWORDS,
- "Set up debug logging.\n"
-"\n"
-"Initialises Samba's debug logging system. One argument is expected which\n"
-"is a boolean specifying whether debugging is interactive and sent to stdout\n"
-"or logged to a file.\n"
-"\n"
-"Example:\n"
-"\n"
-">>> srvsvc.setup_logging(interactive = 1)" },
+ "Set up debug logging.
+
+Initialises Samba's debug logging system. One argument is expected which
+is a boolean specifying whether debugging is interactive and sent to stdout
+or logged to a file.
+
+Example:
+
+>>> srvsvc.setup_logging(interactive = 1)" },
{ "get_debuglevel", (PyCFunction)get_debuglevel,
METH_VARARGS,
- "Set the current debug level.\n"
-"\n"
-"Example:\n"
-"\n"
-">>> srvsvc.get_debuglevel()\n"
-"0" },
+ "Set the current debug level.
+
+Example:
+
+>>> srvsvc.get_debuglevel()
+0" },
{ "set_debuglevel", (PyCFunction)set_debuglevel,
METH_VARARGS,
- "Get the current debug level.\n"
-"\n"
-"Example:\n"
-"\n"
-">>> srvsvc.set_debuglevel(10)" },
+ "Get the current debug level.
+
+Example:
+
+>>> srvsvc.set_debuglevel(10)" },
{ NULL }
};
diff --git a/source3/python/py_srvsvc.h b/source3/python/py_srvsvc.h
index c5e71cb90f..b440c32e13 100644
--- a/source3/python/py_srvsvc.h
+++ b/source3/python/py_srvsvc.h
@@ -23,8 +23,4 @@
#include "python/py_common.h"
-/* The following definitions come from python/py_srvsv.c */
-
-BOOL py_from_SRV_INFO_101(PyObject **dict, SRV_INFO_101 *info);
-
#endif /* _PY_SRVSVC_H */
diff --git a/source3/python/py_srvsvc_conv.c b/source3/python/py_srvsvc_conv.c
index 86c3761d0f..de43f070ed 100644
--- a/source3/python/py_srvsvc_conv.c
+++ b/source3/python/py_srvsvc_conv.c
@@ -33,6 +33,8 @@ static struct pyconv py_SRV_INFO_101[] = {
BOOL py_from_SRV_INFO_101(PyObject **dict, SRV_INFO_101 *info)
{
+ PyObject *obj;
+
*dict = from_struct(info, py_SRV_INFO_101);
PyDict_SetItemString(*dict, "level", PyInt_FromLong(101));
diff --git a/source3/python/py_tdb.c b/source3/python/py_tdb.c
index 37f64ce780..e525422a30 100644
--- a/source3/python/py_tdb.c
+++ b/source3/python/py_tdb.c
@@ -27,14 +27,6 @@
*/
#include "includes.h"
-
-/* This symbol is used in both includes.h and Python.h which causes an
- annoying compiler warning. */
-
-#ifdef HAVE_FSTAT
-#undef HAVE_FSTAT
-#endif
-
#include "Python.h"
/* Tdb exception */
diff --git a/source3/python/py_tdbpack.c b/source3/python/py_tdbpack.c
index 4fa97af8a3..f0718b717e 100644
--- a/source3/python/py_tdbpack.c
+++ b/source3/python/py_tdbpack.c
@@ -66,98 +66,102 @@ static PyObject *pytdbpack_bad_type(char ch,
PyObject *val_obj);
static const char * pytdbpack_docstring =
-"Convert between Python values and Samba binary encodings.\n"
-"\n"
-"This module is conceptually similar to the standard 'struct' module, but it\n"
-"uses both a different binary format and a different description string.\n"
-"\n"
-"Samba's encoding is based on that used inside DCE-RPC and SMB: a\n"
-"little-endian, unpadded, non-self-describing binary format. It is intended\n"
-"that these functions be as similar as possible to the routines in Samba's\n"
-"tdb/tdbutil module, with appropriate adjustments for Python datatypes.\n"
-"\n"
-"Python strings are used to specify the format of data to be packed or\n"
-"unpacked.\n"
-"\n"
-"String encodings are implied by the database format: they may be either DOS\n"
-"codepage (currently hardcoded to 850), or Unix codepage (currently hardcoded\n"
-"to be the same as the default Python encoding).\n"
-"\n"
-"tdbpack format strings:\n"
-"\n"
-" 'f': NUL-terminated string in codepage iso8859-1\n"
-" \n"
-" 'P': same as 'f'\n"
-"\n"
-" 'F': NUL-terminated string in iso-8859-1\n"
-"\n"
-" 'd': 4 byte little-endian unsigned number\n"
-"\n"
-" 'w': 2 byte little-endian unsigned number\n"
-"\n"
-" 'P': \"Pointer\" value -- in the subset of DCERPC used by Samba, this is\n"
-" really just an \"exists\" or \"does not exist\" flag. The boolean\n"
-" value of the Python object is used.\n"
-" \n"
-" 'B': 4-byte LE length, followed by that many bytes of binary data.\n"
-" Corresponds to a Python integer giving the length, followed by a byte\n"
-" string of the appropriate length.\n"
-"\n"
-" '$': Special flag indicating that the preceding format code should be\n"
-" repeated while data remains. This is only supported for unpacking.\n"
-"\n"
-" Every code corresponds to a single Python object, except 'B' which\n"
-" corresponds to two values (length and contents), and '$', which produces\n"
-" however many make sense.\n";
+"Convert between Python values and Samba binary encodings.
+
+This module is conceptually similar to the standard 'struct' module, but it
+uses both a different binary format and a different description string.
+
+Samba's encoding is based on that used inside DCE-RPC and SMB: a
+little-endian, unpadded, non-self-describing binary format. It is intended
+that these functions be as similar as possible to the routines in Samba's
+tdb/tdbutil module, with appropriate adjustments for Python datatypes.
+
+Python strings are used to specify the format of data to be packed or
+unpacked.
+
+String encodings are implied by the database format: they may be either DOS
+codepage (currently hardcoded to 850), or Unix codepage (currently hardcoded
+to be the same as the default Python encoding).
+
+tdbpack format strings:
+
+ 'f': NUL-terminated string in codepage iso8859-1
+
+ 'P': same as 'f'
+
+ 'F': NUL-terminated string in iso-8859-1
+
+ 'd': 4 byte little-endian unsigned number
+
+ 'w': 2 byte little-endian unsigned number
+
+ 'P': \"Pointer\" value -- in the subset of DCERPC used by Samba, this is
+ really just an \"exists\" or \"does not exist\" flag. The boolean
+ value of the Python object is used.
+
+ 'B': 4-byte LE length, followed by that many bytes of binary data.
+ Corresponds to a Python integer giving the length, followed by a byte
+ string of the appropriate length.
+
+ '$': Special flag indicating that the preceding format code should be
+ repeated while data remains. This is only supported for unpacking.
+
+ Every code corresponds to a single Python object, except 'B' which
+ corresponds to two values (length and contents), and '$', which produces
+ however many make sense.
+";
+
static char const pytdbpack_doc[] =
-"pack(format, values) -> buffer\n"
-"Pack Python objects into Samba binary format according to format string.\n"
-"\n"
-"arguments:\n"
-" format -- string of tdbpack format characters\n"
-" values -- sequence of value objects corresponding 1:1 to format characters\n"
-"\n"
-"returns:\n"
-" buffer -- string containing packed data\n"
-"\n"
-"raises:\n"
-" IndexError -- if there are too few values for the format\n"
-" ValueError -- if any of the format characters is illegal\n"
-" TypeError -- if the format is not a string, or values is not a sequence,\n"
-" or any of the values is of the wrong type for the corresponding\n"
-" format character\n"
-"\n"
-"notes:\n"
-" For historical reasons, it is not an error to pass more values than are consumed\n"
-" by the format.\n";
+"pack(format, values) -> buffer
+Pack Python objects into Samba binary format according to format string.
+
+arguments:
+ format -- string of tdbpack format characters
+ values -- sequence of value objects corresponding 1:1 to format characters
+
+returns:
+ buffer -- string containing packed data
+
+raises:
+ IndexError -- if there are too few values for the format
+ ValueError -- if any of the format characters is illegal
+ TypeError -- if the format is not a string, or values is not a sequence,
+ or any of the values is of the wrong type for the corresponding
+ format character
+
+notes:
+ For historical reasons, it is not an error to pass more values than are consumed
+ by the format.
+";
static char const pytdbunpack_doc[] =
-"unpack(format, buffer) -> (values, rest)\n"
-"Unpack Samba binary data according to format string.\n"
-"\n"
-"arguments:\n"
-" format -- string of tdbpack characters\n"
-" buffer -- string of packed binary data\n"
-"\n"
-"returns:\n"
-" 2-tuple of:\n"
-" values -- sequence of values corresponding 1:1 to format characters\n"
-" rest -- string containing data that was not decoded, or '' if the\n"
-" whole string was consumed\n"
-"\n"
-"raises:\n"
-" IndexError -- if there is insufficient data in the buffer for the\n"
-" format (or if the data is corrupt and contains a variable-length\n"
-" field extending past the end)\n"
-" ValueError -- if any of the format characters is illegal\n"
-"\n"
-"notes:\n"
-" Because unconsumed data is returned, you can feed it back in to the\n"
-" unpacker to extract further fields. Alternatively, if you wish to modify\n"
-" some fields near the start of the data, you may be able to save time by\n"
-" only unpacking and repacking the necessary part.\n";
+"unpack(format, buffer) -> (values, rest)
+Unpack Samba binary data according to format string.
+
+arguments:
+ format -- string of tdbpack characters
+ buffer -- string of packed binary data
+
+returns:
+ 2-tuple of:
+ values -- sequence of values corresponding 1:1 to format characters
+ rest -- string containing data that was not decoded, or '' if the
+ whole string was consumed
+
+raises:
+ IndexError -- if there is insufficient data in the buffer for the
+ format (or if the data is corrupt and contains a variable-length
+ field extending past the end)
+ ValueError -- if any of the format characters is illegal
+
+notes:
+ Because unconsumed data is returned, you can feed it back in to the
+ unpacker to extract further fields. Alternatively, if you wish to modify
+ some fields near the start of the data, you may be able to save time by
+ only unpacking and repacking the necessary part.
+";
const char *pytdb_dos_encoding = "cp850";
diff --git a/source3/python/py_winbind.c b/source3/python/py_winbind.c
index db66be2321..20bbe9dba4 100644
--- a/source3/python/py_winbind.c
+++ b/source3/python/py_winbind.c
@@ -585,136 +585,136 @@ static PyMethodDef winbind_methods[] = {
/* Name <-> SID conversion */
{ "name_to_sid", (PyCFunction)py_name_to_sid, METH_VARARGS,
- "name_to_sid(s) -> string\n"
-"\n"
-"Return the SID for a name.\n"
-"\n"
-"Example:\n"
-"\n"
-">>> winbind.name_to_sid('FOO/Administrator')\n"
-"'S-1-5-21-406022937-1377575209-526660263-500' " },
+ "name_to_sid(s) -> string
+
+Return the SID for a name.
+
+Example:
+
+>>> winbind.name_to_sid('FOO/Administrator')
+'S-1-5-21-406022937-1377575209-526660263-500' " },
{ "sid_to_name", (PyCFunction)py_sid_to_name, METH_VARARGS,
- "sid_to_name(s) -> string\n"
-"\n"
-"Return the name for a SID.\n"
-"\n"
-"Example:\n"
-"\n"
-">>> import winbind\n"
-">>> winbind.sid_to_name('S-1-5-21-406022937-1377575209-526660263-500')\n"
-"'FOO/Administrator' " },
+ "sid_to_name(s) -> string
+
+Return the name for a SID.
+
+Example:
+
+>>> import winbind
+>>> winbind.sid_to_name('S-1-5-21-406022937-1377575209-526660263-500')
+'FOO/Administrator' " },
/* Enumerate users/groups */
{ "enum_domain_users", (PyCFunction)py_enum_domain_users, METH_VARARGS,
- "enum_domain_users() -> list of strings\n"
-"\n"
-"Return a list of domain users.\n"
-"\n"
-"Example:\n"
-"\n"
-">>> winbind.enum_domain_users()\n"
-"['FOO/Administrator', 'FOO/anna', 'FOO/Anne Elk', 'FOO/build', \n"
-"'FOO/foo', 'FOO/foo2', 'FOO/foo3', 'FOO/Guest', 'FOO/user1', \n"
-"'FOO/whoops-ptang'] " },
+ "enum_domain_users() -> list of strings
+
+Return a list of domain users.
+
+Example:
+
+>>> winbind.enum_domain_users()
+['FOO/Administrator', 'FOO/anna', 'FOO/Anne Elk', 'FOO/build',
+'FOO/foo', 'FOO/foo2', 'FOO/foo3', 'FOO/Guest', 'FOO/user1',
+'FOO/whoops-ptang'] " },
{ "enum_domain_groups", (PyCFunction)py_enum_domain_groups,
METH_VARARGS,
- "enum_domain_groups() -> list of strings\n"
-"\n"
-"Return a list of domain groups.\n"
-"\n"
-"Example:\n"
-"\n"
-">>> winbind.enum_domain_groups()\n"
-"['FOO/cows', 'FOO/Domain Admins', 'FOO/Domain Guests', \n"
-"'FOO/Domain Users'] " },
+ "enum_domain_groups() -> list of strings
+
+Return a list of domain groups.
+
+Example:
+
+>>> winbind.enum_domain_groups()
+['FOO/cows', 'FOO/Domain Admins', 'FOO/Domain Guests',
+'FOO/Domain Users'] " },
/* ID mapping */
{ "uid_to_sid", (PyCFunction)py_uid_to_sid, METH_VARARGS,
- "uid_to_sid(int) -> string\n"
-"\n"
-"Return the SID for a UNIX uid.\n"
-"\n"
-"Example:\n"
-"\n"
-">>> winbind.uid_to_sid(10000) \n"
-"'S-1-5-21-406022937-1377575209-526660263-500' " },
+ "uid_to_sid(int) -> string
+
+Return the SID for a UNIX uid.
+
+Example:
+
+>>> winbind.uid_to_sid(10000)
+'S-1-5-21-406022937-1377575209-526660263-500' " },
{ "gid_to_sid", (PyCFunction)py_gid_to_sid, METH_VARARGS,
- "gid_to_sid(int) -> string\n"
-"\n"
-"Return the UNIX gid for a SID.\n"
-"\n"
-"Example:\n"
-"\n"
-">>> winbind.gid_to_sid(10001)\n"
-"'S-1-5-21-406022937-1377575209-526660263-512' " },
+ "gid_to_sid(int) -> string
+
+Return the UNIX gid for a SID.
+
+Example:
+
+>>> winbind.gid_to_sid(10001)
+'S-1-5-21-406022937-1377575209-526660263-512' " },
{ "sid_to_uid", (PyCFunction)py_sid_to_uid, METH_VARARGS,
- "sid_to_uid(string) -> int\n"
-"\n"
-"Return the UNIX uid for a SID.\n"
-"\n"
-"Example:\n"
-"\n"
-">>> winbind.sid_to_uid('S-1-5-21-406022937-1377575209-526660263-500')\n"
-"10000 " },
+ "sid_to_uid(string) -> int
+
+Return the UNIX uid for a SID.
+
+Example:
+
+>>> winbind.sid_to_uid('S-1-5-21-406022937-1377575209-526660263-500')
+10000 " },
{ "sid_to_gid", (PyCFunction)py_sid_to_gid, METH_VARARGS,
- "sid_to_gid(string) -> int\n"
-"\n"
-"Return the UNIX gid corresponding to a SID.\n"
-"\n"
-"Example:\n"
-"\n"
-">>> winbind.sid_to_gid('S-1-5-21-406022937-1377575209-526660263-512')\n"
-"10001 " },
+ "sid_to_gid(string) -> int
+
+Return the UNIX gid corresponding to a SID.
+
+Example:
+
+>>> winbind.sid_to_gid('S-1-5-21-406022937-1377575209-526660263-512')
+10001 " },
/* Miscellaneous */
{ "check_secret", (PyCFunction)py_check_secret, METH_VARARGS,
- "check_secret() -> int\n"
-"\n"
-"Check the machine trust account password. The NT status is returned\n"
-"with zero indicating success. " },
+ "check_secret() -> int
+
+Check the machine trust account password. The NT status is returned
+with zero indicating success. " },
{ "enum_trust_dom", (PyCFunction)py_enum_trust_dom, METH_VARARGS,
- "enum_trust_dom() -> list of strings\n"
-"\n"
-"Return a list of trusted domains. The domain the server is a member \n"
-"of is not included.\n"
-"\n"
-"Example:\n"
-"\n"
-">>> winbind.enum_trust_dom()\n"
-"['NPSD-TEST2', 'SP2NDOM'] " },
+ "enum_trust_dom() -> list of strings
+
+Return a list of trusted domains. The domain the server is a member
+of is not included.
+
+Example:
+
+>>> winbind.enum_trust_dom()
+['NPSD-TEST2', 'SP2NDOM'] " },
/* PAM authorisation functions */
{ "auth_plaintext", (PyCFunction)py_auth_plaintext, METH_VARARGS,
- "auth_plaintext(s, s) -> int\n"
-"\n"
-"Authenticate a username and password using plaintext authentication.\n"
-"The NT status code is returned with zero indicating success." },
+ "auth_plaintext(s, s) -> int
+
+Authenticate a username and password using plaintext authentication.
+The NT status code is returned with zero indicating success." },
{ "auth_crap", (PyCFunction)py_auth_crap, METH_VARARGS,
- "auth_crap(s, s) -> int\n"
-"\n"
-"Authenticate a username and password using the challenge/response\n"
-"protocol. The NT status code is returned with zero indicating\n"
-"success." },
+ "auth_crap(s, s) -> int
+
+Authenticate a username and password using the challenge/response
+protocol. The NT status code is returned with zero indicating
+success." },
#if 0 /* Include when smbd_auth merged to HEAD */
{ "auth_smbd", (PyCFunction)py_auth_crap, METH_VARARGS,
- "auth_smbd(s, s) -> int\n"
-"\n"
-"Authenticate a username and password using the challenge/response\n"
-"protocol but using the domain secret to prove we are root. The NT \n"
-"status code is returned with zero indicating success." },
+ "auth_smbd(s, s) -> int
+
+Authenticate a username and password using the challenge/response
+protocol but using the domain secret to prove we are root. The NT
+status code is returned with zero indicating success." },
#endif
diff --git a/source3/python/py_winreg.h b/source3/python/py_winreg.h
index 95d5fc6ea9..e19674d218 100644
--- a/source3/python/py_winreg.h
+++ b/source3/python/py_winreg.h
@@ -21,6 +21,9 @@
#ifndef _PY_WINREG_H
#define _PY_WINREG_H
+#include "includes.h"
+#include "Python.h"
+
#include "python/py_common.h"
#endif /* _PY_WINREG_H */
diff --git a/source3/python/setup.py b/source3/python/setup.py
index 8bc8868a70..48487fee4d 100755
--- a/source3/python/setup.py
+++ b/source3/python/setup.py
@@ -177,9 +177,20 @@ setup(
extra_compile_args = flags_list,
extra_objects = obj_list),
+ # Moving to merge all individual extensions in to one big
+ # extension. This is to avoid the fact that each extension is 3MB
+ # in size due to the lack of proper depedency management in Samba.
+
+ Extension(name = "samba",
+ sources = [samba_srcdir + "python/py_samba.c",
+ samba_srcdir + "python/py_common.c"],
+ libraries = lib_list,
+ library_dirs = ["/usr/kerberos/lib"],
+ extra_compile_args = flags_list,
+ extra_objects = obj_list),
+
# tdbpack/unpack extensions. Does not actually link to any Samba
# code, although it implements a compatible data format.
-
Extension(name = "tdbpack",
sources = [os.path.join(samba_srcdir, "python", "py_tdbpack.c")],
extra_compile_args = ["-I."])