nbd_set_tls_verify_peer(3)

πŸ’… nbd_set_tls_verify_peer(3) β€” like, the libnbd manual, but make it make sense

okay so bestie, welcome to the LIBNBD corner of the man pages πŸŽ€ this one is all about nbd_set_tls_verify_peer β€” say that five times fast, i dare you β€” and it's genuinely important if you care whether the server you're talking to is actually who it says it is. spoiler: you should care. πŸ¦‹


✨ NAME ✨

nbd_set_tls_verify_peer β€” set whether we verify the identity of the server πŸ‘‘

like, do we trust this server or not. that's the whole vibe check.


🌸 SYNOPSIS 🌸

#include <libnbd.h>

int nbd_set_tls_verify_peer (
      struct nbd_handle *h, bool verify
    );

she's small, she's cute, she takes a handle and a bool. iconic behavior honestly.


πŸ’– DESCRIPTION πŸ’–

okay so, real talk: you set this flag to control whether libnbd will verify the identity of the server, using the server's certificate plus the certificate authority. that's it, that's the whole function. 🫢

the default is lowkey smart: it defaults to true when you're connecting to TCP servers using TLS certificate authentication, and false otherwise. so if you're doing the certificate thing, libnbd is already looking out for you β€” no cap. πŸ”₯

this function may be called regardless of whether TLS is supported, but β€” and this is the part where you pay attention, bestie 😭 β€” it will have no effect unless nbd_set_tls(3) is also used to request or require TLS. like, you can flip this switch all you want, but if TLS isn't even turned on, the switch is just... decor. πŸŽ€


⭐ RETURN VALUE ⭐

if the call is successful the function returns 0. slay. ✨


πŸ’€ ERRORS πŸ’€

on error -1 is returned. rude, but okay. πŸ™ˆ

refer to "ERROR HANDLING" in libnbd(3) for how to get further details of the error β€” that's where the actual tea is.

the following parameters must not be NULL: "h". like, do NOT pass a NULL handle, that's not the move. for more information see "Non-NULL parameters" in libnbd(3).


πŸ‘‘ HANDLE STATE πŸ‘‘

nbd_set_tls_verify_peer can be called when the handle is in the following state:

  • βœ… Handle created, before connecting β€” allowed, this is your moment
  • ❌ Connecting β€” error
  • ❌ Connecting & handshaking (opt_mode) β€” error
  • ❌ Connected to the server β€” error
  • ❌ Connection shut down β€” error
  • ❌ Handle dead β€” error

so basically: before you connect, or nothing. it's giving "you had one shot" energy. πŸ’…


πŸ¦‹ VERSION πŸ¦‹

this function first appeared in libnbd 1.0. a classic, an OG, a main character. 🌟

if you need to test if this function is available at compile time, check if the following macro is defined:

#define LIBNBD_HAVE_NBD_SET_TLS_VERIFY_PEER 1

🌈 SEE ALSO 🌈

(the get one is right there if you ever wanna peek at what you set, iykyk πŸ‘€)


πŸ“ AUTHORS πŸ“

  • Eric Blake
  • Richard W.M. Jones

legends, honestly. 🫑


Copyright Red Hat


πŸ’œ LICENSE πŸ’œ

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA


okay that's the whole page, bestie, you ate that 🫢 this was libnbd-1.25.8, dated 2026-10-13, and the page is nbd_set_tls_verify_peer(3) β€” mwah, go verify some peers responsibly πŸ’‹βœ¨

πŸ“¦ where this page comes from