From d21f10d3e65ebdee7db8e4c122a0a623b65bcd49 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 28 May 2002 02:08:39 +0000 Subject: Allow None to be used as a valid credential in open_policy. Added {get,set}_debuglevel() and setup_logging() functions. (This used to be commit b6e860546a622e6da238faf56d7c1567c6cf63a5) --- source3/python/py_lsa.c | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) (limited to 'source3/python/py_lsa.c') diff --git a/source3/python/py_lsa.c b/source3/python/py_lsa.c index 7edd651642..0665578e60 100644 --- a/source3/python/py_lsa.c +++ b/source3/python/py_lsa.c @@ -62,10 +62,15 @@ static PyObject *lsa_open_policy(PyObject *self, PyObject *args, POLICY_HND hnd; if (!PyArg_ParseTupleAndKeywords( - args, kw, "s|O!i", kwlist, &server, &PyDict_Type, - &creds, &desired_access)) + args, kw, "s|Oi", kwlist, &server, &creds, &desired_access)) return NULL; + if (creds && creds != Py_None && !PyDict_Check(creds)) { + PyErr_SetString(PyExc_TypeError, + "credentials must be dictionary or None"); + return NULL; + } + if (!(cli = open_pipe_creds(server, creds, PIPE_LSARPC, &errstr))) { PyErr_SetString(lsa_error, errstr); free(errstr); @@ -360,6 +365,38 @@ static PyMethodDef lsa_methods[] = { METH_VARARGS, "Close a policy handle" }, + /* Other stuff - this should really go into a samba config module + but for the moment let's leave it here. */ + + { "setup_logging", (PyCFunction)py_setup_logging, + METH_VARARGS | METH_KEYWORDS, + "Set up debug logging. + +Initialises Samba's debug logging system. One argument is expected which +is a boolean specifying whether debugging is interactive and sent to stdout +or logged to a file. + +Example: + +>>> spoolss.setup_logging(interactive = 1)" }, + + { "get_debuglevel", (PyCFunction)get_debuglevel, + METH_VARARGS, + "Set the current debug level. + +Example: + +>>> spoolss.get_debuglevel() +0" }, + + { "set_debuglevel", (PyCFunction)set_debuglevel, + METH_VARARGS, + "Get the current debug level. + +Example: + +>>> spoolss.set_debuglevel(10)" }, + { NULL } }; -- cgit