gnutls_psk_server_get_username(3)

πŸ’– gnutls_psk_server_get_username(3) πŸ’–

okay bestie, so this one lives in the gnutls manual, and it's giving "who even are you, mysterious PSK peer" energy. Let's get into it 🫢


✨ NAME ✨

gnutls_psk_server_get_username β€” literally just an API function, no biggie, but it's the one that tells you who's on the other end of a PSK handshake πŸ’…


🌸 SYNOPSIS 🌸

#include <gnutls/gnutls.h>

const char * gnutls_psk_server_get_username(gnutls_session_t session);

look at that signature. clean. iconic. const char * and everything πŸŽ€


πŸ¦‹ ARGUMENTS πŸ¦‹

  • gnutls_session_t session β€” bestie, this is a gnutls session. that's it, that's the whole argument πŸ’–

✨ DESCRIPTION ✨

okay so listen πŸ‘‘ β€” you should only call this in case of PSK authentication, and only when you're the server. like, don't just be out here calling it whenever, it's not for that, no cap.

the pointer you get back? treat it as constant. do not free it, i'm so serious 😭. it stays valid for the lifetime of the session, so just vibe with it and don't touch.

and here's the plot twist πŸ’€ β€” this function will return NULL if the username has embedded NULL bytes. yeah. awkward. in that case you gotta use gnutls_psk_server_get_username2() instead to actually retrieve the username. that one's built different, it handles it. iykyk.


⭐ RETURNS ⭐

the username of the peer 🫢 β€” or NULL if there's an error, or if the username has embedded NULLs. so if you get NULL, don't panic, just check why πŸ’…


πŸ™ˆ REPORTING BUGS πŸ™ˆ

found a bug? not me gatekeeping that info β€” report it to <bugs@gnutls.org>.

home page: https://www.gnutls.org ✨


Copyright Β© 2001-2023 Free Software Foundation, Inc., and others.

copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. so basically, go off, just keep the receipts 🧚


🌈 SEE ALSO 🌈

the full documentation for gnutls is maintained as a Texinfo manual. if the /usr/share/doc/gnutls/ directory does not contain the HTML form, visit:

https://www.gnutls.org/manual/

and that's the whole page, bestie πŸ“ this was gnutls 3.8.13, gnutls_psk_server_get_username(3), signing off β€” stay constant, don't free, and always check for embedded NULLs πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from