net/sunrpc/auth_gss/gss_rpc_xdr.c
Source file repositories/reference/linux-study-clean/net/sunrpc/auth_gss/gss_rpc_xdr.c
File Facts
- System
- Linux kernel
- Corpus path
net/sunrpc/auth_gss/gss_rpc_xdr.c- Extension
.c- Size
- 18350 bytes
- Lines
- 896
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: implementation source
- Status
- source implementation candidate
Why This File Exists
Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/sunrpc/svcauth.hgss_rpc_xdr.h
Detected Declarations
function Copyrightfunction gssx_dec_boolfunction gssx_enc_bufferfunction gssx_enc_in_tokenfunction gssx_dec_bufferfunction gssx_enc_optionfunction gssx_dec_optionfunction dummy_enc_opt_arrayfunction dummy_dec_opt_arrayfunction get_host_u32function gssx_dec_linux_credsfunction gssx_dec_option_arrayfunction gssx_dec_statusfunction gssx_enc_call_ctxfunction gssx_dec_name_attrfunction dummy_enc_nameattr_arrayfunction dummy_dec_nameattr_arrayfunction gssx_enc_namefunction gssx_dec_namefunction dummy_enc_credel_arrayfunction gssx_enc_credfunction gssx_enc_ctxfunction gssx_dec_ctxfunction gssx_enc_cbfunction gssx_enc_accept_sec_contextfunction gssx_dec_accept_sec_context
Annotated Snippet
if (unlikely(p == NULL)) {
err = -ENOSPC;
goto free_creds;
}
length = be32_to_cpup(p);
p = xdr_inline_decode(xdr, length);
if (unlikely(p == NULL)) {
err = -ENOSPC;
goto free_creds;
}
if (length == sizeof(CREDS_VALUE) &&
memcmp(p, CREDS_VALUE, sizeof(CREDS_VALUE)) == 0) {
/* We have creds here. parse them */
err = gssx_dec_linux_creds(xdr, creds);
if (err)
goto free_creds;
oa->data[0].value.len = 1; /* presence */
} else {
/* consume uninteresting buffer */
err = gssx_dec_buffer(xdr, &dummy);
if (err)
goto free_creds;
}
}
return 0;
free_creds:
kfree(creds);
free_oa:
kfree(oa->data);
oa->data = NULL;
return err;
}
static int gssx_dec_status(struct xdr_stream *xdr,
struct gssx_status *status)
{
__be32 *p;
int err;
/* status->major_status */
p = xdr_inline_decode(xdr, 8);
if (unlikely(p == NULL))
return -ENOSPC;
p = xdr_decode_hyper(p, &status->major_status);
/* status->mech */
err = gssx_dec_buffer(xdr, &status->mech);
if (err)
return err;
/* status->minor_status */
p = xdr_inline_decode(xdr, 8);
if (unlikely(p == NULL)) {
err = -ENOSPC;
goto out_free_mech;
}
p = xdr_decode_hyper(p, &status->minor_status);
/* status->major_status_string */
err = gssx_dec_buffer(xdr, &status->major_status_string);
if (err)
goto out_free_mech;
/* status->minor_status_string */
err = gssx_dec_buffer(xdr, &status->minor_status_string);
if (err)
goto out_free_major_status_string;
/* status->server_ctx */
err = gssx_dec_buffer(xdr, &status->server_ctx);
if (err)
goto out_free_minor_status_string;
/* we assume we have no options for now, so simply consume them */
/* status->options */
err = dummy_dec_opt_array(xdr, &status->options);
if (err)
goto out_free_server_ctx;
return 0;
out_free_server_ctx:
kfree(status->server_ctx.data);
status->server_ctx.data = NULL;
out_free_minor_status_string:
kfree(status->minor_status_string.data);
status->minor_status_string.data = NULL;
Annotation
- Immediate include surface: `linux/sunrpc/svcauth.h`, `gss_rpc_xdr.h`.
- Detected declarations: `function Copyright`, `function gssx_dec_bool`, `function gssx_enc_buffer`, `function gssx_enc_in_token`, `function gssx_dec_buffer`, `function gssx_enc_option`, `function gssx_dec_option`, `function dummy_enc_opt_array`, `function dummy_dec_opt_array`, `function get_host_u32`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.