MEMCACHED_G...L_CALLBACKS(3)
π MEMCACHED_GET_SASL_CALLBACKS π
okay bestie, sit down, hydrate, because we're doing libmemcached SASL callback stuff today and it's giving niche but powerful. this page lives in the libmemcached-awesome manual, section 3, and it's literally the whole memcached_get_sasl_callbacks family. let's go π
β¨ NAME β¨
memcached_get_sasl_callbacks β the libmemcached documentation, but make it a group chat π«Ά
πΈ SYNOPSIS πΈ
#include <libmemcached/memcached.h>
and like, compile and link with -lmemcached or it simply will not slay.
void memcached_set_sasl_callbacks(memcached_st *ptr,
const sasl_callback_t *callbacks)
Parameters
ptrβ pointer to initializedmemcached_ststructcallbacksβ pointer tosasl_callbacks_tholding the callbacks to use
const sasl_callback_t *memcached_get_sasl_callbacks(memcached_st *ptr)
Parameters
ptrβ pointer to initializedmemcached_ststruct
Returns
pointer to sasl_callbacks_t holding the callbacks currently used
memcached_return_t memcached_set_sasl_auth_data(memcached_st *ptr,
const char *username,
const char *password)
Parameters
ptrβ pointer to initializedmemcached_ststructusernameβ (yes bestie, the original leaves this one blank. iconic of it, honestly π)passwordβ (same deal, also blank. we simply do not elaborate.)
Returns
memcached_return_t indicating success
memcached_return_t memcached_destroy_sasl_auth_data(memcached_st *ptr)
Parameters
ptrβ pointer to initializedmemcached_ststruct
Returns
memcached_return_t indicating success
π¦ DESCRIPTION π¦
so libmemcached lets you plug in your own callback functions that libsasl uses to do SASL authentication. you're the main character, you bring the callbacks. π
β οΈ okay IMPORTANT: SASL requires the memcached binary protocol. no binary protocol, no SASL, no exceptions. and you have to specify the callbacks before you connect to the server. before. not during. not after. before. π
memcached_set_sasl_auth_data() is the lil helper function that defines the basic functionality for you β so convenient, so cute β but heads up: it will store the username and password in memory. if you go this route, you have to call memcached_destroy_sasl_auth_data() before calling memcached_free() or you get a memory leak. we do not leak. leaking is not the vibe. π«
and the flip side, equally important:
π«Ά you should NOT callmemcached_destroy_sasl_auth_data()if you specified your own callback function withmemcached_set_sasl_callbacks(). nope. don't. that's not your data to destroy, bestie.
β RETURN VALUE β
memcached_get_sasl_callbacks()returns the callbacks currently used by this memcached handle.memcached_set_sasl_auth_data()returnsMEMCACHED_SUCCESSupon success. β¨
π SEE ALSO π
and that's the whole page, bestie. go forth, authenticate responsibly, and remember: destroy your auth data only when it's yours to destroy. π
mwah π this was libmemcached-awesome, version 1.1, dated Jul 24, 2025 β catch you in the next manpage, periodt. πβ¨
π¦ where this page comes from
- fedora 43: libmemcached-awesome-devel 1.1.4-7.fc43 Β· BSD-3-Clause
- fedora 43: libmemcached-awesome-devel 1.1.4-7.fc43 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms