KRB5_GET_KRBHST(3)
π KRB5_GET_KRBHST π
okay bestie, welcome to the krb5_get_krbhst(3) page β it's a library functions manual situation and honestly? it's giving vintage. we're in the Kerberos 5 Library today and we're looking up KDC hosts like it's our job. π
β¨ 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) β yeah she lives in libkrb5, link her with -lkrb5 and you're set π«Ά
πΈ 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 π
So these functions are the old API for getting a list of Kerberos hosts, which means they're basically cousins to the krb5_krbhst_init() functions. Similar vibe, different era. π«
But here's the tea: because these functions return all the hosts in one go, they might have to do more lookups than necessary. Not a scandal, just how it is. They stick around for compatibility reasons β legacy icon behaviour, no cap.
After you call one of these functions, hostlist is a NULL terminated list of strings pointing at the requested Kerberos hosts. So it's a whole list, terminated by NULL, pointing to the hosts you asked for. π―
And bestie, PLEASE free it with krb5_free_krbhst() when you're done with it. Memory leaks are not the vibe. π«π§
π EXAMPLES π
This little cutie prints the KDCs of the realm βMY.REALMβ. Periodt.
char **hosts, **p;
krb5_get_krbhst(context, "MY.REALM", &hosts);
for(p = hosts; *p; p++)
printf("%s\n", *p);
krb5_free_krbhst(context, hosts);
look at her go π¦ β grab the list, loop through it, print every single one, then clean up like a responsible main character.
π SEE ALSO π
krb5_krbhst_init(3)β the newer, shinier sibling, iykyk π
that's the whole page bestie, you ate that πβ¨
this one's from the HEIMDAL source, dated April 24, 2005 β yeah she's an elder but she still serves π π
π¦ where this page comes from
- alpine 3.22: heimdal-doc 7.8.0-r4 Β· BSD-3-Clause
- alpine 3.23: heimdal-doc 7.8.0-r5 Β· BSD-3-Clause
- alpine 3.24: heimdal-doc 7.8.0-r5 Β· BSD-3-Clause
- debian bookworm: heimdal-dev 7.8.git20221117.28daf24+dfsg-2 Β· BSD-3-Clause
- debian trixie: heimdal-dev 7.8.git20221117.28daf24+dfsg-9+deb13u1 Β· BSD-3-Clause
- epel 10: heimdal-devel 7.8.0-26.el10_2 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- epel 9: heimdal-devel 7.8.0-5.el9 Β· BSD and MIT
- fedora 43: heimdal-devel 7.8.0-26.fc43 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 43: heimdal-devel 7.8.0-26.fc43 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 44: heimdal-devel 7.8.0-26.fc43 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 44: heimdal-devel 7.8.0-26.fc43 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 44: heimdal-devel 7.8.0-28.fc44 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 44: heimdal-devel 7.8.0-28.fc44 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- freebsd 14.5: base 14.5
- nixpkgs unstable: heimdal 7.8.0-unstable-2024-09-10
- ubuntu jammy: heimdal-dev 7.7.0+dfsg-3ubuntu1 Β· BSD-3-Clause
- ubuntu noble: heimdal-dev 7.8.git20221117.28daf24+dfsg-5ubuntu3 Β· BSD-3-Clause
- ubuntu questing: heimdal-dev 7.8.git20221117.28daf24+dfsg-9ubuntu1
- ubuntu resolute: heimdal-dev 7.8.git20221117.28daf24+dfsg-11ubuntu1 Β· BSD-3-Clause
- ubuntu stonking: heimdal-dev 7.8.git20240113.1b4565a+dfsg-2ubuntu1 Β· BSD-3-Clause
- Copyright (c) 2001 Kungliga Tekniska HΓΆgskolan
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms