The branch, v4-0-test has been updated
       via  8d4c831184cff8bca85daf6cc711b189b5cf3a47 (commit)
      from  b5dbdef1580a58c0f208e83491946391cd08e570 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v4-0-test


- Log -----------------------------------------------------------------
commit 8d4c831184cff8bca85daf6cc711b189b5cf3a47
Author: Andrew Bartlett <[EMAIL PROTECTED]>
Date:   Wed Mar 19 11:11:55 2008 +1100

    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

-----------------------------------------------------------------------

Summary of changes:
 source/lib/ldb/ldb.i |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/lib/ldb/ldb.i b/source/lib/ldb/ldb.i
index bd41e1e..b0723a8 100644
--- a/source/lib/ldb/ldb.i
+++ b/source/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;
 }
 


-- 
Samba Shared Repository

Reply via email to