summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-05-27 06:33:33 +0000
committerTim Potter <tpot@samba.org>2002-05-27 06:33:33 +0000
commit24def691ef1832d921e6f83daf9b1809de891bcf (patch)
treedd8c153b6110e48dde3c9baf5f54e8b983496293
parentf2cbcec5a4cd6dc6656b4966450c211be3ec451b (diff)
downloadsamba-24def691ef1832d921e6f83daf9b1809de891bcf.tar.gz
samba-24def691ef1832d921e6f83daf9b1809de891bcf.tar.bz2
samba-24def691ef1832d921e6f83daf9b1809de891bcf.zip
Check types of dictionary elements in to_struct()
(This used to be commit 793f1042f153bd6ca3f75bebf719d47744ffecde)
-rw-r--r--source3/python/py_conv.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/source3/python/py_conv.c b/source3/python/py_conv.c
index 9093b54b00..39b20ace86 100644
--- a/source3/python/py_conv.c
+++ b/source3/python/py_conv.c
@@ -99,9 +99,10 @@ BOOL to_struct(void *s, PyObject *dict, struct pyconv *conv)
UNISTR *u = (UNISTR *)((char *)s + conv[i].offset);
char *s = "";
- if (obj && PyString_Check(obj))
- s = PyString_AsString(obj);
+ if (!PyString_Check(obj))
+ goto done;
+ s = PyString_AsString(obj);
init_unistr(u, s);
break;
@@ -109,21 +110,20 @@ BOOL to_struct(void *s, PyObject *dict, struct pyconv *conv)
case PY_UINT32: {
uint32 *u = (uint32 *)((char *)s + conv[i].offset);
- if (obj && PyInt_Check(obj))
- *u = PyInt_AsLong(obj);
- else
- *u = 0;
+ if (!PyInt_Check(obj))
+ goto done;
+
+ *u = PyInt_AsLong(obj);
break;
}
case PY_UINT16: {
uint16 *u = (uint16 *)((char *)s + conv[i].offset);
- if (obj && PyInt_Check(obj))
- *u = PyInt_AsLong(obj);
- else
- *u = 0;
+ if (!PyInt_Check(obj))
+ goto done;
+ *u = PyInt_AsLong(obj);
break;
}
default: