nbd_set_tls_certificates(3)
π nbd_set_tls_certificates β a libnbd(3) glow-up π
okay so bestie, we're diving into nbd_set_tls_certificates from the libnbd manual, section 3. she's a little function with one job and she does it immaculately. let's get into it π
β¨ NAME β¨
nbd_set_tls_certificates β literally just sets the path to the TLS certificates directory. that's it. that's her whole personality π
πΈ SYNOPSIS πΈ
#include <libnbd.h>
int nbd_set_tls_certificates (
struct nbd_handle *h, const char *dir
);
look at that signature. clean. iconic. no notes π«Ά
π¦ DESCRIPTION π¦
so what does she do? she sets the path to the TLS certificates directory. simple as that, bestie.
if you don't set it and TLS gets used, there's a compiled-in default that kicks in:
- for root, that's
"/etc/pki/libnbd/" - for non-root, it's
"$HOME/.pki/libnbd"and"$HOME/.config/pki/libnbd"
and if none of these directories can be found? then the system trusted CAs are used. fallback queen behavior honestly π
ngl this is the important bit: this function may be called regardless of whether TLS is supported, but it will have no effect unless nbd_set_tls(3) is also used to request or require TLS. so likeβ¦ she's ready whenever, but she's not doing anything until TLS actually shows up to the party π
β RETURN VALUE β
if the call is successful, the function returns 0. slay. β¨
π ERRORS π
on error, -1 is returned. not slay, but okay.
refer to "ERROR HANDLING" in libnbd(3) for how to get further details of the error.
also, heads up: the following parameters must not be NULL: "h", "dir". for more info see "Non-NULL parameters" in libnbd(3). don't be passing her nulls, she will not be okay with it π
π§ HANDLE STATE π§
nbd_set_tls_certificates can be called when the handle is in the following state:
- Handle created, before connecting β β allowed
- Connecting β β error
- Connecting & handshaking (opt_mode) β β error
- Connected to the server β β error
- Connection shut down β β error
- Handle dead β β error
so basically: catch her early, before you connect. she's a before-the-party function, not a mid-party function. vibe check passed only in that first row π
π VERSION π
this function first appeared in libnbd 1.0. a whole legend from day one, fr fr.
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_CERTIFICATES 1
π SEE ALSO π
go read them, they're all linked up, iykyk π₯
π AUTHORS π
- Eric Blake
- Richard W.M. Jones
the icons who made this happen. we stan π«Ά
π COPYRIGHT π
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
like, read the license, bestie. it's giving "legally required but also genuinely important" π
and that's the whole page!! this lil beauty is from libnbd-1.25.8, dated 2026-10-13 β screenshot it, cite it, love it. mwah πβ¨πΈ
π¦ where this page comes from
- centos-stream 10: libnbd-devel 1.25.8-1.el10 Β· LGPL-2.0-or-later AND BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms