KRB5_SET_DEFAULT_REALM(3)

πŸ“¦
version 7.8.0 Β· 2 versions
  • 7.8.0 Β· alpine 3.22, alpine 3.23, alpine 3.24, debian bookworm, debian trixie, epel 10, epel 9, fedora 43, fedora 44, nixpkgs unstable, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 14.5 Β· freebsd 14.5
, in alpine 3.22, alpine 3.23, alpine 3.24, debian bookworm, debian trixie, epel 10, epel 9, fedora 43, fedora 44, nixpkgs unstable, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ 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 NULL is used as a realm, the [libdefaults]default_realm stanza in krb5.conf is 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