MEMCACHED_SASL(3)
π MEMCACHED_SASL π
okay bestie, so this is a page from libmemcached-awesome (the libmemcached manual, section 3), and it's all about SASL auth, like, plugging in your own callbacks so libsasl can do its lil authentication moment. it's giving "security but make it customizable" and we're obsessed. π
β¨ NAME β¨
memcached_sasl β the libmemcached Documentation, but make it cute π¦
πΈ SYNOPSIS πΈ
first things first, you gotta pull in the header and link the library:
#include <libmemcached/memcached.h>
Compile and link with -lmemcached
then boom, four functions, here's the whole roster:
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_tholding 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βpasswordβ
Returns
memcached_return_tindicating success
memcached_return_t memcached_destroy_sasl_auth_data(memcached_st *ptr)
Parameters
ptrβ pointer to initializedmemcached_ststruct
Returns
memcached_return_tindicating success
π DESCRIPTION π
so libmemcached lets you plug in your own callbacks function that libsasl uses to do SASL authentication. it's fully your show, your rules, your callback. main character energy fr. π
β οΈ okay important, listen up: SASL requires the memcached binary protocol, and you have to specify the callbacks before you connect to the server. no cap. don't come crying to me later if you didn't. π
memcached_set_sasl_auth_data() is that helper function that defines the basic functionality for you β super convenient, lowkey iconic β but heads up, it will store the username and password in memory. π
if you choose to use this method you have to call memcached_destroy_sasl_auth_data() before calling memcached_free() to avoid a memory leak. like, that's the assignment, do not skip it. π«Ά
and bestie, you should NOT call memcached_destroy_sasl_auth_data() if you specify your own callback function with memcached_set_sasl_callbacks(). that's the rules, periodt. β
π RETURN VALUE π
memcached_get_sasl_callbacks()returns the callbacks currently used by this memcached handle.memcached_set_sasl_auth_data()returnsMEMCACHED_SUCCESSupon success. β¨ slay.
π SEE ALSO π
and that's the whole page, bestie! this was libmemcached-awesome version 1.1, dated Jul 24, 2025 β go forth and authenticate responsibly πβ¨ππ¦
π¦ 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