SASL_CANON_USER_T(3)

✨ NAME ✨

sasl_canon_user_t β€” bestie, this is the Cyrus SASL doc for the user canonicalization callback πŸ’– (it's a page in the Cyrus SASL manual, section 3, so you know it's a library function, iykyk)


πŸŽ€ SYNOPSIS πŸŽ€

#include <sasl/sasl.h>

int sasl_canon_user_t(sasl_conn_t *conn, void *context, const char *user, unsigned ulen,
                      unsigned flags, const char *user_realm, char *out_user,
                      unsigned out_umax, unsigned *out_ulen)

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so, here's the signature again, laid out all pretty, because the original does it this way and we are not skipping anything, periodt:

int sasl_canon_user_t(sasl_conn_t *conn,

void *context,

const char *user,

unsigned ulen,

unsigned flags,

const char *user_realm,

char *out_user,

unsigned out_umax,

unsigned *out_ulen)

So like. sasl_canon_user_t is the callback for an application-supplied user canonicalization function. That's the whole vibe. πŸ‘‘

And because it's that kind of callback, it's subject to the exact same requirements that all user canonicalization functions are subject to:

  • It must copy the result into the output buffers β€” no shortcuts, no "I'll get to it later", fr fr.
  • BUT, plot twist: the output buffers and the input buffers may be the same. πŸ‘€ So your function has to survive being handed the same memory on both sides. Be brave.

🌸 Parameters 🌸

  • context – context from the callback record
  • user – un-canonicalized username
  • ulen – length of user
  • flags – Either SASL_CU_AUTHID (indicating the authentication ID is being canonicalized) or SASL_CU_AUTHZID (indicating the authorization ID is to be canonicalized) or a bitwise OR of the the two.
  • user_realm – Realm of authentication.
  • out_user – The output buffer for the canonicalized username
  • out_umax – Maximum length for out_user
  • out_ulen – Actual length of out_user
Not me pointing out that the flags line really does say "of the the two" β€” that's literally what's written, and I am nothing if not faithful to the source. πŸ’…

πŸ’« Returns πŸ’«

SASL_OK indicates success. That's the slay outcome. ✨

For a full list of SASL error codes, go check out sasl_errors(3) β€” it's giving very "read the fine print, bestie."


🌈 CONFORMING TO 🌈

RFC 4422


πŸ”₯ SEE ALSO πŸ”₯


πŸ’œ AUTHOR πŸ’œ

The Cyrus Team


1993-2016, The Cyrus Team


And that's the whole page, no crumbs left, bestie! πŸŽ€ This one's from Cyrus SASL version 2.1.28, dated February 18, 2022 β€” so when you cite it, you cite it correctly, okay? Main character energy only. Byeee πŸ’–βœ¨