LCOV - code coverage report
Current view: top level - source4/torture/ldb - ldb.c (source / functions) Hit Total Coverage
Test: coverage report for master 2f515e9b Lines: 472 486 97.1 %
Date: 2024-04-21 15:09:00 Functions: 15 15 100.0 %

          Line data    Source code
       1             : /* 
       2             :    Unix SMB/CIFS implementation.
       3             : 
       4             :    Test LDB attribute functions
       5             : 
       6             :    Copyright (C) Andrew Bartlet <abartlet@samba.org> 2008
       7             :    
       8             :    This program is free software; you can redistribute it and/or modify
       9             :    it under the terms of the GNU General Public License as published by
      10             :    the Free Software Foundation; either version 3 of the License, or
      11             :    (at your option) any later version.
      12             :    
      13             :    This program is distributed in the hope that it will be useful,
      14             :    but WITHOUT ANY WARRANTY; without even the implied warranty of
      15             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      16             :    GNU General Public License for more details.
      17             :    
      18             :    You should have received a copy of the GNU General Public License
      19             :    along with this program.  If not, see <http://www.gnu.org/licenses/>.
      20             : */
      21             : 
      22             : #include "includes.h"
      23             : #include "lib/events/events.h"
      24             : #include <ldb.h>
      25             : #include <ldb-samba/ldb_wrap.h>
      26             : #include <ldb_errors.h>
      27             : #include <ldb_module.h>
      28             : #include "lib/ldb-samba/ldif_handlers.h"
      29             : #include "ldb_wrap.h"
      30             : #include "dsdb/samdb/samdb.h"
      31             : #include "param/param.h"
      32             : #include "torture/smbtorture.h"
      33             : #include "torture/local/proto.h"
      34             : #include <time.h>
      35             : 
      36             : static const char *sid = "S-1-5-21-4177067393-1453636373-93818737";
      37             : static const char *hex_sid = "01040000000000051500000081fdf8f815bba456718f9705";
      38             : static const char *guid = "975ac5fa-35d9-431d-b86a-845bcd34fff9";
      39             : static const char *guid2 = "{975ac5fa-35d9-431d-b86a-845bcd34fff9}";
      40             : static const char *hex_guid = "fac55a97d9351d43b86a845bcd34fff9";
      41             : 
      42             : static const char *prefix_map_newline = "2:1.2.840.113556.1.2\n5:2.16.840.1.101.2.2.3";
      43             : static const char *prefix_map_semi = "2:1.2.840.113556.1.2;5:2.16.840.1.101.2.2.3";
      44             : 
      45             : /**
      46             :  * This is the hex code derived from the tdbdump for
      47             :  * "st/ad_dc/private/sam.ldb.d/DC=ADDC,DC=SAMBA,DC=EXAMPLE,DC=COM.ldb"
      48             :  * key "DN=CN=DDA1D01D-4BD7-4C49-A184-46F9241B560E,CN=OPERATIONS,CN=DOMAINUPDATES,CN=SYSTEM,DC=ADDC,DC=SAMBA,DC=EXAMPLE,DC=COM\00"
      49             :  *   -- adrianc
      50             :  */
      51             : 
      52             : static const uint8_t dda1d01d_bin_v1[] = {
      53             :         0x67, 0x19, 0x01, 0x26, 0x0d, 0x00, 0x00, 0x00, 0x43, 0x4e, 0x3d, 0x64, 0x64, 0x61, 0x31, 0x64,
      54             :         0x30, 0x31, 0x64, 0x2d, 0x34, 0x62, 0x64, 0x37, 0x2d, 0x34, 0x63, 0x34, 0x39, 0x2d, 0x61, 0x31,
      55             :         0x38, 0x34, 0x2d, 0x34, 0x36, 0x66, 0x39, 0x32, 0x34, 0x31, 0x62, 0x35, 0x36, 0x30, 0x65, 0x2c,
      56             :         0x43, 0x4e, 0x3d, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2c, 0x43, 0x4e,
      57             :         0x3d, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x2c, 0x43,
      58             :         0x4e, 0x3d, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2c, 0x44, 0x43, 0x3d, 0x61, 0x64, 0x64, 0x63,
      59             :         0x2c, 0x44, 0x43, 0x3d, 0x73, 0x61, 0x6d, 0x62, 0x61, 0x2c, 0x44, 0x43, 0x3d, 0x65, 0x78, 0x61,
      60             :         0x6d, 0x70, 0x6c, 0x65, 0x2c, 0x44, 0x43, 0x3d, 0x63, 0x6f, 0x6d, 0x00, 0x6f, 0x62, 0x6a, 0x65,
      61             :         0x63, 0x74, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
      62             :         0x74, 0x6f, 0x70, 0x00, 0x09, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65,
      63             :         0x72, 0x00, 0x63, 0x6e, 0x00, 0x01, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x64, 0x64, 0x61,
      64             :         0x31, 0x64, 0x30, 0x31, 0x64, 0x2d, 0x34, 0x62, 0x64, 0x37, 0x2d, 0x34, 0x63, 0x34, 0x39, 0x2d,
      65             :         0x61, 0x31, 0x38, 0x34, 0x2d, 0x34, 0x36, 0x66, 0x39, 0x32, 0x34, 0x31, 0x62, 0x35, 0x36, 0x30,
      66             :         0x65, 0x00, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x00, 0x01,
      67             :         0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x34, 0x00, 0x77, 0x68, 0x65, 0x6e, 0x43, 0x72, 0x65,
      68             :         0x61, 0x74, 0x65, 0x64, 0x00, 0x01, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x32, 0x30, 0x31,
      69             :         0x35, 0x30, 0x37, 0x30, 0x38, 0x32, 0x32, 0x34, 0x33, 0x31, 0x30, 0x2e, 0x30, 0x5a, 0x00, 0x77,
      70             :         0x68, 0x65, 0x6e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x00, 0x01, 0x00, 0x00, 0x00, 0x11,
      71             :         0x00, 0x00, 0x00, 0x32, 0x30, 0x31, 0x35, 0x30, 0x37, 0x30, 0x38, 0x32, 0x32, 0x34, 0x33, 0x31,
      72             :         0x30, 0x2e, 0x30, 0x5a, 0x00, 0x75, 0x53, 0x4e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x00,
      73             :         0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x33, 0x34, 0x36, 0x37, 0x00, 0x75, 0x53, 0x4e,
      74             :         0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
      75             :         0x33, 0x34, 0x36, 0x37, 0x00, 0x73, 0x68, 0x6f, 0x77, 0x49, 0x6e, 0x41, 0x64, 0x76, 0x61, 0x6e,
      76             :         0x63, 0x65, 0x64, 0x56, 0x69, 0x65, 0x77, 0x4f, 0x6e, 0x6c, 0x79, 0x00, 0x01, 0x00, 0x00, 0x00,
      77             :         0x04, 0x00, 0x00, 0x00, 0x54, 0x52, 0x55, 0x45, 0x00, 0x6e, 0x54, 0x53, 0x65, 0x63, 0x75, 0x72,
      78             :         0x69, 0x74, 0x79, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x00, 0x01, 0x00,
      79             :         0x00, 0x00, 0x18, 0x05, 0x00, 0x00, 0x01, 0x00, 0x17, 0x8c, 0x14, 0x00, 0x00, 0x00, 0x30, 0x00,
      80             :         0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0xc4, 0x00, 0x00, 0x00, 0x01, 0x05, 0x00, 0x00, 0x00, 0x00,
      81             :         0x00, 0x05, 0x15, 0x00, 0x00, 0x00, 0x9a, 0xbd, 0x91, 0x7d, 0xd5, 0xe0, 0x11, 0x3c, 0x6e, 0x5e,
      82             :         0x1a, 0x4b, 0x00, 0x02, 0x00, 0x00, 0x01, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x15, 0x00,
      83             :         0x00, 0x00, 0x9a, 0xbd, 0x91, 0x7d, 0xd5, 0xe0, 0x11, 0x3c, 0x6e, 0x5e, 0x1a, 0x4b, 0x00, 0x02,
      84             :         0x00, 0x00, 0x04, 0x00, 0x78, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x5a, 0x38, 0x00, 0x20, 0x00,
      85             :         0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xbe, 0x3b, 0x0e, 0xf3, 0xf0, 0x9f, 0xd1, 0x11, 0xb6, 0x03,
      86             :         0x00, 0x00, 0xf8, 0x03, 0x67, 0xc1, 0xa5, 0x7a, 0x96, 0xbf, 0xe6, 0x0d, 0xd0, 0x11, 0xa2, 0x85,
      87             :         0x00, 0xaa, 0x00, 0x30, 0x49, 0xe2, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
      88             :         0x00, 0x00, 0x07, 0x5a, 0x38, 0x00, 0x20, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xbf, 0x3b,
      89             :         0x0e, 0xf3, 0xf0, 0x9f, 0xd1, 0x11, 0xb6, 0x03, 0x00, 0x00, 0xf8, 0x03, 0x67, 0xc1, 0xa5, 0x7a,
      90             :         0x96, 0xbf, 0xe6, 0x0d, 0xd0, 0x11, 0xa2, 0x85, 0x00, 0xaa, 0x00, 0x30, 0x49, 0xe2, 0x01, 0x01,
      91             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x54, 0x04, 0x17, 0x00,
      92             :         0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0xff, 0x01, 0x0f, 0x00, 0x01, 0x05, 0x00, 0x00, 0x00, 0x00,
      93             :         0x00, 0x05, 0x15, 0x00, 0x00, 0x00, 0x9a, 0xbd, 0x91, 0x7d, 0xd5, 0xe0, 0x11, 0x3c, 0x6e, 0x5e,
      94             :         0x1a, 0x4b, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0xff, 0x01, 0x0f, 0x00, 0x01, 0x01,
      95             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x94, 0x00,
      96             :         0x02, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0b, 0x00, 0x00, 0x00, 0x05, 0x1a,
      97             :         0x3c, 0x00, 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x42, 0x16, 0x4c, 0xc0, 0x20,
      98             :         0xd0, 0x11, 0xa7, 0x68, 0x00, 0xaa, 0x00, 0x6e, 0x05, 0x29, 0x14, 0xcc, 0x28, 0x48, 0x37, 0x14,
      99             :         0xbc, 0x45, 0x9b, 0x07, 0xad, 0x6f, 0x01, 0x5e, 0x5f, 0x28, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00,
     100             :         0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x2a, 0x02, 0x00, 0x00, 0x05, 0x1a, 0x3c, 0x00, 0x10, 0x00,
     101             :         0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x42, 0x16, 0x4c, 0xc0, 0x20, 0xd0, 0x11, 0xa7, 0x68,
     102             :         0x00, 0xaa, 0x00, 0x6e, 0x05, 0x29, 0xba, 0x7a, 0x96, 0xbf, 0xe6, 0x0d, 0xd0, 0x11, 0xa2, 0x85,
     103             :         0x00, 0xaa, 0x00, 0x30, 0x49, 0xe2, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x20, 0x00,
     104             :         0x00, 0x00, 0x2a, 0x02, 0x00, 0x00, 0x05, 0x1a, 0x3c, 0x00, 0x10, 0x00, 0x00, 0x00, 0x03, 0x00,
     105             :         0x00, 0x00, 0x10, 0x20, 0x20, 0x5f, 0xa5, 0x79, 0xd0, 0x11, 0x90, 0x20, 0x00, 0xc0, 0x4f, 0xc2,
     106             :         0xd4, 0xcf, 0x14, 0xcc, 0x28, 0x48, 0x37, 0x14, 0xbc, 0x45, 0x9b, 0x07, 0xad, 0x6f, 0x01, 0x5e,
     107             :         0x5f, 0x28, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x2a, 0x02,
     108             :         0x00, 0x00, 0x05, 0x1a, 0x3c, 0x00, 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x20,
     109             :         0x20, 0x5f, 0xa5, 0x79, 0xd0, 0x11, 0x90, 0x20, 0x00, 0xc0, 0x4f, 0xc2, 0xd4, 0xcf, 0xba, 0x7a,
     110             :         0x96, 0xbf, 0xe6, 0x0d, 0xd0, 0x11, 0xa2, 0x85, 0x00, 0xaa, 0x00, 0x30, 0x49, 0xe2, 0x01, 0x02,
     111             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x2a, 0x02, 0x00, 0x00, 0x05, 0x1a,
     112             :         0x3c, 0x00, 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x40, 0xc2, 0x0a, 0xbc, 0xa9, 0x79,
     113             :         0xd0, 0x11, 0x90, 0x20, 0x00, 0xc0, 0x4f, 0xc2, 0xd4, 0xcf, 0x14, 0xcc, 0x28, 0x48, 0x37, 0x14,
     114             :         0xbc, 0x45, 0x9b, 0x07, 0xad, 0x6f, 0x01, 0x5e, 0x5f, 0x28, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00,
     115             :         0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x2a, 0x02, 0x00, 0x00, 0x05, 0x1a, 0x3c, 0x00, 0x10, 0x00,
     116             :         0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x40, 0xc2, 0x0a, 0xbc, 0xa9, 0x79, 0xd0, 0x11, 0x90, 0x20,
     117             :         0x00, 0xc0, 0x4f, 0xc2, 0xd4, 0xcf, 0xba, 0x7a, 0x96, 0xbf, 0xe6, 0x0d, 0xd0, 0x11, 0xa2, 0x85,
     118             :         0x00, 0xaa, 0x00, 0x30, 0x49, 0xe2, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x20, 0x00,
     119             :         0x00, 0x00, 0x2a, 0x02, 0x00, 0x00, 0x05, 0x1a, 0x3c, 0x00, 0x10, 0x00, 0x00, 0x00, 0x03, 0x00,
     120             :         0x00, 0x00, 0x42, 0x2f, 0xba, 0x59, 0xa2, 0x79, 0xd0, 0x11, 0x90, 0x20, 0x00, 0xc0, 0x4f, 0xc2,
     121             :         0xd3, 0xcf, 0x14, 0xcc, 0x28, 0x48, 0x37, 0x14, 0xbc, 0x45, 0x9b, 0x07, 0xad, 0x6f, 0x01, 0x5e,
     122             :         0x5f, 0x28, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x2a, 0x02,
     123             :         0x00, 0x00, 0x05, 0x1a, 0x3c, 0x00, 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x42, 0x2f,
     124             :         0xba, 0x59, 0xa2, 0x79, 0xd0, 0x11, 0x90, 0x20, 0x00, 0xc0, 0x4f, 0xc2, 0xd3, 0xcf, 0xba, 0x7a,
     125             :         0x96, 0xbf, 0xe6, 0x0d, 0xd0, 0x11, 0xa2, 0x85, 0x00, 0xaa, 0x00, 0x30, 0x49, 0xe2, 0x01, 0x02,
     126             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x2a, 0x02, 0x00, 0x00, 0x05, 0x1a,
     127             :         0x3c, 0x00, 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x88, 0x70, 0x03, 0xe1, 0x0a,
     128             :         0xd2, 0x11, 0xb4, 0x22, 0x00, 0xa0, 0xc9, 0x68, 0xf9, 0x39, 0x14, 0xcc, 0x28, 0x48, 0x37, 0x14,
     129             :         0xbc, 0x45, 0x9b, 0x07, 0xad, 0x6f, 0x01, 0x5e, 0x5f, 0x28, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00,
     130             :         0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x2a, 0x02, 0x00, 0x00, 0x05, 0x1a, 0x3c, 0x00, 0x10, 0x00,
     131             :         0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x88, 0x70, 0x03, 0xe1, 0x0a, 0xd2, 0x11, 0xb4, 0x22,
     132             :         0x00, 0xa0, 0xc9, 0x68, 0xf9, 0x39, 0xba, 0x7a, 0x96, 0xbf, 0xe6, 0x0d, 0xd0, 0x11, 0xa2, 0x85,
     133             :         0x00, 0xaa, 0x00, 0x30, 0x49, 0xe2, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x20, 0x00,
     134             :         0x00, 0x00, 0x2a, 0x02, 0x00, 0x00, 0x05, 0x1a, 0x38, 0x00, 0x10, 0x00, 0x00, 0x00, 0x03, 0x00,
     135             :         0x00, 0x00, 0x6d, 0x9e, 0xc6, 0xb7, 0xc7, 0x2c, 0xd2, 0x11, 0x85, 0x4e, 0x00, 0xa0, 0xc9, 0x83,
     136             :         0xf6, 0x08, 0x86, 0x7a, 0x96, 0xbf, 0xe6, 0x0d, 0xd0, 0x11, 0xa2, 0x85, 0x00, 0xaa, 0x00, 0x30,
     137             :         0x49, 0xe2, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x09, 0x00, 0x00, 0x00, 0x05, 0x1a,
     138             :         0x38, 0x00, 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x6d, 0x9e, 0xc6, 0xb7, 0xc7, 0x2c,
     139             :         0xd2, 0x11, 0x85, 0x4e, 0x00, 0xa0, 0xc9, 0x83, 0xf6, 0x08, 0x9c, 0x7a, 0x96, 0xbf, 0xe6, 0x0d,
     140             :         0xd0, 0x11, 0xa2, 0x85, 0x00, 0xaa, 0x00, 0x30, 0x49, 0xe2, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00,
     141             :         0x00, 0x05, 0x09, 0x00, 0x00, 0x00, 0x05, 0x1a, 0x38, 0x00, 0x10, 0x00, 0x00, 0x00, 0x03, 0x00,
     142             :         0x00, 0x00, 0x6d, 0x9e, 0xc6, 0xb7, 0xc7, 0x2c, 0xd2, 0x11, 0x85, 0x4e, 0x00, 0xa0, 0xc9, 0x83,
     143             :         0xf6, 0x08, 0xba, 0x7a, 0x96, 0xbf, 0xe6, 0x0d, 0xd0, 0x11, 0xa2, 0x85, 0x00, 0xaa, 0x00, 0x30,
     144             :         0x49, 0xe2, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x09, 0x00, 0x00, 0x00, 0x05, 0x1a,
     145             :         0x2c, 0x00, 0x94, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x14, 0xcc, 0x28, 0x48, 0x37, 0x14,
     146             :         0xbc, 0x45, 0x9b, 0x07, 0xad, 0x6f, 0x01, 0x5e, 0x5f, 0x28, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00,
     147             :         0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x2a, 0x02, 0x00, 0x00, 0x05, 0x1a, 0x2c, 0x00, 0x94, 0x00,
     148             :         0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x9c, 0x7a, 0x96, 0xbf, 0xe6, 0x0d, 0xd0, 0x11, 0xa2, 0x85,
     149             :         0x00, 0xaa, 0x00, 0x30, 0x49, 0xe2, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x20, 0x00,
     150             :         0x00, 0x00, 0x2a, 0x02, 0x00, 0x00, 0x05, 0x1a, 0x2c, 0x00, 0x94, 0x00, 0x02, 0x00, 0x02, 0x00,
     151             :         0x00, 0x00, 0xba, 0x7a, 0x96, 0xbf, 0xe6, 0x0d, 0xd0, 0x11, 0xa2, 0x85, 0x00, 0xaa, 0x00, 0x30,
     152             :         0x49, 0xe2, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x2a, 0x02,
     153             :         0x00, 0x00, 0x05, 0x12, 0x28, 0x00, 0x30, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xde, 0x47,
     154             :         0xe6, 0x91, 0x6f, 0xd9, 0x70, 0x4b, 0x95, 0x57, 0xd6, 0x3f, 0xf4, 0xf3, 0xcc, 0xd8, 0x01, 0x01,
     155             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x12, 0x24, 0x00, 0xff, 0x01,
     156             :         0x0f, 0x00, 0x01, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x15, 0x00, 0x00, 0x00, 0x9a, 0xbd,
     157             :         0x91, 0x7d, 0xd5, 0xe0, 0x11, 0x3c, 0x6e, 0x5e, 0x1a, 0x4b, 0x07, 0x02, 0x00, 0x00, 0x00, 0x12,
     158             :         0x18, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x20, 0x00,
     159             :         0x00, 0x00, 0x2a, 0x02, 0x00, 0x00, 0x00, 0x12, 0x18, 0x00, 0xbd, 0x01, 0x0f, 0x00, 0x01, 0x02,
     160             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x20, 0x02, 0x00, 0x00, 0x00, 0x6e,
     161             :         0x61, 0x6d, 0x65, 0x00, 0x01, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x64, 0x64, 0x61, 0x31,
     162             :         0x64, 0x30, 0x31, 0x64, 0x2d, 0x34, 0x62, 0x64, 0x37, 0x2d, 0x34, 0x63, 0x34, 0x39, 0x2d, 0x61,
     163             :         0x31, 0x38, 0x34, 0x2d, 0x34, 0x36, 0x66, 0x39, 0x32, 0x34, 0x31, 0x62, 0x35, 0x36, 0x30, 0x65,
     164             :         0x00, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x47, 0x55, 0x49, 0x44, 0x00, 0x01, 0x00, 0x00, 0x00,
     165             :         0x10, 0x00, 0x00, 0x00, 0x57, 0x93, 0x1e, 0x29, 0x25, 0x49, 0xe5, 0x40, 0x9d, 0x98, 0x36, 0x07,
     166             :         0x11, 0x9e, 0xbd, 0xe5, 0x00, 0x72, 0x65, 0x70, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74,
     167             :         0x79, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x00, 0x01, 0x00, 0x00, 0x00, 0x90, 0x01,
     168             :         0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
     169             :         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7e, 0x38, 0xae, 0x0b, 0x03, 0x00,
     170             :         0x00, 0x00, 0x9d, 0xcd, 0xcd, 0x57, 0xee, 0x58, 0x6e, 0x4e, 0x96, 0x99, 0xcc, 0x7d, 0xe1, 0x96,
     171             :         0xf1, 0x05, 0x8b, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8b, 0x0d, 0x00, 0x00, 0x00, 0x00,
     172             :         0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7e, 0x38, 0xae, 0x0b, 0x03, 0x00,
     173             :         0x00, 0x00, 0x9d, 0xcd, 0xcd, 0x57, 0xee, 0x58, 0x6e, 0x4e, 0x96, 0x99, 0xcc, 0x7d, 0xe1, 0x96,
     174             :         0xf1, 0x05, 0x8b, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8b, 0x0d, 0x00, 0x00, 0x00, 0x00,
     175             :         0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7e, 0x38, 0xae, 0x0b, 0x03, 0x00,
     176             :         0x00, 0x00, 0x9d, 0xcd, 0xcd, 0x57, 0xee, 0x58, 0x6e, 0x4e, 0x96, 0x99, 0xcc, 0x7d, 0xe1, 0x96,
     177             :         0xf1, 0x05, 0x8b, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8b, 0x0d, 0x00, 0x00, 0x00, 0x00,
     178             :         0x00, 0x00, 0xa9, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7e, 0x38, 0xae, 0x0b, 0x03, 0x00,
     179             :         0x00, 0x00, 0x9d, 0xcd, 0xcd, 0x57, 0xee, 0x58, 0x6e, 0x4e, 0x96, 0x99, 0xcc, 0x7d, 0xe1, 0x96,
     180             :         0xf1, 0x05, 0x8b, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8b, 0x0d, 0x00, 0x00, 0x00, 0x00,
     181             :         0x00, 0x00, 0x19, 0x01, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7e, 0x38, 0xae, 0x0b, 0x03, 0x00,
     182             :         0x00, 0x00, 0x9d, 0xcd, 0xcd, 0x57, 0xee, 0x58, 0x6e, 0x4e, 0x96, 0x99, 0xcc, 0x7d, 0xe1, 0x96,
     183             :         0xf1, 0x05, 0x8b, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8b, 0x0d, 0x00, 0x00, 0x00, 0x00,
     184             :         0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7e, 0x38, 0xae, 0x0b, 0x03, 0x00,
     185             :         0x00, 0x00, 0x9d, 0xcd, 0xcd, 0x57, 0xee, 0x58, 0x6e, 0x4e, 0x96, 0x99, 0xcc, 0x7d, 0xe1, 0x96,
     186             :         0xf1, 0x05, 0x8b, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8b, 0x0d, 0x00, 0x00, 0x00, 0x00,
     187             :         0x00, 0x00, 0x0e, 0x03, 0x09, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7e, 0x38, 0xae, 0x0b, 0x03, 0x00,
     188             :         0x00, 0x00, 0x9d, 0xcd, 0xcd, 0x57, 0xee, 0x58, 0x6e, 0x4e, 0x96, 0x99, 0xcc, 0x7d, 0xe1, 0x96,
     189             :         0xf1, 0x05, 0x8b, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8b, 0x0d, 0x00, 0x00, 0x00, 0x00,
     190             :         0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7e, 0x38, 0xae, 0x0b, 0x03, 0x00,
     191             :         0x00, 0x00, 0x9d, 0xcd, 0xcd, 0x57, 0xee, 0x58, 0x6e, 0x4e, 0x96, 0x99, 0xcc, 0x7d, 0xe1, 0x96,
     192             :         0xf1, 0x05, 0x8b, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8b, 0x0d, 0x00, 0x00, 0x00, 0x00,
     193             :         0x00, 0x00, 0x00, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72,
     194             :         0x79, 0x00, 0x01, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x3c, 0x47, 0x55, 0x49, 0x44, 0x3d,
     195             :         0x35, 0x32, 0x34, 0x32, 0x39, 0x30, 0x33, 0x38, 0x2d, 0x65, 0x34, 0x33, 0x35, 0x2d, 0x34, 0x66,
     196             :         0x65, 0x33, 0x2d, 0x39, 0x36, 0x34, 0x65, 0x2d, 0x38, 0x30, 0x64, 0x61, 0x31, 0x35, 0x34, 0x39,
     197             :         0x39, 0x63, 0x39, 0x63, 0x3e, 0x3b, 0x43, 0x4e, 0x3d, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e,
     198             :         0x65, 0x72, 0x2c, 0x43, 0x4e, 0x3d, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2c, 0x43, 0x4e, 0x3d,
     199             :         0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x44, 0x43,
     200             :         0x3d, 0x61, 0x64, 0x64, 0x63, 0x2c, 0x44, 0x43, 0x3d, 0x73, 0x61, 0x6d, 0x62, 0x61, 0x2c, 0x44,
     201             :         0x43, 0x3d, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2c, 0x44, 0x43, 0x3d, 0x63, 0x6f, 0x6d,
     202             :         0x00
     203             : };
     204             : 
     205             : static const uint8_t dda1d01d_bin_v2[] = {
     206             :         0x68, 0x19, 0x01, 0x26, 0x0d, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x43, 0x4e, 0x3d, 0x64,
     207             :         0x64, 0x61, 0x31, 0x64, 0x30, 0x31, 0x64, 0x2d, 0x34, 0x62, 0x64, 0x37, 0x2d, 0x34, 0x63, 0x34,
     208             :         0x39, 0x2d, 0x61, 0x31, 0x38, 0x34, 0x2d, 0x34, 0x36, 0x66, 0x39, 0x32, 0x34, 0x31, 0x62, 0x35,
     209             :         0x36, 0x30, 0x65, 0x2c, 0x43, 0x4e, 0x3d, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
     210             :         0x73, 0x2c, 0x43, 0x4e, 0x3d, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x55, 0x70, 0x64, 0x61, 0x74,
     211             :         0x65, 0x73, 0x2c, 0x43, 0x4e, 0x3d, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2c, 0x44, 0x43, 0x3d,
     212             :         0x61, 0x64, 0x64, 0x63, 0x2c, 0x44, 0x43, 0x3d, 0x73, 0x61, 0x6d, 0x62, 0x61, 0x2c, 0x44, 0x43,
     213             :         0x3d, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2c, 0x44, 0x43, 0x3d, 0x63, 0x6f, 0x6d, 0x00,
     214             :         0x5b, 0x00, 0x00, 0x00, 0x61, 0x64, 0x64, 0x63, 0x2e, 0x73, 0x61, 0x6d, 0x62, 0x61, 0x2e, 0x65,
     215             :         0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x53, 0x79, 0x73, 0x74, 0x65,
     216             :         0x6d, 0x2f, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x2f,
     217             :         0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x64, 0x64, 0x61, 0x31, 0x64,
     218             :         0x30, 0x31, 0x64, 0x2d, 0x34, 0x62, 0x64, 0x37, 0x2d, 0x34, 0x63, 0x34, 0x39, 0x2d, 0x61, 0x31,
     219             :         0x38, 0x34, 0x2d, 0x34, 0x36, 0x66, 0x39, 0x32, 0x34, 0x31, 0x62, 0x35, 0x36, 0x30, 0x65, 0x00,
     220             :         0x33, 0x01, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x43, 0x6c,
     221             :         0x61, 0x73, 0x73, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x03, 0x09, 0x02, 0x00, 0x00, 0x00, 0x63,
     222             :         0x6e, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x24, 0x0c, 0x00, 0x00, 0x00, 0x69, 0x6e, 0x73, 0x74,
     223             :         0x61, 0x6e, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x0b,
     224             :         0x00, 0x00, 0x00, 0x77, 0x68, 0x65, 0x6e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x00, 0x01,
     225             :         0x00, 0x00, 0x00, 0x01, 0x11, 0x0b, 0x00, 0x00, 0x00, 0x77, 0x68, 0x65, 0x6e, 0x43, 0x68, 0x61,
     226             :         0x6e, 0x67, 0x65, 0x64, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x11, 0x0a, 0x00, 0x00, 0x00, 0x75,
     227             :         0x53, 0x4e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x04,
     228             :         0x0a, 0x00, 0x00, 0x00, 0x75, 0x53, 0x4e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x00, 0x01,
     229             :         0x00, 0x00, 0x00, 0x01, 0x04, 0x16, 0x00, 0x00, 0x00, 0x73, 0x68, 0x6f, 0x77, 0x49, 0x6e, 0x41,
     230             :         0x64, 0x76, 0x61, 0x6e, 0x63, 0x65, 0x64, 0x56, 0x69, 0x65, 0x77, 0x4f, 0x6e, 0x6c, 0x79, 0x00,
     231             :         0x01, 0x00, 0x00, 0x00, 0x01, 0x04, 0x14, 0x00, 0x00, 0x00, 0x6e, 0x54, 0x53, 0x65, 0x63, 0x75,
     232             :         0x72, 0x69, 0x74, 0x79, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x00, 0x01,
     233             :         0x00, 0x00, 0x00, 0x02, 0x18, 0x05, 0x04, 0x00, 0x00, 0x00, 0x6e, 0x61, 0x6d, 0x65, 0x00, 0x01,
     234             :         0x00, 0x00, 0x00, 0x01, 0x24, 0x0a, 0x00, 0x00, 0x00, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x47,
     235             :         0x55, 0x49, 0x44, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x10, 0x14, 0x00, 0x00, 0x00, 0x72, 0x65,
     236             :         0x70, 0x6c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61,
     237             :         0x74, 0x61, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x90, 0x01, 0x0e, 0x00, 0x00, 0x00, 0x6f, 0x62,
     238             :         0x6a, 0x65, 0x63, 0x74, 0x43, 0x61, 0x74, 0x65, 0x67, 0x6f, 0x72, 0x79, 0x00, 0x01, 0x00, 0x00,
     239             :         0x00, 0x01, 0x76, 0x74, 0x6f, 0x70, 0x00, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72,
     240             :         0x00, 0x64, 0x64, 0x61, 0x31, 0x64, 0x30, 0x31, 0x64, 0x2d, 0x34, 0x62, 0x64, 0x37, 0x2d, 0x34,
     241             :         0x63, 0x34, 0x39, 0x2d, 0x61, 0x31, 0x38, 0x34, 0x2d, 0x34, 0x36, 0x66, 0x39, 0x32, 0x34, 0x31,
     242             :         0x62, 0x35, 0x36, 0x30, 0x65, 0x00, 0x34, 0x00, 0x32, 0x30, 0x31, 0x35, 0x30, 0x37, 0x30, 0x38,
     243             :         0x32, 0x32, 0x34, 0x33, 0x31, 0x30, 0x2e, 0x30, 0x5a, 0x00, 0x32, 0x30, 0x31, 0x35, 0x30, 0x37,
     244             :         0x30, 0x38, 0x32, 0x32, 0x34, 0x33, 0x31, 0x30, 0x2e, 0x30, 0x5a, 0x00, 0x33, 0x34, 0x36, 0x37,
     245             :         0x00, 0x33, 0x34, 0x36, 0x37, 0x00, 0x54, 0x52, 0x55, 0x45, 0x00, 0x01, 0x00, 0x14, 0x8c, 0x14,
     246             :         0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0xc4, 0x00, 0x00, 0x00, 0x01,
     247             :         0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x15, 0x00, 0x00, 0x00, 0x9a, 0xbd, 0x91, 0x7d, 0xd5,
     248             :         0xe0, 0x11, 0x3c, 0x6e, 0x5e, 0x1a, 0x4b, 0x00, 0x02, 0x00, 0x00, 0x01, 0x05, 0x00, 0x00, 0x00,
     249             :         0x00, 0x00, 0x05, 0x15, 0x00, 0x00, 0x00, 0x9a, 0xbd, 0x91, 0x7d, 0xd5, 0xe0, 0x11, 0x3c, 0x6e,
     250             :         0x5e, 0x1a, 0x4b, 0x00, 0x02, 0x00, 0x00, 0x04, 0x00, 0x78, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07,
     251             :         0x5a, 0x38, 0x00, 0x20, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xbe, 0x3b, 0x0e, 0xf3, 0xf0,
     252             :         0x9f, 0xd1, 0x11, 0xb6, 0x03, 0x00, 0x00, 0xf8, 0x03, 0x67, 0xc1, 0xa5, 0x7a, 0x96, 0xbf, 0xe6,
     253             :         0x0d, 0xd0, 0x11, 0xa2, 0x85, 0x00, 0xaa, 0x00, 0x30, 0x49, 0xe2, 0x01, 0x01, 0x00, 0x00, 0x00,
     254             :         0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x07, 0x5a, 0x38, 0x00, 0x20, 0x00, 0x00, 0x00, 0x03,
     255             :         0x00, 0x00, 0x00, 0xbf, 0x3b, 0x0e, 0xf3, 0xf0, 0x9f, 0xd1, 0x11, 0xb6, 0x03, 0x00, 0x00, 0xf8,
     256             :         0x03, 0x67, 0xc1, 0xa5, 0x7a, 0x96, 0xbf, 0xe6, 0x0d, 0xd0, 0x11, 0xa2, 0x85, 0x00, 0xaa, 0x00,
     257             :         0x30, 0x49, 0xe2, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x04,
     258             :         0x00, 0x54, 0x04, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0xff, 0x01, 0x0f, 0x00, 0x01,
     259             :         0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x15, 0x00, 0x00, 0x00, 0x9a, 0xbd, 0x91, 0x7d, 0xd5,
     260             :         0xe0, 0x11, 0x3c, 0x6e, 0x5e, 0x1a, 0x4b, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0xff,
     261             :         0x01, 0x0f, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x12, 0x00, 0x00, 0x00, 0x00,
     262             :         0x00, 0x14, 0x00, 0x94, 0x00, 0x02, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0b,
     263             :         0x00, 0x00, 0x00, 0x05, 0x1a, 0x3c, 0x00, 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
     264             :         0x42, 0x16, 0x4c, 0xc0, 0x20, 0xd0, 0x11, 0xa7, 0x68, 0x00, 0xaa, 0x00, 0x6e, 0x05, 0x29, 0x14,
     265             :         0xcc, 0x28, 0x48, 0x37, 0x14, 0xbc, 0x45, 0x9b, 0x07, 0xad, 0x6f, 0x01, 0x5e, 0x5f, 0x28, 0x01,
     266             :         0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x2a, 0x02, 0x00, 0x00, 0x05,
     267             :         0x1a, 0x3c, 0x00, 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x42, 0x16, 0x4c, 0xc0,
     268             :         0x20, 0xd0, 0x11, 0xa7, 0x68, 0x00, 0xaa, 0x00, 0x6e, 0x05, 0x29, 0xba, 0x7a, 0x96, 0xbf, 0xe6,
     269             :         0x0d, 0xd0, 0x11, 0xa2, 0x85, 0x00, 0xaa, 0x00, 0x30, 0x49, 0xe2, 0x01, 0x02, 0x00, 0x00, 0x00,
     270             :         0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x2a, 0x02, 0x00, 0x00, 0x05, 0x1a, 0x3c, 0x00, 0x10,
     271             :         0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x20, 0x20, 0x5f, 0xa5, 0x79, 0xd0, 0x11, 0x90,
     272             :         0x20, 0x00, 0xc0, 0x4f, 0xc2, 0xd4, 0xcf, 0x14, 0xcc, 0x28, 0x48, 0x37, 0x14, 0xbc, 0x45, 0x9b,
     273             :         0x07, 0xad, 0x6f, 0x01, 0x5e, 0x5f, 0x28, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x20,
     274             :         0x00, 0x00, 0x00, 0x2a, 0x02, 0x00, 0x00, 0x05, 0x1a, 0x3c, 0x00, 0x10, 0x00, 0x00, 0x00, 0x03,
     275             :         0x00, 0x00, 0x00, 0x10, 0x20, 0x20, 0x5f, 0xa5, 0x79, 0xd0, 0x11, 0x90, 0x20, 0x00, 0xc0, 0x4f,
     276             :         0xc2, 0xd4, 0xcf, 0xba, 0x7a, 0x96, 0xbf, 0xe6, 0x0d, 0xd0, 0x11, 0xa2, 0x85, 0x00, 0xaa, 0x00,
     277             :         0x30, 0x49, 0xe2, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x2a,
     278             :         0x02, 0x00, 0x00, 0x05, 0x1a, 0x3c, 0x00, 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x40,
     279             :         0xc2, 0x0a, 0xbc, 0xa9, 0x79, 0xd0, 0x11, 0x90, 0x20, 0x00, 0xc0, 0x4f, 0xc2, 0xd4, 0xcf, 0x14,
     280             :         0xcc, 0x28, 0x48, 0x37, 0x14, 0xbc, 0x45, 0x9b, 0x07, 0xad, 0x6f, 0x01, 0x5e, 0x5f, 0x28, 0x01,
     281             :         0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x2a, 0x02, 0x00, 0x00, 0x05,
     282             :         0x1a, 0x3c, 0x00, 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x40, 0xc2, 0x0a, 0xbc, 0xa9,
     283             :         0x79, 0xd0, 0x11, 0x90, 0x20, 0x00, 0xc0, 0x4f, 0xc2, 0xd4, 0xcf, 0xba, 0x7a, 0x96, 0xbf, 0xe6,
     284             :         0x0d, 0xd0, 0x11, 0xa2, 0x85, 0x00, 0xaa, 0x00, 0x30, 0x49, 0xe2, 0x01, 0x02, 0x00, 0x00, 0x00,
     285             :         0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x2a, 0x02, 0x00, 0x00, 0x05, 0x1a, 0x3c, 0x00, 0x10,
     286             :         0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x42, 0x2f, 0xba, 0x59, 0xa2, 0x79, 0xd0, 0x11, 0x90,
     287             :         0x20, 0x00, 0xc0, 0x4f, 0xc2, 0xd3, 0xcf, 0x14, 0xcc, 0x28, 0x48, 0x37, 0x14, 0xbc, 0x45, 0x9b,
     288             :         0x07, 0xad, 0x6f, 0x01, 0x5e, 0x5f, 0x28, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x20,
     289             :         0x00, 0x00, 0x00, 0x2a, 0x02, 0x00, 0x00, 0x05, 0x1a, 0x3c, 0x00, 0x10, 0x00, 0x00, 0x00, 0x03,
     290             :         0x00, 0x00, 0x00, 0x42, 0x2f, 0xba, 0x59, 0xa2, 0x79, 0xd0, 0x11, 0x90, 0x20, 0x00, 0xc0, 0x4f,
     291             :         0xc2, 0xd3, 0xcf, 0xba, 0x7a, 0x96, 0xbf, 0xe6, 0x0d, 0xd0, 0x11, 0xa2, 0x85, 0x00, 0xaa, 0x00,
     292             :         0x30, 0x49, 0xe2, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x2a,
     293             :         0x02, 0x00, 0x00, 0x05, 0x1a, 0x3c, 0x00, 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8,
     294             :         0x88, 0x70, 0x03, 0xe1, 0x0a, 0xd2, 0x11, 0xb4, 0x22, 0x00, 0xa0, 0xc9, 0x68, 0xf9, 0x39, 0x14,
     295             :         0xcc, 0x28, 0x48, 0x37, 0x14, 0xbc, 0x45, 0x9b, 0x07, 0xad, 0x6f, 0x01, 0x5e, 0x5f, 0x28, 0x01,
     296             :         0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x2a, 0x02, 0x00, 0x00, 0x05,
     297             :         0x1a, 0x3c, 0x00, 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf8, 0x88, 0x70, 0x03, 0xe1,
     298             :         0x0a, 0xd2, 0x11, 0xb4, 0x22, 0x00, 0xa0, 0xc9, 0x68, 0xf9, 0x39, 0xba, 0x7a, 0x96, 0xbf, 0xe6,
     299             :         0x0d, 0xd0, 0x11, 0xa2, 0x85, 0x00, 0xaa, 0x00, 0x30, 0x49, 0xe2, 0x01, 0x02, 0x00, 0x00, 0x00,
     300             :         0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x2a, 0x02, 0x00, 0x00, 0x05, 0x1a, 0x38, 0x00, 0x10,
     301             :         0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x6d, 0x9e, 0xc6, 0xb7, 0xc7, 0x2c, 0xd2, 0x11, 0x85,
     302             :         0x4e, 0x00, 0xa0, 0xc9, 0x83, 0xf6, 0x08, 0x86, 0x7a, 0x96, 0xbf, 0xe6, 0x0d, 0xd0, 0x11, 0xa2,
     303             :         0x85, 0x00, 0xaa, 0x00, 0x30, 0x49, 0xe2, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x09,
     304             :         0x00, 0x00, 0x00, 0x05, 0x1a, 0x38, 0x00, 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x6d,
     305             :         0x9e, 0xc6, 0xb7, 0xc7, 0x2c, 0xd2, 0x11, 0x85, 0x4e, 0x00, 0xa0, 0xc9, 0x83, 0xf6, 0x08, 0x9c,
     306             :         0x7a, 0x96, 0xbf, 0xe6, 0x0d, 0xd0, 0x11, 0xa2, 0x85, 0x00, 0xaa, 0x00, 0x30, 0x49, 0xe2, 0x01,
     307             :         0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x09, 0x00, 0x00, 0x00, 0x05, 0x1a, 0x38, 0x00, 0x10,
     308             :         0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x6d, 0x9e, 0xc6, 0xb7, 0xc7, 0x2c, 0xd2, 0x11, 0x85,
     309             :         0x4e, 0x00, 0xa0, 0xc9, 0x83, 0xf6, 0x08, 0xba, 0x7a, 0x96, 0xbf, 0xe6, 0x0d, 0xd0, 0x11, 0xa2,
     310             :         0x85, 0x00, 0xaa, 0x00, 0x30, 0x49, 0xe2, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x09,
     311             :         0x00, 0x00, 0x00, 0x05, 0x1a, 0x2c, 0x00, 0x94, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x14,
     312             :         0xcc, 0x28, 0x48, 0x37, 0x14, 0xbc, 0x45, 0x9b, 0x07, 0xad, 0x6f, 0x01, 0x5e, 0x5f, 0x28, 0x01,
     313             :         0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x2a, 0x02, 0x00, 0x00, 0x05,
     314             :         0x1a, 0x2c, 0x00, 0x94, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x9c, 0x7a, 0x96, 0xbf, 0xe6,
     315             :         0x0d, 0xd0, 0x11, 0xa2, 0x85, 0x00, 0xaa, 0x00, 0x30, 0x49, 0xe2, 0x01, 0x02, 0x00, 0x00, 0x00,
     316             :         0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x2a, 0x02, 0x00, 0x00, 0x05, 0x1a, 0x2c, 0x00, 0x94,
     317             :         0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0xba, 0x7a, 0x96, 0xbf, 0xe6, 0x0d, 0xd0, 0x11, 0xa2,
     318             :         0x85, 0x00, 0xaa, 0x00, 0x30, 0x49, 0xe2, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x20,
     319             :         0x00, 0x00, 0x00, 0x2a, 0x02, 0x00, 0x00, 0x05, 0x12, 0x28, 0x00, 0x30, 0x01, 0x00, 0x00, 0x01,
     320             :         0x00, 0x00, 0x00, 0xde, 0x47, 0xe6, 0x91, 0x6f, 0xd9, 0x70, 0x4b, 0x95, 0x57, 0xd6, 0x3f, 0xf4,
     321             :         0xf3, 0xcc, 0xd8, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x0a, 0x00, 0x00, 0x00, 0x00,
     322             :         0x12, 0x24, 0x00, 0xff, 0x01, 0x0f, 0x00, 0x01, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x15,
     323             :         0x00, 0x00, 0x00, 0x9a, 0xbd, 0x91, 0x7d, 0xd5, 0xe0, 0x11, 0x3c, 0x6e, 0x5e, 0x1a, 0x4b, 0x07,
     324             :         0x02, 0x00, 0x00, 0x00, 0x12, 0x18, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0x00,
     325             :         0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x2a, 0x02, 0x00, 0x00, 0x00, 0x12, 0x18, 0x00, 0xbd,
     326             :         0x01, 0x0f, 0x00, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x20, 0x00, 0x00, 0x00, 0x20,
     327             :         0x02, 0x00, 0x00, 0x00, 0x64, 0x64, 0x61, 0x31, 0x64, 0x30, 0x31, 0x64, 0x2d, 0x34, 0x62, 0x64,
     328             :         0x37, 0x2d, 0x34, 0x63, 0x34, 0x39, 0x2d, 0x61, 0x31, 0x38, 0x34, 0x2d, 0x34, 0x36, 0x66, 0x39,
     329             :         0x32, 0x34, 0x31, 0x62, 0x35, 0x36, 0x30, 0x65, 0x00, 0x57, 0x93, 0x1e, 0x29, 0x25, 0x49, 0xe5,
     330             :         0x40, 0x9d, 0x98, 0x36, 0x07, 0x11, 0x9e, 0xbd, 0xe5, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
     331             :         0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
     332             :         0x00, 0x00, 0x7e, 0x38, 0xae, 0x0b, 0x03, 0x00, 0x00, 0x00, 0x9d, 0xcd, 0xcd, 0x57, 0xee, 0x58,
     333             :         0x6e, 0x4e, 0x96, 0x99, 0xcc, 0x7d, 0xe1, 0x96, 0xf1, 0x05, 0x8b, 0x0d, 0x00, 0x00, 0x00, 0x00,
     334             :         0x00, 0x00, 0x8b, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00,
     335             :         0x00, 0x00, 0x7e, 0x38, 0xae, 0x0b, 0x03, 0x00, 0x00, 0x00, 0x9d, 0xcd, 0xcd, 0x57, 0xee, 0x58,
     336             :         0x6e, 0x4e, 0x96, 0x99, 0xcc, 0x7d, 0xe1, 0x96, 0xf1, 0x05, 0x8b, 0x0d, 0x00, 0x00, 0x00, 0x00,
     337             :         0x00, 0x00, 0x8b, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x01, 0x00,
     338             :         0x00, 0x00, 0x7e, 0x38, 0xae, 0x0b, 0x03, 0x00, 0x00, 0x00, 0x9d, 0xcd, 0xcd, 0x57, 0xee, 0x58,
     339             :         0x6e, 0x4e, 0x96, 0x99, 0xcc, 0x7d, 0xe1, 0x96, 0xf1, 0x05, 0x8b, 0x0d, 0x00, 0x00, 0x00, 0x00,
     340             :         0x00, 0x00, 0x8b, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa9, 0x00, 0x02, 0x00, 0x01, 0x00,
     341             :         0x00, 0x00, 0x7e, 0x38, 0xae, 0x0b, 0x03, 0x00, 0x00, 0x00, 0x9d, 0xcd, 0xcd, 0x57, 0xee, 0x58,
     342             :         0x6e, 0x4e, 0x96, 0x99, 0xcc, 0x7d, 0xe1, 0x96, 0xf1, 0x05, 0x8b, 0x0d, 0x00, 0x00, 0x00, 0x00,
     343             :         0x00, 0x00, 0x8b, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x01, 0x02, 0x00, 0x01, 0x00,
     344             :         0x00, 0x00, 0x7e, 0x38, 0xae, 0x0b, 0x03, 0x00, 0x00, 0x00, 0x9d, 0xcd, 0xcd, 0x57, 0xee, 0x58,
     345             :         0x6e, 0x4e, 0x96, 0x99, 0xcc, 0x7d, 0xe1, 0x96, 0xf1, 0x05, 0x8b, 0x0d, 0x00, 0x00, 0x00, 0x00,
     346             :         0x00, 0x00, 0x8b, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x01, 0x00,
     347             :         0x00, 0x00, 0x7e, 0x38, 0xae, 0x0b, 0x03, 0x00, 0x00, 0x00, 0x9d, 0xcd, 0xcd, 0x57, 0xee, 0x58,
     348             :         0x6e, 0x4e, 0x96, 0x99, 0xcc, 0x7d, 0xe1, 0x96, 0xf1, 0x05, 0x8b, 0x0d, 0x00, 0x00, 0x00, 0x00,
     349             :         0x00, 0x00, 0x8b, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x03, 0x09, 0x00, 0x01, 0x00,
     350             :         0x00, 0x00, 0x7e, 0x38, 0xae, 0x0b, 0x03, 0x00, 0x00, 0x00, 0x9d, 0xcd, 0xcd, 0x57, 0xee, 0x58,
     351             :         0x6e, 0x4e, 0x96, 0x99, 0xcc, 0x7d, 0xe1, 0x96, 0xf1, 0x05, 0x8b, 0x0d, 0x00, 0x00, 0x00, 0x00,
     352             :         0x00, 0x00, 0x8b, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00,
     353             :         0x00, 0x00, 0x7e, 0x38, 0xae, 0x0b, 0x03, 0x00, 0x00, 0x00, 0x9d, 0xcd, 0xcd, 0x57, 0xee, 0x58,
     354             :         0x6e, 0x4e, 0x96, 0x99, 0xcc, 0x7d, 0xe1, 0x96, 0xf1, 0x05, 0x8b, 0x0d, 0x00, 0x00, 0x00, 0x00,
     355             :         0x00, 0x00, 0x8b, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x47, 0x55, 0x49, 0x44,
     356             :         0x3d, 0x35, 0x32, 0x34, 0x32, 0x39, 0x30, 0x33, 0x38, 0x2d, 0x65, 0x34, 0x33, 0x35, 0x2d, 0x34,
     357             :         0x66, 0x65, 0x33, 0x2d, 0x39, 0x36, 0x34, 0x65, 0x2d, 0x38, 0x30, 0x64, 0x61, 0x31, 0x35, 0x34,
     358             :         0x39, 0x39, 0x63, 0x39, 0x63, 0x3e, 0x3b, 0x43, 0x4e, 0x3d, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69,
     359             :         0x6e, 0x65, 0x72, 0x2c, 0x43, 0x4e, 0x3d, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2c, 0x43, 0x4e,
     360             :         0x3d, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x44,
     361             :         0x43, 0x3d, 0x61, 0x64, 0x64, 0x63, 0x2c, 0x44, 0x43, 0x3d, 0x73, 0x61, 0x6d, 0x62, 0x61, 0x2c,
     362             :         0x44, 0x43, 0x3d, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2c, 0x44, 0x43, 0x3d, 0x63, 0x6f,
     363             :         0x6d, 0x00
     364             : };
     365             : 
     366             : static const char dda1d01d_ldif[] = ""
     367             : "dn: CN=dda1d01d-4bd7-4c49-a184-46f9241b560e,CN=Operations,CN=DomainUpdates,CN=System,DC=addc,DC=samba,DC=example,DC=com\n"
     368             : "objectClass: top\n"
     369             : "objectClass: container\n"
     370             : "cn: dda1d01d-4bd7-4c49-a184-46f9241b560e\n"
     371             : "instanceType: 4\n"
     372             : "whenCreated: 20150708224310.0Z\n"
     373             : "whenChanged: 20150708224310.0Z\n"
     374             : "uSNCreated: 3467\n"
     375             : "uSNChanged: 3467\n"
     376             : "showInAdvancedViewOnly: TRUE\n"
     377             : "nTSecurityDescriptor: O:S-1-5-21-2106703258-1007804629-1260019310-512G:S-1-5-2\n"
     378             : " 1-2106703258-1007804629-1260019310-512D:AI(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;S-\n"
     379             : " 1-5-21-2106703258-1007804629-1260019310-512)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;\n"
     380             : " SY)(A;;LCRPLORC;;;AU)(OA;CIIOID;RP;4c164200-20c0-11d0-a768-00aa006e0529;4828c\n"
     381             : " c14-1437-45bc-9b07-ad6f015e5f28;RU)(OA;CIIOID;RP;4c164200-20c0-11d0-a768-00aa\n"
     382             : " 006e0529;bf967aba-0de6-11d0-a285-00aa003049e2;RU)(OA;CIIOID;RP;5f202010-79a5-\n"
     383             : " 11d0-9020-00c04fc2d4cf;4828cc14-1437-45bc-9b07-ad6f015e5f28;RU)(OA;CIIOID;RP;\n"
     384             : " 5f202010-79a5-11d0-9020-00c04fc2d4cf;bf967aba-0de6-11d0-a285-00aa003049e2;RU)\n"
     385             : " (OA;CIIOID;RP;bc0ac240-79a9-11d0-9020-00c04fc2d4cf;4828cc14-1437-45bc-9b07-ad\n"
     386             : " 6f015e5f28;RU)(OA;CIIOID;RP;bc0ac240-79a9-11d0-9020-00c04fc2d4cf;bf967aba-0de\n"
     387             : " 6-11d0-a285-00aa003049e2;RU)(OA;CIIOID;RP;59ba2f42-79a2-11d0-9020-00c04fc2d3c\n"
     388             : " f;4828cc14-1437-45bc-9b07-ad6f015e5f28;RU)(OA;CIIOID;RP;59ba2f42-79a2-11d0-90\n"
     389             : " 20-00c04fc2d3cf;bf967aba-0de6-11d0-a285-00aa003049e2;RU)(OA;CIIOID;RP;037088f\n"
     390             : " 8-0ae1-11d2-b422-00a0c968f939;4828cc14-1437-45bc-9b07-ad6f015e5f28;RU)(OA;CII\n"
     391             : " OID;RP;037088f8-0ae1-11d2-b422-00a0c968f939;bf967aba-0de6-11d0-a285-00aa00304\n"
     392             : " 9e2;RU)(OA;CIIOID;RP;b7c69e6d-2cc7-11d2-854e-00a0c983f608;bf967a86-0de6-11d0-\n"
     393             : " a285-00aa003049e2;ED)(OA;CIIOID;RP;b7c69e6d-2cc7-11d2-854e-00a0c983f608;bf967\n"
     394             : " a9c-0de6-11d0-a285-00aa003049e2;ED)(OA;CIIOID;RP;b7c69e6d-2cc7-11d2-854e-00a0\n"
     395             : " c983f608;bf967aba-0de6-11d0-a285-00aa003049e2;ED)(OA;CIIOID;LCRPLORC;;4828cc1\n"
     396             : " 4-1437-45bc-9b07-ad6f015e5f28;RU)(OA;CIIOID;LCRPLORC;;bf967a9c-0de6-11d0-a285\n"
     397             : " -00aa003049e2;RU)(OA;CIIOID;LCRPLORC;;bf967aba-0de6-11d0-a285-00aa003049e2;RU\n"
     398             : " )(OA;CIID;RPWPCR;91e647de-d96f-4b70-9557-d63ff4f3ccd8;;PS)(A;CIID;CCDCLCSWRPW\n"
     399             : " PDTLOCRSDRCWDWO;;;S-1-5-21-2106703258-1007804629-1260019310-519)(A;CIID;LC;;;\n"
     400             : " RU)(A;CIID;CCLCSWRPWPLOCRSDRCWDWO;;;BA)S:AI(OU;CIIOIDSA;WP;f30e3bbe-9ff0-11d1\n"
     401             : " -b603-0000f80367c1;bf967aa5-0de6-11d0-a285-00aa003049e2;WD)(OU;CIIOIDSA;WP;f3\n"
     402             : " 0e3bbf-9ff0-11d1-b603-0000f80367c1;bf967aa5-0de6-11d0-a285-00aa003049e2;WD)\n"
     403             : "name: dda1d01d-4bd7-4c49-a184-46f9241b560e\n"
     404             : "objectGUID: 291e9357-4925-40e5-9d98-3607119ebde5\n"
     405             : "replPropertyMetaData:: AQAAAAAAAAAIAAAAAAAAAAAAAAABAAAAfjiuCwMAAACdzc1X7lhuTpa\n"
     406             : " ZzH3hlvEFiw0AAAAAAACLDQAAAAAAAAEAAgABAAAAfjiuCwMAAACdzc1X7lhuTpaZzH3hlvEFiw0A\n"
     407             : " AAAAAACLDQAAAAAAAAIAAgABAAAAfjiuCwMAAACdzc1X7lhuTpaZzH3hlvEFiw0AAAAAAACLDQAAA\n"
     408             : " AAAAKkAAgABAAAAfjiuCwMAAACdzc1X7lhuTpaZzH3hlvEFiw0AAAAAAACLDQAAAAAAABkBAgABAA\n"
     409             : " AAfjiuCwMAAACdzc1X7lhuTpaZzH3hlvEFiw0AAAAAAACLDQAAAAAAAAEACQABAAAAfjiuCwMAAAC\n"
     410             : " dzc1X7lhuTpaZzH3hlvEFiw0AAAAAAACLDQAAAAAAAA4DCQABAAAAfjiuCwMAAACdzc1X7lhuTpaZ\n"
     411             : " zH3hlvEFiw0AAAAAAACLDQAAAAAAAAMAAAABAAAAfjiuCwMAAACdzc1X7lhuTpaZzH3hlvEFiw0AA\n"
     412             : " AAAAACLDQAAAAAAAA==\n"
     413             : "objectCategory: <GUID=52429038-e435-4fe3-964e-80da15499c9c>;CN=Container,CN=Sc\n"
     414             : " hema,CN=Configuration,DC=addc,DC=samba,DC=example,DC=com\n\n";
     415             : 
     416             : static const char *dda1d01d_ldif_reduced = ""
     417             : "dn: CN=dda1d01d-4bd7-4c49-a184-46f9241b560e,CN=Operations,CN=DomainUpdates,CN=System,DC=addc,DC=samba,DC=example,DC=com\n"
     418             : "objectClass: top\n"
     419             : "objectClass: container\n"
     420             : "instanceType: 4\n"
     421             : "whenChanged: 20150708224310.0Z\n"
     422             : "uSNCreated: 3467\n"
     423             : "showInAdvancedViewOnly: TRUE\n"
     424             : "name: dda1d01d-4bd7-4c49-a184-46f9241b560e\n\n";
     425             : 
     426           1 : static bool torture_ldb_attrs(struct torture_context *torture)
     427             : {
     428           1 :         TALLOC_CTX *mem_ctx = talloc_new(torture);
     429           1 :         struct ldb_context *ldb;
     430           1 :         const struct ldb_schema_attribute *attr;
     431           1 :         struct ldb_val string_sid_blob, binary_sid_blob;
     432           1 :         struct ldb_val string_guid_blob, string_guid_blob2, binary_guid_blob;
     433           1 :         struct ldb_val string_prefix_map_newline_blob, string_prefix_map_semi_blob, string_prefix_map_blob;
     434           1 :         struct ldb_val prefix_map_blob;
     435             : 
     436           1 :         DATA_BLOB sid_blob = strhex_to_data_blob(mem_ctx, hex_sid);
     437           1 :         DATA_BLOB guid_blob = strhex_to_data_blob(mem_ctx, hex_guid);
     438             : 
     439           1 :         torture_assert(torture, 
     440             :                        ldb = ldb_init(mem_ctx, torture->ev),
     441             :                        "Failed to init ldb");
     442             : 
     443           1 :         torture_assert_int_equal(torture, 
     444             :                                  ldb_register_samba_handlers(ldb), LDB_SUCCESS,
     445             :                                  "Failed to register Samba handlers");
     446             : 
     447           1 :         ldb_set_utf8_fns(ldb, NULL, wrap_casefold);
     448             : 
     449             :         /* Test SID behaviour */
     450           1 :         torture_assert(torture, attr = ldb_schema_attribute_by_name(ldb, "objectSid"), 
     451             :                        "Failed to get objectSid schema attribute");
     452             :         
     453           1 :         string_sid_blob = data_blob_string_const(sid);
     454             : 
     455           1 :         torture_assert_int_equal(torture, 
     456             :                                  attr->syntax->ldif_read_fn(ldb, mem_ctx, 
     457             :                                                             &string_sid_blob, &binary_sid_blob), 0,
     458             :                                  "Failed to parse string SID");
     459             :         
     460           1 :         torture_assert_data_blob_equal(torture, binary_sid_blob, sid_blob, 
     461             :                                        "Read SID into blob form failed");
     462             :         
     463           1 :         torture_assert_int_equal(torture, 
     464             :                                  attr->syntax->ldif_read_fn(ldb, mem_ctx, 
     465             :                                                             &sid_blob, &binary_sid_blob), -1,
     466             :                                  "Should have failed to parse binary SID");
     467             :         
     468           1 :         torture_assert_int_equal(torture, 
     469             :                                  attr->syntax->ldif_write_fn(ldb, mem_ctx, &binary_sid_blob, &string_sid_blob), 0,
     470             :                                  "Failed to parse binary SID");
     471             :         
     472           1 :         torture_assert_data_blob_equal(torture, 
     473             :                                        string_sid_blob, data_blob_string_const(sid),
     474             :                                        "Write SID into string form failed");
     475             :         
     476           1 :         torture_assert_int_equal(torture, 
     477             :                                  attr->syntax->comparison_fn(ldb, mem_ctx, &binary_sid_blob, &string_sid_blob), 0,
     478             :                                  "Failed to compare binary and string SID");
     479             :         
     480           1 :         torture_assert_int_equal(torture, 
     481             :                                  attr->syntax->comparison_fn(ldb, mem_ctx, &string_sid_blob, &binary_sid_blob), 0,
     482             :                                  "Failed to compare string and binary binary SID");
     483             :         
     484           1 :         torture_assert_int_equal(torture, 
     485             :                                  attr->syntax->comparison_fn(ldb, mem_ctx, &string_sid_blob, &string_sid_blob), 0,
     486             :                                  "Failed to compare string and string SID");
     487             :         
     488           1 :         torture_assert_int_equal(torture, 
     489             :                                  attr->syntax->comparison_fn(ldb, mem_ctx, &binary_sid_blob, &binary_sid_blob), 0,
     490             :                                  "Failed to compare binary and binary SID");
     491             :         
     492           1 :         torture_assert(torture, attr->syntax->comparison_fn(ldb, mem_ctx, &guid_blob, &binary_sid_blob) != 0,
     493             :                        "Failed to distinguish binary GUID and binary SID");
     494             : 
     495             : 
     496             :         /* Test GUID behaviour */
     497           1 :         torture_assert(torture, attr = ldb_schema_attribute_by_name(ldb, "objectGUID"), 
     498             :                        "Failed to get objectGUID schema attribute");
     499             :         
     500           1 :         string_guid_blob = data_blob_string_const(guid);
     501             : 
     502           1 :         torture_assert_int_equal(torture, 
     503             :                                  attr->syntax->ldif_read_fn(ldb, mem_ctx, 
     504             :                                                             &string_guid_blob, &binary_guid_blob), 0,
     505             :                                  "Failed to parse string GUID");
     506             :         
     507           1 :         torture_assert_data_blob_equal(torture, binary_guid_blob, guid_blob, 
     508             :                                        "Read GUID into blob form failed");
     509             :         
     510           1 :         string_guid_blob2 = data_blob_string_const(guid2);
     511             :         
     512           1 :         torture_assert_int_equal(torture, 
     513             :                                  attr->syntax->ldif_read_fn(ldb, mem_ctx, 
     514             :                                                             &string_guid_blob2, &binary_guid_blob), 0,
     515             :                                  "Failed to parse string GUID");
     516             :         
     517           1 :         torture_assert_data_blob_equal(torture, binary_guid_blob, guid_blob, 
     518             :                                        "Read GUID into blob form failed");
     519             :         
     520           1 :         torture_assert_int_equal(torture, 
     521             :                                  attr->syntax->ldif_read_fn(ldb, mem_ctx, 
     522             :                                                             &guid_blob, &binary_guid_blob), 0,
     523             :                                  "Failed to parse binary GUID");
     524             :         
     525           1 :         torture_assert_data_blob_equal(torture, binary_guid_blob, guid_blob, 
     526             :                                        "Read GUID into blob form failed");
     527             :         
     528           1 :         torture_assert_int_equal(torture, 
     529             :                                  attr->syntax->ldif_write_fn(ldb, mem_ctx, &binary_guid_blob, &string_guid_blob), 0,
     530             :                                  "Failed to print binary GUID as string");
     531             : 
     532           1 :         torture_assert_data_blob_equal(torture, string_sid_blob, data_blob_string_const(sid),
     533             :                                        "Write SID into string form failed");
     534             :         
     535           1 :         torture_assert_int_equal(torture, 
     536             :                                  attr->syntax->comparison_fn(ldb, mem_ctx, &binary_guid_blob, &string_guid_blob), 0,
     537             :                                  "Failed to compare binary and string GUID");
     538             :         
     539           1 :         torture_assert_int_equal(torture, 
     540             :                                  attr->syntax->comparison_fn(ldb, mem_ctx, &string_guid_blob, &binary_guid_blob), 0,
     541             :                                  "Failed to compare string and binary binary GUID");
     542             :         
     543           1 :         torture_assert_int_equal(torture, 
     544             :                                  attr->syntax->comparison_fn(ldb, mem_ctx, &string_guid_blob, &string_guid_blob), 0,
     545             :                                  "Failed to compare string and string GUID");
     546             :         
     547           1 :         torture_assert_int_equal(torture, 
     548             :                                  attr->syntax->comparison_fn(ldb, mem_ctx, &binary_guid_blob, &binary_guid_blob), 0,
     549             :                                  "Failed to compare binary and binary GUID");
     550             :         
     551           1 :         string_prefix_map_newline_blob = data_blob_string_const(prefix_map_newline);
     552             :         
     553           1 :         string_prefix_map_semi_blob = data_blob_string_const(prefix_map_semi);
     554             :         
     555             :         /* Test prefixMap behaviour */
     556           1 :         torture_assert(torture, attr = ldb_schema_attribute_by_name(ldb, "prefixMap"), 
     557             :                        "Failed to get prefixMap schema attribute");
     558             :         
     559           1 :         torture_assert_int_equal(torture, 
     560             :                                  attr->syntax->comparison_fn(ldb, mem_ctx, &string_prefix_map_newline_blob, &string_prefix_map_semi_blob), 0,
     561             :                                  "Failed to compare prefixMap with newlines and prefixMap with semicolons");
     562             :         
     563           1 :         torture_assert_int_equal(torture, 
     564             :                                  attr->syntax->ldif_read_fn(ldb, mem_ctx, &string_prefix_map_newline_blob, &prefix_map_blob), 0,
     565             :                                  "Failed to read prefixMap with newlines");
     566           1 :         torture_assert_int_equal(torture, 
     567             :                                  attr->syntax->comparison_fn(ldb, mem_ctx, &string_prefix_map_newline_blob, &prefix_map_blob), 0,
     568             :                                  "Failed to compare prefixMap with newlines and prefixMap binary");
     569             :         
     570           1 :         torture_assert_int_equal(torture, 
     571             :                                  attr->syntax->ldif_write_fn(ldb, mem_ctx, &prefix_map_blob, &string_prefix_map_blob), 0,
     572             :                                  "Failed to write prefixMap");
     573           1 :         torture_assert_int_equal(torture, 
     574             :                                  attr->syntax->comparison_fn(ldb, mem_ctx, &string_prefix_map_blob, &prefix_map_blob), 0,
     575             :                                  "Failed to compare prefixMap ldif write and prefixMap binary");
     576             :         
     577           1 :         torture_assert_data_blob_equal(torture, string_prefix_map_blob, string_prefix_map_semi_blob,
     578             :                 "Failed to compare prefixMap ldif write and prefixMap binary");
     579             :         
     580             : 
     581             : 
     582           1 :         talloc_free(mem_ctx);
     583           1 :         return true;
     584             : }
     585             : 
     586           1 : static bool torture_ldb_dn_attrs(struct torture_context *torture)
     587             : {
     588           1 :         TALLOC_CTX *mem_ctx = talloc_new(torture);
     589           1 :         struct ldb_context *ldb;
     590           1 :         const struct ldb_dn_extended_syntax *attr;
     591           1 :         struct ldb_val string_sid_blob, binary_sid_blob;
     592           1 :         struct ldb_val string_guid_blob, binary_guid_blob;
     593           1 :         struct ldb_val hex_sid_blob, hex_guid_blob;
     594             : 
     595           1 :         DATA_BLOB sid_blob = strhex_to_data_blob(mem_ctx, hex_sid);
     596           1 :         DATA_BLOB guid_blob = strhex_to_data_blob(mem_ctx, hex_guid);
     597             : 
     598           1 :         torture_assert(torture, 
     599             :                        ldb = ldb_init(mem_ctx, torture->ev),
     600             :                        "Failed to init ldb");
     601             : 
     602           1 :         torture_assert_int_equal(torture, 
     603             :                                  ldb_register_samba_handlers(ldb), LDB_SUCCESS,
     604             :                                  "Failed to register Samba handlers");
     605             : 
     606           1 :         ldb_set_utf8_fns(ldb, NULL, wrap_casefold);
     607             : 
     608             :         /* Test SID behaviour */
     609           1 :         torture_assert(torture, attr = ldb_dn_extended_syntax_by_name(ldb, "SID"), 
     610             :                        "Failed to get SID DN syntax");
     611             :         
     612           1 :         string_sid_blob = data_blob_string_const(sid);
     613             : 
     614           1 :         torture_assert_int_equal(torture, 
     615             :                                  attr->read_fn(ldb, mem_ctx, 
     616             :                                                &string_sid_blob, &binary_sid_blob), 0,
     617             :                                  "Failed to parse string SID");
     618             :         
     619           1 :         torture_assert_data_blob_equal(torture, binary_sid_blob, sid_blob, 
     620             :                                        "Read SID into blob form failed");
     621             : 
     622           1 :         hex_sid_blob = data_blob_string_const(hex_sid);
     623             :         
     624           1 :         torture_assert_int_equal(torture, 
     625             :                                  attr->read_fn(ldb, mem_ctx, 
     626             :                                                &hex_sid_blob, &binary_sid_blob), 0,
     627             :                                  "Failed to parse HEX SID");
     628             :         
     629           1 :         torture_assert_data_blob_equal(torture, binary_sid_blob, sid_blob, 
     630             :                                        "Read SID into blob form failed");
     631             :         
     632           1 :         torture_assert_int_equal(torture, 
     633             :                                  attr->read_fn(ldb, mem_ctx, 
     634             :                                                &sid_blob, &binary_sid_blob), -1,
     635             :                                  "Should have failed to parse binary SID");
     636             :         
     637           1 :         torture_assert_int_equal(torture, 
     638             :                                  attr->write_hex_fn(ldb, mem_ctx, &sid_blob, &hex_sid_blob), 0,
     639             :                                  "Failed to parse binary SID");
     640             :         
     641           1 :         torture_assert_data_blob_equal(torture, 
     642             :                                        hex_sid_blob, data_blob_string_const(hex_sid),
     643             :                                        "Write SID into HEX string form failed");
     644             :         
     645           1 :         torture_assert_int_equal(torture, 
     646             :                                  attr->write_clear_fn(ldb, mem_ctx, &sid_blob, &string_sid_blob), 0,
     647             :                                  "Failed to parse binary SID");
     648             :         
     649           1 :         torture_assert_data_blob_equal(torture, 
     650             :                                        string_sid_blob, data_blob_string_const(sid),
     651             :                                        "Write SID into clear string form failed");
     652             :         
     653             : 
     654             :         /* Test GUID behaviour */
     655           1 :         torture_assert(torture, attr = ldb_dn_extended_syntax_by_name(ldb, "GUID"), 
     656             :                        "Failed to get GUID DN syntax");
     657             :         
     658           1 :         string_guid_blob = data_blob_string_const(guid);
     659             : 
     660           1 :         torture_assert_int_equal(torture, 
     661             :                                  attr->read_fn(ldb, mem_ctx, 
     662             :                                                &string_guid_blob, &binary_guid_blob), 0,
     663             :                                  "Failed to parse string GUID");
     664             :         
     665           1 :         torture_assert_data_blob_equal(torture, binary_guid_blob, guid_blob, 
     666             :                                        "Read GUID into blob form failed");
     667             :         
     668           1 :         hex_guid_blob = data_blob_string_const(hex_guid);
     669             :         
     670           1 :         torture_assert_int_equal(torture, 
     671             :                                  attr->read_fn(ldb, mem_ctx, 
     672             :                                                &hex_guid_blob, &binary_guid_blob), 0,
     673             :                                  "Failed to parse HEX GUID");
     674             :         
     675           1 :         torture_assert_data_blob_equal(torture, binary_guid_blob, guid_blob, 
     676             :                                        "Read GUID into blob form failed");
     677             :         
     678           1 :         torture_assert_int_equal(torture, 
     679             :                                  attr->read_fn(ldb, mem_ctx, 
     680             :                                                &guid_blob, &binary_guid_blob), -1,
     681             :                                  "Should have failed to parse binary GUID");
     682             :         
     683           1 :         torture_assert_int_equal(torture, 
     684             :                                  attr->write_hex_fn(ldb, mem_ctx, &guid_blob, &hex_guid_blob), 0,
     685             :                                  "Failed to parse binary GUID");
     686             :         
     687           1 :         torture_assert_data_blob_equal(torture, 
     688             :                                        hex_guid_blob, data_blob_string_const(hex_guid),
     689             :                                        "Write GUID into HEX string form failed");
     690             :         
     691           1 :         torture_assert_int_equal(torture, 
     692             :                                  attr->write_clear_fn(ldb, mem_ctx, &guid_blob, &string_guid_blob), 0,
     693             :                                  "Failed to parse binary GUID");
     694             :         
     695           1 :         torture_assert_data_blob_equal(torture, 
     696             :                                        string_guid_blob, data_blob_string_const(guid),
     697             :                                        "Write GUID into clear string form failed");
     698             :         
     699             : 
     700             : 
     701           1 :         talloc_free(mem_ctx);
     702           1 :         return true;
     703             : }
     704             : 
     705           1 : static bool torture_ldb_dn_extended(struct torture_context *torture)
     706             : {
     707           1 :         TALLOC_CTX *mem_ctx = talloc_new(torture);
     708           1 :         struct ldb_context *ldb;
     709           1 :         struct ldb_dn *dn, *dn2;
     710             : 
     711           1 :         DATA_BLOB sid_blob = strhex_to_data_blob(mem_ctx, hex_sid);
     712           1 :         DATA_BLOB guid_blob = strhex_to_data_blob(mem_ctx, hex_guid);
     713             : 
     714           1 :         const char *dn_str = "cn=admin,cn=users,dc=samba,dc=org";
     715             : 
     716           1 :         torture_assert(torture, 
     717             :                        ldb = ldb_init(mem_ctx, torture->ev),
     718             :                        "Failed to init ldb");
     719             : 
     720           1 :         torture_assert_int_equal(torture, 
     721             :                                  ldb_register_samba_handlers(ldb), LDB_SUCCESS,
     722             :                                  "Failed to register Samba handlers");
     723             : 
     724           1 :         ldb_set_utf8_fns(ldb, NULL, wrap_casefold);
     725             : 
     726             :         /* Check behaviour of a normal DN */
     727           1 :         torture_assert(torture, 
     728             :                        dn = ldb_dn_new(mem_ctx, ldb, dn_str), 
     729             :                        "Failed to create a 'normal' DN");
     730             : 
     731           1 :         torture_assert(torture, 
     732             :                        ldb_dn_validate(dn),
     733             :                        "Failed to validate 'normal' DN");
     734             : 
     735           1 :         torture_assert(torture, ldb_dn_has_extended(dn) == false, 
     736             :                        "Should not find plain DN to be 'extended'");
     737             : 
     738           1 :         torture_assert(torture, ldb_dn_get_extended_component(dn, "SID") == NULL, 
     739             :                        "Should not find an SID on plain DN");
     740             : 
     741           1 :         torture_assert(torture, ldb_dn_get_extended_component(dn, "GUID") == NULL, 
     742             :                        "Should not find an GUID on plain DN");
     743             :         
     744           1 :         torture_assert(torture, ldb_dn_get_extended_component(dn, "WKGUID") == NULL, 
     745             :                        "Should not find an WKGUID on plain DN");
     746             :         
     747             :         /* Now make an extended DN */
     748           1 :         torture_assert(torture, 
     749             :                        dn = ldb_dn_new_fmt(mem_ctx, ldb, "<GUID=%s>;<SID=%s>;%s",
     750             :                                            guid, sid, dn_str), 
     751             :                        "Failed to create an 'extended' DN");
     752             : 
     753           1 :         torture_assert(torture, 
     754             :                        dn2 = ldb_dn_copy(mem_ctx, dn), 
     755             :                        "Failed to copy the 'extended' DN");
     756           1 :         talloc_free(dn);
     757           1 :         dn = dn2;
     758             : 
     759           1 :         torture_assert(torture, 
     760             :                        ldb_dn_validate(dn),
     761             :                        "Failed to validate 'extended' DN");
     762             : 
     763           1 :         torture_assert(torture, ldb_dn_has_extended(dn) == true, 
     764             :                        "Should find extended DN to be 'extended'");
     765             : 
     766           1 :         torture_assert(torture, ldb_dn_get_extended_component(dn, "SID") != NULL, 
     767             :                        "Should find an SID on extended DN");
     768             : 
     769           1 :         torture_assert(torture, ldb_dn_get_extended_component(dn, "GUID") != NULL, 
     770             :                        "Should find an GUID on extended DN");
     771             :         
     772           1 :         torture_assert_data_blob_equal(torture, *ldb_dn_get_extended_component(dn, "SID"), sid_blob, 
     773             :                                        "Extended DN SID incorrect");
     774             : 
     775           1 :         torture_assert_data_blob_equal(torture, *ldb_dn_get_extended_component(dn, "GUID"), guid_blob, 
     776             :                                        "Extended DN GUID incorrect");
     777             : 
     778           1 :         torture_assert_str_equal(torture, ldb_dn_get_linearized(dn), dn_str, 
     779             :                                  "linearized DN incorrect");
     780             : 
     781           1 :         torture_assert_str_equal(torture, ldb_dn_get_casefold(dn), strupper_talloc(mem_ctx, dn_str), 
     782             :                                  "casefolded DN incorrect");
     783             : 
     784           1 :         torture_assert_str_equal(torture, ldb_dn_get_component_name(dn, 0), "cn", 
     785             :                                  "component zero incorrect");
     786             : 
     787           1 :         torture_assert_data_blob_equal(torture, *ldb_dn_get_component_val(dn, 0), data_blob_string_const("admin"), 
     788             :                                  "component zero incorrect");
     789             : 
     790           1 :         torture_assert_str_equal(torture, ldb_dn_get_extended_linearized(mem_ctx, dn, 1),
     791             :                                  talloc_asprintf(mem_ctx, "<GUID=%s>;<SID=%s>;%s", 
     792             :                                                  guid, sid, dn_str),
     793             :                                  "Clear extended linearized DN incorrect");
     794             : 
     795           1 :         torture_assert_str_equal(torture, ldb_dn_get_extended_linearized(mem_ctx, dn, 0),
     796             :                                  talloc_asprintf(mem_ctx, "<GUID=%s>;<SID=%s>;%s", 
     797             :                                                  hex_guid, hex_sid, dn_str),
     798             :                                  "HEX extended linearized DN incorrect");
     799             : 
     800           1 :         torture_assert(torture, ldb_dn_remove_child_components(dn, 1) == true,
     801             :                                  "Failed to remove DN child");
     802             :                        
     803           1 :         torture_assert(torture, ldb_dn_has_extended(dn) == false, 
     804             :                        "Extended DN flag should be cleared after child element removal");
     805             :         
     806           1 :         torture_assert(torture, ldb_dn_get_extended_component(dn, "SID") == NULL, 
     807             :                        "Should not find an SID on DN");
     808             : 
     809           1 :         torture_assert(torture, ldb_dn_get_extended_component(dn, "GUID") == NULL, 
     810             :                        "Should not find an GUID on DN");
     811             : 
     812             : 
     813             :         /* TODO:  test setting these in the other order, and ensure it still comes out 'GUID first' */
     814           1 :         torture_assert_int_equal(torture, ldb_dn_set_extended_component(dn, "GUID", &guid_blob), 0, 
     815             :                        "Failed to set a GUID on DN");
     816             :         
     817           1 :         torture_assert_int_equal(torture, ldb_dn_set_extended_component(dn, "SID", &sid_blob), 0, 
     818             :                        "Failed to set a SID on DN");
     819             : 
     820           1 :         torture_assert_data_blob_equal(torture, *ldb_dn_get_extended_component(dn, "SID"), sid_blob, 
     821             :                                        "Extended DN SID incorrect");
     822             : 
     823           1 :         torture_assert_data_blob_equal(torture, *ldb_dn_get_extended_component(dn, "GUID"), guid_blob, 
     824             :                                        "Extended DN GUID incorrect");
     825             : 
     826           1 :         torture_assert_str_equal(torture, ldb_dn_get_linearized(dn), "cn=users,dc=samba,dc=org", 
     827             :                                  "linearized DN incorrect");
     828             : 
     829           1 :         torture_assert_str_equal(torture, ldb_dn_get_extended_linearized(mem_ctx, dn, 1),
     830             :                                  talloc_asprintf(mem_ctx, "<GUID=%s>;<SID=%s>;%s", 
     831             :                                                  guid, sid, "cn=users,dc=samba,dc=org"),
     832             :                                  "Clear extended linearized DN incorrect");
     833             : 
     834           1 :         torture_assert_str_equal(torture, ldb_dn_get_extended_linearized(mem_ctx, dn, 0),
     835             :                                  talloc_asprintf(mem_ctx, "<GUID=%s>;<SID=%s>;%s", 
     836             :                                                  hex_guid, hex_sid, "cn=users,dc=samba,dc=org"),
     837             :                                  "HEX extended linearized DN incorrect");
     838             : 
     839             :         /* Now check a 'just GUID' DN (clear format) */
     840           1 :         torture_assert(torture, 
     841             :                        dn = ldb_dn_new_fmt(mem_ctx, ldb, "<GUID=%s>",
     842             :                                            guid), 
     843             :                        "Failed to create an 'extended' DN");
     844             : 
     845           1 :         torture_assert(torture, 
     846             :                        ldb_dn_validate(dn),
     847             :                        "Failed to validate 'extended' DN");
     848             : 
     849           1 :         torture_assert(torture, ldb_dn_has_extended(dn) == true, 
     850             :                        "Should find extended DN to be 'extended'");
     851             : 
     852           1 :         torture_assert(torture, ldb_dn_get_extended_component(dn, "SID") == NULL, 
     853             :                        "Should not find an SID on this DN");
     854             : 
     855           1 :         torture_assert_int_equal(torture, ldb_dn_get_comp_num(dn), 0, 
     856             :                        "Should not find an 'normal' component on this DN");
     857             : 
     858           1 :         torture_assert(torture, ldb_dn_get_extended_component(dn, "GUID") != NULL, 
     859             :                        "Should find an GUID on this DN");
     860             :         
     861           1 :         torture_assert_data_blob_equal(torture, *ldb_dn_get_extended_component(dn, "GUID"), guid_blob, 
     862             :                                        "Extended DN GUID incorrect");
     863             : 
     864           1 :         torture_assert_str_equal(torture, ldb_dn_get_linearized(dn), "", 
     865             :                                  "linearized DN incorrect");
     866             : 
     867           1 :         torture_assert_str_equal(torture, ldb_dn_get_extended_linearized(mem_ctx, dn, 1),
     868             :                                  talloc_asprintf(mem_ctx, "<GUID=%s>", 
     869             :                                                  guid),
     870             :                                  "Clear extended linearized DN incorrect");
     871             : 
     872           1 :         torture_assert_str_equal(torture, ldb_dn_get_extended_linearized(mem_ctx, dn, 0),
     873             :                                  talloc_asprintf(mem_ctx, "<GUID=%s>", 
     874             :                                                  hex_guid),
     875             :                                  "HEX extended linearized DN incorrect");
     876             : 
     877             :         /* Now check a 'just GUID' DN (HEX format) */
     878           1 :         torture_assert(torture, 
     879             :                        dn = ldb_dn_new_fmt(mem_ctx, ldb, "<GUID=%s>",
     880             :                                            hex_guid), 
     881             :                        "Failed to create an 'extended' DN");
     882             : 
     883           1 :         torture_assert(torture, 
     884             :                        ldb_dn_validate(dn),
     885             :                        "Failed to validate 'extended' DN");
     886             : 
     887           1 :         torture_assert(torture, ldb_dn_has_extended(dn) == true, 
     888             :                        "Should find extended DN to be 'extended'");
     889             : 
     890           1 :         torture_assert(torture, ldb_dn_get_extended_component(dn, "SID") == NULL, 
     891             :                        "Should not find an SID on this DN");
     892             : 
     893           1 :         torture_assert(torture, ldb_dn_get_extended_component(dn, "GUID") != NULL, 
     894             :                        "Should find an GUID on this DN");
     895             :         
     896           1 :         torture_assert_data_blob_equal(torture, *ldb_dn_get_extended_component(dn, "GUID"), guid_blob, 
     897             :                                        "Extended DN GUID incorrect");
     898             : 
     899           1 :         torture_assert_str_equal(torture, ldb_dn_get_linearized(dn), "", 
     900             :                                  "linearized DN incorrect");
     901             : 
     902             :         /* Now check a 'just SID' DN (clear format) */
     903           1 :         torture_assert(torture, 
     904             :                        dn = ldb_dn_new_fmt(mem_ctx, ldb, "<SID=%s>",
     905             :                                            sid), 
     906             :                        "Failed to create an 'extended' DN");
     907             : 
     908           1 :         torture_assert(torture, 
     909             :                        ldb_dn_validate(dn),
     910             :                        "Failed to validate 'extended' DN");
     911             : 
     912           1 :         torture_assert(torture, ldb_dn_has_extended(dn) == true, 
     913             :                        "Should find extended DN to be 'extended'");
     914             : 
     915           1 :         torture_assert(torture, ldb_dn_get_extended_component(dn, "GUID") == NULL, 
     916             :                        "Should not find an SID on this DN");
     917             : 
     918           1 :         torture_assert(torture, ldb_dn_get_extended_component(dn, "SID") != NULL, 
     919             :                        "Should find an SID on this DN");
     920             :         
     921           1 :         torture_assert_data_blob_equal(torture, *ldb_dn_get_extended_component(dn, "SID"), sid_blob, 
     922             :                                        "Extended DN SID incorrect");
     923             : 
     924           1 :         torture_assert_str_equal(torture, ldb_dn_get_linearized(dn), "", 
     925             :                                  "linearized DN incorrect");
     926             : 
     927           1 :         torture_assert_str_equal(torture, ldb_dn_get_extended_linearized(mem_ctx, dn, 1),
     928             :                                  talloc_asprintf(mem_ctx, "<SID=%s>", 
     929             :                                                  sid),
     930             :                                  "Clear extended linearized DN incorrect");
     931             : 
     932           1 :         torture_assert_str_equal(torture, ldb_dn_get_extended_linearized(mem_ctx, dn, 0),
     933             :                                  talloc_asprintf(mem_ctx, "<SID=%s>", 
     934             :                                                  hex_sid),
     935             :                                  "HEX extended linearized DN incorrect");
     936             : 
     937             :         /* Now check a 'just SID' DN (HEX format) */
     938           1 :         torture_assert(torture, 
     939             :                        dn = ldb_dn_new_fmt(mem_ctx, ldb, "<SID=%s>",
     940             :                                            hex_sid), 
     941             :                        "Failed to create an 'extended' DN");
     942             : 
     943           1 :         torture_assert(torture, 
     944             :                        ldb_dn_validate(dn),
     945             :                        "Failed to validate 'extended' DN");
     946             : 
     947           1 :         torture_assert(torture, ldb_dn_has_extended(dn) == true, 
     948             :                        "Should find extended DN to be 'extended'");
     949             : 
     950           1 :         torture_assert(torture, ldb_dn_get_extended_component(dn, "GUID") == NULL, 
     951             :                        "Should not find an SID on this DN");
     952             : 
     953           1 :         torture_assert(torture, ldb_dn_get_extended_component(dn, "SID") != NULL, 
     954             :                        "Should find an SID on this DN");
     955             :         
     956           1 :         torture_assert_data_blob_equal(torture, *ldb_dn_get_extended_component(dn, "SID"), sid_blob, 
     957             :                                        "Extended DN SID incorrect");
     958             : 
     959           1 :         torture_assert_str_equal(torture, ldb_dn_get_linearized(dn), "", 
     960             :                                  "linearized DN incorrect");
     961             : 
     962           1 :         talloc_free(mem_ctx);
     963           1 :         return true;
     964             : }
     965             : 
     966             : 
     967           1 : static bool torture_ldb_dn(struct torture_context *torture)
     968             : {
     969           1 :         TALLOC_CTX *mem_ctx = talloc_new(torture);
     970           1 :         struct ldb_context *ldb;
     971           1 :         struct ldb_dn *dn;
     972           1 :         struct ldb_dn *child_dn;
     973           1 :         struct ldb_dn *typo_dn;
     974           1 :         struct ldb_dn *special_dn;
     975           1 :         struct ldb_val val;
     976             : 
     977           1 :         torture_assert(torture, 
     978             :                        ldb = ldb_init(mem_ctx, torture->ev),
     979             :                        "Failed to init ldb");
     980             : 
     981           1 :         torture_assert_int_equal(torture, 
     982             :                                  ldb_register_samba_handlers(ldb), LDB_SUCCESS,
     983             :                                  "Failed to register Samba handlers");
     984             : 
     985           1 :         ldb_set_utf8_fns(ldb, NULL, wrap_casefold);
     986             : 
     987             :         /* Check behaviour of a normal DN */
     988           1 :         torture_assert(torture, 
     989             :                        dn = ldb_dn_new(mem_ctx, ldb, NULL), 
     990             :                        "Failed to create a NULL DN");
     991             : 
     992           1 :         torture_assert(torture, 
     993             :                        ldb_dn_validate(dn),
     994             :                        "Failed to validate NULL DN");
     995             : 
     996           1 :         torture_assert(torture, 
     997             :                        ldb_dn_add_base_fmt(dn, "dc=org"), 
     998             :                        "Failed to add base DN");
     999             : 
    1000           1 :         torture_assert(torture, 
    1001             :                        ldb_dn_add_child_fmt(dn, "dc=samba"), 
    1002             :                        "Failed to add base DN");
    1003             : 
    1004           1 :         torture_assert_str_equal(torture, ldb_dn_get_linearized(dn), "dc=samba,dc=org", 
    1005             :                                  "linearized DN incorrect");
    1006             : 
    1007           1 :         torture_assert_str_equal(torture, ldb_dn_get_extended_linearized(mem_ctx, dn, 0), "dc=samba,dc=org", 
    1008             :                                  "extended linearized DN incorrect");
    1009             : 
    1010             :         /* Check child DN comparisons */
    1011           1 :         torture_assert(torture, 
    1012             :                        child_dn = ldb_dn_new(mem_ctx, ldb, "CN=users,DC=SAMBA,DC=org"), 
    1013             :                        "Failed to create child DN");
    1014             : 
    1015           1 :         torture_assert(torture, 
    1016             :                        ldb_dn_compare(dn, child_dn) != 0,
    1017             :                        "Comparison on dc=samba,dc=org and CN=users,DC=SAMBA,DC=org should != 0");
    1018             : 
    1019           1 :         torture_assert(torture, 
    1020             :                        ldb_dn_compare_base(child_dn, dn) != 0,
    1021             :                        "Base Comparison of CN=users,DC=SAMBA,DC=org and dc=samba,dc=org should != 0");
    1022             : 
    1023           1 :         torture_assert(torture, 
    1024             :                        ldb_dn_compare_base(dn, child_dn) == 0,
    1025             :                        "Base Comparison on dc=samba,dc=org and CN=users,DC=SAMBA,DC=org should == 0");
    1026             : 
    1027             :         /* Check comparisons with a truncated DN */
    1028           1 :         torture_assert(torture, 
    1029             :                        typo_dn = ldb_dn_new(mem_ctx, ldb, "c=samba,dc=org"), 
    1030             :                        "Failed to create 'typo' DN");
    1031             : 
    1032           1 :         torture_assert(torture, 
    1033             :                        ldb_dn_compare(dn, typo_dn) != 0,
    1034             :                        "Comparison on dc=samba,dc=org and c=samba,dc=org should != 0");
    1035             : 
    1036           1 :         torture_assert(torture, 
    1037             :                        ldb_dn_compare_base(typo_dn, dn) != 0,
    1038             :                        "Base Comparison of c=samba,dc=org and dc=samba,dc=org should != 0");
    1039             : 
    1040           1 :         torture_assert(torture, 
    1041             :                        ldb_dn_compare_base(dn, typo_dn) != 0,
    1042             :                        "Base Comparison on dc=samba,dc=org and c=samba,dc=org should != 0");
    1043             : 
    1044             :         /* Check comparisons with a special DN */
    1045           1 :         torture_assert(torture,
    1046             :                        special_dn = ldb_dn_new(mem_ctx, ldb, "@special_dn"),
    1047             :                        "Failed to create 'special' DN");
    1048             : 
    1049           1 :         torture_assert(torture,
    1050             :                        ldb_dn_compare(dn, special_dn) != 0,
    1051             :                        "Comparison on dc=samba,dc=org and @special_dn should != 0");
    1052             : 
    1053           1 :         torture_assert(torture,
    1054             :                        ldb_dn_compare_base(special_dn, dn) > 0,
    1055             :                        "Base Comparison of @special_dn and dc=samba,dc=org should > 0");
    1056             : 
    1057           1 :         torture_assert(torture,
    1058             :                        ldb_dn_compare_base(dn, special_dn) < 0,
    1059             :                        "Base Comparison on dc=samba,dc=org and @special_dn should < 0");
    1060             : 
    1061             :         /* Check DN based on MS-ADTS:3.1.1.5.1.2 Naming Constraints*/
    1062           1 :         torture_assert(torture,
    1063             :                        dn = ldb_dn_new(mem_ctx, ldb, "CN=New\nLine,DC=SAMBA,DC=org"),
    1064             :                        "Failed to create a DN with 0xA in it");
    1065             : 
    1066             :         /* this is a warning until we work out how the DEL: CNs work */
    1067           1 :         if (ldb_dn_validate(dn) != false) {
    1068           1 :                 torture_warning(torture,
    1069             :                                 "should have failed to validate a DN with 0xA in it");
    1070             :         }
    1071             : 
    1072             :         /* Escaped comma */
    1073           1 :         torture_assert(torture,
    1074             :                        dn = ldb_dn_new(mem_ctx, ldb, "CN=A\\,comma,DC=SAMBA,DC=org"),
    1075             :                        "Failed to create a DN with an escaped comma in it");
    1076             : 
    1077             : 
    1078           1 :         val = data_blob_const("CN=Zer\0,DC=SAMBA,DC=org", 23);
    1079           1 :         torture_assert(torture,
    1080             :                        NULL == ldb_dn_from_ldb_val(mem_ctx, ldb, &val),
    1081             :                        "should fail to create a DN with 0x0 in it");
    1082             : 
    1083           1 :         talloc_free(mem_ctx);
    1084           1 :         return true;
    1085             : }
    1086             : 
    1087           1 : static bool torture_ldb_dn_invalid_extended(struct torture_context *torture)
    1088             : {
    1089           1 :         TALLOC_CTX *mem_ctx = talloc_new(torture);
    1090           1 :         struct ldb_context *ldb;
    1091           1 :         struct ldb_dn *dn;
    1092             : 
    1093           1 :         const char *dn_str = "cn=admin,cn=users,dc=samba,dc=org";
    1094             : 
    1095           1 :         torture_assert(torture, 
    1096             :                        ldb = ldb_init(mem_ctx, torture->ev),
    1097             :                        "Failed to init ldb");
    1098             : 
    1099           1 :         torture_assert_int_equal(torture, 
    1100             :                                  ldb_register_samba_handlers(ldb), LDB_SUCCESS,
    1101             :                                  "Failed to register Samba handlers");
    1102             : 
    1103           1 :         ldb_set_utf8_fns(ldb, NULL, wrap_casefold);
    1104             : 
    1105             :         /* Check behaviour of a normal DN */
    1106           1 :         torture_assert(torture, 
    1107             :                        dn = ldb_dn_new(mem_ctx, ldb, "samba,dc=org"), 
    1108             :                        "Failed to create a 'normal' invalid DN");
    1109             : 
    1110           1 :         torture_assert(torture, 
    1111             :                        ldb_dn_validate(dn) == false,
    1112             :                        "should have failed to validate 'normal' invalid DN");
    1113             : 
    1114             :         /* Now make an extended DN */
    1115           1 :         torture_assert(torture, 
    1116             :                        dn = ldb_dn_new_fmt(mem_ctx, ldb, "<PID=%s>;%s",
    1117             :                                            sid, dn_str), 
    1118             :                        "Failed to create an invalid 'extended' DN");
    1119             : 
    1120           1 :         torture_assert(torture, 
    1121             :                        ldb_dn_validate(dn) == false,
    1122             :                        "should have failed to validate 'extended' DN");
    1123             : 
    1124           1 :         torture_assert(torture, 
    1125             :                        dn = ldb_dn_new_fmt(mem_ctx, ldb, "<GUID=%s>%s",
    1126             :                                            sid, dn_str), 
    1127             :                        "Failed to create an invalid 'extended' DN");
    1128             : 
    1129           1 :         torture_assert(torture, 
    1130             :                        ldb_dn_validate(dn) == false,
    1131             :                        "should have failed to validate 'extended' DN");
    1132             : 
    1133           1 :         torture_assert(torture, 
    1134             :                        dn = ldb_dn_new_fmt(mem_ctx, ldb, "<GUID=%s>;",
    1135             :                                            sid), 
    1136             :                        "Failed to create an invalid 'extended' DN");
    1137             : 
    1138           1 :         torture_assert(torture, 
    1139             :                        ldb_dn_validate(dn) == false,
    1140             :                        "should have failed to validate 'extended' DN");
    1141             : 
    1142           1 :         torture_assert(torture, 
    1143             :                        dn = ldb_dn_new_fmt(mem_ctx, ldb, "<GUID=%s>;",
    1144             :                                            hex_sid), 
    1145             :                        "Failed to create an invalid 'extended' DN");
    1146             : 
    1147           1 :         torture_assert(torture, 
    1148             :                        ldb_dn_validate(dn) == false,
    1149             :                        "should have failed to validate 'extended' DN");
    1150             : 
    1151           1 :         torture_assert(torture, 
    1152             :                        dn = ldb_dn_new_fmt(mem_ctx, ldb, "<SID=%s>;",
    1153             :                                            hex_guid), 
    1154             :                        "Failed to create an invalid 'extended' DN");
    1155             : 
    1156           1 :         torture_assert(torture, 
    1157             :                        ldb_dn_validate(dn) == false,
    1158             :                        "should have failed to validate 'extended' DN");
    1159             : 
    1160           1 :         torture_assert(torture, 
    1161             :                        dn = ldb_dn_new_fmt(mem_ctx, ldb, "<SID=%s>;",
    1162             :                                            guid), 
    1163             :                        "Failed to create an invalid 'extended' DN");
    1164             : 
    1165           1 :         torture_assert(torture, 
    1166             :                        ldb_dn_validate(dn) == false,
    1167             :                        "should have failed to validate 'extended' DN");
    1168             : 
    1169           1 :         torture_assert(torture, 
    1170             :                        dn = ldb_dn_new_fmt(mem_ctx, ldb, "<GUID=>"), 
    1171             :                        "Failed to create an invalid 'extended' DN");
    1172             : 
    1173           1 :         torture_assert(torture, 
    1174             :                        ldb_dn_validate(dn) == false,
    1175             :                        "should have failed to validate 'extended' DN");
    1176             : 
    1177           0 :         return true;
    1178             : }
    1179             : 
    1180           3 : static bool helper_ldb_message_compare(struct torture_context *torture,
    1181             :                                        struct ldb_message *a,
    1182             :                                        struct ldb_message *b)
    1183             : {
    1184           3 :         int i;
    1185             : 
    1186           3 :         if (a->num_elements != b->num_elements) {
    1187           0 :                 return false;
    1188             :         }
    1189             : 
    1190          43 :         for (i = 0; i < a->num_elements; i++) {
    1191          40 :                 int j;
    1192          40 :                 struct ldb_message_element x = a->elements[i];
    1193          40 :                 struct ldb_message_element y = b->elements[i];
    1194             : 
    1195          40 :                 torture_comment(torture, "#%s\n", x.name);
    1196          40 :                 torture_assert_int_equal(torture, x.flags, y.flags,
    1197             :                                          "Flags do not match");
    1198          40 :                 torture_assert_str_equal(torture, x.name, y.name,
    1199             :                                          "Names do not match in field");
    1200          40 :                 torture_assert_int_equal(torture, x.num_values, y.num_values,
    1201             :                                          "Number of values do not match");
    1202             : 
    1203             :                 /*
    1204             :                  * Records cannot round trip via the SDDL string with a
    1205             :                  * nTSecurityDescriptor field.
    1206             :                  *
    1207             :                  * Parsing from SDDL and diffing the NDR dump output gives the
    1208             :                  * following:
    1209             :                  *
    1210             :                  *          in: struct decode_security_descriptor
    1211             :                  *             sd: struct security_descriptor
    1212             :                  *                 revision                 : SECURITY_DESCRIPTOR_REVISION_1 (1)
    1213             :                  *-                type                     : 0x8c14 (35860)
    1214             :                  *-                       0: SEC_DESC_OWNER_DEFAULTED
    1215             :                  *-                       0: SEC_DESC_GROUP_DEFAULTED
    1216             :                  *+                type                     : 0x8c17 (35863)
    1217             :                  *+                       1: SEC_DESC_OWNER_DEFAULTED
    1218             :                  *+                       1: SEC_DESC_GROUP_DEFAULTED
    1219             :                  *                        1: SEC_DESC_DACL_PRESENT
    1220             :                  *                        0: SEC_DESC_DACL_DEFAULTED
    1221             :                  *                        1: SEC_DESC_SACL_PRESENT
    1222             :                  */
    1223          40 :                 if (strcmp(x.name, "nTSecurityDescriptor") == 0) {
    1224           3 :                         continue;
    1225             :                 }
    1226       10076 :                 for (j = 0; j < x.num_values; j++) {
    1227       10039 :                         torture_assert_int_equal(torture, x.values[j].length,
    1228             :                                                  y.values[j].length,
    1229             :                                                  "Does not match in length");
    1230       10039 :                         torture_assert_mem_equal(torture,
    1231             :                                                  x.values[j].data,
    1232             :                                                  y.values[j].data,
    1233             :                                                  x.values[j].length,
    1234             :                                                  "Does not match in data");
    1235             :                 }
    1236             :         }
    1237           0 :         return true;
    1238             : }
    1239             : 
    1240           2 : static bool torture_ldb_unpack(struct torture_context *torture,
    1241             :                                const void *data_p)
    1242             : {
    1243           2 :         TALLOC_CTX *mem_ctx = talloc_new(torture);
    1244           2 :         struct ldb_context *ldb;
    1245           2 :         struct ldb_val data = *discard_const_p(struct ldb_val, data_p);
    1246           2 :         struct ldb_message *msg = ldb_msg_new(mem_ctx);
    1247           2 :         const char *ldif_text = dda1d01d_ldif;
    1248           2 :         struct ldb_ldif ldif;
    1249             : 
    1250           2 :         ldb = samba_ldb_init(mem_ctx, torture->ev, NULL, NULL, NULL);
    1251           2 :         torture_assert(torture,
    1252             :                        ldb != NULL,
    1253             :                        "Failed to init ldb");
    1254             : 
    1255           2 :         torture_assert_int_equal(torture, ldb_unpack_data(ldb, &data, msg), 0,
    1256             :                                  "ldb_unpack_data failed");
    1257             : 
    1258           2 :         ldif.changetype = LDB_CHANGETYPE_NONE;
    1259           2 :         ldif.msg = msg;
    1260           2 :         ldif_text = ldb_ldif_write_string(ldb, mem_ctx, &ldif);
    1261             : 
    1262           2 :         torture_assert_int_equal(torture,
    1263             :                                  strcmp(ldif_text, dda1d01d_ldif), 0,
    1264             :                                  "ldif form differs from binary form");
    1265           0 :         return true;
    1266             : }
    1267             : 
    1268           2 : static bool torture_ldb_unpack_flags(struct torture_context *torture,
    1269             :                                      const void *data_p)
    1270             : {
    1271           2 :         TALLOC_CTX *mem_ctx = talloc_new(torture);
    1272           2 :         struct ldb_context *ldb;
    1273           2 :         struct ldb_val data = *discard_const_p(struct ldb_val, data_p);
    1274           2 :         struct ldb_message *msg = ldb_msg_new(mem_ctx);
    1275           2 :         const char *ldif_text = dda1d01d_ldif;
    1276           2 :         struct ldb_ldif ldif;
    1277             : 
    1278           2 :         ldb = samba_ldb_init(mem_ctx, torture->ev, NULL, NULL, NULL);
    1279           2 :         torture_assert(torture,
    1280             :                        ldb != NULL,
    1281             :                        "Failed to init ldb");
    1282             : 
    1283           2 :         torture_assert_int_equal(torture,
    1284             :                                  ldb_unpack_data_flags(ldb, &data, msg,
    1285             :                                         LDB_UNPACK_DATA_FLAG_NO_VALUES_ALLOC),
    1286             :                                  0,
    1287             :                                  "ldb_unpack_data failed");
    1288             : 
    1289           2 :         ldif.changetype = LDB_CHANGETYPE_NONE;
    1290           2 :         ldif.msg = msg;
    1291           2 :         ldif_text = ldb_ldif_write_string(ldb, mem_ctx, &ldif);
    1292             : 
    1293           2 :         torture_assert_int_equal(torture,
    1294             :                                  strcmp(ldif_text, dda1d01d_ldif), 0,
    1295             :                                  "ldif form differs from binary form");
    1296             : 
    1297           2 :         torture_assert_int_equal(torture,
    1298             :                                  ldb_unpack_data_flags(ldb, &data, msg,
    1299             :                                                 LDB_UNPACK_DATA_FLAG_NO_DN),
    1300             :                                  0,
    1301             :                                  "ldb_unpack_data failed");
    1302             : 
    1303           2 :         torture_assert(torture,
    1304             :                        msg->dn == NULL,
    1305             :                        "msg->dn should be NULL");
    1306             : 
    1307           0 :         return true;
    1308             : }
    1309             : 
    1310           1 : static bool torture_ldb_unpack_data_corrupt(struct torture_context *torture)
    1311             : {
    1312           1 :         TALLOC_CTX *mem_ctx = talloc_new(torture);
    1313           1 :         struct ldb_context *ldb;
    1314             : 
    1315           1 :         uint8_t bin[] = {0x68, 0x19, 0x01, 0x26, /* version */
    1316             :                 1, 0, 0, 0, /* num elements */
    1317             :                 4, 0, 0, 0, /* dn length */
    1318             :                 'D', 'N', '=', 'A', 0, /* dn with null term */
    1319             :                 2, 0, 0, 0, /* canonicalized dn length */
    1320             :                 '/', 'A', 0, /* canonicalized dn with null term */
    1321             :                 18, 0, 0, 0, /* size of name and sizes section + 4 (this field) */
    1322             :                 3, 0, 0, 0, /* el name length */
    1323             :                 'a', 'b', 'c', 0, /* name with null term */
    1324             :                 1, 0, 0, 0, 1, /* num values and length width */
    1325             :                 1, /* value lengths */
    1326             :                 '1', 0}; /* values for abc */
    1327             : 
    1328           1 :         struct ldb_val binary = data_blob_const(bin, sizeof(bin));
    1329           1 :         struct ldb_val bin_copy;
    1330           1 :         struct ldb_message *msg;
    1331             : 
    1332           1 :         int i, j, current, expect_rcode, ret;
    1333           1 :         const char *comment;
    1334             : 
    1335             :         /*
    1336             :          * List of corruptible byte ranges. First 12 bytes are corruptible,
    1337             :          * next 4 bytes are not, next 5 bytes are corruptible, etc.
    1338             :          */
    1339           1 :         uint8_t corrupt_bytes[] = {12, 4, 5, 2, 9, 3, 7, 2};
    1340             : 
    1341           1 :         ldb = samba_ldb_init(mem_ctx, torture->ev, NULL,NULL,NULL);
    1342           1 :         torture_assert(torture, ldb != NULL, "Failed to init ldb");
    1343             : 
    1344           0 :         current = 0;
    1345           9 :         for (i=0; i<sizeof(corrupt_bytes); i++) {
    1346           8 :                 expect_rcode = i % 2 == 0 ? -1 : 0;
    1347             : 
    1348          52 :                 for (j=0; j<corrupt_bytes[i]; j++, current++) {
    1349          44 :                         bin_copy.data = talloc_size(NULL, binary.length);
    1350          44 :                         memcpy(bin_copy.data, binary.data, binary.length);
    1351          44 :                         bin_copy.length = binary.length;
    1352          44 :                         msg = ldb_msg_new(bin_copy.data);
    1353             : 
    1354          44 :                         bin_copy.data[current]++;
    1355             : 
    1356          44 :                         ret = ldb_unpack_data(ldb, &bin_copy, msg);
    1357             : 
    1358          88 :                         comment = talloc_asprintf(
    1359          44 :                                 bin_copy.data,
    1360             :                                 "Expected unpack rcode for index %d "
    1361             :                                 "(corrupt bytes index %d) "
    1362             :                                 "to be %d but got %d",
    1363             :                                 current,
    1364             :                                 i,
    1365             :                                 expect_rcode,
    1366             :                                 ret);
    1367          44 :                         torture_assert_int_equal(torture, ret, expect_rcode,
    1368             :                                                  comment);
    1369             : 
    1370          44 :                         talloc_free(bin_copy.data);
    1371             :                 }
    1372             :         }
    1373             : 
    1374           0 :         return true;
    1375             : }
    1376             : 
    1377           1 : static bool torture_ldb_pack_data_v2(struct torture_context *torture)
    1378             : {
    1379           1 :         TALLOC_CTX *mem_ctx = talloc_new(torture);
    1380           1 :         struct ldb_context *ldb;
    1381           1 :         struct ldb_val binary;
    1382             : 
    1383           1 :         uint8_t bin[] = {0x68, 0x19, 0x01, 0x26, /* version */
    1384             :                 2, 0, 0, 0, /* num elements */
    1385             :                 4, 0, 0, 0, /* dn length */
    1386             :                 'D', 'N', '=', 'A', 0, /* dn with null term */
    1387             :                 2, 0, 0, 0, /* canonicalized dn length */
    1388             :                 '/', 'A', 0, /* canonicalized dn with null term */
    1389             :                 42, 0, 0, 0, /* distance from here to values section */
    1390             :                 3, 0, 0, 0, /* el name length */
    1391             :                 'a', 'b', 'c', 0, /* name with null term */
    1392             :                 4, 0, 0, 0, 1, /* num values and length width */
    1393             :                 1, 1, 1, 1, /* value lengths */
    1394             :                 3, 0, 0, 0, /* el name length */
    1395             :                 'd', 'e', 'f', 0, /* name def with null term */
    1396             :                 4, 0, 0, 0, 2, /* num of values and length width */
    1397             :                 1, 0, 1, 0, 1, 0, 0, 1, /* value lengths */
    1398             :                 '1', 0, '2', 0, '3', 0, '4', 0, /* values for abc */
    1399             :                 '5', 0, '6', 0, '7', 0}; /* first 3 values for def */
    1400             : 
    1401           1 :         char eight_256[257] =\
    1402             :                 "88888888888888888888888888888888888888888888888888888888888"
    1403             :                 "88888888888888888888888888888888888888888888888888888888888"
    1404             :                 "88888888888888888888888888888888888888888888888888888888888"
    1405             :                 "88888888888888888888888888888888888888888888888888888888888"
    1406             :                 "88888888888888888888"; /* def's 4th value */
    1407             : 
    1408           1 :         struct ldb_val vals[4] = {{.data=discard_const_p(uint8_t, "1"),
    1409             :                                    .length=1},
    1410             :                                   {.data=discard_const_p(uint8_t, "2"),
    1411             :                                    .length=1},
    1412             :                                   {.data=discard_const_p(uint8_t, "3"),
    1413             :                                    .length=1},
    1414             :                                   {.data=discard_const_p(uint8_t, "4"),
    1415             :                                    .length=1}};
    1416           1 :         struct ldb_val vals2[4] = {{.data=discard_const_p(uint8_t,"5"),
    1417             :                                    .length=1},
    1418             :                                   {.data=discard_const_p(uint8_t, "6"),
    1419             :                                    .length=1},
    1420             :                                   {.data=discard_const_p(uint8_t, "7"),
    1421             :                                    .length=1},
    1422             :                                   {.data=discard_const_p(uint8_t, eight_256),
    1423             :                                    .length=256}};
    1424           1 :         struct ldb_message_element els[2] = {{.name=discard_const_p(char, "abc"),
    1425             :                                            .num_values=4, .values=vals},
    1426             :                                           {.name=discard_const_p(char, "def"),
    1427             :                                            .num_values=4, .values=vals2}};
    1428           1 :         struct ldb_message msg = {.num_elements=2, .elements=els};
    1429             : 
    1430           1 :         uint8_t *expect_bin;
    1431           1 :         struct ldb_val expect_bin_ldb;
    1432           1 :         size_t expect_size = sizeof(bin) + sizeof(eight_256);
    1433           1 :         expect_bin = talloc_size(NULL, expect_size);
    1434           1 :         memcpy(expect_bin, bin, sizeof(bin));
    1435           1 :         memcpy(expect_bin + sizeof(bin), eight_256, sizeof(eight_256));
    1436           1 :         expect_bin_ldb = data_blob_const(expect_bin, expect_size);
    1437             : 
    1438           1 :         ldb = samba_ldb_init(mem_ctx, torture->ev, NULL,NULL,NULL);
    1439           1 :         torture_assert(torture, ldb != NULL, "Failed to init ldb");
    1440             : 
    1441           1 :         msg.dn = ldb_dn_new(NULL, ldb, "DN=A");
    1442             : 
    1443           1 :         torture_assert_int_equal(torture,
    1444             :                                  ldb_pack_data(ldb, &msg, &binary,
    1445             :                                                LDB_PACKING_FORMAT_V2),
    1446             :                                  0, "ldb_pack_data failed");
    1447             : 
    1448           1 :         torture_assert_int_equal(torture, expect_bin_ldb.length,
    1449             :                                  binary.length,
    1450             :                                  "packed data length not as expected");
    1451             : 
    1452           1 :         torture_assert_mem_equal(torture,
    1453             :                                  expect_bin_ldb.data,
    1454             :                                  binary.data,
    1455             :                                  binary.length,
    1456             :                                  "packed data not as expected");
    1457           1 :         talloc_free(expect_bin);
    1458           1 :         TALLOC_FREE(msg.dn);
    1459             : 
    1460           0 :         return true;
    1461             : }
    1462             : 
    1463           1 : static bool torture_ldb_pack_data_v2_special(struct torture_context *torture)
    1464             : {
    1465           1 :         TALLOC_CTX *mem_ctx = talloc_new(torture);
    1466           1 :         struct ldb_context *ldb;
    1467           1 :         struct ldb_val binary;
    1468             : 
    1469           1 :         uint8_t bin[] = {0x68, 0x19, 0x01, 0x26, /* version */
    1470             :                 1, 0, 0, 0, /* num elements */
    1471             :                 2, 0, 0, 0, /* dn length */
    1472             :                 '@', 'A', 0, /* dn with null term */
    1473             :                 0, 0, 0, 0, /* canonicalized dn length */
    1474             :                 0, /* no canonicalized dn, just null term */
    1475             :                 18, 0, 0, 0, /* distance from here to values section */
    1476             :                 3, 0, 0, 0, /* el name length */
    1477             :                 'a', 'b', 'c', 0, /* name with null term */
    1478             :                 1, 0, 0, 0, 1, /* num values and length width */
    1479             :                 1, /* value lengths */
    1480             :                 '1', 0}; /* values for abc */
    1481             : 
    1482           1 :         struct ldb_val vals[1] = {{.data=discard_const_p(uint8_t, "1"),
    1483             :                                    .length=1}};
    1484           1 :         struct ldb_message_element els[1] = {{.name=discard_const_p(char,
    1485             :                                                                     "abc"),
    1486             :                                               .num_values=1, .values=vals}};
    1487           1 :         struct ldb_message msg = {.num_elements=1, .elements=els};
    1488             : 
    1489           1 :         struct ldb_val expect_bin_ldb;
    1490           1 :         expect_bin_ldb = data_blob_const(bin, sizeof(bin));
    1491             : 
    1492           1 :         ldb = samba_ldb_init(mem_ctx, torture->ev, NULL,NULL,NULL);
    1493           1 :         torture_assert(torture, ldb != NULL, "Failed to init ldb");
    1494             : 
    1495           1 :         msg.dn = ldb_dn_new(NULL, ldb, "@A");
    1496             : 
    1497           1 :         torture_assert_int_equal(torture,
    1498             :                                  ldb_pack_data(ldb, &msg, &binary,
    1499             :                                                LDB_PACKING_FORMAT_V2),
    1500             :                                  0, "ldb_pack_data failed");
    1501             : 
    1502           1 :         torture_assert_int_equal(torture, expect_bin_ldb.length,
    1503             :                                  binary.length,
    1504             :                                  "packed data length not as expected");
    1505             : 
    1506           1 :         torture_assert_mem_equal(torture,
    1507             :                                  expect_bin_ldb.data,
    1508             :                                  binary.data,
    1509             :                                  binary.length,
    1510             :                                  "packed data not as expected");
    1511             : 
    1512           1 :         TALLOC_FREE(msg.dn);
    1513             : 
    1514           0 :         return true;
    1515             : }
    1516             : 
    1517           2 : static bool torture_ldb_parse_ldif(struct torture_context *torture,
    1518             :                                    const void *data_p)
    1519             : {
    1520           2 :         TALLOC_CTX *mem_ctx = talloc_new(torture);
    1521           2 :         const char *ldif_text = dda1d01d_ldif;
    1522           2 :         struct ldb_context *ldb;
    1523           2 :         struct ldb_ldif *ldif;
    1524           2 :         struct ldb_val binary;
    1525           2 :         struct ldb_val data = *discard_const_p(struct ldb_val, data_p);
    1526           2 :         struct ldb_message *msg = ldb_msg_new(mem_ctx);
    1527             : 
    1528           2 :         ldb = samba_ldb_init(mem_ctx, torture->ev, NULL,NULL,NULL);
    1529           2 :         torture_assert(torture,
    1530             :                        ldb != NULL,
    1531             :                        "Failed to init ldb");
    1532             : 
    1533           2 :         ldif = ldb_ldif_read_string(ldb, &ldif_text);
    1534           2 :         torture_assert(torture,
    1535             :                        ldif != NULL,
    1536             :                        "ldb_ldif_read_string failed");
    1537           2 :         torture_assert_int_equal(torture, ldif->changetype, LDB_CHANGETYPE_NONE,
    1538             :                                  "changetype is incorrect");
    1539           2 :         torture_assert_int_equal(torture,
    1540             :                                  ldb_pack_data(ldb, ldif->msg, &binary,
    1541             :                                                LDB_PACKING_FORMAT_V2),
    1542             :                                  0, "ldb_pack_data failed");
    1543             : 
    1544           2 :         torture_assert_int_equal(torture, ldb_unpack_data(ldb, &data, msg), 0,
    1545             :                                  "ldb_unpack_data failed");
    1546             : 
    1547           2 :         torture_assert(torture,
    1548             :                        helper_ldb_message_compare(torture, ldif->msg, msg),
    1549             :                        "Forms differ in memory");
    1550             : 
    1551           0 :         return true;
    1552             : }
    1553             : 
    1554           1 : static bool torture_ldb_pack_format_perf(struct torture_context *torture)
    1555             : {
    1556           1 :         TALLOC_CTX *mem_ctx = talloc_new(torture);
    1557           1 :         char *unp_ldif_text = talloc_strndup(mem_ctx, dda1d01d_ldif,
    1558             :                                                sizeof(dda1d01d_ldif)-1);
    1559           1 :         const char *ldif_text;
    1560           1 :         struct ldb_context *ldb;
    1561           1 :         struct ldb_ldif *ldif;
    1562           1 :         struct ldb_val binary;
    1563           1 :         struct ldb_message *msg = ldb_msg_new(mem_ctx);
    1564           1 :         int ret, i;
    1565           1 :         clock_t start, diff;
    1566             : 
    1567           1 :         ldb = samba_ldb_init(mem_ctx, torture->ev, NULL,NULL,NULL);
    1568           1 :         torture_assert(torture,
    1569             :                        ldb != NULL,
    1570             :                        "Failed to init ldb");
    1571             : 
    1572           1 :         unp_ldif_text[sizeof(dda1d01d_ldif)-2] = '\0';
    1573           1 :         ldif_text = unp_ldif_text;
    1574             : 
    1575       10001 :         for (i=0; i<10000; i++) {
    1576       10000 :                 ldif_text = talloc_asprintf_append(
    1577             :                                 discard_const_p(char, ldif_text),
    1578             :                                 "member: fillerfillerfillerfillerfillerfiller"
    1579             :                                 "fillerfillerfillerfillerfillerfillerfiller"
    1580             :                                 "fillerfillerfillerfillerfiller-group%d\n", i);
    1581             :         }
    1582             : 
    1583           1 :         ldif = ldb_ldif_read_string(ldb, &ldif_text);
    1584           1 :         torture_assert(torture,
    1585             :                        ldif != NULL,
    1586             :                        "ldb_ldif_read_string failed");
    1587           1 :         torture_assert_int_equal(torture, ldif->changetype, LDB_CHANGETYPE_NONE,
    1588             :                                  "changetype is incorrect");
    1589           1 :         torture_assert_int_equal(torture,
    1590             :                                  ldb_pack_data(ldb, ldif->msg, &binary,
    1591             :                                                LDB_PACKING_FORMAT_V2),
    1592             :                                  0, "ldb_pack_data failed");
    1593             : 
    1594           1 :         ret = ldb_unpack_data(ldb, &binary, msg);
    1595           1 :         torture_assert_int_equal(torture, ret, 0,
    1596             :                                  "ldb_unpack_data failed");
    1597             : 
    1598           1 :         torture_assert(torture,
    1599             :                        helper_ldb_message_compare(torture, ldif->msg, msg),
    1600             :                        "Forms differ in memory");
    1601             : 
    1602           1 :         i = 0;
    1603           1 :         start = clock();
    1604        1000 :         while (true) {
    1605        1000 :                 ldb_pack_data(ldb, ldif->msg, &binary, LDB_PACKING_FORMAT_V2);
    1606        1000 :                 i++;
    1607             : 
    1608        1000 :                 if (i >= 1000) {
    1609           0 :                         break;
    1610             :                 }
    1611             :         }
    1612           1 :         diff = (clock() - start) * 1000 / CLOCKS_PER_SEC;
    1613           1 :         printf("\n%d pack runs took: %ldms\n", i, (long)diff);
    1614             : 
    1615           1 :         i = 0;
    1616           1 :         start = clock();
    1617        1000 :         while (true) {
    1618        1000 :                 ldb_unpack_data(ldb, &binary, msg);
    1619        1000 :                 i++;
    1620             : 
    1621        1000 :                 if (i >= 1000) {
    1622           0 :                         break;
    1623             :                 }
    1624             :         }
    1625           1 :         diff = (clock() - start) * 1000 / CLOCKS_PER_SEC;
    1626           1 :         printf("%d unpack runs took: %ldms\n", i, (long)diff);
    1627             : 
    1628           1 :         return true;
    1629             : }
    1630             : 
    1631           2 : static bool torture_ldb_unpack_and_filter(struct torture_context *torture,
    1632             :                                           const void *data_p)
    1633             : {
    1634           2 :         TALLOC_CTX *mem_ctx = talloc_new(torture);
    1635           2 :         struct ldb_context *ldb;
    1636           2 :         struct ldb_val data = *discard_const_p(struct ldb_val, data_p);
    1637           2 :         struct ldb_message *msg = ldb_msg_new(mem_ctx);
    1638           2 :         const char *lookup_names[] = {"instanceType", "nonexistent",
    1639             :                                       "whenChanged", "objectClass",
    1640             :                                       "uSNCreated", "showInAdvancedViewOnly",
    1641             :                                       "name", "cnNotHere", NULL};
    1642           2 :         const char *ldif_text;
    1643           2 :         struct ldb_ldif ldif;
    1644             : 
    1645           2 :         ldb = samba_ldb_init(mem_ctx, torture->ev, NULL, NULL, NULL);
    1646           2 :         torture_assert(torture,
    1647             :                        ldb != NULL,
    1648             :                        "Failed to init samba");
    1649             : 
    1650           2 :         torture_assert_int_equal(torture,
    1651             :                                  ldb_unpack_data(ldb, &data, msg),
    1652             :                                  0, "ldb_unpack_data failed");
    1653             : 
    1654           2 :         torture_assert_int_equal(torture, msg->num_elements, 13,
    1655             :                                  "Got wrong count of elements");
    1656             : 
    1657           2 :         torture_assert_int_equal(torture,
    1658             :                                  ldb_filter_attrs_in_place(msg, lookup_names),
    1659             :                                  0, "ldb_filter_attrs_in_place failed");
    1660             : 
    1661             :         /* Compare data in binary form */
    1662           2 :         torture_assert_int_equal(torture, msg->num_elements, 6,
    1663             :                                  "Got wrong number of parsed elements");
    1664             : 
    1665           2 :         torture_assert_str_equal(torture, msg->elements[0].name, "objectClass",
    1666             :                                  "First element has wrong name");
    1667           2 :         torture_assert_int_equal(torture, msg->elements[0].num_values, 2,
    1668             :                                  "First element has wrong count of values");
    1669           2 :         torture_assert_int_equal(torture,
    1670             :                                  msg->elements[0].values[0].length, 3,
    1671             :                                  "First element's first value is of wrong length");
    1672           2 :         torture_assert_mem_equal(torture,
    1673             :                                  msg->elements[0].values[0].data, "top", 3,
    1674             :                                  "First element's first value is incorrect");
    1675           2 :         torture_assert_int_equal(torture,
    1676             :                                  msg->elements[0].values[1].length, strlen("container"),
    1677             :                                  "First element's second value is of wrong length");
    1678           2 :         torture_assert_mem_equal(torture, msg->elements[0].values[1].data,
    1679             :                                  "container", strlen("container"),
    1680             :                                  "First element's second value is incorrect");
    1681             : 
    1682           2 :         torture_assert_str_equal(torture, msg->elements[1].name, "instanceType",
    1683             :                                  "Second element has wrong name");
    1684           2 :         torture_assert_int_equal(torture, msg->elements[1].num_values, 1,
    1685             :                                  "Second element has too many values");
    1686           2 :         torture_assert_int_equal(torture, msg->elements[1].values[0].length, 1,
    1687             :                                  "Second element's value is of wrong length");
    1688           2 :         torture_assert_mem_equal(torture, msg->elements[1].values[0].data,
    1689             :                                  "4", 1,
    1690             :                                  "Second element's value is incorrect");
    1691             : 
    1692           2 :         torture_assert_str_equal(torture, msg->elements[2].name, "whenChanged",
    1693             :                                  "Third element has wrong name");
    1694           2 :         torture_assert_int_equal(torture, msg->elements[2].num_values, 1,
    1695             :                                  "Third element has too many values");
    1696           2 :         torture_assert_int_equal(torture, msg->elements[2].values[0].length,
    1697             :                                  strlen("20150708224310.0Z"),
    1698             :                                  "Third element's value is of wrong length");
    1699           2 :         torture_assert_mem_equal(torture, msg->elements[2].values[0].data,
    1700             :                                  "20150708224310.0Z", strlen("20150708224310.0Z"),
    1701             :                                  "Third element's value is incorrect");
    1702             : 
    1703           2 :         torture_assert_str_equal(torture, msg->elements[3].name, "uSNCreated",
    1704             :                                  "Fourth element has wrong name");
    1705           2 :         torture_assert_int_equal(torture, msg->elements[3].num_values, 1,
    1706             :                                  "Fourth element has too many values");
    1707           2 :         torture_assert_int_equal(torture, msg->elements[3].values[0].length, 4,
    1708             :                                  "Fourth element's value is of wrong length");
    1709           2 :         torture_assert_mem_equal(torture, msg->elements[3].values[0].data,
    1710             :                                  "3467", 4,
    1711             :                                  "Fourth element's value is incorrect");
    1712             : 
    1713           2 :         torture_assert_str_equal(torture, msg->elements[4].name, "showInAdvancedViewOnly",
    1714             :                                  "Fifth element has wrong name");
    1715           2 :         torture_assert_int_equal(torture, msg->elements[4].num_values, 1,
    1716             :                                  "Fifth element has too many values");
    1717           2 :         torture_assert_int_equal(torture, msg->elements[4].values[0].length, 4,
    1718             :                                  "Fifth element's value is of wrong length");
    1719           2 :         torture_assert_mem_equal(torture, msg->elements[4].values[0].data,
    1720             :                                  "TRUE", 4,
    1721             :                                  "Fourth element's value is incorrect");
    1722             : 
    1723           2 :         torture_assert_str_equal(torture, msg->elements[5].name, "name",
    1724             :                                  "Sixth element has wrong name");
    1725           2 :         torture_assert_int_equal(torture, msg->elements[5].num_values, 1,
    1726             :                                  "Sixth element has too many values");
    1727           2 :         torture_assert_int_equal(torture, msg->elements[5].values[0].length,
    1728             :                                  strlen("dda1d01d-4bd7-4c49-a184-46f9241b560e"),
    1729             :                                  "Sixth element's value is of wrong length");
    1730           2 :         torture_assert_mem_equal(torture, msg->elements[5].values[0].data,
    1731             :                                  "dda1d01d-4bd7-4c49-a184-46f9241b560e",
    1732             :                                  strlen("dda1d01d-4bd7-4c49-a184-46f9241b560e"),
    1733             :                                  "Sixth element's value is incorrect");
    1734             : 
    1735             :         /* Compare data in ldif form */
    1736           2 :         ldif.changetype = LDB_CHANGETYPE_NONE;
    1737           2 :         ldif.msg = msg;
    1738           2 :         ldif_text = ldb_ldif_write_string(ldb, mem_ctx, &ldif);
    1739             : 
    1740           2 :         torture_assert_str_equal(torture, ldif_text, dda1d01d_ldif_reduced,
    1741             :                                  "Expected fields did not match");
    1742             : 
    1743           0 :         return true;
    1744             : }
    1745             : 
    1746        2354 : struct torture_suite *torture_ldb(TALLOC_CTX *mem_ctx)
    1747             : {
    1748         125 :         int i;
    1749        2354 :         struct ldb_val *bins = talloc_array(mem_ctx, struct ldb_val, 2);
    1750        2354 :         struct torture_suite *suite = torture_suite_create(mem_ctx, "ldb");
    1751             : 
    1752        2354 :         if (suite == NULL) {
    1753           0 :                 return NULL;
    1754             :         }
    1755             : 
    1756        2354 :         bins[0] = data_blob_const(dda1d01d_bin_v1, sizeof(dda1d01d_bin_v1));
    1757        2354 :         bins[1] = data_blob_const(dda1d01d_bin_v2, sizeof(dda1d01d_bin_v2));
    1758             : 
    1759        2354 :         torture_suite_add_simple_test(suite, "attrs", torture_ldb_attrs);
    1760        2354 :         torture_suite_add_simple_test(suite, "dn-attrs", torture_ldb_dn_attrs);
    1761        2354 :         torture_suite_add_simple_test(suite, "dn-extended",
    1762             :                                       torture_ldb_dn_extended);
    1763        2354 :         torture_suite_add_simple_test(suite, "dn-invalid-extended",
    1764             :                                       torture_ldb_dn_invalid_extended);
    1765        2354 :         torture_suite_add_simple_test(suite, "dn", torture_ldb_dn);
    1766        2354 :         torture_suite_add_simple_test(suite, "pack-format-perf",
    1767             :                                       torture_ldb_pack_format_perf);
    1768        2354 :         torture_suite_add_simple_test(suite, "pack-data-v2",
    1769             :                                       torture_ldb_pack_data_v2);
    1770        2354 :         torture_suite_add_simple_test(suite, "pack-data-special-v2",
    1771             :                                       torture_ldb_pack_data_v2_special);
    1772        2354 :         torture_suite_add_simple_test(suite, "unpack-corrupt-v2",
    1773             :                                       torture_ldb_unpack_data_corrupt);
    1774             : 
    1775        7187 :         for (i=0; i<2; i++) {
    1776        4708 :                 torture_suite_add_simple_tcase_const(suite,
    1777        4708 :                         talloc_asprintf(mem_ctx, "unpack-data-v%d", i+1),
    1778        4708 :                         torture_ldb_unpack, &bins[i]);
    1779        4708 :                 torture_suite_add_simple_tcase_const(suite,
    1780        4708 :                         talloc_asprintf(mem_ctx, "unpack-data-flags-v%d", i+1),
    1781        4458 :                         torture_ldb_unpack_flags, &bins[i]);
    1782        4708 :                 torture_suite_add_simple_tcase_const(suite,
    1783        4708 :                         talloc_asprintf(mem_ctx, "parse-ldif-v%d", i+1),
    1784        4458 :                         torture_ldb_parse_ldif, &bins[i]);
    1785        4708 :                 torture_suite_add_simple_tcase_const(suite,
    1786        4708 :                         talloc_asprintf(mem_ctx,
    1787             :                                         "unpack-data-and-filter-v%d", i+1),
    1788        4458 :                         torture_ldb_unpack_and_filter, &bins[i]);
    1789             :         }
    1790             : 
    1791        2354 :         suite->description = talloc_strdup(suite, "LDB (samba-specific behaviour) tests");
    1792             : 
    1793        2354 :         return suite;
    1794             : }

Generated by: LCOV version 1.14