summaryrefslogtreecommitdiff
path: root/source3/python/py_lsa.c
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-05-28 02:08:39 +0000
committerTim Potter <tpot@samba.org>2002-05-28 02:08:39 +0000
commitd21f10d3e65ebdee7db8e4c122a0a623b65bcd49 (patch)
tree54c3f8a68c45edd56647b9e3e750d0f77add992e /source3/python/py_lsa.c
parentd26bcfaf955027d0a61e2b3557f3062e47c25ccd (diff)
downloadsamba-d21f10d3e65ebdee7db8e4c122a0a623b65bcd49.tar.gz
samba-d21f10d3e65ebdee7db8e4c122a0a623b65bcd49.tar.bz2
samba-d21f10d3e65ebdee7db8e4c122a0a623b65bcd49.zip
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)
Diffstat (limited to 'source3/python/py_lsa.c')
-rw-r--r--source3/python/py_lsa.c41
1 files changed, 39 insertions, 2 deletions
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 }
};