コード例 #1
0
        /// <summary>
        /// Decodes -- that is: deserializes -- an ONC/RPC authentication object
        /// (credential & verifier) on the server side.
        /// </summary>
        /// <remarks>
        /// Decodes -- that is: deserializes -- an ONC/RPC authentication object
        /// (credential & verifier) on the server side.
        /// </remarks>
        /// <exception cref="org.acplt.oncrpc.OncRpcException">if an ONC/RPC error occurs.</exception>
        /// <exception cref="System.IO.IOException">if an I/O error occurs.</exception>
        public sealed override void xdrDecodeCredVerf(org.acplt.oncrpc.XdrDecodingStream
                                                      xdr)
        {
            //
            // Reset some part of the object's state...
            //
            shorthandVerf = null;
            //
            // Now pull off the object state of the XDR stream...
            //
            int realLen = xdr.xdrDecodeInt();

            stamp       = xdr.xdrDecodeInt();
            machinename = xdr.xdrDecodeString();
            uid         = xdr.xdrDecodeInt();
            gid         = xdr.xdrDecodeInt();
            gids        = xdr.xdrDecodeIntVector();
            //
            // Make sure that the indicated length of the opaque data is kosher.
            // If not, throw an exception, as there is something strange going on!
            //
            int len = 4 + ((machinename.Length + 7) & ~3) + 4 + 4 + (gids.Length * 4) + 4;

            // length of stamp
            // len string incl. len
            // length of uid
            // length of gid
            // length of vector of gids incl. len
            if (realLen != len)
            {
                if (realLen < len)
                {
                    throw (new org.acplt.oncrpc.OncRpcException(org.acplt.oncrpc.OncRpcException.RPC_BUFFERUNDERFLOW
                                                                ));
                }
                else
                {
                    throw (new org.acplt.oncrpc.OncRpcException(org.acplt.oncrpc.OncRpcException.RPC_AUTHERROR
                                                                ));
                }
            }
            //
            // We also need to decode the verifier. This must be of type
            // AUTH_NONE too. For some obscure historical reasons, we have to
            // deal with credentials and verifiers, although they belong together,
            // according to Sun's specification.
            //
            if ((xdr.xdrDecodeInt() != org.acplt.oncrpc.OncRpcAuthType.ONCRPC_AUTH_NONE) || (
                    xdr.xdrDecodeInt() != 0))
            {
                throw (new org.acplt.oncrpc.OncRpcAuthenticationException(org.acplt.oncrpc.OncRpcAuthStatus
                                                                          .ONCRPC_AUTH_BADVERF));
            }
        }
コード例 #2
0
 /// <summary>
 /// Decodes -- that is: deserializes -- a XDR string from a XDR stream in
 /// compliance to RFC 1832.
 /// </summary>
 /// <remarks>
 /// Decodes -- that is: deserializes -- a XDR string from a XDR stream in
 /// compliance to RFC 1832.
 /// </remarks>
 /// <exception cref="OncRpcException">if an ONC/RPC error occurs.</exception>
 /// <exception cref="System.IO.IOException">if an I/O error occurs.</exception>
 /// <exception cref="org.acplt.oncrpc.OncRpcException"></exception>
 public virtual void xdrDecode(org.acplt.oncrpc.XdrDecodingStream xdr)
 {
     value = xdr.xdrDecodeString();
 }