---
name: "rpc_gss_set_callback"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/rpc_gss_set_callback"
---

# rpc\_gss\_set\_callback(3)

Register a security context creation callback

## NAME

**rpc\_gss\_set\_callback** – Register a security context creation callback

## LIBRARY

library “librpcsec\_gss”

## SYNOPSIS

**#include \<rpc/rpcsec\_gss.h\>**

*bool\_t*\

**(\*callback)**(*struct svc\_req \*req*, *gss\_cred\_id\_t deleg*, *gss\_ctx\_id\_t gss\_context*, *rpc\_gss\_lock\_t \*lock*, *void \*\*cookie*);

*bool\_t*\

**rpc\_gss\_set\_callback**(*rpc\_gss\_callback\_t \*cb*);

## DESCRIPTION

Register a function which will be called when new security contexts are created on a server. This function will be called on the first RPC request which uses that context and has the opportunity of rejecting the request (for instance after matching the request credentials to an access control list). To accept the new security context, the callback should return TRUE, otherwise FALSE. If the callback accepts a context, it becomes responsible for the lifetime of the delegated client credentials (if any).

It is also possible to 'lock' the values of service and quality of protection used by the context. If a context is locked, any subsequent requests which use different values for service and quality of protection will be rejected.

## PARAMETERS

- cb

  A structure containing the RPC program and version for this callback and a function which will be called when new contexts are created for the given RPC program and version

- req

  The RPC request using the new context

- deleg

  GSS-API delegated credentials (if any)

- gss\_context

  The GSS-API context

- lock

  A structure used to enforce a particular QOP and service. Set *lock-\>locked* to TRUE to lock the service and QOP values

- cookie

  The callback function may set *\*cookie* to any pointer sized value. This value can be accessed during the lifetime of the context via **rpc\_gss\_getcred**().

## RETURN VALUES

Returns TRUE if the callback was registered successfully or FALSE otherwise

## SEE ALSO

[gssapi(3)](/gssapi/3.md), [rpc(3)](/rpc/3.md), [rpc\_gss\_getcred(3)](/rpc_gss_getcred/3.md), [rpcsec\_gss(3)](/rpcsec_gss/3.md)

## HISTORY

The **rpc\_gss\_set\_callback** function first appeared in FreeBSD 8.0.

## AUTHORS

This manual page was written by Doug Rabson ⟨*dfr@FreeBSD.org*⟩.

## BUGS

There is no mechanism for informing a server when a security context has been deleted. This makes it difficult to allocate resources (e.g. to return via the callback's *cookie* argument).
