1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-25 17:57:42 +03:00

s4-net: Use new Net() object in net export keytab.

This commit is contained in:
Jelmer Vernooij 2010-04-08 22:59:16 +02:00
parent 814e20e7da
commit 6510b2cdd2
3 changed files with 10 additions and 6 deletions

View File

@ -54,14 +54,14 @@ static PyObject *py_ldb_set_loadparm(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "O", &py_lp_ctx))
return NULL;
lp_ctx = lp_from_py_object(py_lp_ctx);
ldb = PyLdb_AsLdbContext(self);
lp_ctx = lp_from_py_object(ldb, py_lp_ctx);
if (lp_ctx == NULL) {
PyErr_SetString(PyExc_TypeError, "Expected loadparm object");
return NULL;
}
ldb = PyLdb_AsLdbContext(self);
ldb_set_opaque(ldb, "loadparm", lp_ctx);
Py_RETURN_NONE;

View File

@ -1,7 +1,7 @@
/*
Unix SMB/CIFS implementation.
Samba utility functions
Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2008
Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2008-2010
Copyright (C) Kamen Mazdrashki <kamen.mazdrashki@postpath.com> 2009
This program is free software; you can redistribute it and/or modify
@ -215,6 +215,10 @@ PyTypeObject py_net_Type = {
void initnet(void)
{
PyObject *m;
if (PyType_Ready(&py_net_Type) < 0)
return;
m = Py_InitModule3("net", NULL, NULL);
if (m == NULL)
return;

View File

@ -20,7 +20,7 @@
import samba.getopt as options
from samba import net
from samba.net import Net
from samba.netcmd import (
Command,
@ -45,7 +45,7 @@ class cmd_export_keytab(Command):
def run(self, keytab, credopts=None, sambaopts=None, versionopts=None):
lp = sambaopts.get_loadparm()
creds = credopts.get_credentials(lp)
# FIXME: Obtain net context
net = Net(creds, lp)
net.export_keytab(keytab=keytab, creds=creds)