@@ -0,0 +1,2561 @@
+#!/usr/bin/python%0A%0Aimport sys%0Afrom ldif import LDIFParser, LDIFWriter, LDIFRecordList%0A%0Aclass LDIFVerifier():%0A    %22%22%22%0A    Check that two LDIF files contain equivalent LDAP information.%0A    %22%22%22%0A%0A    def __init__( self, in_file_1, in_file_2):%0A        %22%22%22%0A        Parameters:%0A        in_file_1%0A            filename of first file to read%0A        in_file_2%0A            filename of second file to read%0A        %22%22%22%0A        self._src_1 = LDIFRecordList(open(in_file_1))%0A        self._src_2 = LDIFRecordList(open(in_file_2))%0A%0A    def findRecord( self, list, dn):%0A        %22%22%22%0A        Find a record with given dn, or None if no such record exists.%0A        %22%22%22%0A        for record in list:%0A            recordDn,recordValueSet = record%0A            if recordDn == dn:%0A                return record%0A        return None%0A%0A    def emitDifferingValues( self, valSet1, valSet2):%0A        %22%22%22%0A        Emit all differences between two value-sets%0A        %22%22%22%0A        #union = valSet1 + ...%0A        for k , values1 in valSet1.iteritems():%0A            values2 = valSet2%5Bk%5D%0A            if values1 != values2:%0A                print %22  %22 + k + %22: %22 + str(values1) + %22 != %22 + str(values2)%0A%0A    def emitDifferences( self, list1, list2):%0A        %22%22%22%0A        Emit all differences between list1 and list2%0A        %22%22%22%0A        #union = list1 + list2%0A        for record1 in list1:%0A            dn,valueSet1 = record1%0A            record2 = self.findRecord( list2, dn)%0A            if record2:%0A                dn2,valueSet2 = record2%0A                if( valueSet1 != valueSet2):%0A                    print dn + %22: %22%0A                    self.emitDifferingValues( valueSet1, valueSet2)%0A            else:%0A                print %22Missing second corresponding%22%0A                self.printRecord( record1)%0A%0A%0A    def printRecord( self, record):%0A        %22%22%22%0A        Print a record%0A        %22%22%22%0A        dn,value = record%0A        print %22dn: %22 + dn%0A        for k, v in value.iteritems():%0A            print %22  %22 + k + %22: %22 + v %5B0%5D%0A            if( len(v) %3E 1):%0A                for val in v%5B1:%5D:%0A                    print %22      %22 + val%0A%0A%0A    def compare( self):%0A        %22%22%22%0A        Check whether the two named files are equal.%0A        %22%22%22%0A        self._src_1.parse()%0A        self._src_2.parse()%0A%0A        if( self._src_1.all_records != self._src_2.all_records):%0A            self.emitDifferences( self._src_1.all_records, self._src_2.all_records)%0A            sys.exit(%22Differences detected%22)%0A%0Aif( len(sys.argv) != 3):%0A  sys.exit(%22Need two arguments%22)%0A%0Averifier = LDIFVerifier( sys.argv%5B1%5D, sys.argv%5B2%5D)%0A%0Averifier.compare()%0A

Add initial version of compare Python script