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:
parent
b26d9d7939
commit
4cafbcb205
@ -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;
|
||||
}
|
||||
|
@ -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 */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user