---
name: "krb5_expand_hostname"
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_expand_hostname_realms"
---

# krb5\_expand\_hostname(3)

Kerberos 5 host name canonicalization functions

Part of [krb5\_expand\_hostname\_realms(3)](/krb5_expand_hostname_realms/3.md).

## NAME

**krb5\_expand\_hostname**, **krb5\_expand\_hostname\_realms** – Kerberos 5 host name canonicalization functions

## LIBRARY

Kerberos 5 Library (libkrb5, -lkrb5)

## SYNOPSIS

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

*krb5\_error\_code*\

**krb5\_expand\_hostname**(*krb5\_context context*, *const char \*orig\_hostname*, *char \*\*new\_hostname*);

*krb5\_error\_code*\

**krb5\_expand\_hostname\_realms**(*krb5\_context context*, *const char \*orig\_hostname*, *char \*\*new\_hostname*, *char \*\*\*realms*);

## DESCRIPTION

**krb5\_expand\_hostname**() tries to make *orig\_hostname* into a more canonical one in the newly allocated space returned in *new\_hostname*. Caller must free the hostname with [free(3)](/free/3.md).

**krb5\_expand\_hostname\_realms**() expands *orig\_hostname* to a name we believe to be a hostname in newly allocated space in *new\_hostname* and return the realms *new\_hostname* is belive to belong to in *realms*. *Realms* is a array terminated with NULL. Caller must free the *realms* with **krb5\_free\_host\_realm**() and *new\_hostname* with [free(3)](/free/3.md).

## SEE ALSO

[krb5(3)](/krb5/3.md), [krb5\_free\_host\_realm(3)](/krb5_free_host_realm/3.md), [krb5\_get\_host\_realm(3)](/krb5_get_host_realm/3.md), [kerberos(8)](/kerberos/8.md)
