libssh2_session_banner_get(3)

πŸ“¦
version 1.11.1 Β· 3 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, debian trixie, epel 10, epel 9, fedora 43, fedora 44, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– libssh2_session_banner_get(3) β€” the libssh2 manual πŸ’–

okay bestie, gather round, we're reading a manpage and honestly? it's a short one, we love that for us. this is libssh2_session_banner_get, and it's literally just here to hand you the remote banner. cute. simple. iconic. ✨


🌸 NAME 🌸

libssh2_session_banner_get β€” get the remote banner, that's it, that's the whole job πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <libssh2.h>

const char *
libssh2_session_banner_get(oLIBSSH2_SESSION *session);

(yes, the o is right there in the source, we don't ask questions, we just copy it exactly 🫢)


✨ DESCRIPTION ✨

so here's the vibe. once you've done your whole session setup thing and libssh2_session_handshake(3) has completed successfully β€” like, actually succeeded, no half-finished nonsense β€” then you can call this function.

and what does it do? it gets you the server id out of the banner that every server presents. every server shows up with a banner, it's like their little intro card, and this is how you read it. main character energy, honestly. πŸ‘‘


πŸŽ€ RETURN VALUE πŸŽ€

you get back a pointer to a string, or NULL if something failed 😭 (we don't love that for you, but it happens).

and listen, this part matters: the data that pointer points to is allocated and associated to the session handle. so don't you dare go freeing it yourself, bestie β€” libssh2 handles that, and it gets freed when libssh2_session_free(3) is used. it's giving "not your problem to clean up." periodt. πŸ’…


🌈 AVAILABILITY 🌈

Added in 1.4.0 β€” so if you're on something older, sorry babe, she's not there yet πŸ™ˆ


πŸ‘‘ SEE ALSO πŸ‘‘


ngl, the one thing to remember: handshake first, then read the banner, and never ever free the string yourself. libssh2_session_free(3) is the one who handles that. iykyk πŸ’–

and that's a wrap on this little page from the libssh2 manual, dated 9 Sep 2011, filed under libssh2_session_banner_get(3). slay, go read your server banners responsibly, mwah πŸŽ€πŸ¦‹πŸ’œ