1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-28 17:47:29 +03:00

Added a utility function to extract the info key from a dictionary.

This commit is contained in:
Tim Potter -
parent b26d9d7939
commit 4cafbcb205
2 changed files with 18 additions and 0 deletions

View File

@ -197,3 +197,20 @@ struct cli_state *open_pipe_creds(char *server, PyObject *creds,
return cli;
}
/* Return true if a dictionary contains a "level" key with an integer
value. Set the value if so. */
BOOL get_level_value(PyObject *dict, uint32 *level)
{
PyObject *obj;
if (!(obj = PyDict_GetItemString(dict, "level")) ||
!PyInt_Check(obj))
return False;
if (level)
*level = PyInt_AsLong(obj);
return True;
}

View File

@ -14,6 +14,7 @@ PyObject *set_debuglevel(PyObject *self, PyObject *args);
PyObject *py_setup_logging(PyObject *self, PyObject *args, PyObject *kw);
struct cli_state *open_pipe_creds(char *server, PyObject *creds,
cli_pipe_fn *connect_fn, char **errstr);
BOOL get_level_value(PyObject *dict, uint32 *level);
/* The following definitions come from python/py_ntsec.c */