Ejemplo n.º 1
0
        public void RegisterHandlerInvalidLow()
        {
            var kdc = new KdcServer(new KdcServerOptions {
            });

            kdc.RegisterMessageHandler((MessageType)9, null);
        }
Ejemplo n.º 2
0
        public void TestRegisterHandlerInvalidHigh()
        {
            var kdc = new KdcServer(new ListenerOptions {
            });

            kdc.RegisterMessageHandler((MessageType)123, null);
        }
Ejemplo n.º 3
0
        public async Task KdcTagPeekFailureNullBuilder()
        {
            var kdc = new KdcServer(new KdcServerOptions {
                DefaultRealm = "domain.com", IsDebug = true
            });

            kdc.RegisterMessageHandler(MessageType.KRB_CRED, (b, o) => null);

            var krbCred = new KrbCred {
                Tickets = Array.Empty <KrbTicket>()
            };

            var response = await kdc.ProcessMessage(krbCred.EncodeApplication());

            var err = KrbError.DecodeApplication(response);

            Assert.IsNotNull(err);

            Assert.AreEqual(KerberosErrorCode.KRB_ERR_GENERIC, err.ErrorCode);
            Assert.IsTrue(err.EText.Contains("Message handler builder KRB_CRED must not return null"));
        }
Ejemplo n.º 4
0
        public async Task TestKdcTagPeekFailureNullBuilder()
        {
            var kdc = new KdcServer(new ListenerOptions {
                DefaultRealm = "domain.com", IsDebug = true
            });

            kdc.RegisterMessageHandler((MessageType)27, (b, o) => null);

            var aprepPart = new KrbEncApRepPart {
            };

            ReadOnlySequence <byte> request = new ReadOnlySequence <byte>(aprepPart.EncodeApplication().ToArray());

            var response = await kdc.ProcessMessage(request);

            var err = KrbError.DecodeApplication(response);

            Assert.IsNotNull(err);

            Assert.AreEqual(KerberosErrorCode.KRB_ERR_GENERIC, err.ErrorCode);
            Assert.IsTrue(err.EText.Contains("Message handler builder 27 must not return null"));
        }