/// <summary> /// Encodes ONC/RPC authentication information in form of a credential /// and a verifier when sending an ONC/RPC call message. /// </summary> /// <remarks> /// Encodes ONC/RPC authentication information in form of a credential /// and a verifier when sending an ONC/RPC call message. The /// <code>AUTH_UNIX</code> authentication method only uses the credential /// but no verifier. If the ONC/RPC server sent a <code>AUTH_SHORT</code> /// "shorthand" credential together with the previous reply message, it /// is used instead of the original credential. /// </remarks> /// <param name="xdr"> /// XDR stream where to encode the credential and the verifier /// to. /// </param> /// <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 xdrEncodeCredVerf(org.acplt.oncrpc.XdrEncodingStream xdr) { if (shorthandCred == null) { // // Encode the credential, which contains some unsecure information // about user and group ID, etc. Note that the credential itself // is encoded as a variable-sized bunch of octets. // if ((gids.Length > org.acplt.oncrpc.OncRpcAuthConstants.ONCRPC_MAX_GROUPS) || (machinename .Length > org.acplt.oncrpc.OncRpcAuthConstants.ONCRPC_MAX_MACHINE_NAME)) { throw (new org.acplt.oncrpc.OncRpcAuthenticationException(org.acplt.oncrpc.OncRpcAuthStatus .ONCRPC_AUTH_FAILED)); } xdr.xdrEncodeInt(org.acplt.oncrpc.OncRpcAuthType.ONCRPC_AUTH_UNIX); 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 (len > org.acplt.oncrpc.OncRpcAuthConstants.ONCRPC_MAX_AUTH_BYTES) { throw (new org.acplt.oncrpc.OncRpcAuthenticationException(org.acplt.oncrpc.OncRpcAuthStatus .ONCRPC_AUTH_FAILED)); } xdr.xdrEncodeInt(len); xdr.xdrEncodeInt(stamp); xdr.xdrEncodeString(machinename); xdr.xdrEncodeInt(uid); xdr.xdrEncodeInt(gid); xdr.xdrEncodeIntVector(gids); } else { // // Use shorthand credential instead of original credential. // xdr.xdrEncodeInt(org.acplt.oncrpc.OncRpcAuthType.ONCRPC_AUTH_SHORT); xdr.xdrEncodeDynamicOpaque(shorthandCred); } // // We also need to encode the verifier, which is always of // type AUTH_NONE. // xdr.xdrEncodeInt(org.acplt.oncrpc.OncRpcAuthType.ONCRPC_AUTH_NONE); xdr.xdrEncodeInt(0); }