The branch, master has been updated
       via  983606d... s4/tort: Add test for comparing special DNs
       via  1f3faea... s4/dn: handle case 'base' dn has no components
      from  7cf1a29... s4-smbtorture: add smbcli_rap_netoemchangepassword().

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 983606dbe0a23cab28d0f33a32a0e4ab0acf99a7
Author: Kamen Mazdrashki <[email protected]>
Date:   Sat May 8 10:20:00 2010 +0300

    s4/tort: Add test for comparing special DNs

commit 1f3faea0463782d16bdbfd34b3b51624aca2bc90
Author: Kamen Mazdrashki <[email protected]>
Date:   Sat May 8 10:19:14 2010 +0300

    s4/dn: handle case 'base' dn has no components
    
    This could if the 'base' dn is special for example.

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

Summary of changes:
 source4/lib/ldb/common/ldb_dn.c |    2 +-
 source4/torture/ldb/ldb.c       |   18 ++++++++++++++++++
 2 files changed, 19 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/lib/ldb/common/ldb_dn.c b/source4/lib/ldb/common/ldb_dn.c
index d91e9d9..00646f6 100644
--- a/source4/lib/ldb/common/ldb_dn.c
+++ b/source4/lib/ldb/common/ldb_dn.c
@@ -1065,7 +1065,7 @@ int ldb_dn_compare_base(struct ldb_dn *base, struct 
ldb_dn *dn)
                return (dn->comp_num - base->comp_num);
        }
 
-       if (dn->comp_num == 0) {
+       if ((dn->comp_num == 0) || (base->comp_num == 0)) {
                if (dn->special && base->special) {
                        return strcmp(base->linearized, dn->linearized);
                } else if (dn->special) {
diff --git a/source4/torture/ldb/ldb.c b/source4/torture/ldb/ldb.c
index dbfd96c..8bc6357 100644
--- a/source4/torture/ldb/ldb.c
+++ b/source4/torture/ldb/ldb.c
@@ -587,6 +587,7 @@ static bool torture_ldb_dn(struct torture_context *torture)
        struct ldb_dn *dn;
        struct ldb_dn *child_dn;
        struct ldb_dn *typo_dn;
+       struct ldb_dn *special_dn;
        struct ldb_val val;
 
        torture_assert(torture, 
@@ -656,6 +657,23 @@ static bool torture_ldb_dn(struct torture_context *torture)
                       ldb_dn_compare_base(dn, typo_dn) != 0,
                       "Base Comparison on dc=samba,dc=org and c=samba,dc=org 
should != 0");
 
+       /* Check comparisons with a special DN */
+       torture_assert(torture,
+                      special_dn = ldb_dn_new(mem_ctx, ldb, "@special_dn"),
+                      "Failed to create 'special' DN");
+
+       torture_assert(torture,
+                      ldb_dn_compare(dn, special_dn) != 0,
+                      "Comparison on dc=samba,dc=org and @special_dn should != 
0");
+
+       torture_assert(torture,
+                      ldb_dn_compare_base(special_dn, dn) > 0,
+                      "Base Comparison of @special_dn and dc=samba,dc=org 
should > 0");
+
+       torture_assert(torture,
+                      ldb_dn_compare_base(dn, special_dn) < 0,
+                      "Base Comparison on dc=samba,dc=org and @special_dn 
should < 0");
+
        /* Check DN based on MS-ADTS:3.1.1.5.1.2 Naming Constraints*/
        torture_assert(torture,
                       dn = ldb_dn_new(mem_ctx, ldb, 
"CN=New\nLine,DC=SAMBA,DC=org"),


-- 
Samba Shared Repository

Reply via email to