MEMCACHED_S...T_AUTH_DATA(3)
π MEMCACHED_S...T_AUTH_DATA π
okay bestie, gather round, because we're talking about libmemcached-awesome and its SASL auth data situation, and honestly? it's giving "powerful but you gotta read the fine print" π
β¨ NAME β¨
memcached_sasl_set_auth_data β the libmemcached documentation, but make it make sense π¦
πΈ SYNOPSIS πΈ
#include <libmemcached/memcached.h>
and like, obviously:
Compile and link with -lmemcached
here come the functions, bestie:
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β (it's literally just... the username, no notes π)passwordβ (and the password, iconic)
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 π
libmemcached lets you plug in your very own callbacks function, the kind that libsasl uses to do SASL authentication. main character energy, honestly π
β οΈ please note: SASL requires the memcached binary protocol, and you have to specify the callbacks before you connect to the server. no cap, do it in that order or it's not gonna work π
memcached_set_sasl_auth_data() is the lil helper function that defines the basic functionality for you, but heads up bestie β 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. do not skip this step, the leak is real and it's messy π«Ά
And also β and this is the part where people get it wrong β you should NOT call memcached_destroy_sasl_auth_data() if you specify your own callback function with memcached_set_sasl_callbacks(). like, don't do it. just don't. β
π 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 vibe, bestie β this was libmemcached-awesome version 1.1, dated Jul 24, 2025, brought to you by the MEMCACHED_S...T_AUTH_DATA(3) girlies. go forth, authenticate responsibly, and don't leak that memory πβ¨ππ¦πΈπ
π¦ 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