diff options
| author | Tim Potter <tpot@samba.org> | 2003-02-19 22:47:49 +0000 | 
|---|---|---|
| committer | Tim Potter <tpot@samba.org> | 2003-02-19 22:47:49 +0000 | 
| commit | 5ef421f1d820abee603817f91a5656b26ae502c2 (patch) | |
| tree | c21b57a269bd05fba0194cf38a0a73974bcae472 /source3/python | |
| parent | 3fd3bb38e24d39cae58894ce2b6bcb750b9de1b0 (diff) | |
| download | samba-5ef421f1d820abee603817f91a5656b26ae502c2.tar.gz samba-5ef421f1d820abee603817f91a5656b26ae502c2.tar.bz2 samba-5ef421f1d820abee603817f91a5656b26ae502c2.zip  | |
Merge of cleanups and srvsvc implementation from HEAD.
(This used to be commit dbea592877ad12f270805a9d8a86a50985beaf66)
Diffstat (limited to 'source3/python')
| -rw-r--r-- | source3/python/py_common.c | 5 | ||||
| -rw-r--r-- | source3/python/py_common.h | 38 | ||||
| -rw-r--r-- | source3/python/py_common_proto.h | 32 | ||||
| -rw-r--r-- | source3/python/py_conv.c | 19 | ||||
| -rw-r--r-- | source3/python/py_conv.h | 5 | ||||
| -rw-r--r-- | source3/python/py_lsa.h | 7 | ||||
| -rw-r--r-- | source3/python/py_lsa_proto.h | 13 | ||||
| -rw-r--r-- | source3/python/py_ntsec.c | 5 | ||||
| -rw-r--r-- | source3/python/py_samr.c | 2 | ||||
| -rw-r--r-- | source3/python/py_samr.h | 8 | ||||
| -rw-r--r-- | source3/python/py_smb.h | 5 | ||||
| -rw-r--r-- | source3/python/py_spoolss.c | 18 | ||||
| -rw-r--r-- | source3/python/py_spoolss.h | 124 | ||||
| -rw-r--r-- | source3/python/py_spoolss_printerdata.c | 1 | ||||
| -rw-r--r-- | source3/python/py_spoolss_proto.h | 127 | ||||
| -rw-r--r-- | source3/python/py_tdb.h | 5 | ||||
| -rw-r--r-- | source3/python/py_winbind.c | 43 | ||||
| -rw-r--r-- | source3/python/py_winbind_conv.c | 3 | ||||
| -rw-r--r-- | source3/python/py_winreg.h | 2 | ||||
| -rwxr-xr-x | source3/python/setup.py | 15 | 
20 files changed, 222 insertions, 255 deletions
diff --git a/source3/python/py_common.c b/source3/python/py_common.c index 6e299470bf..ea092d9370 100644 --- a/source3/python/py_common.c +++ b/source3/python/py_common.c @@ -18,10 +18,7 @@     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */ -#include "includes.h" -#include "Python.h" - -#include "python/py_common_proto.h" +#include "python/py_common.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 1f5188971d..2bbd148ff4 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 +   Copyright (C) Tim Potter, 2002-2003     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,6 +23,15 @@  #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. */ @@ -30,6 +39,29 @@ typedef struct cli_state *(cli_pipe_fn)(  	struct cli_state *cli, char *system_name,  	struct ntuser_creds *creds); -#include "python/py_common_proto.h" +/* 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_H */ +#endif /*  _PY_COMMON_H  */ diff --git a/source3/python/py_common_proto.h b/source3/python/py_common_proto.h deleted file mode 100644 index b012c17e15..0000000000 --- a/source3/python/py_common_proto.h +++ /dev/null @@ -1,32 +0,0 @@ -#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 e865daf7d9..d0a2d78aab 100644 --- a/source3/python/py_conv.c +++ b/source3/python/py_conv.c @@ -18,8 +18,6 @@     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */ -#include "includes.h" -#include "Python.h"  #include "py_conv.h"  /* Helper for rpcstr_pull() function */ @@ -29,6 +27,11 @@ 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) @@ -52,6 +55,18 @@ 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 b384f70fc2..798661c3a0 100644 --- a/source3/python/py_conv.h +++ b/source3/python/py_conv.h @@ -21,7 +21,10 @@  #ifndef _PY_CONV_H  #define _PY_CONV_H -enum pyconv_types { PY_UNISTR, PY_UINT32, PY_UINT16, PY_STRING, PY_UID, PY_GID }; +#include "python/py_common.h" + +enum pyconv_types { PY_UNISTR, PY_UNISTR2, PY_UINT32, PY_UINT16, PY_STRING,  +		    PY_UID, PY_GID };  struct pyconv {  	char *name;		/* Name of member */ diff --git a/source3/python/py_lsa.h b/source3/python/py_lsa.h index f9a30d2f7e..99f3de50b1 100644 --- a/source3/python/py_lsa.h +++ b/source3/python/py_lsa.h @@ -21,10 +21,7 @@  #ifndef _PY_LSA_H  #define _PY_LSA_H -#include "includes.h" -#include "Python.h" - -#include "python/py_common_proto.h" +#include "python/py_common.h"  /* LSA policy handle object */ @@ -41,6 +38,4 @@ 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 deleted file mode 100644 index 1c6f6ab1d1..0000000000 --- a/source3/python/py_lsa_proto.h +++ /dev/null @@ -1,13 +0,0 @@ -#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 f216d96aa8..47524d8e19 100644 --- a/source3/python/py_ntsec.c +++ b/source3/python/py_ntsec.c @@ -18,10 +18,7 @@     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */ -#include "includes.h" -#include "Python.h" - -#include "python/py_common_proto.h" +#include "python/py_common.h"  /* Convert a SID to a Python dict */ diff --git a/source3/python/py_samr.c b/source3/python/py_samr.c index 208274d9b5..182671d047 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 22c3660ef9..3292eb97ec 100644 --- a/source3/python/py_samr.h +++ b/source3/python/py_samr.h @@ -21,10 +21,7 @@  #ifndef _PY_SAMR_H  #define _PY_SAMR_H -#include "includes.h" -#include "Python.h" - -#include "python/py_common_proto.h" +#include "python/py_common.h"  /* SAMR connect policy handle object */ @@ -78,6 +75,7 @@ extern PyTypeObject samr_connect_hnd_type, samr_domain_hnd_type,  extern PyObject *samr_error; -/* #include "python/py_samr_proto.h" */ +/* The following definitions are from py_samr_conv.c */ +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 18677b4905..31bcf4aab2 100644 --- a/source3/python/py_smb.h +++ b/source3/python/py_smb.h @@ -21,10 +21,7 @@  #ifndef _PY_SMB_H  #define _PY_SMB_H -#include "includes.h" -#include "Python.h" - -#include "python/py_common_proto.h" +#include "python/py_common.h"  /* cli_state handle object */ diff --git a/source3/python/py_spoolss.c b/source3/python/py_spoolss.c index 957b4e9d9f..7b0a102b31 100644 --- a/source3/python/py_spoolss.c +++ b/source3/python/py_spoolss.c @@ -24,24 +24,6 @@  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 40a6ae972e..34b48190cd 100644 --- a/source3/python/py_spoolss.h +++ b/source3/python/py_spoolss.h @@ -21,10 +21,7 @@  #ifndef _PY_SPOOLSS_H  #define _PY_SPOOLSS_H -#include "includes.h" -#include "Python.h" - -#include "python/py_common_proto.h" +#include "python/py_common.h"  /* Spoolss policy handle object */ @@ -41,6 +38,123 @@ extern PyTypeObject spoolss_policy_hnd_type;  extern PyObject *spoolss_error, *spoolss_werror; -#include "python/py_spoolss_proto.h" +/* 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);  #endif /* _PY_SPOOLSS_H */ diff --git a/source3/python/py_spoolss_printerdata.c b/source3/python/py_spoolss_printerdata.c index 583d097e84..f165475b08 100644 --- a/source3/python/py_spoolss_printerdata.c +++ b/source3/python/py_spoolss_printerdata.c @@ -19,6 +19,7 @@  */  #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 deleted file mode 100644 index 77feb1acc3..0000000000 --- a/source3/python/py_spoolss_proto.h +++ /dev/null @@ -1,127 +0,0 @@ -#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 794a20cf2b..69f251c8c1 100644 --- a/source3/python/py_tdb.h +++ b/source3/python/py_tdb.h @@ -21,9 +21,6 @@  #ifndef _PY_TDB_H  #define _PY_TDB_H -#include "includes.h" -#include "Python.h" - -#include "python/py_common_proto.h" +#include "python/py_common.h"  #endif /* _PY_TDB_H */ diff --git a/source3/python/py_winbind.c b/source3/python/py_winbind.c index 783ac54439..e9fc4b7dd8 100644 --- a/source3/python/py_winbind.c +++ b/source3/python/py_winbind.c @@ -20,10 +20,7 @@     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */ -#include "includes.h" -#include "Python.h" - -#include "py_common_proto.h" +#include "py_winbind.h"  /*    * Exceptions raised by this module  @@ -49,7 +46,8 @@ static PyObject *py_name_to_sid(PyObject *self, PyObject *args)  	struct winbindd_request request;  	struct winbindd_response response;  	PyObject *result; -	char *name, *p, *sep; +	char *name, *p; +	const char *sep;  	if (!PyArg_ParseTuple(args, "s", &name))  		return NULL; @@ -137,7 +135,7 @@ static PyObject *py_enum_domain_users(PyObject *self, PyObject *args)  	result = PyList_New(0);  	if (response.extra_data) { -		char *extra_data = response.extra_data; +		const char *extra_data = response.extra_data;  		fstring name;  		while (next_token(&extra_data, name, ",", sizeof(fstring))) @@ -168,7 +166,7 @@ static PyObject *py_enum_domain_groups(PyObject *self, PyObject *args)  	result = PyList_New(0);  	if (response.extra_data) { -		char *extra_data = response.extra_data; +		const char *extra_data = response.extra_data;  		fstring name;  		while (next_token(&extra_data, name, ",", sizeof(fstring))) @@ -203,7 +201,7 @@ static PyObject *py_enum_trust_dom(PyObject *self, PyObject *args)  	result = PyList_New(0);  	if (response.extra_data) { -		char *extra_data = response.extra_data; +		const char *extra_data = response.extra_data;  		fstring name;  		while (next_token(&extra_data, name, ",", sizeof(fstring))) @@ -522,12 +520,12 @@ static PyObject *py_getpwuid(PyObject *self, PyObject *args)  static PyMethodDef winbind_methods[] = { -	{ "getpwnam", py_getpwnam, METH_VARARGS, "getpwnam(3)" }, -	{ "getpwuid", py_getpwuid, METH_VARARGS, "getpwuid(3)" }, +	{ "getpwnam", (PyCFunction)py_getpwnam, METH_VARARGS, "getpwnam(3)" }, +	{ "getpwuid", (PyCFunction)py_getpwuid, METH_VARARGS, "getpwuid(3)" },  	/* Name <-> SID conversion */ -	{ "name_to_sid", py_name_to_sid, METH_VARARGS, +	{ "name_to_sid", (PyCFunction)py_name_to_sid, METH_VARARGS,  	  "name_to_sid(s) -> string  Return the SID for a name. @@ -537,7 +535,7 @@ Example:  >>> winbind.name_to_sid('FOO/Administrator')  'S-1-5-21-406022937-1377575209-526660263-500' " }, -	{ "sid_to_name", py_sid_to_name, METH_VARARGS, +	{ "sid_to_name", (PyCFunction)py_sid_to_name, METH_VARARGS,  	  "sid_to_name(s) -> string  Return the name for a SID. @@ -550,7 +548,7 @@ Example:  	/* Enumerate users/groups */ -	{ "enum_domain_users", py_enum_domain_users, METH_VARARGS, +	{ "enum_domain_users", (PyCFunction)py_enum_domain_users, METH_VARARGS,  	  "enum_domain_users() -> list of strings  Return a list of domain users. @@ -562,7 +560,8 @@ Example:  'FOO/foo', 'FOO/foo2', 'FOO/foo3', 'FOO/Guest', 'FOO/user1',   'FOO/whoops-ptang'] " }, -	{ "enum_domain_groups", py_enum_domain_groups, METH_VARARGS, +	{ "enum_domain_groups", (PyCFunction)py_enum_domain_groups,  +	  METH_VARARGS,  	  "enum_domain_groups() -> list of strings  Return a list of domain groups. @@ -575,7 +574,7 @@ Example:  	/* ID mapping */ -	{ "uid_to_sid", py_uid_to_sid, METH_VARARGS, +	{ "uid_to_sid", (PyCFunction)py_uid_to_sid, METH_VARARGS,  	  "uid_to_sid(int) -> string  Return the SID for a UNIX uid. @@ -585,7 +584,7 @@ Example:  >>> winbind.uid_to_sid(10000)     'S-1-5-21-406022937-1377575209-526660263-500' " }, -	{ "gid_to_sid", py_gid_to_sid, METH_VARARGS, +	{ "gid_to_sid", (PyCFunction)py_gid_to_sid, METH_VARARGS,  	  "gid_to_sid(int) -> string  Return the UNIX gid for a SID. @@ -595,7 +594,7 @@ Example:  >>> winbind.gid_to_sid(10001)  'S-1-5-21-406022937-1377575209-526660263-512' " }, -	{ "sid_to_uid", py_sid_to_uid, METH_VARARGS, +	{ "sid_to_uid", (PyCFunction)py_sid_to_uid, METH_VARARGS,  	  "sid_to_uid(string) -> int  Return the UNIX uid for a SID. @@ -605,7 +604,7 @@ Example:  >>> winbind.sid_to_uid('S-1-5-21-406022937-1377575209-526660263-500')  10000 " }, -	{ "sid_to_gid", py_sid_to_gid, METH_VARARGS, +	{ "sid_to_gid", (PyCFunction)py_sid_to_gid, METH_VARARGS,  	  "sid_to_gid(string) -> int  Return the UNIX gid corresponding to a SID. @@ -617,13 +616,13 @@ Example:  	/* Miscellaneous */ -	{ "check_secret", py_check_secret, METH_VARARGS, +	{ "check_secret", (PyCFunction)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", py_enum_trust_dom, METH_VARARGS, +	{ "enum_trust_dom", (PyCFunction)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  @@ -636,13 +635,13 @@ Example:  	/* PAM authorisation functions */ -	{ "auth_plaintext", py_auth_plaintext, METH_VARARGS, +	{ "auth_plaintext", (PyCFunction)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", py_auth_crap, METH_VARARGS, +	{ "auth_crap", (PyCFunction)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 c3e416171e..6e2eab5941 100644 --- a/source3/python/py_winbind_conv.c +++ b/source3/python/py_winbind_conv.c @@ -18,8 +18,7 @@     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */ -#include "includes.h" -#include "Python.h" +#include "python/py_common.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 088be724e2..e19674d218 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_proto.h" +#include "python/py_common.h"  #endif /* _PY_WINREG_H */ diff --git a/source3/python/setup.py b/source3/python/setup.py index b15f906bc2..48487fee4d 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 +# Copyright (C) Tim Potter, 2002-2003  # Copyright (C) Martin Pool, 2002  #  # This program is free software; you can redistribute it and/or modify @@ -83,6 +83,7 @@ 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", @@ -144,6 +145,18 @@ 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",  | 
