SD_BUS_MESSAGE_SENSITIVE(3)

πŸ’… SD_BUS_MESSAGE_SENSITIVE(3) β€” like, the sd_bus_message_sensitive page, bestie

okay so this is the manual page for sd_bus_message_sensitive, and honestly? it's short but it matters, so pay attention 🫢


✨ NAME ✨

sd_bus_message_sensitive β€” mark a message object as containing sensitive data πŸ”


🌸 SYNOPSIS 🌸

#include <systemd/sd-bus.h>

int sd_bus_message_sensitive(sd_bus_message *message);

πŸ’– DESCRIPTION πŸ’–

so sd_bus_message_sensitive() does one thing and does it iconically: it marks an allocated bus message as containing sensitive data. and why do we care? because when that message gets released, its data gets carefully removed from memory β€” specifically, overwritten with zero bytes. no leftovers, no crumbs, nothing for the memory gremlins to find. ✨

the recommendation, straight up: mark all incoming and outgoing messages like this whenever they contain security credentials and similar data that should be dealt with carefully. it's giving responsible main character energy. πŸ”₯

⚠️ heads up bestie β€” you literally cannot unmark a message. it's a one way operation, periodt. and if a message is already marked sensitive and then you mark it sensitive a second time, it stays marked and no further operation is executed. no drama, no double work. πŸ’…

also, as a safety precaution: every message that's created as a reply to a message that's marked sensitive gets implicitly marked too. the sensitivity is contagious in the best way. πŸ¦‹


⭐ RETURN VALUE ⭐

on success, this function returns 0 or a positive integer. on failure, it returns a negative errno-style error code. 😭

πŸ™ˆ Errors

the errors it may throw back at you indicate the following problems:

  • -EINVAL β€” the message parameter is NULL. yeah. that one. 🫠

Added in version 245.


πŸŽ€ NOTES πŸŽ€

the functions described here are available as a shared library, which you can compile against and link to with the libsystemd pkg-config(1) file. πŸ”—

all functions listed here are thread-agnostic, and only a single thread may operate on a given object at any given time. different threads may access the same object at different times, and multiple independent objects can be used from different threads in parallel. so like… share the objects, not the moment. iykyk. 🧚

the code described here uses getenv(3), which is declared to be not multi-thread-safe. what that means for you: code calling the functions described here must not call setenv(3) from a parallel thread. the recommendation is to only do calls to setenv() from an early phase of the program, back when no other threads have been started. get it done first, then spawn the chaos. 🌈


πŸ‘‘ HISTORY πŸ‘‘

sd_bus_message_sensitive() was added in version 245. a classic, an icon, a legend. ⭐


πŸ”₯ SEE ALSO πŸ”₯

systemd(1), sd-bus(3), sd_bus_message_new_method_call(3)


and that's the whole page, bestie β€” no cap πŸ’œ this was systemd 261.3, dated SD_BUS_MESSAGE_SENSITIVE(3), and honestly? she ate. πŸŽ€βœ¨

πŸ“¦ where this page comes from