Ejemplo n.º 1
0
        public virtual void TestUnprivilegedPort()
        {
            // Don't allow connections from unprivileged ports. Given that this test is
            // presumably not being run by root, this will be the case.
            int serverPort = StartRpcServer(false);
            XDR xdrOut     = CreateGetportMount();
            int bufsize    = 2 * 1024 * 1024;

            byte[] buffer = new byte[bufsize];
            xdrOut.WriteFixedOpaque(buffer);
            // Send the request to the server
            TestRequest(xdrOut, serverPort);
            // Verify the server rejected the request.
            Assert.Equal(0, resultSize);
            // Ensure that the NULL procedure does in fact succeed.
            xdrOut = new XDR();
            CreatePortmapXDRheader(xdrOut, 0);
            int headerSize = xdrOut.Size();

            buffer = new byte[bufsize];
            xdrOut.WriteFixedOpaque(buffer);
            int requestSize = xdrOut.Size() - headerSize;

            // Send the request to the server
            TestRequest(xdrOut, serverPort);
            // Verify the server did not reject the request.
            Assert.Equal(requestSize, resultSize);
        }
Ejemplo n.º 2
0
        public virtual void TestFrames()
        {
            int serverPort = StartRpcServer(true);
            XDR xdrOut     = CreateGetportMount();
            int headerSize = xdrOut.Size();
            int bufsize    = 2 * 1024 * 1024;

            byte[] buffer = new byte[bufsize];
            xdrOut.WriteFixedOpaque(buffer);
            int requestSize = xdrOut.Size() - headerSize;

            // Send the request to the server
            TestRequest(xdrOut, serverPort);
            // Verify the server got the request with right size
            Assert.Equal(requestSize, resultSize);
        }