libssh2_userauth_banner(3)

πŸ“¦
version 1.11.1 Β· 2 versions
  • 1.11.1 Β· 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 (latest)
  • 1.11.0 Β· ubuntu noble
, 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_userauth_banner β€” bestie's guide to the manual page

okay so this is part of the libssh2 manual, page libssh2_userauth_banner(3), and we're about to get the server's userauth banner message. yes it's giving "wait what's a banner" but stay with me, it's cute I promise πŸŽ€


✨ NAME ✨

libssh2_userauth_banner β€” get the server's userauth banner message πŸ’Œ


🌸 SYNOPSIS 🌸

#include <libssh2.h>

int
libssh2_userauth_banner(LIBSSH2_SESSION *session, char **banner);

like... that's it. that's the whole vibe. two args, one int, no cap.


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so the args, bestie, let's go:

  • session β€” this is your Session instance, the one you already got back from libssh2_session_init_ex(3). it's literally your whole connection's main character πŸ‘‘
  • banner β€” should point to a pointer that gets filled with the banner message. yes, a pointer to a pointer. it's giving inception but make it C πŸ™ˆ

so here's the tea: after an authentication has been attempted β€” like an SSH_USERAUTH_NONE request sent by libssh2_userauth_list(3) β€” then you can call this function to retrieve the userauth banner the server sent you. that's the whole point of it. 🫢

but listen. if no such banner was sent, or if an authentication hasn't even been attempted yet? it returns LIBSSH2_ERROR_MISSING_USERAUTH_BANNER. like it's literally telling you "girl, there's nothing here." πŸ’€

fr fr don't call this before you've attempted auth. it will NOT be the moment you wanted.

πŸ’– RETURN VALUE πŸ’–

  • On success it returns 0, and an UTF-8 NUL-terminated string is stored in the banner. iconic ✨
  • that string is internally managed by libssh2 and will be deallocated upon session termination. so do NOT free it yourself, bestie. don't do it. that's not your job, that's libssh2's job. 🧚
  • On failure it returns LIBSSH2_ERROR_MISSING_USERAUTH_BANNER. we've been over this. no banner, no vibes. 😭

🌈 SEE ALSO 🌈


and that's the whole page, periodt. πŸ’… this one's from libssh2 1.9.0, dated 1 Jun 2021 β€” oldie but a goodie, lowkey timeless, and it ate. mwah πŸ«ΆπŸ’œ