---
name: "krb5_ticket_get_server"
section: "3"
platform: "linux"
package: "heimdal-dev"
version: "1.2.dfsg.1-2.1+lenny1"
release: "Debian 5.0 (Lenny)"
platforms: ["linux"]
url: "https://new.carta.tech/krb5_copy_ticket"
---

# krb5\_ticket\_get\_server(3)

Kerberos 5 ticket access and handling functions

Part of [krb5\_copy\_ticket(3)](/krb5_copy_ticket/3.md).

## NAME

**krb5\_ticket**, **krb5\_free\_ticket**, **krb5\_copy\_ticket**, **krb5\_ticket\_get\_authorization\_data\_type**, **krb5\_ticket\_get\_client**, **krb5\_ticket\_get\_server**, **krb5\_ticket\_get\_endtime** – Kerberos 5 ticket access and handling functions

## LIBRARY

Kerberos 5 Library (libkrb5, -lkrb5)

## SYNOPSIS

**#include \<krb5.h\>**

krb5\_ticket;

*krb5\_error\_code*\

**krb5\_free\_ticket**(*krb5\_context context*, *krb5\_ticket \*ticket*);

*krb5\_error\_code*\

**krb5\_copy\_ticket**(*krb5\_context context*, *const krb5\_ticket \*from*, *krb5\_ticket \*\*to*);

*krb5\_error\_code*\

**krb5\_ticket\_get\_authorization\_data\_type**(*krb5\_context context*, *krb5\_ticket \*ticket*, *int type*, *krb5\_data \*data*);

*krb5\_error\_code*\

**krb5\_ticket\_get\_client**(*krb5\_context context*, *const krb5\_ticket \*ticket*, *krb5\_principal \*client*);

*krb5\_error\_code*\

**krb5\_ticket\_get\_server**(*krb5\_context context*, *const krb5\_ticket \*ticket*, *krb5\_principal \*server*);

*time\_t*\

**krb5\_ticket\_get\_endtime**(*krb5\_context context*, *const krb5\_ticket \*ticket*);

## DESCRIPTION

krb5\_ticket holds a kerberos ticket. The internals of the structure should never be accessed directly, functions exist for extracting information.

**krb5\_free\_ticket**() frees the *ticket* and its content. Used to free the result of **krb5\_copy\_ticket**() and **krb5\_recvauth**().

**krb5\_copy\_ticket**() copies the content of the ticket *from* to the ticket *to*. The result *to* should be freed with **krb5\_free\_ticket**().

**krb5\_ticket\_get\_authorization\_data\_type**() fetches the authorization data of the type *type* from the *ticket*. If there isn't any authorization data of type *type*, ENOENT is returned. *data* needs to be freed with **krb5\_data\_free**() on success.

**krb5\_ticket\_get\_client**() and **krb5\_ticket\_get\_server**() returns a copy of the client/server principal from the ticket. The principal returned should be free using [krb5\_free\_principal(3)](/krb5_free_principal/3.md).

**krb5\_ticket\_get\_endtime**() return the end time of the ticket.

## SEE ALSO

[krb5(3)](/krb5/3.md)
