def test_invalid_transaction_cookie(self):
        if test_server_type == 'EDIR' and not self.connection.strategy.pooled and not self.connection.strategy.no_real_dsa:
            self.delete_at_teardown.append(
                add_user(self.connection, testcase_id, 'user-1'))
            transaction_control = self.connection.extend.novell.start_transaction(
            )
            invalid_transaction_control = build_control(
                '2.16.840.1.113719.1.27.103.7',
                True,
                Integer(12345678),
                encode_control_value=True)
            self.connection.modify(
                self.delete_at_teardown[0][0],
                {'givenName': (MODIFY_REPLACE, ['user-1b'])},
                controls=[transaction_control])
            self.connection.modify(self.delete_at_teardown[0][0],
                                   {'sn': (MODIFY_REPLACE, ['sn-user-1b'])},
                                   controls=[invalid_transaction_control])
            result = self.connection.extend.novell.end_transaction(
                commit=True, controls=[transaction_control])
            result = self.connection.search(self.delete_at_teardown[0][0],
                                            '(objectclass=*)',
                                            attributes=['givenName', 'sn'])
            if not self.connection.strategy.sync:
                response, result = self.connection.get_response(result)
            else:
                response, result = self.connection.response, self.connection.result

            if response:
                self.assertEquals(response[0]['attributes']['givenName'][0],
                                  'user-1b')
                self.assertEquals(response[0]['attributes']['sn'][0], 'user-1')
            else:
                self.assertFalse(True,
                                 self.delete_at_teardown[0][0] + ' not found')
Esempio n. 2
0
    def test_invalid_transaction_cookie(self):
        if test_server_type == 'EDIR' and not self.connection.strategy.pooled and not self.connection.strategy.no_real_dsa:
            self.delete_at_teardown.append(add_user(self.connection, testcase_id, 'user-1'))
            transaction_control = self.connection.extend.novell.start_transaction()
            invalid_transaction_control = build_control('2.16.840.1.113719.1.27.103.7', True, Integer(12345678), encode_control_value=True)
            self.connection.modify(self.delete_at_teardown[0][0], {'givenName': (MODIFY_REPLACE, ['user-1b'])}, controls=[transaction_control])
            self.connection.modify(self.delete_at_teardown[0][0], {'sn': (MODIFY_REPLACE, ['sn-user-1b'])}, controls=[invalid_transaction_control])
            result = self.connection.extend.novell.end_transaction(commit=True, controls=[transaction_control])
            result = self.connection.search(self.delete_at_teardown[0][0], '(objectclass=*)', attributes=['givenName', 'sn'])
            if not self.connection.strategy.sync:
                response, result = self.connection.get_response(result)
            else:
                response, result = self.connection.response, self.connection.result

            if response:
                self.assertEqual(response[0]['attributes']['givenName'][0], 'user-1b')
                self.assertEqual(response[0]['attributes']['sn'][0], 'user-1')
            else:
                self.assertFalse(True, self.delete_at_teardown[0][0] + ' not found')
Esempio n. 3
0
def build_sd_control(sdflags=0x05):
    sdcontrol = SdFlags()
    sdcontrol.setComponentByName('Flags', sdflags)
    return build_control('1.2.840.113556.1.4.801', True, sdcontrol)