/// <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 override sealed void xdrDecodeCredVerf(org.acplt.oncrpc.XdrDecodingStream xdr) { // // Reset the authentication object's state properly... // shorthandCred = null; shorthandVerf = null; // // Pull off the shorthand credential information (opaque date) of // the XDR stream... // shorthandCred = xdr.xdrDecodeDynamicOpaque(); if (shorthandCred.Length > org.acplt.oncrpc.OncRpcAuthConstants.ONCRPC_MAX_AUTH_BYTES) { throw (new org.acplt.oncrpc.OncRpcAuthenticationException(org.acplt.oncrpc.OncRpcAuthStatus .ONCRPC_AUTH_BADCRED)); } // // 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)); } }
/// <summary> /// Decodes -- that is: deserializes -- a XDR opaque from a XDR stream in /// compliance to RFC 1832. /// </summary> /// <remarks> /// Decodes -- that is: deserializes -- a XDR opaque 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.xdrDecodeDynamicOpaque(); }
/// <summary> /// Decodes ONC/RPC authentication information in form of a verifier /// when receiving an ONC/RPC reply message. /// </summary> /// <remarks> /// Decodes ONC/RPC authentication information in form of a verifier /// when receiving an ONC/RPC reply message. /// </remarks> /// <param name="xdr"> /// XDR stream from which to receive the verifier sent together /// with an ONC/RPC reply message. /// </param> /// <exception cref="OncRpcAuthenticationException"> /// if the received verifier is /// not kosher. /// </exception> /// <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> internal override void xdrDecodeVerf(org.acplt.oncrpc.XdrDecodingStream xdr) { switch (xdr.xdrDecodeInt()) { case org.acplt.oncrpc.OncRpcAuthType.ONCRPC_AUTH_NONE: { // // The verifier sent in response to AUTH_UNIX or AUTH_SHORT credentials // can only be AUTH_NONE or AUTH_SHORT. In the latter case we drop // any old shorthand credential and use the new one. // // // Make sure that the verifier does not contain any opaque data. // Anything different from this is not kosher and an authentication // exception will be thrown. // if (xdr.xdrDecodeInt() != 0) { throw (new org.acplt.oncrpc.OncRpcAuthenticationException(org.acplt.oncrpc.OncRpcAuthStatus .ONCRPC_AUTH_FAILED)); } break; } case org.acplt.oncrpc.OncRpcAuthType.ONCRPC_AUTH_SHORT: { // // Fetch the credential from the XDR stream and make sure that // it does conform to the length restriction as set forth in // the ONC/RPC protocol. // shorthandCred = xdr.xdrDecodeDynamicOpaque(); if (shorthandCred.Length > org.acplt.oncrpc.OncRpcAuthConstants.ONCRPC_MAX_AUTH_BYTES) { throw (new org.acplt.oncrpc.OncRpcAuthenticationException(org.acplt.oncrpc.OncRpcAuthStatus .ONCRPC_AUTH_FAILED)); } break; } default: { // // Do not accept any other kind of verifier sent. // throw (new org.acplt.oncrpc.OncRpcAuthenticationException(org.acplt.oncrpc.OncRpcAuthStatus .ONCRPC_AUTH_INVALIDRESP)); } } }