diff options
author | Andrew Bartlett <abartlet@samba.org> | 2008-03-19 11:11:55 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2008-03-19 11:11:55 +1100 |
commit | 5af56a613c3a954f80eeef21887f9317119af8ba (patch) | |
tree | 778281c6ddb74119bc9e58076b70196dc24257c3 | |
parent | 576540b25c6761978d1317334a647fead0155765 (diff) | |
download | samba-5af56a613c3a954f80eeef21887f9317119af8ba.tar.gz samba-5af56a613c3a954f80eeef21887f9317119af8ba.tar.bz2 samba-5af56a613c3a954f80eeef21887f9317119af8ba.zip |
More safety around ldb_dn C functions in python bindings.
Ensure that the ldb python binding 'TypeError dn not set' errors are
not in the SWIG wrapper's use of ldb functions, put some more error
checks in.
Andrew Bartlett
(This used to be commit 8d4c831184cff8bca85daf6cc711b189b5cf3a47)
-rw-r--r-- | source4/lib/ldb/ldb.i | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/source4/lib/ldb/ldb.i b/source4/lib/ldb/ldb.i index bd41e1e23e..b0723a8ecd 100644 --- a/source4/lib/ldb/ldb.i +++ b/source4/lib/ldb/ldb.i @@ -257,15 +257,19 @@ int ldb_dn_from_pyobject(TALLOC_CTX *mem_ctx, PyObject *object, int ret; struct ldb_dn *odn; if (ldb_ctx != NULL && PyString_Check(object)) { - *dn = ldb_dn_new(mem_ctx, ldb_ctx, PyString_AsString(object)); - if (!*dn) { + odn = ldb_dn_new(mem_ctx, ldb_ctx, PyString_AsString(object)); + if (!odn) { return SWIG_ERROR; } + *dn = odn; return 0; } ret = SWIG_ConvertPtr(object, (void **)&odn, SWIGTYPE_p_ldb_dn, SWIG_POINTER_EXCEPTION); *dn = ldb_dn_copy(mem_ctx, odn); + if (odn && !*dn) { + return SWIG_ERROR; + } return ret; } |