def test_abort_mid(q, bus, conn, stream): chan, authenticator = start_mechanism(q, bus, conn) authenticator.challenge(EXCHANGE[1][0]) q.expect('dbus-signal', signal='NewChallenge', interface=cs.CHANNEL_IFACE_SASL_AUTH, args=[EXCHANGE[1][0]]) abort_auth(q, chan, cs.SASL_ABORT_REASON_INVALID_CHALLENGE, "wrong data from server")
def test_plain_abort(q, bus, conn, stream): chan, props = connect_and_get_sasl_channel(q, bus, conn) chan.SASLAuthentication.StartMechanismWithData('PLAIN', INITIAL_RESPONSE) e, _ = q.expect_many( EventPattern('sasl-auth', initial_response=INITIAL_RESPONSE), EventPattern('dbus-signal', signal='SASLStatusChanged', interface=cs.CHANNEL_IFACE_SASL_AUTH, args=[cs.SASL_STATUS_IN_PROGRESS, '', {}]), ) authenticator = e.authenticator authenticator.success(None) q.expect('dbus-signal', signal='SASLStatusChanged', interface=cs.CHANNEL_IFACE_SASL_AUTH, args=[cs.SASL_STATUS_SERVER_SUCCEEDED, '', {}]) abort_auth(q, chan, cs.SASL_ABORT_REASON_INVALID_CHALLENGE, "Something is fishy")
def test_abort_mid(q, bus, conn, stream): chan, props = connect_and_get_sasl_channel(q, bus, conn) chan.SASLAuthentication.StartMechanismWithData("ABORT-TEST", EXCHANGE[0][1]) q.expect( "dbus-signal", signal="SASLStatusChanged", interface=cs.CHANNEL_IFACE_SASL_AUTH, args=[cs.SASL_STATUS_IN_PROGRESS, "", {}], ) e = q.expect("sasl-auth", initial_response=EXCHANGE[0][1]) authenticator = e.authenticator authenticator.challenge(EXCHANGE[1][0]) q.expect("dbus-signal", signal="NewChallenge", interface=cs.CHANNEL_IFACE_SASL_AUTH, args=[EXCHANGE[1][0]]) abort_auth(q, chan, cs.SASL_ABORT_REASON_INVALID_CHALLENGE, "wrong data from server")
def test_abort_early(q, bus, conn, stream): chan, props = connect_and_get_sasl_channel(q, bus, conn) abort_auth(q, chan, 31337, "maybe if I use an undefined code you'll crash")