mirror of
https://github.com/samba-team/samba.git
synced 2025-01-10 01:18:15 +03:00
python3 port for dckeytab module
Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
This commit is contained in:
parent
6a7cdad3e7
commit
4f036497f1
@ -22,6 +22,7 @@
|
||||
|
||||
#include <Python.h>
|
||||
#include "includes.h"
|
||||
#include "python/py3compat.h"
|
||||
#include "py_net.h"
|
||||
#include "libnet_export_keytab.h"
|
||||
|
||||
@ -74,28 +75,37 @@ static PyMethodDef export_keytab_method_table[] = {
|
||||
* the global module table even if we don't really need that record. Thus, we initialize
|
||||
* dckeytab module but never use it.
|
||||
* */
|
||||
void initdckeytab(void)
|
||||
void initdckeytab(void);
|
||||
static struct PyModuleDef moduledef = {
|
||||
PyModuleDef_HEAD_INIT,
|
||||
.m_name = "dckeytab",
|
||||
.m_doc = "dckeytab",
|
||||
.m_size = -1,
|
||||
.m_methods = NULL
|
||||
};
|
||||
|
||||
MODULE_INIT_FUNC(dckeytab)
|
||||
{
|
||||
PyObject *m;
|
||||
PyObject *m = NULL;
|
||||
PyObject *Net;
|
||||
PyObject *descr;
|
||||
int ret;
|
||||
|
||||
m = Py_InitModule3("dckeytab", NULL, NULL);
|
||||
m = PyModule_Create(&moduledef);
|
||||
if (m == NULL)
|
||||
return;
|
||||
return m;
|
||||
|
||||
m = PyImport_ImportModule("samba.net");
|
||||
if (m == NULL)
|
||||
return;
|
||||
return m;
|
||||
|
||||
Net = (PyObject *)PyObject_GetAttrString(m, "Net");
|
||||
if (Net == NULL)
|
||||
return;
|
||||
return m;
|
||||
|
||||
descr = PyDescr_NewMethod((PyTypeObject*)Net, &export_keytab_method_table[0]);
|
||||
if (descr == NULL)
|
||||
return;
|
||||
return m;
|
||||
|
||||
ret = PyDict_SetItemString(((PyTypeObject*)Net)->tp_dict,
|
||||
export_keytab_method_table[0].ml_name,
|
||||
@ -103,4 +113,6 @@ void initdckeytab(void)
|
||||
if (ret != -1) {
|
||||
Py_DECREF(descr);
|
||||
}
|
||||
|
||||
return m;
|
||||
}
|
||||
|
@ -18,9 +18,9 @@ for env in bld.gen_python_environments():
|
||||
realname='samba/net.so'
|
||||
)
|
||||
|
||||
bld.SAMBA_PYTHON('python_dckeytab',
|
||||
source='py_net_dckeytab.c libnet_export_keytab.c',
|
||||
deps='pyrpc_util db-glue krb5 com_err',
|
||||
realname='samba/dckeytab.so',
|
||||
enabled=bld.CONFIG_SET('AD_DC_BUILD_IS_ENABLED')
|
||||
)
|
||||
bld.SAMBA_PYTHON('python_dckeytab',
|
||||
source='py_net_dckeytab.c libnet_export_keytab.c',
|
||||
deps='pyrpc_util db-glue krb5 com_err',
|
||||
realname='samba/dckeytab.so',
|
||||
enabled=bld.CONFIG_SET('AD_DC_BUILD_IS_ENABLED')
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user