Ignore:
Timestamp:
Nov 27, 2012, 4:43:17 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.0

Location:
trunk/server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/source4/torture/ldb/ldb.c

    r414 r745  
    2222#include "includes.h"
    2323#include "lib/events/events.h"
    24 #include "lib/ldb/include/ldb.h"
    25 #include "lib/ldb/include/ldb_errors.h"
     24#include <ldb.h>
     25#include <ldb_errors.h>
    2626#include "lib/ldb-samba/ldif_handlers.h"
    2727#include "ldb_wrap.h"
     
    3232
    3333static const char *sid = "S-1-5-21-4177067393-1453636373-93818737";
    34 static const char *hex_sid = "01040000000000051500000081FDF8F815BBA456718F9705";
     34static const char *hex_sid = "01040000000000051500000081fdf8f815bba456718f9705";
    3535static const char *guid = "975ac5fa-35d9-431d-b86a-845bcd34fff9";
    3636static const char *guid2 = "{975ac5fa-35d9-431d-b86a-845bcd34fff9}";
    37 static const char *hex_guid = "FAC55A97D9351D43B86A845BCD34FFF9";
     37static const char *hex_guid = "fac55a97d9351d43b86a845bcd34fff9";
    3838
    3939static const char *prefix_map_newline = "2:1.2.840.113556.1.2\n5:2.16.840.1.101.2.2.3";
     
    5858
    5959        torture_assert_int_equal(torture,
    60                                  ldb_register_samba_handlers(ldb), 0,
     60                                 ldb_register_samba_handlers(ldb), LDB_SUCCESS,
    6161                                 "Failed to register Samba handlers");
    6262
     
    217217
    218218        torture_assert_int_equal(torture,
    219                                  ldb_register_samba_handlers(ldb), 0,
     219                                 ldb_register_samba_handlers(ldb), LDB_SUCCESS,
    220220                                 "Failed to register Samba handlers");
    221221
     
    335335
    336336        torture_assert_int_equal(torture,
    337                                  ldb_register_samba_handlers(ldb), 0,
     337                                 ldb_register_samba_handlers(ldb), LDB_SUCCESS,
    338338                                 "Failed to register Samba handlers");
    339339
     
    588588        struct ldb_dn *child_dn;
    589589        struct ldb_dn *typo_dn;
     590        struct ldb_dn *special_dn;
    590591        struct ldb_val val;
    591592
     
    595596
    596597        torture_assert_int_equal(torture,
    597                                  ldb_register_samba_handlers(ldb), 0,
     598                                 ldb_register_samba_handlers(ldb), LDB_SUCCESS,
    598599                                 "Failed to register Samba handlers");
    599600
     
    656657                       ldb_dn_compare_base(dn, typo_dn) != 0,
    657658                       "Base Comparison on dc=samba,dc=org and c=samba,dc=org should != 0");
     659
     660        /* Check comparisons with a special DN */
     661        torture_assert(torture,
     662                       special_dn = ldb_dn_new(mem_ctx, ldb, "@special_dn"),
     663                       "Failed to create 'special' DN");
     664
     665        torture_assert(torture,
     666                       ldb_dn_compare(dn, special_dn) != 0,
     667                       "Comparison on dc=samba,dc=org and @special_dn should != 0");
     668
     669        torture_assert(torture,
     670                       ldb_dn_compare_base(special_dn, dn) > 0,
     671                       "Base Comparison of @special_dn and dc=samba,dc=org should > 0");
     672
     673        torture_assert(torture,
     674                       ldb_dn_compare_base(dn, special_dn) < 0,
     675                       "Base Comparison on dc=samba,dc=org and @special_dn should < 0");
    658676
    659677        /* Check DN based on MS-ADTS:3.1.1.5.1.2 Naming Constraints*/
     
    662680                       "Failed to create a DN with 0xA in it");
    663681
     682        /* this is a warning until we work out how the DEL: CNs work */
     683        if (ldb_dn_validate(dn) != false) {
     684                torture_warning(torture,
     685                                "should have failed to validate a DN with 0xA in it");
     686        }
     687
     688        /* Escaped comma */
    664689        torture_assert(torture,
    665                        ldb_dn_validate(dn) == false,
    666                        "should have failed to validate a DN with 0xA in it");
    667 
    668         val.data = "CN=Zer\0,DC=SAMBA,DC=org";
    669         val.length = 23;
     690                       dn = ldb_dn_new(mem_ctx, ldb, "CN=A\\,comma,DC=SAMBA,DC=org"),
     691                       "Failed to create a DN with an escaped comma in it");
     692
     693
     694        val = data_blob_const("CN=Zer\0,DC=SAMBA,DC=org", 23);
    670695        torture_assert(torture,
    671696                       NULL == ldb_dn_from_ldb_val(mem_ctx, ldb, &val),
    672697                       "should fail to create a DN with 0x0 in it");
    673 
    674         torture_assert(torture,
    675                        dn = ldb_dn_new(mem_ctx, ldb, "CN=loooooooooooooooooooooooooooo"
    676 "ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo"
    677 "ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo"
    678 "ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo"
    679 "ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo"
    680 "ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongdn,DC=SAMBA,DC=org"),
    681                        "Failed to create a DN with size more than 255 characters");
    682 
    683         torture_assert(torture,
    684                        ldb_dn_validate(dn) == false,
    685                        "should have failed to validate DN with size more than 255 characters");
    686698
    687699        talloc_free(mem_ctx);
     
    702714
    703715        torture_assert_int_equal(torture,
    704                                  ldb_register_samba_handlers(ldb), 0,
     716                                 ldb_register_samba_handlers(ldb), LDB_SUCCESS,
    705717                                 "Failed to register Samba handlers");
    706718
     
    784796struct torture_suite *torture_ldb(TALLOC_CTX *mem_ctx)
    785797{
    786         struct torture_suite *suite = torture_suite_create(mem_ctx, "LDB");
     798        struct torture_suite *suite = torture_suite_create(mem_ctx, "ldb");
    787799
    788800        if (suite == NULL) {
     
    790802        }
    791803
    792         torture_suite_add_simple_test(suite, "ATTRS", torture_ldb_attrs);
    793         torture_suite_add_simple_test(suite, "DN-ATTRS", torture_ldb_dn_attrs);
    794         torture_suite_add_simple_test(suite, "DN-EXTENDED", torture_ldb_dn_extended);
    795         torture_suite_add_simple_test(suite, "DN-INVALID-EXTENDED", torture_ldb_dn_invalid_extended);
    796         torture_suite_add_simple_test(suite, "DN", torture_ldb_dn);
     804        torture_suite_add_simple_test(suite, "attrs", torture_ldb_attrs);
     805        torture_suite_add_simple_test(suite, "dn-attrs", torture_ldb_dn_attrs);
     806        torture_suite_add_simple_test(suite, "dn-extended", torture_ldb_dn_extended);
     807        torture_suite_add_simple_test(suite, "dn-invalid-extended", torture_ldb_dn_invalid_extended);
     808        torture_suite_add_simple_test(suite, "dn", torture_ldb_dn);
    797809
    798810        suite->description = talloc_strdup(suite, "LDB (samba-specific behaviour) tests");
Note: See TracChangeset for help on using the changeset viewer.