mirror of
https://github.com/samba-team/samba.git
synced 2025-12-11 08:23:49 +03:00
Allow None to be used as a valid credential in open_policy.
Added {get,set}_debuglevel() and setup_logging() functions.
This commit is contained in:
@@ -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 }
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user