summaryrefslogtreecommitdiff
path: root/source3/python
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-05-17 02:25:37 +0000
committerTim Potter <tpot@samba.org>2002-05-17 02:25:37 +0000
commit1ab45841cc7ecfcfeba7a41ecfc34791171f41fa (patch)
tree991ea107124dba2138b35eb5d024a6a012757bfc /source3/python
parent119716f16215ba00bc557cff9e60009cca61cc64 (diff)
downloadsamba-1ab45841cc7ecfcfeba7a41ecfc34791171f41fa.tar.gz
samba-1ab45841cc7ecfcfeba7a41ecfc34791171f41fa.tar.bz2
samba-1ab45841cc7ecfcfeba7a41ecfc34791171f41fa.zip
Added a utility function to extract the info key from a dictionary.
(This used to be commit 4cafbcb205af11c478a2d9047554315915933e5d)
Diffstat (limited to 'source3/python')
-rw-r--r--source3/python/py_common.c17
-rw-r--r--source3/python/py_common_proto.h1
2 files changed, 18 insertions, 0 deletions
diff --git a/source3/python/py_common.c b/source3/python/py_common.c
index 61eacced27..85305d027e 100644
--- a/source3/python/py_common.c
+++ b/source3/python/py_common.c
@@ -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;
+}
diff --git a/source3/python/py_common_proto.h b/source3/python/py_common_proto.h
index dd823dd4c0..992d444fa4 100644
--- a/source3/python/py_common_proto.h
+++ b/source3/python/py_common_proto.h
@@ -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 */