mirror of
https://github.com/samba-team/samba.git
synced 2025-07-31 20:22:15 +03:00
Cleanup of header files for python extensions.
- combine py_foo_proto.h and py_foo.h - move #include of Python.h into one place so we can get rid of that annoying compiler warning about HAVE_FSTAT being redefined
This commit is contained in:
@ -18,10 +18,7 @@
|
|||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "python/py_common.h"
|
||||||
#include "Python.h"
|
|
||||||
|
|
||||||
#include "python/py_common_proto.h"
|
|
||||||
|
|
||||||
/* Return a tuple of (error code, error string) from a WERROR */
|
/* Return a tuple of (error code, error string) from a WERROR */
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
Python wrappers for DCERPC/SMB client routines.
|
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
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -23,6 +23,15 @@
|
|||||||
|
|
||||||
#include "includes.h"
|
#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
|
/* Return a cli_state struct opened on the specified pipe. If credentials
|
||||||
are passed use them. */
|
are passed use them. */
|
||||||
|
|
||||||
@ -30,6 +39,29 @@ typedef struct cli_state *(cli_pipe_fn)(
|
|||||||
struct cli_state *cli, char *system_name,
|
struct cli_state *cli, char *system_name,
|
||||||
struct ntuser_creds *creds);
|
struct ntuser_creds *creds);
|
||||||
|
|
||||||
#include "python/py_common_proto.h"
|
/* The following definitions come from python/py_common.c */
|
||||||
|
|
||||||
#endif /* _PY_COMMON_H */
|
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 */
|
||||||
|
@ -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 */
|
|
@ -18,8 +18,6 @@
|
|||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
|
||||||
#include "Python.h"
|
|
||||||
#include "py_conv.h"
|
#include "py_conv.h"
|
||||||
|
|
||||||
/* Helper for rpcstr_pull() function */
|
/* 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);
|
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 */
|
/* Convert a structure to a Python dict */
|
||||||
|
|
||||||
PyObject *from_struct(void *s, struct pyconv *conv)
|
PyObject *from_struct(void *s, struct pyconv *conv)
|
||||||
@ -52,6 +55,18 @@ PyObject *from_struct(void *s, struct pyconv *conv)
|
|||||||
|
|
||||||
break;
|
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: {
|
case PY_UINT32: {
|
||||||
uint32 *u = (uint32 *)((char *)s + conv[i].offset);
|
uint32 *u = (uint32 *)((char *)s + conv[i].offset);
|
||||||
|
|
||||||
|
@ -21,7 +21,10 @@
|
|||||||
#ifndef _PY_CONV_H
|
#ifndef _PY_CONV_H
|
||||||
#define _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 {
|
struct pyconv {
|
||||||
char *name; /* Name of member */
|
char *name; /* Name of member */
|
||||||
|
@ -21,10 +21,7 @@
|
|||||||
#ifndef _PY_LSA_H
|
#ifndef _PY_LSA_H
|
||||||
#define _PY_LSA_H
|
#define _PY_LSA_H
|
||||||
|
|
||||||
#include "includes.h"
|
#include "python/py_common.h"
|
||||||
#include "Python.h"
|
|
||||||
|
|
||||||
#include "python/py_common_proto.h"
|
|
||||||
|
|
||||||
/* LSA policy handle object */
|
/* LSA policy handle object */
|
||||||
|
|
||||||
@ -41,6 +38,4 @@ extern PyTypeObject lsa_policy_hnd_type;
|
|||||||
|
|
||||||
extern PyObject *lsa_error;
|
extern PyObject *lsa_error;
|
||||||
|
|
||||||
#include "python/py_lsa_proto.h"
|
|
||||||
|
|
||||||
#endif /* _PY_LSA_H */
|
#endif /* _PY_LSA_H */
|
||||||
|
@ -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 */
|
|
@ -18,10 +18,7 @@
|
|||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "python/py_common.h"
|
||||||
#include "Python.h"
|
|
||||||
|
|
||||||
#include "python/py_common_proto.h"
|
|
||||||
|
|
||||||
/* Convert a SID to a Python dict */
|
/* Convert a SID to a Python dict */
|
||||||
|
|
||||||
|
@ -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;
|
samr_domain_hnd_object *domain_hnd = (samr_domain_hnd_object *)self;
|
||||||
static char *kwlist[] = { NULL };
|
static char *kwlist[] = { NULL };
|
||||||
TALLOC_CTX *mem_ctx;
|
TALLOC_CTX *mem_ctx;
|
||||||
uint32 desired_access = MAXIMUM_ALLOWED_ACCESS;
|
/* uint32 desired_access = MAXIMUM_ALLOWED_ACCESS; */
|
||||||
uint32 start_idx, size, num_dom_groups;
|
uint32 start_idx, size, num_dom_groups;
|
||||||
struct acct_info *dom_groups;
|
struct acct_info *dom_groups;
|
||||||
NTSTATUS result;
|
NTSTATUS result;
|
||||||
|
@ -21,10 +21,7 @@
|
|||||||
#ifndef _PY_SAMR_H
|
#ifndef _PY_SAMR_H
|
||||||
#define _PY_SAMR_H
|
#define _PY_SAMR_H
|
||||||
|
|
||||||
#include "includes.h"
|
#include "python/py_common.h"
|
||||||
#include "Python.h"
|
|
||||||
|
|
||||||
#include "python/py_common_proto.h"
|
|
||||||
|
|
||||||
/* SAMR connect policy handle object */
|
/* SAMR connect policy handle object */
|
||||||
|
|
||||||
@ -78,6 +75,7 @@ extern PyTypeObject samr_connect_hnd_type, samr_domain_hnd_type,
|
|||||||
|
|
||||||
extern PyObject *samr_error;
|
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 */
|
#endif /* _PY_SAMR_H */
|
||||||
|
@ -21,10 +21,7 @@
|
|||||||
#ifndef _PY_SMB_H
|
#ifndef _PY_SMB_H
|
||||||
#define _PY_SMB_H
|
#define _PY_SMB_H
|
||||||
|
|
||||||
#include "includes.h"
|
#include "python/py_common.h"
|
||||||
#include "Python.h"
|
|
||||||
|
|
||||||
#include "python/py_common_proto.h"
|
|
||||||
|
|
||||||
/* cli_state handle object */
|
/* cli_state handle object */
|
||||||
|
|
||||||
|
@ -24,24 +24,6 @@
|
|||||||
|
|
||||||
PyObject *spoolss_error, *spoolss_werror;
|
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
|
* Method dispatch table
|
||||||
*/
|
*/
|
||||||
|
@ -21,10 +21,7 @@
|
|||||||
#ifndef _PY_SPOOLSS_H
|
#ifndef _PY_SPOOLSS_H
|
||||||
#define _PY_SPOOLSS_H
|
#define _PY_SPOOLSS_H
|
||||||
|
|
||||||
#include "includes.h"
|
#include "python/py_common.h"
|
||||||
#include "Python.h"
|
|
||||||
|
|
||||||
#include "python/py_common_proto.h"
|
|
||||||
|
|
||||||
/* Spoolss policy handle object */
|
/* Spoolss policy handle object */
|
||||||
|
|
||||||
@ -41,6 +38,123 @@ extern PyTypeObject spoolss_policy_hnd_type;
|
|||||||
|
|
||||||
extern PyObject *spoolss_error, *spoolss_werror;
|
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 */
|
#endif /* _PY_SPOOLSS_H */
|
||||||
|
35
source/python/py_spoolss_common.c
Normal file
35
source/python/py_spoolss_common.c
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
Python wrappers for DCERPC/SMB client routines.
|
||||||
|
|
||||||
|
Copyright (C) Tim Potter, 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
|
||||||
|
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/py_spoolss.h"
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
@ -19,6 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "python/py_spoolss.h"
|
#include "python/py_spoolss.h"
|
||||||
|
#include "python/py_conv.h"
|
||||||
|
|
||||||
static BOOL py_from_printerdata(PyObject **dict, char *key, char *value,
|
static BOOL py_from_printerdata(PyObject **dict, char *key, char *value,
|
||||||
uint16 data_type, uint8 *data,
|
uint16 data_type, uint8 *data,
|
||||||
|
@ -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 */
|
|
@ -28,6 +28,33 @@ static struct const_vals {
|
|||||||
char *name;
|
char *name;
|
||||||
uint32 value;
|
uint32 value;
|
||||||
} module_const_vals[] = {
|
} module_const_vals[] = {
|
||||||
|
{ "SV_TYPE_WORKSTATION", SV_TYPE_WORKSTATION },
|
||||||
|
{ "SV_TYPE_SERVER", SV_TYPE_SERVER },
|
||||||
|
{ "SV_TYPE_SQLSERVER", SV_TYPE_SQLSERVER },
|
||||||
|
{ "SV_TYPE_DOMAIN_CTRL", SV_TYPE_DOMAIN_CTRL },
|
||||||
|
{ "SV_TYPE_DOMAIN_BAKCTRL", SV_TYPE_DOMAIN_BAKCTRL },
|
||||||
|
{ "SV_TYPE_TIME_SOURCE", SV_TYPE_TIME_SOURCE },
|
||||||
|
{ "SV_TYPE_AFP", SV_TYPE_AFP },
|
||||||
|
{ "SV_TYPE_NOVELL", SV_TYPE_NOVELL },
|
||||||
|
{ "SV_TYPE_DOMAIN_MEMBER", SV_TYPE_DOMAIN_MEMBER },
|
||||||
|
{ "SV_TYPE_PRINTQ_SERVER", SV_TYPE_PRINTQ_SERVER },
|
||||||
|
{ "SV_TYPE_DIALIN_SERVER", SV_TYPE_DIALIN_SERVER },
|
||||||
|
{ "SV_TYPE_SERVER_UNIX", SV_TYPE_SERVER_UNIX },
|
||||||
|
{ "SV_TYPE_NT", SV_TYPE_NT },
|
||||||
|
{ "SV_TYPE_WFW", SV_TYPE_WFW },
|
||||||
|
{ "SV_TYPE_SERVER_MFPN", SV_TYPE_SERVER_MFPN },
|
||||||
|
{ "SV_TYPE_SERVER_NT", SV_TYPE_SERVER_NT },
|
||||||
|
{ "SV_TYPE_POTENTIAL_BROWSER", SV_TYPE_POTENTIAL_BROWSER },
|
||||||
|
{ "SV_TYPE_BACKUP_BROWSER", SV_TYPE_BACKUP_BROWSER },
|
||||||
|
{ "SV_TYPE_MASTER_BROWSER", SV_TYPE_MASTER_BROWSER },
|
||||||
|
{ "SV_TYPE_DOMAIN_MASTER", SV_TYPE_DOMAIN_MASTER },
|
||||||
|
{ "SV_TYPE_SERVER_OSF", SV_TYPE_SERVER_OSF },
|
||||||
|
{ "SV_TYPE_SERVER_VMS", SV_TYPE_SERVER_VMS },
|
||||||
|
{ "SV_TYPE_WIN95_PLUS", SV_TYPE_WIN95_PLUS },
|
||||||
|
{ "SV_TYPE_DFS_SERVER", SV_TYPE_DFS_SERVER },
|
||||||
|
{ "SV_TYPE_ALTERNATE_XPORT", SV_TYPE_ALTERNATE_XPORT },
|
||||||
|
{ "SV_TYPE_LOCAL_LIST_ONLY", SV_TYPE_LOCAL_LIST_ONLY },
|
||||||
|
{ "SV_TYPE_DOMAIN_ENUM", SV_TYPE_DOMAIN_ENUM },
|
||||||
{ NULL },
|
{ NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -100,8 +127,18 @@ PyObject *srvsvc_netservergetinfo(PyObject *self, PyObject *args,
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = Py_None;
|
if (level != ctr.switch_value) {
|
||||||
Py_INCREF(Py_None);
|
PyErr_SetString(srvsvc_error, "container level value wrong");
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(level) {
|
||||||
|
case 101:
|
||||||
|
py_from_SRV_INFO_101(&result, &ctr.srv.sv101);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Py_INCREF(result);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if (mem_ctx)
|
if (mem_ctx)
|
||||||
|
@ -21,9 +21,6 @@
|
|||||||
#ifndef _PY_SRVSVC_H
|
#ifndef _PY_SRVSVC_H
|
||||||
#define _PY_SRVSVC_H
|
#define _PY_SRVSVC_H
|
||||||
|
|
||||||
#include "includes.h"
|
#include "python/py_common.h"
|
||||||
#include "Python.h"
|
|
||||||
|
|
||||||
#include "python/py_common_proto.h"
|
|
||||||
|
|
||||||
#endif /* _PY_SRVSVC_H */
|
#endif /* _PY_SRVSVC_H */
|
||||||
|
43
source/python/py_srvsvc_conv.c
Normal file
43
source/python/py_srvsvc_conv.c
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
Python wrappers for DCERPC/SMB client routines.
|
||||||
|
|
||||||
|
Copyright (C) Tim Potter, 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
|
||||||
|
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/py_srvsvc.h"
|
||||||
|
#include "python/py_conv.h"
|
||||||
|
|
||||||
|
static struct pyconv py_SRV_INFO_101[] = {
|
||||||
|
{ "platform_id", PY_UINT32, offsetof(SRV_INFO_101, platform_id) },
|
||||||
|
{ "major_version", PY_UINT32, offsetof(SRV_INFO_101, ver_major) },
|
||||||
|
{ "minor_version", PY_UINT32, offsetof(SRV_INFO_101, ver_minor) },
|
||||||
|
{ "server_type", PY_UINT32, offsetof(SRV_INFO_101, srv_type) },
|
||||||
|
{ "name", PY_UNISTR2, offsetof(SRV_INFO_101, uni_name) },
|
||||||
|
{ "comment", PY_UNISTR2, offsetof(SRV_INFO_101, uni_comment) },
|
||||||
|
{ NULL }
|
||||||
|
};
|
||||||
|
|
||||||
|
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));
|
||||||
|
|
||||||
|
return True;
|
||||||
|
}
|
@ -21,9 +21,6 @@
|
|||||||
#ifndef _PY_TDB_H
|
#ifndef _PY_TDB_H
|
||||||
#define _PY_TDB_H
|
#define _PY_TDB_H
|
||||||
|
|
||||||
#include "includes.h"
|
#include "python/py_common.h"
|
||||||
#include "Python.h"
|
|
||||||
|
|
||||||
#include "python/py_common_proto.h"
|
|
||||||
|
|
||||||
#endif /* _PY_TDB_H */
|
#endif /* _PY_TDB_H */
|
||||||
|
@ -20,10 +20,7 @@
|
|||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "py_winbind.h"
|
||||||
#include "Python.h"
|
|
||||||
|
|
||||||
#include "py_common_proto.h"
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Exceptions raised by this module
|
* 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_request request;
|
||||||
struct winbindd_response response;
|
struct winbindd_response response;
|
||||||
PyObject *result;
|
PyObject *result;
|
||||||
char *name, *p, *sep;
|
char *name, *p;
|
||||||
|
const char *sep;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "s", &name))
|
if (!PyArg_ParseTuple(args, "s", &name))
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -137,7 +135,7 @@ static PyObject *py_enum_domain_users(PyObject *self, PyObject *args)
|
|||||||
result = PyList_New(0);
|
result = PyList_New(0);
|
||||||
|
|
||||||
if (response.extra_data) {
|
if (response.extra_data) {
|
||||||
char *extra_data = response.extra_data;
|
const char *extra_data = response.extra_data;
|
||||||
fstring name;
|
fstring name;
|
||||||
|
|
||||||
while (next_token(&extra_data, name, ",", sizeof(fstring)))
|
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);
|
result = PyList_New(0);
|
||||||
|
|
||||||
if (response.extra_data) {
|
if (response.extra_data) {
|
||||||
char *extra_data = response.extra_data;
|
const char *extra_data = response.extra_data;
|
||||||
fstring name;
|
fstring name;
|
||||||
|
|
||||||
while (next_token(&extra_data, name, ",", sizeof(fstring)))
|
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);
|
result = PyList_New(0);
|
||||||
|
|
||||||
if (response.extra_data) {
|
if (response.extra_data) {
|
||||||
char *extra_data = response.extra_data;
|
const char *extra_data = response.extra_data;
|
||||||
fstring name;
|
fstring name;
|
||||||
|
|
||||||
while (next_token(&extra_data, name, ",", sizeof(fstring)))
|
while (next_token(&extra_data, name, ",", sizeof(fstring)))
|
||||||
@ -522,12 +520,12 @@ static PyObject *py_getpwuid(PyObject *self, PyObject *args)
|
|||||||
|
|
||||||
static PyMethodDef winbind_methods[] = {
|
static PyMethodDef winbind_methods[] = {
|
||||||
|
|
||||||
{ "getpwnam", py_getpwnam, METH_VARARGS, "getpwnam(3)" },
|
{ "getpwnam", (PyCFunction)py_getpwnam, METH_VARARGS, "getpwnam(3)" },
|
||||||
{ "getpwuid", py_getpwuid, METH_VARARGS, "getpwuid(3)" },
|
{ "getpwuid", (PyCFunction)py_getpwuid, METH_VARARGS, "getpwuid(3)" },
|
||||||
|
|
||||||
/* Name <-> SID conversion */
|
/* 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
|
"name_to_sid(s) -> string
|
||||||
|
|
||||||
Return the SID for a name.
|
Return the SID for a name.
|
||||||
@ -537,7 +535,7 @@ Example:
|
|||||||
>>> winbind.name_to_sid('FOO/Administrator')
|
>>> winbind.name_to_sid('FOO/Administrator')
|
||||||
'S-1-5-21-406022937-1377575209-526660263-500' " },
|
'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
|
"sid_to_name(s) -> string
|
||||||
|
|
||||||
Return the name for a SID.
|
Return the name for a SID.
|
||||||
@ -550,7 +548,7 @@ Example:
|
|||||||
|
|
||||||
/* Enumerate users/groups */
|
/* 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
|
"enum_domain_users() -> list of strings
|
||||||
|
|
||||||
Return a list of domain users.
|
Return a list of domain users.
|
||||||
@ -562,7 +560,8 @@ Example:
|
|||||||
'FOO/foo', 'FOO/foo2', 'FOO/foo3', 'FOO/Guest', 'FOO/user1',
|
'FOO/foo', 'FOO/foo2', 'FOO/foo3', 'FOO/Guest', 'FOO/user1',
|
||||||
'FOO/whoops-ptang'] " },
|
'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
|
"enum_domain_groups() -> list of strings
|
||||||
|
|
||||||
Return a list of domain groups.
|
Return a list of domain groups.
|
||||||
@ -575,7 +574,7 @@ Example:
|
|||||||
|
|
||||||
/* ID mapping */
|
/* 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
|
"uid_to_sid(int) -> string
|
||||||
|
|
||||||
Return the SID for a UNIX uid.
|
Return the SID for a UNIX uid.
|
||||||
@ -585,7 +584,7 @@ Example:
|
|||||||
>>> winbind.uid_to_sid(10000)
|
>>> winbind.uid_to_sid(10000)
|
||||||
'S-1-5-21-406022937-1377575209-526660263-500' " },
|
'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
|
"gid_to_sid(int) -> string
|
||||||
|
|
||||||
Return the UNIX gid for a SID.
|
Return the UNIX gid for a SID.
|
||||||
@ -595,7 +594,7 @@ Example:
|
|||||||
>>> winbind.gid_to_sid(10001)
|
>>> winbind.gid_to_sid(10001)
|
||||||
'S-1-5-21-406022937-1377575209-526660263-512' " },
|
'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
|
"sid_to_uid(string) -> int
|
||||||
|
|
||||||
Return the UNIX uid for a SID.
|
Return the UNIX uid for a SID.
|
||||||
@ -605,7 +604,7 @@ Example:
|
|||||||
>>> winbind.sid_to_uid('S-1-5-21-406022937-1377575209-526660263-500')
|
>>> winbind.sid_to_uid('S-1-5-21-406022937-1377575209-526660263-500')
|
||||||
10000 " },
|
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
|
"sid_to_gid(string) -> int
|
||||||
|
|
||||||
Return the UNIX gid corresponding to a SID.
|
Return the UNIX gid corresponding to a SID.
|
||||||
@ -617,13 +616,13 @@ Example:
|
|||||||
|
|
||||||
/* Miscellaneous */
|
/* Miscellaneous */
|
||||||
|
|
||||||
{ "check_secret", py_check_secret, METH_VARARGS,
|
{ "check_secret", (PyCFunction)py_check_secret, METH_VARARGS,
|
||||||
"check_secret() -> int
|
"check_secret() -> int
|
||||||
|
|
||||||
Check the machine trust account password. The NT status is returned
|
Check the machine trust account password. The NT status is returned
|
||||||
with zero indicating success. " },
|
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
|
"enum_trust_dom() -> list of strings
|
||||||
|
|
||||||
Return a list of trusted domains. The domain the server is a member
|
Return a list of trusted domains. The domain the server is a member
|
||||||
@ -636,13 +635,13 @@ Example:
|
|||||||
|
|
||||||
/* PAM authorisation functions */
|
/* PAM authorisation functions */
|
||||||
|
|
||||||
{ "auth_plaintext", py_auth_plaintext, METH_VARARGS,
|
{ "auth_plaintext", (PyCFunction)py_auth_plaintext, METH_VARARGS,
|
||||||
"auth_plaintext(s, s) -> int
|
"auth_plaintext(s, s) -> int
|
||||||
|
|
||||||
Authenticate a username and password using plaintext authentication.
|
Authenticate a username and password using plaintext authentication.
|
||||||
The NT status code is returned with zero indicating success." },
|
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
|
"auth_crap(s, s) -> int
|
||||||
|
|
||||||
Authenticate a username and password using the challenge/response
|
Authenticate a username and password using the challenge/response
|
||||||
|
30
source/python/py_winbind.h
Normal file
30
source/python/py_winbind.h
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _PY_WINBIND_H
|
||||||
|
#define _PY_WINBIND_H
|
||||||
|
|
||||||
|
#include "python/py_common.h"
|
||||||
|
|
||||||
|
/* The following definitions are from py_winbind_conv.c */
|
||||||
|
|
||||||
|
BOOL py_from_winbind_passwd(PyObject **dict, struct winbindd_response *response);
|
||||||
|
|
||||||
|
#endif /* _PY_WINBIND_H */
|
@ -18,8 +18,7 @@
|
|||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "python/py_common.h"
|
||||||
#include "Python.h"
|
|
||||||
#include "python/py_conv.h"
|
#include "python/py_conv.h"
|
||||||
|
|
||||||
/* Convert a struct passwd to a dictionary */
|
/* Convert a struct passwd to a dictionary */
|
||||||
|
@ -24,6 +24,6 @@
|
|||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
|
|
||||||
#include "python/py_common_proto.h"
|
#include "python/py_common.h"
|
||||||
|
|
||||||
#endif /* _PY_WINREG_H */
|
#endif /* _PY_WINREG_H */
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# Unix SMB/CIFS implementation.
|
# Unix SMB/CIFS implementation.
|
||||||
# Module packaging setup for Samba python extensions
|
# Module packaging setup for Samba python extensions
|
||||||
#
|
#
|
||||||
# Copyright (C) Tim Potter, 2002
|
# Copyright (C) Tim Potter, 2002-2003
|
||||||
# Copyright (C) Martin Pool, 2002
|
# Copyright (C) Martin Pool, 2002
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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_common.c",
|
||||||
samba_srcdir + "python/py_conv.c",
|
samba_srcdir + "python/py_conv.c",
|
||||||
samba_srcdir + "python/py_ntsec.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.c",
|
||||||
samba_srcdir + "python/py_spoolss_forms_conv.c",
|
samba_srcdir + "python/py_spoolss_forms_conv.c",
|
||||||
samba_srcdir + "python/py_spoolss_drivers.c",
|
samba_srcdir + "python/py_spoolss_drivers.c",
|
||||||
@ -148,6 +149,8 @@ setup(
|
|||||||
|
|
||||||
Extension(name = "srvsvc",
|
Extension(name = "srvsvc",
|
||||||
sources = [samba_srcdir + "python/py_srvsvc.c",
|
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"],
|
samba_srcdir + "python/py_common.c"],
|
||||||
libraries = lib_list,
|
libraries = lib_list,
|
||||||
library_dirs = ["/usr/kerberos/lib"],
|
library_dirs = ["/usr/kerberos/lib"],
|
||||||
|
Reference in New Issue
Block a user