[SCM] Samba Shared Repository - branch master updated - tevent-0-9-8-586-g9d9bd31

Jelmer Vernooij jelmer at samba.org
Mon Sep 21 08:48:29 MDT 2009


Hi Andrew,

Andrew Bartlett wrote:
> diff --git a/source4/librpc/ndr/py_security.c b/source4/librpc/ndr/py_security.c
> index 02dc059..1b185a5 100644
> --- a/source4/librpc/ndr/py_security.c
> +++ b/source4/librpc/ndr/py_security.c
> @@ -23,6 +23,11 @@
>  #define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
>  #endif
>  
> +PyObject *py_dom_sid_FromSid(struct dom_sid *sid)
> +{
> +	return py_talloc_reference(&dom_sid_Type, sid);
> +}
> +
>  static void PyType_AddMethods(PyTypeObject *type, PyMethodDef *methods)
>  {
>  	PyObject *dict;
> diff --git a/source4/librpc/ndr/py_security.h b/source4/librpc/ndr/py_security.h
> new file mode 100644
> index 0000000..9d200fa
> --- /dev/null
> +++ b/source4/librpc/ndr/py_security.h
> @@ -0,0 +1,23 @@
> +/* 
> +   Unix SMB/CIFS implementation.
> +   Samba utility functions
> +   Copyright (C) Jelmer Vernooij <jelmer at samba.org> 2008
> +   
> +   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 3 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, see <http://www.gnu.org/licenses/>.
> +*/
> +
> +#include "libcli/security/security.h"
> +
> +/* a lone prototype for this function, because it's python */
> +PyObject *py_dom_sid_FromSid(struct dom_sid *sid);
> diff --git a/source4/param/config.mk b/source4/param/config.mk
> index 6e5290b..45eb836 100644
> --- a/source4/param/config.mk
> +++ b/source4/param/config.mk
> @@ -13,7 +13,7 @@ PUBLIC_HEADERS += param/param.h
>  PC_FILES += $(paramsrcdir)/samba-hostconfig.pc
>  
>  [SUBSYSTEM::PROVISION]
> -PRIVATE_DEPENDENCIES = LIBPYTHON pyldb pyparam_util
> +PRIVATE_DEPENDENCIES = LIBPYTHON pyldb pyparam_util python_dcerpc_security
>  
>  PROVISION_OBJ_FILES = $(paramsrcdir)/provision.o $(param_OBJ_FILES)
>
>   
This doesn't work - we'll end up with two py_Sid_Type symbols in our
Python process - one that came from provision.so and one that came from
security.so. The way around this is to use Py_Import to ask Python to
return the right handle for the Sid type to you (see pyglue.c for an
example). You'll notice that Sids created by the first module won't
actually be accepted as valid Sid objects by security.so.

Cheers,

Jelmer


More information about the samba-cvs mailing list