/* SPDX-License-Identifier: GPL-2.0 */ /* * Encode/decode NLM basic data types * * Basic NLMv3 XDR data types are not defined in an IETF standards * document. X/Open has a description of these data types that * is useful. See Chapter 10 of "Protocols for Interworking: * XNFS, Version 3W". * * Basic NLMv4 XDR data types are defined in Appendix II.1.4 of * RFC 1813: "NFS Version 3 Protocol Specification". * * Author: Chuck Lever <chuck.lever@oracle.com> * * Copyright (c) 2020, Oracle and/or its affiliates.
*/
if (xdr_stream_decode_u32(xdr, &len) < 0) returnfalse; if (len > NLM_MAXSTRLEN) returnfalse;
p = xdr_inline_decode(xdr, len); if (!p) returnfalse;
*data_len = len;
*data = (char *)p;
returntrue;
}
/* * NLM cookies are defined by specification to be a variable-length * XDR opaque no longer than 1024 bytes. However, this implementation * limits their length to 32 bytes, and treats zero-length cookies * specially.
*/ staticinlinebool
svcxdr_decode_cookie(struct xdr_stream *xdr, struct nlm_cookie *cookie)
{
__be32 *p;
u32 len;
if (xdr_stream_decode_u32(xdr, &len) < 0) returnfalse; if (len > NLM_MAXCOOKIELEN) returnfalse; if (!len) goto out_hpux;
p = xdr_inline_decode(xdr, len); if (!p) returnfalse;
cookie->len = len;
memcpy(cookie->data, p, len);
returntrue;
/* apparently HPUX can return empty cookies */
out_hpux:
cookie->len = 4;
memset(cookie->data, 0, 4); returntrue;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.