KRB5_SET_DEFAULT_REALM(3)
β¨ KRB5_SET_DEFAULT_REALM(3) β¨
okay so bestie, we're in the Library Functions Manual today and this page is literally about default and host realm read and manipulation routines β the KRB5_SET_DEFAULT_REALM(3) of it all. Kerberos realms, babes. Let's get into it π
π NAME π
krb5_copy_host_realm, krb5_free_host_realm, krb5_get_default_realm, krb5_get_default_realms, krb5_get_host_realm, krb5_set_default_realm β default and host realm read and manipulation routines
π¦ LIBRARY π¦
Kerberos 5 Library (libkrb5, -lkrb5)
πΈ SYNOPSIS πΈ
#include <krb5.h>
krb5_error_code
krb5_copy_host_realm(krb5_context context, const krb5_realm *from,
krb5_realm **to);
krb5_error_code
krb5_free_host_realm(krb5_context context, krb5_realm *realmlist);
krb5_error_code
krb5_get_default_realm(krb5_context context, krb5_realm *realm);
krb5_error_code
krb5_get_default_realms(krb5_context context, krb5_realm **realm);
krb5_error_code
krb5_get_host_realm(krb5_context context, const char *host,
krb5_realm **realms);
krb5_error_code
krb5_set_default_realm(krb5_context context, const char *realm);
π DESCRIPTION π
π«Ά the realm shuffle
krb5_copy_host_realm() copies the list of realms from from to to. and the way that to is now your problem, bestie β the caller has to free it with krb5_free_host_realm. no cap, it's giving "you break it, you buy it" π
krb5_free_host_realm() frees all memory allocated by realmlist. that's it, that's the whole job, and honestly? iconic. clean up after yourself, queen π
krb5_get_default_realm() returns the first default realm for this host. the realm it hands you should be freed with krb5_xfree(). not krb5_free_host_realm, not vibes, krb5_xfree(). iykyk β¨
krb5_get_default_realms() (plural, we love a plot twist) returns a NULL terminated list of default realms for this context. and the realms it returns should be freed with krb5_free_host_realm(). yes, different from the one above. no, i don't make the rules π₯²
krb5_get_host_realm() returns a NULL terminated list of realms for host, and it does that by looking up the info in the [domain_realm] in krb5.conf or in DNS. and here's the cute little easter egg: if the mapping in [domain_realm] results in the string dns_locate, then DNS is used to look up the realm. periodt π«
π dns detective work, a saga
when it's using DNS to resolve the domain for the host a.b.c, krb5_get_host_realm() goes looking for a TXT resource record named _kerberos.a.b.c. and if it doesn't find it? it strips off the first component and tries again (_kerberos.b.c) β and it just keeps doing that, climbing and climbing, until it reaches the root. main character energy fr fr π₯
if there's no configuration or DNS information found, krb5_get_host_realm() assumes it can use the domain part of the host to form a realm. and the caller must free realmlist with krb5_free_host_realm(). every single time. don't skip it π
π setting the default realm
krb5_set_default_realm() sets the default realm for the context. and here's the fallback chain, bestie, write it down:
- if
NULLis used as a realm, the[libdefaults]default_realmstanza inkrb5.confis used π - if there is no such stanza in the configuration file, the
krb5_get_host_realm()function is used to form a default realm π¦
three layers deep. it's giving backup plan for the backup plan. slay π
β SEE ALSO β
ok bestie that's the whole page, go forth and manage your realms responsibly π«Άβ¨
HEIMDAL Β· April 24, 2005 Β· that's the source, the version and the date, mwah, love u, bye ππ
π¦ 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
- 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) 2003 - 2005 Kungliga Tekniska HΓΆgskolan
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms