SASL_ENCODEV(3)

πŸ’– SASL_ENCODEV(3) β€” the Cyrus SASL glow-up πŸ’–

okay bestie, welcome to sasl_encodev(3) from the Cyrus SASL manual, section 3 ofc. this is the one that wraps your outgoing bytes in whatever security layer you and your remote bestie negotiated. no cap, it's iconic. let's get into it 🫢


✨ NAME ✨

sasl_encodev β€” literally the Cyrus SASL documentation for it, that's the name, that's the vibe πŸ’…


🌸 SYNOPSIS 🌸

#include <sasl/sasl.h>

int sasl_encode(sasl_conn_t *conn,
                const char * input,
                unsigned inputlen,
                const char ** output,
                unsigned * outputlen);

int sasl_encodev(sasl_conn_t *conn,
                const struct iovec * invec,
                unsigned numiov,
                const char ** output,
                unsigned * outputlen);

two functions, one <sasl/sasl.h> include, and yes you have to actually type the include, it's not gonna include itself πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

so sasl_encode encodes data to be sent to be sent to a remote host who we've had a successful authentication session with. (<- yes the manual says "to be sent" twice, we're keeping it, it's part of the lore 😭) if there is a negotiated security layer, then the data in is signed/encrypted and the output should be sent without modification to the remote host. and if there is no</> security layer? the output is identical to the input. literally identical. same bytes. no notes. ✨

sasl_encodev does the same exact thing, but for a struct iovec instead of a character buffer. that's the whole difference. iovec girlies rise up 🧚


πŸ’œ the sasl_encode situation πŸ’œ

int sasl_encode(sasl_conn_t *conn,
                const char * input,
                unsigned inputlen,
                const char ** output,
                unsigned * outputlen);

πŸ“ Parameters

  • conn – is the SASL connection context
  • output – contains the decoded data and is allocated/freed by the library.
  • outputlen – length of output.
ok quick heads up bestie β€” that's the whole parameter list, exactly like the original has it. we're not adding anything, we're not taking anything away. πŸ’–

πŸ’œ the sasl_encodev situation πŸ’œ

int sasl_encodev(sasl_conn_t *conn,
                const struct iovec * invec,
                unsigned numiov,
                const char ** output,
                unsigned * outputlen);

πŸ“ Parameters

  • conn – is the SASL connection context
  • output – contains the decoded data and is allocated/freed by the library.
  • outputlen – length of output.
same energy, same three params, same "the library owns output" energy. don't you dare free() it yourself πŸ™ˆ

πŸ”₯ RETURN VALUE πŸ”₯

SASL callback functions should return SASL return codes. See sasl.h for a complete list. SASL_OK indicates success. πŸ‘‘

Other return codes indicate errors and should be handled. like, actually handled. not vibe-checked and ignored. fr fr. πŸ’€


🌈 SEE ALSO 🌈

go read sasl_decode(3), it's the reverse girlie and she's also serving πŸ’…


πŸ‘‘ AUTHOR πŸ‘‘

The Cyrus Team. legends only, honestly.


1993-2016, The Cyrus Team


and that's the whole page, bestie!! this was Cyrus SASL version 2.1.28, dated February 18, 2022, section 3, SASL_ENCODEV(3) β€” mwah, slay, go encrypt something responsibly πŸ’–βœ¨πŸ¦‹