---
name: "globus_gss_assist_init_sec_context_async"
section: "3"
platform: "linux"
package: "libglobus-gss-assist-doc"
version: "12.7-3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/globus_gss_assist_context"
---

# globus\_gss\_assist\_init\_sec\_context\_async(3)

Security Context Management - Security Context Creation and Use.

Part of [globus\_gss\_assist\_context(3)](/globus_gss_assist_context/3.md).

## NAME

globus\_gss\_assist\_context - Security Context Management

 \- Security Context Creation and Use.

## SYNOPSIS

### Functions

OM\_uint32 **globus\_gss\_assist\_accept\_sec\_context** (OM\_uint32 \*minor\_status, gss\_ctx\_id\_t \*context\_handle, const gss\_cred\_id\_t cred\_handle, char \*\*src\_name\_char, OM\_uint32 \*ret\_flags, int \*user\_to\_user\_flag, int \*token\_status, gss\_cred\_id\_t \*delegated\_cred\_handle, int(\*gss\_assist\_get\_token)(void \*, void \*\*, size\_t \*), void \*gss\_assist\_get\_context, int(\*gss\_assist\_send\_token)(void \*, void \*, size\_t), void \*gss\_assist\_send\_context)\
 Accept a Security Context.  OM\_uint32 **globus\_gss\_assist\_accept\_sec\_context\_async** (OM\_uint32 \*minor\_status, gss\_ctx\_id\_t \*context\_handle, const gss\_cred\_id\_t cred\_handle, char \*\*src\_name\_char, OM\_uint32 \*ret\_flags, int \*user\_to\_user\_flag, void \*input\_buffer, size\_t input\_buffer\_len, void \*\*output\_bufferp, size\_t \*output\_buffer\_lenp, gss\_cred\_id\_t \*delegated\_cred\_handle)\
 Accept a Security Context Without Blocking.  OM\_uint32 **globus\_gss\_assist\_export\_sec\_context** (OM\_uint32 \*minor\_status, gss\_ctx\_id\_t \*context\_handle, int \*token\_status, int fdp, FILE \*fperr)\
 OM\_uint32 **globus\_gss\_assist\_import\_sec\_context** (OM\_uint32 \*minor\_status, gss\_ctx\_id\_t \*context\_handle, int \*token\_status, int fdp, FILE \*fperr)\
 OM\_uint32 **globus\_gss\_assist\_init\_sec\_context** (OM\_uint32 \*minor\_status, const gss\_cred\_id\_t cred\_handle, gss\_ctx\_id\_t \*context\_handle, char \*target\_name\_char, OM\_uint32 req\_flags, OM\_uint32 \*ret\_flags, int \*token\_status, int(\*gss\_assist\_get\_token)(void \*, void \*\*, size\_t \*), void \*gss\_assist\_get\_context, int(\*gss\_assist\_send\_token)(void \*, void \*, size\_t), void \*gss\_assist\_send\_context)\
 OM\_uint32 **globus\_gss\_assist\_init\_sec\_context\_async** (OM\_uint32 \*minor\_status, const gss\_cred\_id\_t cred\_handle, gss\_ctx\_id\_t \*context\_handle, char \*target\_name\_char, OM\_uint32 req\_flags, OM\_uint32 \*ret\_flags, void \*input\_buffer, size\_t input\_buffer\_len, void \*\*output\_bufferp, size\_t \*output\_buffer\_lenp)\
 OM\_uint32 **globus\_gss\_assist\_will\_handle\_restrictions** (OM\_uint32 \*minor\_status, gss\_ctx\_id\_t \*context\_handle)\
 OM\_uint32 **globus\_gss\_assist\_get\_unwrap** (OM\_uint32 \*minor\_status, const gss\_ctx\_id\_t context\_handle, char \*\*data, size\_t \*length, int \*token\_status, int(\*gss\_assist\_get\_token)(void \*, void \*\*, size\_t \*), void \*gss\_assist\_get\_context, FILE \*fperr)\
 Get Unwrap.

## Detailed Description

Security Context Creation and Use.

The functions in this section are used to create security contexts and send and receive messages sent over them. They use the functions provided by **Token Transport** or user-supplied functions to communicate security tokens over the context, looping over continue results from the GSSAPI as needed.

## Function Documentation

### OM\_uint32 globus\_gss\_assist\_accept\_sec\_context (OM\_uint32 \* minor\_status, gss\_ctx\_id\_t \* context\_handle, const gss\_cred\_id\_t cred\_handle, char \*\* src\_name\_char, OM\_uint32 \* ret\_flags, int \* user\_to\_user\_flag, int \* token\_status, gss\_cred\_id\_t \* delegated\_cred\_handle, int(\*)(void \*, void \*\*, size\_t \*) gss\_assist\_get\_token, void \* gss\_assist\_get\_context, int(\*)(void \*, void \*, size\_t) gss\_assist\_send\_token, void \* gss\_assist\_send\_context)

Accept a Security Context. This routine accepts a GSSAPI security context and is called by the gram\_gatekeeper. It isolates the GSSAPI from the rest of the gram code.

Initialize a GSSAPI security connection. Used by the server. The context\_handle is returned, and there is one for each connection. This routine will take cake of the looping and token processing, using the supplied get\_token and send\_token routines.

**Parameters**

*minor\_status* GSSAPI return code \
 *context\_handle* pointer to returned context. \
 *cred\_handle* the cred handle obtained by acquire\_cred. \
 *src\_name\_char* Pointer to char string representation of the client which contacted the server. Maybe NULL if not wanted. Should be freed when done. \
 *ret\_flags* Pointer to which services are available after the connection is established. Maybe NULL if not wanted. We will also use this to pass in flags to the globus version of GSSAPI \
 *user\_to\_user\_flag* Pointer to flag to be set if the src\_name is the same as our name. (Following are particular to this assist routine) \
 *token\_status* assist routine get/send token status \
 *delegated\_cred\_handle* pointer to be set to the credential delegated by the client if delegation occurs during the security handshake \
 *gss\_assist\_get\_token* a get token routine \
 *gss\_assist\_get\_context* first arg for the get token routine \
 *gss\_assist\_send\_token* a send token routine \
 *gss\_assist\_send\_context* first arg for the send token routine

**Returns**

GSS\_S\_COMPLETE on success Other GSSAPI errors on failure.

### OM\_uint32 globus\_gss\_assist\_accept\_sec\_context\_async (OM\_uint32 \* minor\_status, gss\_ctx\_id\_t \* context\_handle, const gss\_cred\_id\_t cred\_handle, char \*\* src\_name\_char, OM\_uint32 \* ret\_flags, int \* user\_to\_user\_flag, void \* input\_buffer, size\_t input\_buffer\_len, void \*\* output\_bufferp, size\_t \* output\_buffer\_lenp, gss\_cred\_id\_t \* delegated\_cred\_handle)

Accept a Security Context Without Blocking. This is an asynchronous version of the **globus\_gss\_assist\_accept\_sec\_context()** function. Instead of looping itself it passes in and out the read and written buffers and the calling application is responsible for doing the I/O directly.

**Parameters**

*minor\_status* GSSAPI return code \
 *context\_handle* pointer to returned context. \
 *cred\_handle* the cred handle obtained by acquire\_cred. \
 *src\_name\_char* Pointer to char string representation of the client which contacted the server. Maybe NULL if not wanted. Should be freed when done. \
 *ret\_flags* Pointer to which services are available after the connection is established. Maybe NULL if not wanted. We will also use this to pass in flags to the Globus version of GSSAPI \
 *user\_to\_user\_flag* Pointer to flag to be set if the src\_name is the same as our name. \
 *input\_buffer* pointer to a buffer received from peer. \
 *input\_buffer\_len* length of the buffer input\_buffer. \
 *output\_bufferp* pointer to a pointer which will be filled in with a pointer to an allocated block of memory. If non-NULL the contents of this block should be written to the peer where they will be fed into the **globus\_gss\_assist\_init\_sec\_context\_async()** function. \
 *output\_buffer\_lenp* pointer to an integer which will be filled in with the length of the allocated output buffer pointed to by \*output\_bufferp. \
 *delegated\_cred\_handle* pointer to be set to the credential delegated by the client if delegation occurs during the security handshake

**Returns**

GSS\_S\_COMPLETE on successful completion when this function does not need to be called again.

GSS\_S\_CONTINUE\_NEEDED when \*output\_bufferp should be sent to the peer and a new input\_buffer read and this function called again.

Other GSSAPI errors on failure.

### OM\_uint32 globus\_gss\_assist\_export\_sec\_context (OM\_uint32 \* minor\_status, gss\_ctx\_id\_t \* context\_handle, int \* token\_status, int fdp, FILE \* fperr)

Export the security context from a file

**Parameters**

*minor\_status* GSSAPI return code. This is a Globus Error code (or GLOBUS\_SUCCESS) cast to a OM\_uint32 pointer. If an error has occurred, the resulting error (from calling globus\_error\_get on this variable) needs to be freed by the caller \
 *context\_handle* The context to export \
 *token\_status* Errors that occurred while reading from the file \
 *fdp* the file descriptor pointing to a file containing the security context \
 *fperr* FILE \* to write error messages

**Returns**

the major status

### OM\_uint32 globus\_gss\_assist\_get\_unwrap (OM\_uint32 \* minor\_status, const gss\_ctx\_id\_t context\_handle, char \*\* data, size\_t \* length, int \* token\_status, int(\*)(void \*, void \*\*, size\_t \*) gss\_assist\_get\_token, void \* gss\_assist\_get\_context, FILE \* fperr)

Get Unwrap. Gets a token using the specific tokenizing functions, and performs the GSS unwrap of that token

**See also**

gss\_unwrap

**Parameters**

*minor\_status* GSSAPI return code,

**See also**

gss\_unwrap

**Parameters**

*context\_handle* the context \
 *data* pointer to be set to the unwrapped application data. This must be freed by the caller. \
 *length* pointer to be set to the length of the *data* byte array. \
 *token\_status* assist routine get/send token status \
 *gss\_assist\_get\_token* a detokenizing routine \
 *gss\_assist\_get\_context* first arg for above routine \
 *fperr* error stream to print to

**Returns**

GSS\_S\_COMPLETE on success Other gss errors on failure. \

### OM\_uint32 globus\_gss\_assist\_import\_sec\_context (OM\_uint32 \* minor\_status, gss\_ctx\_id\_t \* context\_handle, int \* token\_status, int fdp, FILE \* fperr)

Import the security context from a file

**Parameters**

*minor\_status* GSSAPI return code. This is a Globus Error code (or GLOBUS\_SUCCESS) cast to a OM\_uint32 pointer. If an error has occurred, the resulting error (from calling globus\_error\_get on this variable) needs to be freed by the caller \
 *context\_handle* The imported context \
 *token\_status* Errors that occurred while reading from the file \
 *fdp* the file descriptor pointing to a file containing the security context \
 *fperr* FILE \* to write error messages

**Returns**

the major status

### OM\_uint32 globus\_gss\_assist\_init\_sec\_context (OM\_uint32 \* minor\_status, const gss\_cred\_id\_t cred\_handle, gss\_ctx\_id\_t \* context\_handle, char \* target\_name\_char, OM\_uint32 req\_flags, OM\_uint32 \* ret\_flags, int \* token\_status, int(\*)(void \*, void \*\*, size\_t \*) gss\_assist\_get\_token, void \* gss\_assist\_get\_context, int(\*)(void \*, void \*, size\_t) gss\_assist\_send\_token, void \* gss\_assist\_send\_context)

Initialize a GSSAPI security connection. Used by the client. The context\_handle is returned, and there is one for each connection. This routine will take cake of the looping and token processing, using the supplied get\_token and send\_token routines.

**Parameters**

*minor\_status* GSSAPI return code. The new minor\_status is a globus\_result\_t cast to an OM\_uint32. If the call was successful, the minor status is equivalent to GLOBUS\_SUCCESS. Otherwise, it is a globus error object ID that can be passed to globus\_error\_get to get the error object. The error object needs to be freed with globus\_object\_free. \
 *cred\_handle* the cred handle obtained by acquire\_cred. \
 *context\_handle* pointer to returned context. \
 *target\_name\_char* char string representation of the server to be contacted. \
 *req\_flags* request flags, such as GSS\_C\_DELEG\_FLAG for delegation and the GSS\_C\_MUTUAL\_FLAG for mutual authentication. \
 *ret\_flags* Pointer to which services are available after the connection is established. Maybe NULL if not wanted.

The following are particular to this assist routine:

**Parameters**

*token\_status* the assist routine's get/send token status \
 *gss\_assist\_get\_token* function pointer for getting the token \
 *gss\_assist\_get\_context* first argument passed to the gss\_assist\_get\_token function \
 *gss\_assist\_send\_token* function pointer for setting the token \
 *gss\_assist\_send\_context* first argument passed to the gss\_assist\_set\_token function pointer

**Returns**

The major status

### OM\_uint32 globus\_gss\_assist\_init\_sec\_context\_async (OM\_uint32 \* minor\_status, const gss\_cred\_id\_t cred\_handle, gss\_ctx\_id\_t \* context\_handle, char \* target\_name\_char, OM\_uint32 req\_flags, OM\_uint32 \* ret\_flags, void \* input\_buffer, size\_t input\_buffer\_len, void \*\* output\_bufferp, size\_t \* output\_buffer\_lenp)

This is an asynchronous version of the **globus\_gss\_assist\_init\_sec\_context()** function. Instead of looping itself it passes in and out the read and written buffers and the calling application is responsible for doing the I/O directly.

**Parameters**

*minor\_status* GSSAPI return code. The new minor status is a globus\_result\_t cast to a OM\_uint32. If an error occurred (GSS\_ERROR(major\_status)) the minor\_status is a globus error object id. The error object can be obtained via globus\_error\_get and should be destroyed with globus\_object\_free when no longer needed. If no error occurred, the minor status is equal to GLOBUS\_SUCCESS. \
 *cred\_handle* the cred handle obtained by acquire\_cred. \
 *context\_handle* pointer to returned context. \
 *target\_name\_char* char string representation of the server to be contacted. \
 *req\_flags* request flags, such as GSS\_C\_DELEG\_FLAG for delegation and the GSS\_C\_MUTUAL\_FLAG for mutual authentication. \
 *ret\_flags* Pointer to which services are available after the connection is established. Maybe NULL if not wanted. \
 *input\_buffer* pointer to a buffer received from peer. Should be NULL on first call. \
 *input\_buffer\_len* length of the buffer input\_buffer. Should be zero on first call. \
 *output\_bufferp* pointer to a pointer which will be filled in with a pointer to an allocated block of memory. If non-NULL the contents of this block should be written to the peer where they will be fed into the **globus\_gss\_assist\_accept\_sec\_context\_async()** function. \
 *output\_buffer\_lenp* pointer to an integer which will be filled in with the length of the allocated output buffer pointed to by \*output\_bufferp.

**Returns**

GSS\_S\_COMPLETE on successful completion when this function does not need to be called again.

GSS\_S\_CONTINUE\_NEEDED when \*output\_bufferp should be sent to the peer and a new input\_buffer read and this function called again.

Other gss errors on failure.

### OM\_uint32 globus\_gss\_assist\_will\_handle\_restrictions (OM\_uint32 \* minor\_status, gss\_ctx\_id\_t \* context\_handle)

Sets the context to handle restrictions

**Parameters**

*minor\_status* the resulting minor status from setting the context handle \
 *context\_handle* the context handle to set the minor status of

**Returns**

the major status from setting the context

## Author

Generated automatically by Doxygen for globus\_gss\_assist from the source code.
