gnutls_psk_server_get_username2(3)

πŸ’– gnutls_psk_server_get_username2(3) πŸ’–

okay bestie, so this one lives in the gnutls manual (yes, that gnutls, the TLS library, we're being ✨secure✨ today), and it's genuinely such a handy little function, you're gonna love her.


🌸 NAME 🌸

gnutls_psk_server_get_username2 β€” it's an API function, and it's the one you call when you're the server and you wanna know who just showed up with a PSK πŸ‘€


✨ SYNOPSIS ✨

#include <gnutls/gnutls.h>

int gnutls_psk_server_get_username2(gnutls_session_t session,
gnutls_datum_t * username);

πŸŽ€ ARGUMENTS πŸŽ€

  • gnutls_session_t session β€” it's a gnutls session, babe. that's the whole vibe. it's the session you're asking about.
  • gnutls_datum_t * username β€” a datum that this function is gonna fill in for you. you hand it over empty, she hands it back with the goods 🫢

πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the tea: this function returns a pointer to the username of the peer, tucked into the datum you supplied. And no, it does not need to be null-terminated β€” do not come for her about that, she's fine as she is πŸ’…

Heads up bestie: you should only call this in case of PSK authentication, and only in case of a server. Like, if you're the client, this is not your moment. Read the room 🚫

Also important, and I need you to hear me on this one: the returned pointer should be considered constant β€” as in do not free it β€” and it stays valid for the lifetime of the session. So don't you dare free() her, she's not yours to free, she's a guest in the session's house 🏠✨


⭐ RETURNS ⭐

You get GNUTLS_E_SUCCESS when everything slays, or a negative value in case of an error. Negative = bad vibes = go check your error handling, fr fr 😭


πŸ’€ REPORTING BUGS πŸ’€

Found something cursed? Report bugs to <bugs@gnutls.org>.

Home page: https://www.gnutls.org

(they actually wanna hear about it, no gatekeeping πŸ”₯)


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. periodt. πŸ’œ


🌈 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/


okay that's the whole page, you ate that πŸ“ this was gnutls version 3.8.13, and like every good group chat, this manual page is signed off with love and also with the exact same name it came in with β€” gnutls_psk_server_get_username2(3). mwah πŸ’–πŸ§šβœ¨

πŸ“¦ where this page comes from