Ejemplo n.º 1
0
        private static void ServePolicyFile(IAsyncResult ar)
        {
            try
            {
                TcpClient cli = ((TcpListener)ar.AsyncState).EndAcceptTcpClient(ar);
                ((TcpListener)ar.AsyncState)?.BeginAcceptTcpClient(ServePolicyFile, ar.AsyncState);
                NetworkStream s   = cli.GetStream();
                NReader       rdr = new NReader(s);
                NWriter       wtr = new NWriter(s);
                if (rdr.ReadNullTerminatedString() == "<policy-file-request/>")
                {
                    wtr.WriteNullTerminatedString(@"<cross-domain-policy>
     <allow-access-from domain=""*"" to-ports=""*"" />
</cross-domain-policy>");
                    wtr.Write((byte)'\r');
                    wtr.Write((byte)'\n');
                }
                cli.Close();
            }
            catch (ObjectDisposedException) { }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
        private static void ServePolicyFile(IAsyncResult ar)
        {
            try
            {
                TcpClient cli = (ar.AsyncState as TcpListener).EndAcceptTcpClient(ar);
                (ar.AsyncState as TcpListener).BeginAcceptTcpClient(ServePolicyFile, ar.AsyncState);
                NetworkStream s = cli.GetStream();
                NReader rdr = new NReader(s);
                NWriter wtr = new NWriter(s);
                if (rdr.ReadNullTerminatedString() == "<policy-file-request/>")
                {
                    wtr.WriteNullTerminatedString(@"<cross-domain-policy>
     <allow-access-from domain=""*"" to-ports=""*"" />
</cross-domain-policy>");
                    wtr.Write((byte)'\r');
                    wtr.Write((byte)'\n');
                }
                cli.Close();
            }
            catch (ObjectDisposedException) { }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
        }
Ejemplo n.º 3
0
        private static void ServePolicyFile(IAsyncResult ar)
        {
            try
            {
                var cli = (ar.AsyncState as TcpListener).EndAcceptTcpClient(ar);

                (ar.AsyncState as TcpListener).BeginAcceptTcpClient(ServePolicyFile, ar.AsyncState);

                var s   = cli.GetStream();
                var rdr = new NReader(s);
                var wtr = new NWriter(s);

                if (rdr.ReadNullTerminatedString() == "<policy-file-request/>")
                {
                    wtr.WriteNullTerminatedString(
                        @"<cross-domain-policy>" +
                        @"<allow-access-from domain=""*"" to-ports=""*"" />" +
                        @"</cross-domain-policy>");
                    wtr.Write((byte)'\r');
                    wtr.Write((byte)'\n');
                }

                cli.Close();
            }
            catch { }
        }
Ejemplo n.º 4
0
        private void ProcessPolicyFile()
        {
            NetworkStream s   = new NetworkStream(skt);
            NWriter       wtr = new NWriter(s);

            wtr.WriteNullTerminatedString(Settings.IS_PRODUCTION ? Settings.NETWORKING.INTERNAL.SELECTED_DOMAINS : Settings.NETWORKING.INTERNAL.LOCALHOST_DOMAINS);
            wtr.Write((byte)'\r');
            wtr.Write((byte)'\n');
            parent.Disconnect(DisconnectReason.PROCESS_POLICY_FILE);
        }
Ejemplo n.º 5
0
        private void ProcessPolicyFile()
        {
            var s   = new NetworkStream(skt);
            var wtr = new NWriter(s);

            wtr.WriteNullTerminatedString(customDomains.enabled ? customDomains.custom : customDomains.local);
            wtr.Write((byte)'\r');
            wtr.Write((byte)'\n');
            parent.Disconnect();
        }
        private void ProcessPolicyFile() //WUT.
        {
            NetworkStream s = new NetworkStream(skt);
            NWriter wtr = new NWriter(s);
            wtr.WriteNullTerminatedString(@"<cross-domain-policy>
     <allow-access-from domain=""*"" to-ports=""*"" />
</cross-domain-policy>");
            wtr.Write((byte)'\r');
            wtr.Write((byte)'\n');
            parent.Disconnect();
        }
        private void ProcessPolicyFile() //WUT.
        {
            NetworkStream s   = new NetworkStream(skt);
            NWriter       wtr = new NWriter(s);

            wtr.WriteNullTerminatedString(@"<cross-domain-policy>
     <allow-access-from domain=""*"" to-ports=""*"" />
</cross-domain-policy>");
            wtr.Write((byte)'\r');
            wtr.Write((byte)'\n');
            parent.Disconnect();
        }
Ejemplo n.º 8
0
        private void ProcessPolicyFile() //WUT.
        {
            NetworkStream s   = new NetworkStream(skt);
            NWriter       wtr = new NWriter(s);

            wtr.WriteNullTerminatedString(@"<allow-access-from domain=""*"" secure=false/>
<allow-http-request-headers-from domain=""*"" headers=""*"" secure=false/>
<allow-https-request-headers-from domain=""*"" headers=""*"" secure=false/>");
            wtr.Write((byte)'\r');
            wtr.Write((byte)'\n');
            parent.Disconnect();
        }
Ejemplo n.º 9
0
        private void ProcessPolicyFile()
        {
            var s   = new NetworkStream(_skt);
            var wtr = new NWriter(s);

            wtr.WriteNullTerminatedString(
                @"<cross-domain-policy>
                    <allow-access-from domain=""*"" to-ports=""*"" />
                </cross-domain-policy>");
            wtr.Write((byte)'\r');
            wtr.Write((byte)'\n');
            _parent.Disconnect(Client.DisconnectReason.PROCESS_POLICY);
        }
Ejemplo n.º 10
0
 static void ServePolicyFile(IAsyncResult ar)
 {
     TcpClient cli = (ar.AsyncState as TcpListener).EndAcceptTcpClient(ar);
     (ar.AsyncState as TcpListener).BeginAcceptTcpClient(ServePolicyFile, ar.AsyncState);
     try
     {
         var s = cli.GetStream();
         NReader rdr = new NReader(s);
         NWriter wtr = new NWriter(s);
         if (rdr.ReadNullTerminatedString() == "<policy-file-request/>")
         {
             wtr.WriteNullTerminatedString(@"<cross-domain-policy>
      <allow-access-from domain=""*"" to-ports=""*"" />
     </cross-domain-policy>");
             wtr.Write((byte)'\r');
             wtr.Write((byte)'\n');
         }
         cli.Close();
     }
     catch { }
 }
Ejemplo n.º 11
0
        private static void ServePolicyFile(IAsyncResult ar)
        {
            TcpClient cli = (ar.AsyncState as TcpListener).EndAcceptTcpClient(ar);

            (ar.AsyncState as TcpListener).BeginAcceptTcpClient(ServePolicyFile, ar.AsyncState);
            try
            {
                NetworkStream s   = cli.GetStream();
                var           rdr = new NReader(s);
                var           wtr = new NWriter(s);
                if (rdr.ReadNullTerminatedString() == "<policy-file-request/>")
                {
                    wtr.WriteNullTerminatedString(customDomains.enabled ? customDomains.custom : customDomains.local);
                    wtr.Write((byte)'\r');
                    wtr.Write((byte)'\n');
                }
                cli.Close();
            }
            catch
            {
            }
        }
        private void ProcessPolicyFile()
        {
            if (skt == null)
            {
                return;
            }

            try
            {
                var s   = new NetworkStream(skt);
                var wtr = new NWriter(s);
                wtr.WriteNullTerminatedString(
                    @"<cross-domain-policy>" +
                    @"<allow-access-from domain=""*"" to-ports=""*"" />" +
                    @"</cross-domain-policy>");
                wtr.Write((byte)'\r');
                wtr.Write((byte)'\n');
            }
            catch (Exception e)
            {
                GameServer.log.Error(e.ToString());
            }
        }
Ejemplo n.º 13
0
 private static void ServePolicyFile(IAsyncResult ar)
 {
     try
     {
         TcpClient cli = (ar.AsyncState as TcpListener).EndAcceptTcpClient(ar);
         (ar.AsyncState as TcpListener).BeginAcceptTcpClient(ServePolicyFile, ar.AsyncState);
         NetworkStream s   = cli.GetStream();
         NReader       rdr = new NReader(s);
         NWriter       wtr = new NWriter(s);
         if (rdr.ReadNullTerminatedString() == "<policy-file-request/>")
         {
             wtr.WriteNullTerminatedString(Settings.IS_PRODUCTION ? Settings.NETWORKING.INTERNAL.SELECTED_DOMAINS : Settings.NETWORKING.INTERNAL.LOCALHOST_DOMAINS);
             wtr.Write((byte)'\r');
             wtr.Write((byte)'\n');
         }
         cli.Close();
     }
     catch (ObjectDisposedException) { }
     catch (Exception ex)
     {
         log.Error(ex);
     }
 }
Ejemplo n.º 14
0
        private void SendPolicyFile()
        { // temporary
            if (_client.Skt == null)
            {
                return;
            }

            try
            {
                var s   = new NetworkStream(_client.Skt);
                var wtr = new NWriter(s);
                wtr.WriteNullTerminatedString(
                    @"<cross-domain-policy>" +
                    @"<allow-access-from domain=""*.valormg.com"" to-ports=""*"" />" +
                    @"</cross-domain-policy>");
                wtr.Write((byte)'\r');
                wtr.Write((byte)'\n');
            }
            catch (Exception e)
            {
                Log.Error(e.ToString());
            }
        }