KRB5_GET_ADDRS(3)

✨ KRB5_GET_ADDRS ✨

okay bestie, so this is a page from the Kerberos 5 Library β€” that's libkrb5, linked with -lkrb5 β€” and it's literally all about finding out what addresses your local host is repping. two functions, both iconic, both your new faves πŸ’…


🌸 NAME 🌸

krb5_get_all_client_addrs, krb5_get_all_server_addrs β€” return local addresses

like. they get you the addresses. the local ones. that's the whole vibe. 🫢


πŸ“š LIBRARY πŸ“š

Kerberos 5 Library β€” libkrb5, -lkrb5


πŸŽ€ SYNOPSIS πŸŽ€

#include <krb5.h>

krb5_error_code
krb5_get_all_client_addrs(krb5_context context, krb5_addresses *addrs);

krb5_error_code
krb5_get_all_server_addrs(krb5_context context, krb5_addresses *addrs);

no cap, that's it. two calls, both taking a krb5_context context and a krb5_addresses *addrs, both handing you back a krb5_error_code so you can vibe-check whether it worked. ✨


πŸ’– DESCRIPTION πŸ’–

so here's the tea πŸ“ β€” these functions return in addrs a list of addresses associated with the local host. that's it, that's the core.

now let's talk about the two of them, because they are NOT the same girl. 😌

πŸ‘‘ the server variant

krb5_get_all_server_addrs returns all configured interface addresses (if possible), and yes bestie, it includes loop-back addresses. this is the one you want if you're about to create sockets to listen to. it's giving main character energy, it's giving "i am the host, hear me roar." πŸ”₯

πŸ¦‹ the client variant

krb5_get_all_client_addrs will also scan local interfaces β€” but lowkey you can turn that off by setting libdefaults/scan_interfaces to false in krb5.conf. and here's the key difference, don't miss it:

  • it will not include loop-back addresses… unless there are no other addresses found. (pity loopback, honestly. it only shows up when nobody else does. 😭)
  • it will remove all addresses included in libdefaults/ignore_addresses β€” like, blocked, unfollowed, done. πŸ™ˆ
  • but it will unconditionally include addresses in libdefaults/extra_addresses. no questions asked. those are the ride-or-dies. πŸ’œ

⚠️ okay this part is IMPORTANT, do not skip it: the returned addresses should be freed by calling krb5_free_addresses(). don't just leave them lying around, bestie, that's not the move. free your memory. it's self-care. 🧚

πŸ” SEE ALSO πŸ”


and that's the whole page!! πŸ’– this one's from HEIMDAL, dated July 1, 2001 β€” yeah, it's an elder but she still slays, periodt. πŸ‘‘βœ¨ go get those addresses, bestie, and remember to free them. iykyk. πŸŽ€

πŸ“¦ where this page comes from