mirror of
https://github.com/samba-team/samba.git
synced 2025-01-12 09:18:10 +03:00
Aborted experiment to avoid namespace pollution and prototype hell and
moved to 'make proto' based solution.
(This used to be commit 1e48f872a4
)
This commit is contained in:
parent
321767cb66
commit
230e36ccde
@ -18,8 +18,8 @@
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef _PY_SPOOLSS_CONV_H
|
||||
#define _PY_SPOOLSS_CONV_H
|
||||
#ifndef _PY_CONV_H
|
||||
#define _PY_CONV_H
|
||||
|
||||
enum pyconv_types { PY_UNISTR, PY_UINT32, PY_UINT16 };
|
||||
|
||||
@ -32,4 +32,9 @@ struct pyconv {
|
||||
PyObject *from_struct(void *s, struct pyconv *conv);
|
||||
void to_struct(void *s, PyObject *dict, struct pyconv *conv);
|
||||
|
||||
#endif /* _PY_SPOOLSS_CONV_H */
|
||||
/* Another version of offsetof (-: */
|
||||
|
||||
#undef offsetof
|
||||
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
|
||||
|
||||
#endif /* _PY_CONV_H */
|
||||
|
@ -18,11 +18,6 @@
|
||||
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"
|
||||
#include "python/py_spoolss.h"
|
||||
|
||||
/* Exceptions this module can raise */
|
||||
@ -33,13 +28,6 @@ PyObject *spoolss_error, *spoolss_werror;
|
||||
* Routines to convert from python hashes to Samba structures
|
||||
*/
|
||||
|
||||
/* Return a cli_state struct opened on the SPOOLSS pipe. If credentials
|
||||
are passed use them. */
|
||||
|
||||
typedef struct cli_state *(cli_pipe_fn)(
|
||||
struct cli_state *cli, char *system_name,
|
||||
struct ntuser_creds *creds);
|
||||
|
||||
struct cli_state *open_pipe_creds(char *system_name, PyObject *creds,
|
||||
cli_pipe_fn *connect_fn,
|
||||
struct cli_state *cli)
|
||||
@ -110,8 +98,8 @@ struct cli_state *open_pipe_creds(char *system_name, PyObject *creds,
|
||||
return cli;
|
||||
}
|
||||
|
||||
static PyObject *new_policy_hnd_object(struct cli_state *cli,
|
||||
TALLOC_CTX *mem_ctx, POLICY_HND *pol)
|
||||
PyObject *new_policy_hnd_object(struct cli_state *cli, TALLOC_CTX *mem_ctx,
|
||||
POLICY_HND *pol)
|
||||
{
|
||||
spoolss_policy_hnd_object *o;
|
||||
|
||||
@ -128,11 +116,6 @@ static PyObject *new_policy_hnd_object(struct cli_state *cli,
|
||||
* Method dispatch table
|
||||
*/
|
||||
|
||||
#include "py_spoolss_printers.c"
|
||||
#include "py_spoolss_drivers.c"
|
||||
#include "py_spoolss_ports.c"
|
||||
#include "py_spoolss_forms.c"
|
||||
|
||||
static PyMethodDef spoolss_methods[] = {
|
||||
|
||||
/* Open/close printer handles */
|
||||
|
@ -21,10 +21,13 @@
|
||||
#ifndef _PY_SPOOLSS_H
|
||||
#define _PY_SPOOLSS_H
|
||||
|
||||
/* Another version of offsetof (-: */
|
||||
#include "includes.h"
|
||||
#include "Python.h"
|
||||
|
||||
#undef offsetof
|
||||
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
|
||||
#include "python/py_common.h"
|
||||
#include "python/py_conv.h"
|
||||
|
||||
/* Spoolss policy handle object */
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
@ -33,11 +36,19 @@ typedef struct {
|
||||
POLICY_HND pol;
|
||||
} spoolss_policy_hnd_object;
|
||||
|
||||
/* Exceptions raised by this module */
|
||||
|
||||
extern PyTypeObject spoolss_policy_hnd_type;
|
||||
|
||||
extern PyObject *spoolss_error, *spoolss_werror;
|
||||
|
||||
void to_struct(void *s, PyObject *dict, struct pyconv *conv);
|
||||
PyObject *from_struct(void *s, struct pyconv *conv);
|
||||
/* Return a cli_state struct opened on the SPOOLSS pipe. If credentials
|
||||
are passed use them. */
|
||||
|
||||
typedef struct cli_state *(cli_pipe_fn)(
|
||||
struct cli_state *cli, char *system_name,
|
||||
struct ntuser_creds *creds);
|
||||
|
||||
#include "python/py_spoolss_proto.h"
|
||||
|
||||
#endif /* _PY_SPOOLSS_H */
|
||||
|
@ -18,6 +18,8 @@
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "python/py_spoolss.h"
|
||||
|
||||
/* Structure/hash conversions */
|
||||
|
||||
struct pyconv py_DRIVER_INFO_1[] = {
|
||||
@ -80,8 +82,8 @@ struct pyconv py_DRIVER_DIRECTORY_1[] = {
|
||||
|
||||
/* Enumerate printer drivers */
|
||||
|
||||
static PyObject *spoolss_enumprinterdrivers(PyObject *self, PyObject *args,
|
||||
PyObject *kw)
|
||||
PyObject *spoolss_enumprinterdrivers(PyObject *self, PyObject *args,
|
||||
PyObject *kw)
|
||||
{
|
||||
WERROR werror;
|
||||
PyObject *result = Py_None, *creds = NULL;
|
||||
@ -179,8 +181,8 @@ static PyObject *spoolss_enumprinterdrivers(PyObject *self, PyObject *args,
|
||||
|
||||
/* Fetch printer driver */
|
||||
|
||||
static PyObject *spoolss_getprinterdriver(PyObject *self, PyObject *args,
|
||||
PyObject *kw)
|
||||
PyObject *spoolss_getprinterdriver(PyObject *self, PyObject *args,
|
||||
PyObject *kw)
|
||||
{
|
||||
spoolss_policy_hnd_object *hnd = (spoolss_policy_hnd_object *)self;
|
||||
WERROR werror;
|
||||
@ -232,8 +234,8 @@ static PyObject *spoolss_getprinterdriver(PyObject *self, PyObject *args,
|
||||
|
||||
/* Fetch printer driver directory */
|
||||
|
||||
static PyObject *spoolss_getprinterdriverdir(PyObject *self, PyObject *args,
|
||||
PyObject *kw)
|
||||
PyObject *spoolss_getprinterdriverdir(PyObject *self, PyObject *args,
|
||||
PyObject *kw)
|
||||
{
|
||||
WERROR werror;
|
||||
PyObject *result = Py_None, *creds = NULL;
|
||||
|
@ -18,6 +18,8 @@
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "python/py_spoolss.h"
|
||||
|
||||
struct pyconv py_FORM[] = {
|
||||
{ "flags", PY_UINT32, offsetof(FORM, flags) },
|
||||
{ "width", PY_UINT32, offsetof(FORM, size_x) },
|
||||
@ -43,7 +45,7 @@ struct pyconv py_FORM_1[] = {
|
||||
|
||||
/* Add a form */
|
||||
|
||||
static PyObject *spoolss_addform(PyObject *self, PyObject *args, PyObject *kw)
|
||||
PyObject *spoolss_addform(PyObject *self, PyObject *args, PyObject *kw)
|
||||
{
|
||||
spoolss_policy_hnd_object *hnd = (spoolss_policy_hnd_object *)self;
|
||||
WERROR werror;
|
||||
@ -95,7 +97,7 @@ static PyObject *spoolss_addform(PyObject *self, PyObject *args, PyObject *kw)
|
||||
|
||||
/* Get form properties */
|
||||
|
||||
static PyObject *spoolss_getform(PyObject *self, PyObject *args, PyObject *kw)
|
||||
PyObject *spoolss_getform(PyObject *self, PyObject *args, PyObject *kw)
|
||||
{
|
||||
spoolss_policy_hnd_object *hnd = (spoolss_policy_hnd_object *)self;
|
||||
WERROR werror;
|
||||
@ -142,7 +144,7 @@ static PyObject *spoolss_getform(PyObject *self, PyObject *args, PyObject *kw)
|
||||
|
||||
/* Set form properties */
|
||||
|
||||
static PyObject *spoolss_setform(PyObject *self, PyObject *args, PyObject *kw)
|
||||
PyObject *spoolss_setform(PyObject *self, PyObject *args, PyObject *kw)
|
||||
{
|
||||
spoolss_policy_hnd_object *hnd = (spoolss_policy_hnd_object *)self;
|
||||
WERROR werror;
|
||||
@ -180,8 +182,7 @@ static PyObject *spoolss_setform(PyObject *self, PyObject *args, PyObject *kw)
|
||||
|
||||
/* Delete a form */
|
||||
|
||||
static PyObject *spoolss_deleteform(PyObject *self, PyObject *args,
|
||||
PyObject *kw)
|
||||
PyObject *spoolss_deleteform(PyObject *self, PyObject *args, PyObject *kw)
|
||||
{
|
||||
spoolss_policy_hnd_object *hnd = (spoolss_policy_hnd_object *)self;
|
||||
WERROR werror;
|
||||
@ -212,8 +213,7 @@ static PyObject *spoolss_deleteform(PyObject *self, PyObject *args,
|
||||
|
||||
/* Enumerate forms */
|
||||
|
||||
static PyObject *spoolss_enumforms(PyObject *self, PyObject *args,
|
||||
PyObject *kw)
|
||||
PyObject *spoolss_enumforms(PyObject *self, PyObject *args, PyObject *kw)
|
||||
{
|
||||
PyObject *result;
|
||||
spoolss_policy_hnd_object *hnd = (spoolss_policy_hnd_object *)self;
|
||||
|
@ -18,10 +18,6 @@
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
#include "Python.h"
|
||||
|
||||
#include "python/py_conv.h"
|
||||
#include "python/py_spoolss.h"
|
||||
|
||||
struct pyconv py_PORT_INFO_1[] = {
|
||||
@ -40,8 +36,7 @@ struct pyconv py_PORT_INFO_2[] = {
|
||||
|
||||
/* Enumerate ports */
|
||||
|
||||
static PyObject *spoolss_enumports(PyObject *self, PyObject *args,
|
||||
PyObject *kw)
|
||||
PyObject *spoolss_enumports(PyObject *self, PyObject *args, PyObject *kw)
|
||||
{
|
||||
WERROR werror;
|
||||
PyObject *result, *creds = NULL;
|
||||
|
@ -18,6 +18,8 @@
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "python/py_spoolss.h"
|
||||
|
||||
struct pyconv py_PRINTER_INFO_0[] = {
|
||||
{ "printer_name", PY_UNISTR, offsetof(PRINTER_INFO_0, printername) },
|
||||
{ "server_name", PY_UNISTR, offsetof(PRINTER_INFO_0, servername) },
|
||||
@ -234,8 +236,7 @@ static PyObject *PyDEVICEMODE_FromDEVICEMODE(DEVICEMODE *devmode)
|
||||
|
||||
/* Open a printer */
|
||||
|
||||
static PyObject *spoolss_openprinter(PyObject *self, PyObject *args,
|
||||
PyObject *kw)
|
||||
PyObject *spoolss_openprinter(PyObject *self, PyObject *args, PyObject *kw)
|
||||
{
|
||||
char *full_name, *computer_name = NULL;
|
||||
TALLOC_CTX *mem_ctx;
|
||||
@ -296,7 +297,7 @@ static PyObject *spoolss_openprinter(PyObject *self, PyObject *args,
|
||||
|
||||
/* Close a printer */
|
||||
|
||||
static PyObject *spoolss_closeprinter(PyObject *self, PyObject *args)
|
||||
PyObject *spoolss_closeprinter(PyObject *self, PyObject *args)
|
||||
{
|
||||
PyObject *po;
|
||||
spoolss_policy_hnd_object *hnd;
|
||||
@ -326,8 +327,7 @@ static PyObject *spoolss_closeprinter(PyObject *self, PyObject *args)
|
||||
|
||||
/* Fetch printer information */
|
||||
|
||||
static PyObject *spoolss_getprinter(PyObject *self, PyObject *args,
|
||||
PyObject *kw)
|
||||
PyObject *spoolss_getprinter(PyObject *self, PyObject *args, PyObject *kw)
|
||||
{
|
||||
spoolss_policy_hnd_object *hnd = (spoolss_policy_hnd_object *)self;
|
||||
WERROR werror;
|
||||
@ -403,8 +403,7 @@ static PyObject *spoolss_getprinter(PyObject *self, PyObject *args,
|
||||
|
||||
/* Set printer information */
|
||||
|
||||
static PyObject *spoolss_setprinter(PyObject *self, PyObject *args,
|
||||
PyObject *kw)
|
||||
PyObject *spoolss_setprinter(PyObject *self, PyObject *args, PyObject *kw)
|
||||
{
|
||||
spoolss_policy_hnd_object *hnd = (spoolss_policy_hnd_object *)self;
|
||||
WERROR werror;
|
||||
@ -458,8 +457,7 @@ static PyObject *spoolss_setprinter(PyObject *self, PyObject *args,
|
||||
|
||||
/* Enumerate printers */
|
||||
|
||||
static PyObject *spoolss_enumprinters(PyObject *self, PyObject *args,
|
||||
PyObject *kw)
|
||||
PyObject *spoolss_enumprinters(PyObject *self, PyObject *args, PyObject *kw)
|
||||
{
|
||||
WERROR werror;
|
||||
PyObject *result, *creds = NULL;
|
||||
|
43
source3/python/py_spoolss_proto.h
Normal file
43
source3/python/py_spoolss_proto.h
Normal file
@ -0,0 +1,43 @@
|
||||
#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 */
|
||||
|
||||
struct cli_state *open_pipe_creds(char *system_name, PyObject *creds,
|
||||
cli_pipe_fn *connect_fn,
|
||||
struct cli_state *cli);
|
||||
void initspoolss(void);
|
||||
|
||||
/* The following definitions come from python/py_spoolss_drivers.c */
|
||||
|
||||
PyObject *spoolss_enumprinterdrivers(PyObject *self, PyObject *args,
|
||||
PyObject *kw);
|
||||
PyObject *spoolss_getprinterdriver(PyObject *self, PyObject *args,
|
||||
PyObject *kw);
|
||||
PyObject *spoolss_getprinterdriverdir(PyObject *self, PyObject *args,
|
||||
PyObject *kw);
|
||||
|
||||
/* The following definitions come from python/py_spoolss_forms.c */
|
||||
|
||||
PyObject *spoolss_addform(PyObject *self, PyObject *args, PyObject *kw);
|
||||
PyObject *spoolss_getform(PyObject *self, PyObject *args, PyObject *kw);
|
||||
PyObject *spoolss_setform(PyObject *self, PyObject *args, PyObject *kw);
|
||||
PyObject *spoolss_deleteform(PyObject *self, PyObject *args, PyObject *kw);
|
||||
PyObject *spoolss_enumforms(PyObject *self, PyObject *args, PyObject *kw);
|
||||
|
||||
/* 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_printers.c */
|
||||
|
||||
PyObject *spoolss_openprinter(PyObject *self, PyObject *args, PyObject *kw);
|
||||
PyObject *spoolss_closeprinter(PyObject *self, PyObject *args);
|
||||
PyObject *spoolss_getprinter(PyObject *self, PyObject *args, PyObject *kw);
|
||||
PyObject *spoolss_setprinter(PyObject *self, PyObject *args, PyObject *kw);
|
||||
PyObject *spoolss_enumprinters(PyObject *self, PyObject *args, PyObject *kw);
|
||||
|
||||
#endif /* _PY_SPOOLSS_PROTO_H */
|
@ -4,8 +4,8 @@ RCS file: /data/cvs/samba/source/Makefile.in,v
|
||||
retrieving revision 1.460
|
||||
diff -u -r1.460 Makefile.in
|
||||
--- Makefile.in 2002/03/22 02:39:35 1.460
|
||||
+++ Makefile.in 2002/03/28 00:02:54
|
||||
@@ -781,6 +781,20 @@
|
||||
+++ Makefile.in 2002/03/28 04:12:51
|
||||
@@ -781,6 +781,27 @@
|
||||
-$(INSTALLCMD) -d ${prefix}/include
|
||||
-$(INSTALLCMD) include/libsmbclient.h ${prefix}/include
|
||||
|
||||
@ -14,14 +14,21 @@ diff -u -r1.460 Makefile.in
|
||||
+PYTHON_OBJS = $(LIB_OBJ) $(LIBSMB_OBJ) $(RPC_PARSE_OBJ) $(UBIQX_OBJ) \
|
||||
+ $(PARAM_OBJ) $(LIBMSRPC_OBJ) $(PASSDB_OBJ) $(GROUPDB_OBJ)
|
||||
+
|
||||
+python/setup.py: $(srcdir)/setup.py.in
|
||||
+ @echo "WARNING: you need to run ./config.status"
|
||||
+PY_SPOOLSS_PROTO_OBJ = python/py_spoolss.o python/py_spoolss_printers.o \
|
||||
+ python/py_spoolss_forms.o python/py_spoolss_ports.o \
|
||||
+ python/py_spoolss_drivers.o
|
||||
+
|
||||
+python_proto: python_spoolss_proto
|
||||
+
|
||||
+python_spoolss_proto:
|
||||
+ @cd $(srcdir) && $(SHELL) script/mkproto.sh $(AWK) \
|
||||
+ -h _PY_SPOOLSS_PROTO_H python/py_spoolss_proto.h \
|
||||
+ $(PY_SPOOLSS_PROTO_OBJ)
|
||||
+
|
||||
+python_ext: $(PYTHON_OBJS)
|
||||
+ @echo python python/setup.py build
|
||||
+ @PYTHON_OBJS="$(PYTHON_OBJS)" PYTHON_CFLAGS="$(CFLAGS) $(CPPFLAGS)" \
|
||||
+ python python/setup.py build
|
||||
+
|
||||
+
|
||||
# revert to the previously installed version
|
||||
revert:
|
||||
@ -32,7 +39,7 @@ RCS file: /data/cvs/samba/source/configure.in,v
|
||||
retrieving revision 1.292
|
||||
diff -u -r1.292 configure.in
|
||||
--- configure.in 2002/03/19 02:32:31 1.292
|
||||
+++ configure.in 2002/03/28 00:02:55
|
||||
+++ configure.in 2002/03/28 04:12:52
|
||||
@@ -2690,7 +2690,7 @@
|
||||
builddir=`pwd`
|
||||
AC_SUBST(builddir)
|
||||
|
@ -86,7 +86,12 @@ setup(
|
||||
Extension(name = "spoolss",
|
||||
sources = [samba_srcdir + "python/py_spoolss.c",
|
||||
samba_srcdir + "python/py_common.c",
|
||||
samba_srcdir + "python/py_conv.c"],
|
||||
samba_srcdir + "python/py_conv.c",
|
||||
samba_srcdir + "python/py_spoolss_forms.c",
|
||||
samba_srcdir + "python/py_spoolss_drivers.c",
|
||||
samba_srcdir + "python/py_spoolss_printers.c",
|
||||
samba_srcdir + "python/py_spoolss_ports.c",
|
||||
],
|
||||
libraries = lib_list,
|
||||
library_dirs = ["/usr/kerberos/lib"],
|
||||
extra_objects = obj_list),
|
||||
|
Loading…
Reference in New Issue
Block a user