summaryrefslogtreecommitdiff
path: root/source3/python
diff options
context:
space:
mode:
Diffstat (limited to 'source3/python')
-rw-r--r--source3/python/py_common.c5
-rw-r--r--source3/python/py_common.h38
-rw-r--r--source3/python/py_common_proto.h32
-rw-r--r--source3/python/py_conv.c19
-rw-r--r--source3/python/py_conv.h5
-rw-r--r--source3/python/py_lsa.c10
-rw-r--r--source3/python/py_lsa.h7
-rw-r--r--source3/python/py_lsa_proto.h13
-rw-r--r--source3/python/py_ntsec.c5
-rw-r--r--source3/python/py_samr.c2
-rw-r--r--source3/python/py_samr.h8
-rw-r--r--source3/python/py_smb.h5
-rw-r--r--source3/python/py_spoolss.c18
-rw-r--r--source3/python/py_spoolss.h124
-rw-r--r--source3/python/py_spoolss_printerdata.c1
-rw-r--r--source3/python/py_spoolss_proto.h127
-rw-r--r--source3/python/py_tdb.h5
-rw-r--r--source3/python/py_winbind.c43
-rw-r--r--source3/python/py_winbind_conv.c3
-rw-r--r--source3/python/py_winreg.h2
-rwxr-xr-xsource3/python/setup.py15
21 files changed, 257 insertions, 230 deletions
diff --git a/source3/python/py_common.c b/source3/python/py_common.c
index ea092d9370..6e299470bf 100644
--- a/source3/python/py_common.c
+++ b/source3/python/py_common.c
@@ -18,7 +18,10 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "python/py_common.h"
+#include "includes.h"
+#include "Python.h"
+
+#include "python/py_common_proto.h"
/* Return a tuple of (error code, error string) from a WERROR */
diff --git a/source3/python/py_common.h b/source3/python/py_common.h
index 2bbd148ff4..1f5188971d 100644
--- a/source3/python/py_common.h
+++ b/source3/python/py_common.h
@@ -1,7 +1,7 @@
/*
Python wrappers for DCERPC/SMB client routines.
- Copyright (C) Tim Potter, 2002-2003
+ 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
@@ -23,15 +23,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"
-
/* Return a cli_state struct opened on the specified pipe. If credentials
are passed use them. */
@@ -39,29 +30,6 @@ typedef struct cli_state *(cli_pipe_fn)(
struct cli_state *cli, char *system_name,
struct ntuser_creds *creds);
-/* The following definitions come from python/py_common.c */
-
-PyObject *py_werror_tuple(WERROR werror);
-PyObject *py_ntstatus_tuple(NTSTATUS ntstatus);
-void py_samba_init(void);
-PyObject *get_debuglevel(PyObject *self, PyObject *args);
-PyObject *set_debuglevel(PyObject *self, PyObject *args);
-PyObject *py_setup_logging(PyObject *self, PyObject *args, PyObject *kw);
-BOOL py_parse_creds(PyObject *creds, char **username, char **domain,
- char **password, char **errstr);
-struct cli_state *open_pipe_creds(char *server, PyObject *creds,
- int pipe_idx, char **errstr);
-BOOL get_level_value(PyObject *dict, uint32 *level);
-
-/* The following definitions come from python/py_ntsec.c */
-
-BOOL py_from_SID(PyObject **obj, DOM_SID *sid);
-BOOL py_to_SID(DOM_SID *sid, PyObject *obj);
-BOOL py_from_ACE(PyObject **dict, SEC_ACE *ace);
-BOOL py_to_ACE(SEC_ACE *ace, PyObject *dict);
-BOOL py_from_ACL(PyObject **dict, SEC_ACL *acl);
-BOOL py_to_ACL(SEC_ACL *acl, PyObject *dict, TALLOC_CTX *mem_ctx);
-BOOL py_from_SECDESC(PyObject **dict, SEC_DESC *sd);
-BOOL py_to_SECDESC(SEC_DESC **sd, PyObject *dict, TALLOC_CTX *mem_ctx);
+#include "python/py_common_proto.h"
-#endif /* _PY_COMMON_H */
+#endif /* _PY_COMMON_H */
diff --git a/source3/python/py_common_proto.h b/source3/python/py_common_proto.h
new file mode 100644
index 0000000000..b012c17e15
--- /dev/null
+++ b/source3/python/py_common_proto.h
@@ -0,0 +1,32 @@
+#ifndef _PY_COMMON_PROTO_H
+#define _PY_COMMON_PROTO_H
+
+/* This file is automatically generated with "make proto". DO NOT EDIT */
+
+
+/* The following definitions come from python/py_common.c */
+
+PyObject *py_werror_tuple(WERROR werror);
+PyObject *py_ntstatus_tuple(NTSTATUS ntstatus);
+void py_samba_init(void);
+PyObject *get_debuglevel(PyObject *self, PyObject *args);
+PyObject *set_debuglevel(PyObject *self, PyObject *args);
+PyObject *py_setup_logging(PyObject *self, PyObject *args, PyObject *kw);
+BOOL py_parse_creds(PyObject *creds, char **username, char **domain,
+ char **password, char **errstr);
+struct cli_state *open_pipe_creds(char *server, PyObject *creds,
+ int pipe_idx, char **errstr);
+BOOL get_level_value(PyObject *dict, uint32 *level);
+
+/* The following definitions come from python/py_ntsec.c */
+
+BOOL py_from_SID(PyObject **obj, DOM_SID *sid);
+BOOL py_to_SID(DOM_SID *sid, PyObject *obj);
+BOOL py_from_ACE(PyObject **dict, SEC_ACE *ace);
+BOOL py_to_ACE(SEC_ACE *ace, PyObject *dict);
+BOOL py_from_ACL(PyObject **dict, SEC_ACL *acl);
+BOOL py_to_ACL(SEC_ACL *acl, PyObject *dict, TALLOC_CTX *mem_ctx);
+BOOL py_from_SECDESC(PyObject **dict, SEC_DESC *sd);
+BOOL py_to_SECDESC(SEC_DESC **sd, PyObject *dict, TALLOC_CTX *mem_ctx);
+
+#endif /* _PY_COMMON_PROTO_H */
diff --git a/source3/python/py_conv.c b/source3/python/py_conv.c
index d0a2d78aab..e865daf7d9 100644
--- a/source3/python/py_conv.c
+++ b/source3/python/py_conv.c
@@ -18,6 +18,8 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include "includes.h"
+#include "Python.h"
#include "py_conv.h"
/* Helper for rpcstr_pull() function */
@@ -27,11 +29,6 @@ static void fstr_pull(fstring str, UNISTR *uni)
rpcstr_pull(str, uni->buffer, sizeof(fstring), -1, STR_TERMINATE);
}
-static void fstr_pull2(fstring str, UNISTR2 *uni)
-{
- rpcstr_pull(str, uni->buffer, sizeof(fstring), -1, STR_TERMINATE);
-}
-
/* Convert a structure to a Python dict */
PyObject *from_struct(void *s, struct pyconv *conv)
@@ -55,18 +52,6 @@ PyObject *from_struct(void *s, struct pyconv *conv)
break;
}
- case PY_UNISTR2: {
- UNISTR2 *u = (UNISTR2 *)((char *)s + conv[i].offset);
- fstring str = "";
-
- if (u->buffer)
- fstr_pull2(str, u);
-
- item = PyString_FromString(str);
- PyDict_SetItemString(obj, conv[i].name, item);
-
- break;
- }
case PY_UINT32: {
uint32 *u = (uint32 *)((char *)s + conv[i].offset);
diff --git a/source3/python/py_conv.h b/source3/python/py_conv.h
index 798661c3a0..b384f70fc2 100644
--- a/source3/python/py_conv.h
+++ b/source3/python/py_conv.h
@@ -21,10 +21,7 @@
#ifndef _PY_CONV_H
#define _PY_CONV_H
-#include "python/py_common.h"
-
-enum pyconv_types { PY_UNISTR, PY_UNISTR2, PY_UINT32, PY_UINT16, PY_STRING,
- PY_UID, PY_GID };
+enum pyconv_types { PY_UNISTR, PY_UINT32, PY_UINT16, PY_STRING, PY_UID, PY_GID };
struct pyconv {
char *name; /* Name of member */
diff --git a/source3/python/py_lsa.c b/source3/python/py_lsa.c
index 22db29665a..31706af684 100644
--- a/source3/python/py_lsa.c
+++ b/source3/python/py_lsa.c
@@ -235,10 +235,7 @@ static PyObject *lsa_lookup_sids(PyObject *self, PyObject *args,
for (i = 0; i < num_sids; i++) {
PyObject *obj = PyList_GetItem(py_sids, i);
- if (!string_to_sid(&sids[i], PyString_AsString(obj))) {
- PyErr_SetString(PyExc_ValueError, "string_to_sid failed");
- return NULL;
- }
+ string_to_sid(&sids[i], PyString_AsString(obj));
}
} else {
@@ -248,10 +245,7 @@ static PyObject *lsa_lookup_sids(PyObject *self, PyObject *args,
num_sids = 1;
sids = (DOM_SID *)talloc(hnd->mem_ctx, sizeof(DOM_SID));
- if (!string_to_sid(&sids[0], PyString_AsString(py_sids))) {
- PyErr_SetString(PyExc_ValueError, "string_to_sid failed");
- return NULL;
- }
+ string_to_sid(&sids[0], PyString_AsString(py_sids));
}
ntstatus = cli_lsa_lookup_sids(hnd->cli, hnd->mem_ctx, &hnd->pol,
diff --git a/source3/python/py_lsa.h b/source3/python/py_lsa.h
index 99f3de50b1..f9a30d2f7e 100644
--- a/source3/python/py_lsa.h
+++ b/source3/python/py_lsa.h
@@ -21,7 +21,10 @@
#ifndef _PY_LSA_H
#define _PY_LSA_H
-#include "python/py_common.h"
+#include "includes.h"
+#include "Python.h"
+
+#include "python/py_common_proto.h"
/* LSA policy handle object */
@@ -38,4 +41,6 @@ extern PyTypeObject lsa_policy_hnd_type;
extern PyObject *lsa_error;
+#include "python/py_lsa_proto.h"
+
#endif /* _PY_LSA_H */
diff --git a/source3/python/py_lsa_proto.h b/source3/python/py_lsa_proto.h
new file mode 100644
index 0000000000..1c6f6ab1d1
--- /dev/null
+++ b/source3/python/py_lsa_proto.h
@@ -0,0 +1,13 @@
+#ifndef _PY_LSA_PROTO_H
+#define _PY_LSA_PROTO_H
+
+/* This file is automatically generated with "make proto". DO NOT EDIT */
+
+
+/* The following definitions come from python/py_lsa.c */
+
+PyObject *new_lsa_policy_hnd_object(struct cli_state *cli, TALLOC_CTX *mem_ctx,
+ POLICY_HND *pol);
+void initlsa(void);
+
+#endif /* _PY_LSA_PROTO_H */
diff --git a/source3/python/py_ntsec.c b/source3/python/py_ntsec.c
index 47524d8e19..f216d96aa8 100644
--- a/source3/python/py_ntsec.c
+++ b/source3/python/py_ntsec.c
@@ -18,7 +18,10 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "python/py_common.h"
+#include "includes.h"
+#include "Python.h"
+
+#include "python/py_common_proto.h"
/* Convert a SID to a Python dict */
diff --git a/source3/python/py_samr.c b/source3/python/py_samr.c
index 182671d047..208274d9b5 100644
--- a/source3/python/py_samr.c
+++ b/source3/python/py_samr.c
@@ -157,7 +157,7 @@ static PyObject *samr_enum_dom_groups(PyObject *self, PyObject *args,
samr_domain_hnd_object *domain_hnd = (samr_domain_hnd_object *)self;
static char *kwlist[] = { NULL };
TALLOC_CTX *mem_ctx;
-/* uint32 desired_access = MAXIMUM_ALLOWED_ACCESS; */
+ uint32 desired_access = MAXIMUM_ALLOWED_ACCESS;
uint32 start_idx, size, num_dom_groups;
struct acct_info *dom_groups;
NTSTATUS result;
diff --git a/source3/python/py_samr.h b/source3/python/py_samr.h
index 3292eb97ec..22c3660ef9 100644
--- a/source3/python/py_samr.h
+++ b/source3/python/py_samr.h
@@ -21,7 +21,10 @@
#ifndef _PY_SAMR_H
#define _PY_SAMR_H
-#include "python/py_common.h"
+#include "includes.h"
+#include "Python.h"
+
+#include "python/py_common_proto.h"
/* SAMR connect policy handle object */
@@ -75,7 +78,6 @@ extern PyTypeObject samr_connect_hnd_type, samr_domain_hnd_type,
extern PyObject *samr_error;
-/* The following definitions are from py_samr_conv.c */
+/* #include "python/py_samr_proto.h" */
-BOOL py_from_acct_info(PyObject **array, struct acct_info *info, int num_accts);
#endif /* _PY_SAMR_H */
diff --git a/source3/python/py_smb.h b/source3/python/py_smb.h
index 31bcf4aab2..18677b4905 100644
--- a/source3/python/py_smb.h
+++ b/source3/python/py_smb.h
@@ -21,7 +21,10 @@
#ifndef _PY_SMB_H
#define _PY_SMB_H
-#include "python/py_common.h"
+#include "includes.h"
+#include "Python.h"
+
+#include "python/py_common_proto.h"
/* cli_state handle object */
diff --git a/source3/python/py_spoolss.c b/source3/python/py_spoolss.c
index 7b0a102b31..957b4e9d9f 100644
--- a/source3/python/py_spoolss.c
+++ b/source3/python/py_spoolss.c
@@ -24,6 +24,24 @@
PyObject *spoolss_error, *spoolss_werror;
+/*
+ * Routines to convert from python hashes to Samba structures
+ */
+
+PyObject *new_spoolss_policy_hnd_object(struct cli_state *cli,
+ TALLOC_CTX *mem_ctx, POLICY_HND *pol)
+{
+ spoolss_policy_hnd_object *o;
+
+ o = PyObject_New(spoolss_policy_hnd_object, &spoolss_policy_hnd_type);
+
+ o->cli = cli;
+ o->mem_ctx = mem_ctx;
+ memcpy(&o->pol, pol, sizeof(POLICY_HND));
+
+ return (PyObject*)o;
+}
+
/*
* Method dispatch table
*/
diff --git a/source3/python/py_spoolss.h b/source3/python/py_spoolss.h
index 34b48190cd..40a6ae972e 100644
--- a/source3/python/py_spoolss.h
+++ b/source3/python/py_spoolss.h
@@ -21,7 +21,10 @@
#ifndef _PY_SPOOLSS_H
#define _PY_SPOOLSS_H
-#include "python/py_common.h"
+#include "includes.h"
+#include "Python.h"
+
+#include "python/py_common_proto.h"
/* Spoolss policy handle object */
@@ -38,123 +41,6 @@ extern PyTypeObject spoolss_policy_hnd_type;
extern PyObject *spoolss_error, *spoolss_werror;
-/* The following definitions come from python/py_spoolss_common.c */
-
-PyObject *new_spoolss_policy_hnd_object(struct cli_state *cli,
- TALLOC_CTX *mem_ctx, POLICY_HND *pol);
-
-/* The following definitions come from python/py_spoolss_drivers.c */
-
-PyObject *spoolss_enumprinterdrivers(PyObject *self, PyObject *args,
- PyObject *kw);
-PyObject *spoolss_hnd_getprinterdriver(PyObject *self, PyObject *args,
- PyObject *kw);
-PyObject *spoolss_getprinterdriverdir(PyObject *self, PyObject *args,
- PyObject *kw);
-PyObject *spoolss_addprinterdriver(PyObject *self, PyObject *args,
- PyObject *kw);
-PyObject *spoolss_addprinterdriverex(PyObject *self, PyObject *args,
- PyObject *kw);
-PyObject *spoolss_deleteprinterdriver(PyObject *self, PyObject *args,
- PyObject *kw);
-PyObject *spoolss_deleteprinterdriverex(PyObject *self, PyObject *args,
- PyObject *kw);
-
-/* The following definitions come from python/py_spoolss_drivers_conv.c */
-
-BOOL py_from_DRIVER_INFO_1(PyObject **dict, DRIVER_INFO_1 *info);
-BOOL py_to_DRIVER_INFO_1(DRIVER_INFO_1 *info, PyObject *dict);
-BOOL py_from_DRIVER_INFO_2(PyObject **dict, DRIVER_INFO_2 *info);
-BOOL py_to_DRIVER_INFO_2(DRIVER_INFO_2 *info, PyObject *dict);
-BOOL py_from_DRIVER_INFO_3(PyObject **dict, DRIVER_INFO_3 *info);
-BOOL py_to_DRIVER_INFO_3(DRIVER_INFO_3 *info, PyObject *dict);
-BOOL py_from_DRIVER_INFO_6(PyObject **dict, DRIVER_INFO_6 *info);
-BOOL py_to_DRIVER_INFO_6(DRIVER_INFO_6 *info, PyObject *dict);
-BOOL py_from_DRIVER_DIRECTORY_1(PyObject **dict, DRIVER_DIRECTORY_1 *info);
-BOOL py_to_DRIVER_DIRECTORY_1(DRIVER_DIRECTORY_1 *info, PyObject *dict);
-
-/* The following definitions come from python/py_spoolss_forms.c */
-
-PyObject *spoolss_hnd_addform(PyObject *self, PyObject *args, PyObject *kw);
-PyObject *spoolss_hnd_getform(PyObject *self, PyObject *args, PyObject *kw);
-PyObject *spoolss_hnd_setform(PyObject *self, PyObject *args, PyObject *kw);
-PyObject *spoolss_hnd_deleteform(PyObject *self, PyObject *args, PyObject *kw);
-PyObject *spoolss_hnd_enumforms(PyObject *self, PyObject *args, PyObject *kw);
-
-/* The following definitions come from python/py_spoolss_forms_conv.c */
-
-BOOL py_from_FORM_1(PyObject **dict, FORM_1 *form);
-BOOL py_to_FORM(FORM *form, PyObject *dict);
-
-/* The following definitions come from python/py_spoolss_jobs.c */
-
-PyObject *spoolss_hnd_enumjobs(PyObject *self, PyObject *args, PyObject *kw);
-PyObject *spoolss_hnd_setjob(PyObject *self, PyObject *args, PyObject *kw);
-PyObject *spoolss_hnd_getjob(PyObject *self, PyObject *args, PyObject *kw);
-PyObject *spoolss_hnd_startpageprinter(PyObject *self, PyObject *args, PyObject *kw);
-PyObject *spoolss_hnd_endpageprinter(PyObject *self, PyObject *args, PyObject *kw);
-PyObject *spoolss_hnd_startdocprinter(PyObject *self, PyObject *args, PyObject *kw);
-PyObject *spoolss_hnd_enddocprinter(PyObject *self, PyObject *args, PyObject *kw);
-PyObject *spoolss_hnd_writeprinter(PyObject *self, PyObject *args, PyObject *kw);
-PyObject *spoolss_hnd_addjob(PyObject *self, PyObject *args, PyObject *kw);
-
-/* The following definitions come from python/py_spoolss_jobs_conv.c */
-
-BOOL py_from_JOB_INFO_1(PyObject **dict, JOB_INFO_1 *info);
-BOOL py_to_JOB_INFO_1(JOB_INFO_1 *info, PyObject *dict);
-BOOL py_from_JOB_INFO_2(PyObject **dict, JOB_INFO_2 *info);
-BOOL py_to_JOB_INFO_2(JOB_INFO_2 *info, PyObject *dict);
-BOOL py_from_DOC_INFO_1(PyObject **dict, DOC_INFO_1 *info);
-BOOL py_to_DOC_INFO_1(DOC_INFO_1 *info, PyObject *dict);
-
-/* The following definitions come from python/py_spoolss_ports.c */
-
-PyObject *spoolss_enumports(PyObject *self, PyObject *args, PyObject *kw);
-
-/* The following definitions come from python/py_spoolss_ports_conv.c */
-
-BOOL py_from_PORT_INFO_1(PyObject **dict, PORT_INFO_1 *info);
-BOOL py_to_PORT_INFO_1(PORT_INFO_1 *info, PyObject *dict);
-BOOL py_from_PORT_INFO_2(PyObject **dict, PORT_INFO_2 *info);
-BOOL py_to_PORT_INFO_2(PORT_INFO_2 *info, PyObject *dict);
-
-/* The following definitions come from python/py_spoolss_printerdata.c */
-
-PyObject *spoolss_hnd_getprinterdata(PyObject *self, PyObject *args, PyObject *kw);
-PyObject *spoolss_hnd_setprinterdata(PyObject *self, PyObject *args, PyObject *kw);
-PyObject *spoolss_hnd_enumprinterdata(PyObject *self, PyObject *args, PyObject *kw);
-PyObject *spoolss_hnd_deleteprinterdata(PyObject *self, PyObject *args, PyObject *kw);
-PyObject *spoolss_hnd_getprinterdataex(PyObject *self, PyObject *args, PyObject *kw);
-PyObject *spoolss_hnd_setprinterdataex(PyObject *self, PyObject *args, PyObject *kw);
-PyObject *spoolss_hnd_enumprinterdataex(PyObject *self, PyObject *args, PyObject *kw);
-PyObject *spoolss_hnd_deleteprinterdataex(PyObject *self, PyObject *args, PyObject *kw);
-PyObject *spoolss_hnd_enumprinterkey(PyObject *self, PyObject *args,
- PyObject *kw);
-PyObject *spoolss_hnd_deleteprinterkey(PyObject *self, PyObject *args,
- PyObject *kw);
-
-/* The following definitions come from python/py_spoolss_printers.c */
-
-PyObject *spoolss_openprinter(PyObject *self, PyObject *args, PyObject *kw);
-PyObject *spoolss_closeprinter(PyObject *self, PyObject *args);
-PyObject *spoolss_hnd_getprinter(PyObject *self, PyObject *args, PyObject *kw);
-PyObject *spoolss_hnd_setprinter(PyObject *self, PyObject *args, PyObject *kw);
-PyObject *spoolss_enumprinters(PyObject *self, PyObject *args, PyObject *kw);
-PyObject *spoolss_addprinterex(PyObject *self, PyObject *args, PyObject *kw);
-
-/* The following definitions come from python/py_spoolss_printers_conv.c */
-
-BOOL py_from_DEVICEMODE(PyObject **dict, DEVICEMODE *devmode);
-BOOL py_to_DEVICEMODE(DEVICEMODE *devmode, PyObject *dict);
-BOOL py_from_PRINTER_INFO_0(PyObject **dict, PRINTER_INFO_0 *info);
-BOOL py_to_PRINTER_INFO_0(PRINTER_INFO_0 *info, PyObject *dict);
-BOOL py_from_PRINTER_INFO_1(PyObject **dict, PRINTER_INFO_1 *info);
-BOOL py_to_PRINTER_INFO_1(PRINTER_INFO_1 *info, PyObject *dict);
-BOOL py_from_PRINTER_INFO_2(PyObject **dict, PRINTER_INFO_2 *info);
-BOOL py_to_PRINTER_INFO_2(PRINTER_INFO_2 *info, PyObject *dict,
- TALLOC_CTX *mem_ctx);
-BOOL py_from_PRINTER_INFO_3(PyObject **dict, PRINTER_INFO_3 *info);
-BOOL py_to_PRINTER_INFO_3(PRINTER_INFO_3 *info, PyObject *dict,
- TALLOC_CTX *mem_ctx);
+#include "python/py_spoolss_proto.h"
#endif /* _PY_SPOOLSS_H */
diff --git a/source3/python/py_spoolss_printerdata.c b/source3/python/py_spoolss_printerdata.c
index f165475b08..583d097e84 100644
--- a/source3/python/py_spoolss_printerdata.c
+++ b/source3/python/py_spoolss_printerdata.c
@@ -19,7 +19,6 @@
*/
#include "python/py_spoolss.h"
-#include "python/py_conv.h"
static BOOL py_from_printerdata(PyObject **dict, char *key, char *value,
uint16 data_type, uint8 *data,
diff --git a/source3/python/py_spoolss_proto.h b/source3/python/py_spoolss_proto.h
new file mode 100644
index 0000000000..77feb1acc3
--- /dev/null
+++ b/source3/python/py_spoolss_proto.h
@@ -0,0 +1,127 @@
+#ifndef _PY_SPOOLSS_PROTO_H
+#define _PY_SPOOLSS_PROTO_H
+
+/* This file is automatically generated with "make proto". DO NOT EDIT */
+
+
+/* The following definitions come from python/py_spoolss.c */
+
+PyObject *new_spoolss_policy_hnd_object(struct cli_state *cli,
+ TALLOC_CTX *mem_ctx, POLICY_HND *pol);
+void initspoolss(void);
+
+/* The following definitions come from python/py_spoolss_drivers.c */
+
+PyObject *spoolss_enumprinterdrivers(PyObject *self, PyObject *args,
+ PyObject *kw);
+PyObject *spoolss_hnd_getprinterdriver(PyObject *self, PyObject *args,
+ PyObject *kw);
+PyObject *spoolss_getprinterdriverdir(PyObject *self, PyObject *args,
+ PyObject *kw);
+PyObject *spoolss_addprinterdriver(PyObject *self, PyObject *args,
+ PyObject *kw);
+PyObject *spoolss_addprinterdriverex(PyObject *self, PyObject *args,
+ PyObject *kw);
+PyObject *spoolss_deleteprinterdriver(PyObject *self, PyObject *args,
+ PyObject *kw);
+PyObject *spoolss_deleteprinterdriverex(PyObject *self, PyObject *args,
+ PyObject *kw);
+
+/* The following definitions come from python/py_spoolss_drivers_conv.c */
+
+BOOL py_from_DRIVER_INFO_1(PyObject **dict, DRIVER_INFO_1 *info);
+BOOL py_to_DRIVER_INFO_1(DRIVER_INFO_1 *info, PyObject *dict);
+BOOL py_from_DRIVER_INFO_2(PyObject **dict, DRIVER_INFO_2 *info);
+BOOL py_to_DRIVER_INFO_2(DRIVER_INFO_2 *info, PyObject *dict);
+BOOL py_from_DRIVER_INFO_3(PyObject **dict, DRIVER_INFO_3 *info);
+BOOL py_to_DRIVER_INFO_3(DRIVER_INFO_3 *info, PyObject *dict);
+BOOL py_from_DRIVER_INFO_6(PyObject **dict, DRIVER_INFO_6 *info);
+BOOL py_to_DRIVER_INFO_6(DRIVER_INFO_6 *info, PyObject *dict);
+BOOL py_from_DRIVER_DIRECTORY_1(PyObject **dict, DRIVER_DIRECTORY_1 *info);
+BOOL py_to_DRIVER_DIRECTORY_1(DRIVER_DIRECTORY_1 *info, PyObject *dict);
+
+/* The following definitions come from python/py_spoolss_forms.c */
+
+PyObject *spoolss_hnd_addform(PyObject *self, PyObject *args, PyObject *kw);
+PyObject *spoolss_hnd_getform(PyObject *self, PyObject *args, PyObject *kw);
+PyObject *spoolss_hnd_setform(PyObject *self, PyObject *args, PyObject *kw);
+PyObject *spoolss_hnd_deleteform(PyObject *self, PyObject *args, PyObject *kw);
+PyObject *spoolss_hnd_enumforms(PyObject *self, PyObject *args, PyObject *kw);
+
+/* The following definitions come from python/py_spoolss_forms_conv.c */
+
+BOOL py_from_FORM_1(PyObject **dict, FORM_1 *form);
+BOOL py_to_FORM(FORM *form, PyObject *dict);
+
+/* The following definitions come from python/py_spoolss_jobs.c */
+
+PyObject *spoolss_hnd_enumjobs(PyObject *self, PyObject *args, PyObject *kw);
+PyObject *spoolss_hnd_setjob(PyObject *self, PyObject *args, PyObject *kw);
+PyObject *spoolss_hnd_getjob(PyObject *self, PyObject *args, PyObject *kw);
+PyObject *spoolss_hnd_startpageprinter(PyObject *self, PyObject *args, PyObject *kw);
+PyObject *spoolss_hnd_endpageprinter(PyObject *self, PyObject *args, PyObject *kw);
+PyObject *spoolss_hnd_startdocprinter(PyObject *self, PyObject *args, PyObject *kw);
+PyObject *spoolss_hnd_enddocprinter(PyObject *self, PyObject *args, PyObject *kw);
+PyObject *spoolss_hnd_writeprinter(PyObject *self, PyObject *args, PyObject *kw);
+PyObject *spoolss_hnd_addjob(PyObject *self, PyObject *args, PyObject *kw);
+
+/* The following definitions come from python/py_spoolss_jobs_conv.c */
+
+BOOL py_from_JOB_INFO_1(PyObject **dict, JOB_INFO_1 *info);
+BOOL py_to_JOB_INFO_1(JOB_INFO_1 *info, PyObject *dict);
+BOOL py_from_JOB_INFO_2(PyObject **dict, JOB_INFO_2 *info);
+BOOL py_to_JOB_INFO_2(JOB_INFO_2 *info, PyObject *dict);
+BOOL py_from_DOC_INFO_1(PyObject **dict, DOC_INFO_1 *info);
+BOOL py_to_DOC_INFO_1(DOC_INFO_1 *info, PyObject *dict);
+
+/* The following definitions come from python/py_spoolss_ports.c */
+
+PyObject *spoolss_enumports(PyObject *self, PyObject *args, PyObject *kw);
+
+/* The following definitions come from python/py_spoolss_ports_conv.c */
+
+BOOL py_from_PORT_INFO_1(PyObject **dict, PORT_INFO_1 *info);
+BOOL py_to_PORT_INFO_1(PORT_INFO_1 *info, PyObject *dict);
+BOOL py_from_PORT_INFO_2(PyObject **dict, PORT_INFO_2 *info);
+BOOL py_to_PORT_INFO_2(PORT_INFO_2 *info, PyObject *dict);
+
+/* The following definitions come from python/py_spoolss_printerdata.c */
+
+PyObject *spoolss_hnd_getprinterdata(PyObject *self, PyObject *args, PyObject *kw);
+PyObject *spoolss_hnd_setprinterdata(PyObject *self, PyObject *args, PyObject *kw);
+PyObject *spoolss_hnd_enumprinterdata(PyObject *self, PyObject *args, PyObject *kw);
+PyObject *spoolss_hnd_deleteprinterdata(PyObject *self, PyObject *args, PyObject *kw);
+PyObject *spoolss_hnd_getprinterdataex(PyObject *self, PyObject *args, PyObject *kw);
+PyObject *spoolss_hnd_setprinterdataex(PyObject *self, PyObject *args, PyObject *kw);
+PyObject *spoolss_hnd_enumprinterdataex(PyObject *self, PyObject *args, PyObject *kw);
+PyObject *spoolss_hnd_deleteprinterdataex(PyObject *self, PyObject *args, PyObject *kw);
+PyObject *spoolss_hnd_enumprinterkey(PyObject *self, PyObject *args,
+ PyObject *kw);
+PyObject *spoolss_hnd_deleteprinterkey(PyObject *self, PyObject *args,
+ PyObject *kw);
+
+/* The following definitions come from python/py_spoolss_printers.c */
+
+PyObject *spoolss_openprinter(PyObject *self, PyObject *args, PyObject *kw);
+PyObject *spoolss_closeprinter(PyObject *self, PyObject *args);
+PyObject *spoolss_hnd_getprinter(PyObject *self, PyObject *args, PyObject *kw);
+PyObject *spoolss_hnd_setprinter(PyObject *self, PyObject *args, PyObject *kw);
+PyObject *spoolss_enumprinters(PyObject *self, PyObject *args, PyObject *kw);
+PyObject *spoolss_addprinterex(PyObject *self, PyObject *args, PyObject *kw);
+
+/* The following definitions come from python/py_spoolss_printers_conv.c */
+
+BOOL py_from_DEVICEMODE(PyObject **dict, DEVICEMODE *devmode);
+BOOL py_to_DEVICEMODE(DEVICEMODE *devmode, PyObject *dict);
+BOOL py_from_PRINTER_INFO_0(PyObject **dict, PRINTER_INFO_0 *info);
+BOOL py_to_PRINTER_INFO_0(PRINTER_INFO_0 *info, PyObject *dict);
+BOOL py_from_PRINTER_INFO_1(PyObject **dict, PRINTER_INFO_1 *info);
+BOOL py_to_PRINTER_INFO_1(PRINTER_INFO_1 *info, PyObject *dict);
+BOOL py_from_PRINTER_INFO_2(PyObject **dict, PRINTER_INFO_2 *info);
+BOOL py_to_PRINTER_INFO_2(PRINTER_INFO_2 *info, PyObject *dict,
+ TALLOC_CTX *mem_ctx);
+BOOL py_from_PRINTER_INFO_3(PyObject **dict, PRINTER_INFO_3 *info);
+BOOL py_to_PRINTER_INFO_3(PRINTER_INFO_3 *info, PyObject *dict,
+ TALLOC_CTX *mem_ctx);
+
+#endif /* _PY_SPOOLSS_PROTO_H */
diff --git a/source3/python/py_tdb.h b/source3/python/py_tdb.h
index 69f251c8c1..794a20cf2b 100644
--- a/source3/python/py_tdb.h
+++ b/source3/python/py_tdb.h
@@ -21,6 +21,9 @@
#ifndef _PY_TDB_H
#define _PY_TDB_H
-#include "python/py_common.h"
+#include "includes.h"
+#include "Python.h"
+
+#include "python/py_common_proto.h"
#endif /* _PY_TDB_H */
diff --git a/source3/python/py_winbind.c b/source3/python/py_winbind.c
index e9fc4b7dd8..783ac54439 100644
--- a/source3/python/py_winbind.c
+++ b/source3/python/py_winbind.c
@@ -20,7 +20,10 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "py_winbind.h"
+#include "includes.h"
+#include "Python.h"
+
+#include "py_common_proto.h"
/*
* Exceptions raised by this module
@@ -46,8 +49,7 @@ static PyObject *py_name_to_sid(PyObject *self, PyObject *args)
struct winbindd_request request;
struct winbindd_response response;
PyObject *result;
- char *name, *p;
- const char *sep;
+ char *name, *p, *sep;
if (!PyArg_ParseTuple(args, "s", &name))
return NULL;
@@ -135,7 +137,7 @@ static PyObject *py_enum_domain_users(PyObject *self, PyObject *args)
result = PyList_New(0);
if (response.extra_data) {
- const char *extra_data = response.extra_data;
+ char *extra_data = response.extra_data;
fstring name;
while (next_token(&extra_data, name, ",", sizeof(fstring)))
@@ -166,7 +168,7 @@ static PyObject *py_enum_domain_groups(PyObject *self, PyObject *args)
result = PyList_New(0);
if (response.extra_data) {
- const char *extra_data = response.extra_data;
+ char *extra_data = response.extra_data;
fstring name;
while (next_token(&extra_data, name, ",", sizeof(fstring)))
@@ -201,7 +203,7 @@ static PyObject *py_enum_trust_dom(PyObject *self, PyObject *args)
result = PyList_New(0);
if (response.extra_data) {
- const char *extra_data = response.extra_data;
+ char *extra_data = response.extra_data;
fstring name;
while (next_token(&extra_data, name, ",", sizeof(fstring)))
@@ -520,12 +522,12 @@ static PyObject *py_getpwuid(PyObject *self, PyObject *args)
static PyMethodDef winbind_methods[] = {
- { "getpwnam", (PyCFunction)py_getpwnam, METH_VARARGS, "getpwnam(3)" },
- { "getpwuid", (PyCFunction)py_getpwuid, METH_VARARGS, "getpwuid(3)" },
+ { "getpwnam", py_getpwnam, METH_VARARGS, "getpwnam(3)" },
+ { "getpwuid", py_getpwuid, METH_VARARGS, "getpwuid(3)" },
/* Name <-> SID conversion */
- { "name_to_sid", (PyCFunction)py_name_to_sid, METH_VARARGS,
+ { "name_to_sid", py_name_to_sid, METH_VARARGS,
"name_to_sid(s) -> string
Return the SID for a name.
@@ -535,7 +537,7 @@ 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", py_sid_to_name, METH_VARARGS,
"sid_to_name(s) -> string
Return the name for a SID.
@@ -548,7 +550,7 @@ Example:
/* Enumerate users/groups */
- { "enum_domain_users", (PyCFunction)py_enum_domain_users, METH_VARARGS,
+ { "enum_domain_users", py_enum_domain_users, METH_VARARGS,
"enum_domain_users() -> list of strings
Return a list of domain users.
@@ -560,8 +562,7 @@ Example:
'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", py_enum_domain_groups, METH_VARARGS,
"enum_domain_groups() -> list of strings
Return a list of domain groups.
@@ -574,7 +575,7 @@ Example:
/* ID mapping */
- { "uid_to_sid", (PyCFunction)py_uid_to_sid, METH_VARARGS,
+ { "uid_to_sid", py_uid_to_sid, METH_VARARGS,
"uid_to_sid(int) -> string
Return the SID for a UNIX uid.
@@ -584,7 +585,7 @@ 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", py_gid_to_sid, METH_VARARGS,
"gid_to_sid(int) -> string
Return the UNIX gid for a SID.
@@ -594,7 +595,7 @@ 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", py_sid_to_uid, METH_VARARGS,
"sid_to_uid(string) -> int
Return the UNIX uid for a SID.
@@ -604,7 +605,7 @@ 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", py_sid_to_gid, METH_VARARGS,
"sid_to_gid(string) -> int
Return the UNIX gid corresponding to a SID.
@@ -616,13 +617,13 @@ Example:
/* Miscellaneous */
- { "check_secret", (PyCFunction)py_check_secret, METH_VARARGS,
+ { "check_secret", py_check_secret, METH_VARARGS,
"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", py_enum_trust_dom, METH_VARARGS,
"enum_trust_dom() -> list of strings
Return a list of trusted domains. The domain the server is a member
@@ -635,13 +636,13 @@ Example:
/* PAM authorisation functions */
- { "auth_plaintext", (PyCFunction)py_auth_plaintext, METH_VARARGS,
+ { "auth_plaintext", py_auth_plaintext, METH_VARARGS,
"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", py_auth_crap, METH_VARARGS,
"auth_crap(s, s) -> int
Authenticate a username and password using the challenge/response
diff --git a/source3/python/py_winbind_conv.c b/source3/python/py_winbind_conv.c
index 6e2eab5941..c3e416171e 100644
--- a/source3/python/py_winbind_conv.c
+++ b/source3/python/py_winbind_conv.c
@@ -18,7 +18,8 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "python/py_common.h"
+#include "includes.h"
+#include "Python.h"
#include "python/py_conv.h"
/* Convert a struct passwd to a dictionary */
diff --git a/source3/python/py_winreg.h b/source3/python/py_winreg.h
index e19674d218..088be724e2 100644
--- a/source3/python/py_winreg.h
+++ b/source3/python/py_winreg.h
@@ -24,6 +24,6 @@
#include "includes.h"
#include "Python.h"
-#include "python/py_common.h"
+#include "python/py_common_proto.h"
#endif /* _PY_WINREG_H */
diff --git a/source3/python/setup.py b/source3/python/setup.py
index 48487fee4d..b15f906bc2 100755
--- a/source3/python/setup.py
+++ b/source3/python/setup.py
@@ -3,7 +3,7 @@
# Unix SMB/CIFS implementation.
# Module packaging setup for Samba python extensions
#
-# Copyright (C) Tim Potter, 2002-2003
+# Copyright (C) Tim Potter, 2002
# Copyright (C) Martin Pool, 2002
#
# This program is free software; you can redistribute it and/or modify
@@ -83,7 +83,6 @@ setup(
samba_srcdir + "python/py_common.c",
samba_srcdir + "python/py_conv.c",
samba_srcdir + "python/py_ntsec.c",
- samba_srcdir + "python/py_spoolss_common.c",
samba_srcdir + "python/py_spoolss_forms.c",
samba_srcdir + "python/py_spoolss_forms_conv.c",
samba_srcdir + "python/py_spoolss_drivers.c",
@@ -145,18 +144,6 @@ setup(
extra_compile_args = flags_list,
extra_objects = obj_list),
- # SRVSVC pipe module
-
- Extension(name = "srvsvc",
- sources = [samba_srcdir + "python/py_srvsvc.c",
- samba_srcdir + "python/py_conv.c",
- samba_srcdir + "python/py_srvsvc_conv.c",
- samba_srcdir + "python/py_common.c"],
- libraries = lib_list,
- library_dirs = ["/usr/kerberos/lib"],
- extra_compile_args = flags_list,
- extra_objects = obj_list),
-
# tdb module
Extension(name = "tdb",