---
name: "krb5_get_krb524hst"
section: "3"
platform: "linux"
package: "heimdal-dev"
version: "7.8.git20221117.28daf24+dfsg-9+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/krb5_get_krb524hst"
---

# krb5\_get\_krb524hst(3)

lookup Kerberos KDC hosts

## NAME

**krb5\_get\_krbhst**, **krb5\_get\_krb\_admin\_hst**, **krb5\_get\_krb\_changepw\_hst**, **krb5\_get\_krb524hst**, **krb5\_free\_krbhst** – lookup Kerberos KDC hosts

## LIBRARY

Kerberos 5 Library (libkrb5, -lkrb5)

## SYNOPSIS

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

*krb5\_error\_code*\

**krb5\_get\_krbhst**(*krb5\_context context*, *const krb5\_realm \*realm*, *char \*\*\*hostlist*);

*krb5\_error\_code*\

**krb5\_get\_krb\_admin\_hst**(*krb5\_context context*, *const krb5\_realm \*realm*, *char \*\*\*hostlist*);

*krb5\_error\_code*\

**krb5\_get\_krb\_changepw\_hst**(*krb5\_context context*, *const krb5\_realm \*realm*, *char \*\*\*hostlist*);

*krb5\_error\_code*\

**krb5\_get\_krb524hst**(*krb5\_context context*, *const krb5\_realm \*realm*, *char \*\*\*hostlist*);

*krb5\_error\_code*\

**krb5\_free\_krbhst**(*krb5\_context context*, *char \*\*hostlist*);

## DESCRIPTION

These functions implement the old API to get a list of Kerberos hosts, and are thus similar to the **krb5\_krbhst\_init**() functions. However, since these functions returns *all* hosts in one go, they potentially have to do more lookups than necessary. These functions remain for compatibility reasons.

After a call to one of these functions, *hostlist* is a NULL terminated list of strings, pointing to the requested Kerberos hosts. These should be freed with **krb5\_free\_krbhst**() when done with.

## EXAMPLES

The following code will print the KDCs of the realm “MY.REALM”.

```
char **hosts, **p;
krb5_get_krbhst(context, "MY.REALM", &hosts);
for(p = hosts; *p; p++)
    printf("%s\n", *p);
krb5_free_krbhst(context, hosts);
```

## SEE ALSO

[krb5\_krbhst\_init(3)](/krb5_krbhst_init/3.md)
