summaryrefslogtreecommitdiff
path: root/source4/libnet/py_net.c
diff options
context:
space:
mode:
authorAlexander Bokovoy <ab@samba.org>2012-04-10 12:09:20 +0300
committerAndreas Schneider <asn@cryptomilk.org>2012-04-12 15:23:19 +0200
commitbcc16f191175740f200c12925b63d45478f06454 (patch)
treec61461de3ab2d0d5af71ae73e1028deab59cc3d0 /source4/libnet/py_net.c
parentdda0531aae70e78e815fda8c594213369e76a847 (diff)
downloadsamba-bcc16f191175740f200c12925b63d45478f06454.tar.gz
samba-bcc16f191175740f200c12925b63d45478f06454.tar.bz2
samba-bcc16f191175740f200c12925b63d45478f06454.zip
s4-libnet: split export_keytab in a separate python module to avoid pulling in HDB dependency
Signed-off-by: Andreas Schneider <asn@samba.org> Autobuild-User: Andreas Schneider <asn@cryptomilk.org> Autobuild-Date: Thu Apr 12 15:23:19 CEST 2012 on sn-devel-104
Diffstat (limited to 'source4/libnet/py_net.c')
-rw-r--r--source4/libnet/py_net.c45
1 files changed, 1 insertions, 44 deletions
diff --git a/source4/libnet/py_net.c b/source4/libnet/py_net.c
index c710680b39..acb0a37759 100644
--- a/source4/libnet/py_net.c
+++ b/source4/libnet/py_net.c
@@ -32,16 +32,10 @@
#include "libcli/resolve/resolve.h"
#include "libcli/finddc.h"
#include "dsdb/samdb/samdb.h"
+#include "py_net.h"
void initnet(void);
-typedef struct {
- PyObject_HEAD
- TALLOC_CTX *mem_ctx;
- struct libnet_context *libnet_ctx;
- struct tevent_context *ev;
-} py_net_Object;
-
static PyObject *py_net_join_member(py_net_Object *self, PyObject *args, PyObject *kwargs)
{
struct libnet_Join_member r;
@@ -187,42 +181,6 @@ static const char py_net_set_password_doc[] = "set_password(account_name, domain
" newpassword=new_pass)\n";
-static PyObject *py_net_export_keytab(py_net_Object *self, PyObject *args, PyObject *kwargs)
-{
- struct libnet_export_keytab r;
- TALLOC_CTX *mem_ctx;
- const char *kwnames[] = { "keytab", "principal", NULL };
- NTSTATUS status;
- r.in.principal = NULL;
-
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|z:export_keytab", discard_const_p(char *, kwnames),
- &r.in.keytab_name,
- &r.in.principal)) {
- return NULL;
- }
-
- mem_ctx = talloc_new(self->mem_ctx);
- if (mem_ctx == NULL) {
- PyErr_NoMemory();
- return NULL;
- }
-
- status = libnet_export_keytab(self->libnet_ctx, mem_ctx, &r);
- if (NT_STATUS_IS_ERR(status)) {
- PyErr_SetString(PyExc_RuntimeError,
- r.out.error_string?r.out.error_string:nt_errstr(status));
- talloc_free(mem_ctx);
- return NULL;
- }
-
- talloc_free(mem_ctx);
-
- Py_RETURN_NONE;
-}
-
-static const char py_net_export_keytab_doc[] = "export_keytab(keytab, name)\n\n"
-"Export the DC keytab to a keytab file.";
-
static PyObject *py_net_time(py_net_Object *self, PyObject *args, PyObject *kwargs)
{
const char *kwnames[] = { "server_name", NULL };
@@ -644,7 +602,6 @@ static PyMethodDef net_obj_methods[] = {
{"join_member", (PyCFunction)py_net_join_member, METH_VARARGS|METH_KEYWORDS, py_net_join_member_doc},
{"change_password", (PyCFunction)py_net_change_password, METH_VARARGS|METH_KEYWORDS, py_net_change_password_doc},
{"set_password", (PyCFunction)py_net_set_password, METH_VARARGS|METH_KEYWORDS, py_net_set_password_doc},
- {"export_keytab", (PyCFunction)py_net_export_keytab, METH_VARARGS|METH_KEYWORDS, py_net_export_keytab_doc},
{"time", (PyCFunction)py_net_time, METH_VARARGS|METH_KEYWORDS, py_net_time_doc},
{"create_user", (PyCFunction)py_net_user_create, METH_VARARGS|METH_KEYWORDS, py_net_create_user_doc},
{"delete_user", (PyCFunction)py_net_user_delete, METH_VARARGS|METH_KEYWORDS, py_net_delete_user_doc},