SASL_GETSECRET_T(3)

πŸ’– NAME πŸ’–

sasl_getsecret_t β€” Cyrus SASL documentation, bestie. That's the whole vibe. It's giving "the callback that hands over your secret."


✨ SYNOPSIS ✨

#include <sasl/sasl.h>

int sasl_getsecret_t(sasl_conn_t *conn,
                    void *context,
                    int id,
                    sasl_secret_t ** psecret);

πŸŽ€ DESCRIPTION πŸŽ€

okay so here's the whole function again, laid out all dramatic:

int sasl_getsecret_t(sasl_conn_t *conn,

void *context,

int id,

sasl_secret_t ** psecret);

sasl_getsecret_t() is literally the function you use to retrieve the secret from the application. Like, the app is holding the secret, and this is the little hand-off moment. 🫢

And here's the part you cannot skip: a sasl_secret_t should be allocated to length sizeof(sasl_secret_t) + <length of secret>. Yes, you read that right β€” you size it for the struct plus the actual secret, not just the struct. Slay but make it correct. πŸ’…

It's got two fields, and you need both:

  • len β€” which is the length of the secret in bytes.
  • data β€” which contains the secret itself (and ngl, it does not need to be null terminated).

🌸 Parameters

  • conn – is the SASL connection context
fr fr, that's the parameter list. Just conn. Don't come for me, I'm only the messenger. 😭

πŸ”₯ RETURN VALUE πŸ”₯

SASL callback functions should return SASL return codes. See sasl.h for a complete list β€” it's all in there, go look, iykyk. ✨

SASL_OK indicates success. iconic. perfect. no notes. πŸ‘‘

Other return codes indicate errors and should be handled. Not optional, bestie. Handle them. πŸ™ˆ


πŸ¦‹ SEE ALSO πŸ¦‹

RFC 4422, :saslman:sasl(3), sasl_callbacks(3)


πŸ’œ AUTHOR πŸ’œ

The Cyrus Team


1993-2016, The Cyrus Team


and that's the whole page, periodt. πŸ’–βœ¨ This one's from Cyrus SASL 2.1.28, dated February 18, 2022 β€” she's an older icon but she still ate. πŸŽ€πŸ¦‹ go forth and allocate your secrets correctly, mwah πŸ’