Memcac...ed_sasl(3pm)

πŸ’– NAME πŸ’–

ok so bestie, gather round β€” these are the SASL girlies:

  • memcached_set_sasl_callbacks
  • memcached_get_sasl_callbacks
  • memcached_sasl_set_auth_data
  • memcached_destroy_sasl_auth_data

they're all about SASL support, no cap. πŸ’…


πŸ“š LIBRARY πŸ“š

C Client Library for memcached β€” that's libmemcached, link it with -lmemcached. 🫢


✨ SYNOPSIS ✨

#include <memcached.h>

void memcached_set_sasl_callbacks(memcached_st *ptr,
                                  const sasl_callback_t *callbacks)

const sasl_callback_t *memcached_get_sasl_callbacks(memcached_st *ptr)

memcached_return memcached_set_sasl_auth_data(memcached_st *ptr,
                                              const char *username,
                                              const char *password)
memcached_return memcached_destroy_sasl_auth_data(memcached_st *ptr)

🌸 DESCRIPTION 🌸

libmemcached(3) lets you plug in your own callbacks function that libsasl uses to do its SASL authentication thing. it's giving customizable. it's giving icon behavior. ✨

🚨 IMPORTANT VIBE CHECK: SASL requires the memcached binary protocol, and you have to specify the callbacks before you connect to the server. like, before. don't be late to this. πŸ’€

memcached_set_sasl_auth_data() is a lil helper function that defines the basic functionality for you πŸ₯° β€” but heads up, it will store the username and password in memory. so if you go that route, you have to call memcached_destroy_sasl_auth_data before calling memcached_free, or you get a memory leak and that's not the vibe, that's giving leaky. 😭

⚠️ also: you should NOT call memcached_destroy_sasl_auth_data if you specified your own callback function with memcached_set_sasl_callbacks(). don't do it!! not the move!! πŸ™ˆ

and ngl, there's homework on your side, bestie β€” you as the client user have to initialize libsasl by using sasl_client_init before enabling it in libmemcached, and you have to shut down libsasl by calling sasl_done() when you're done using SASL from libmemcached. 🧚 both ends. periodt.


πŸŽ€ RETURN πŸŽ€

  • memcached_get_sasl_callbacks() β€” returns the callbacks currently used by this memcached handle. πŸ‘‘
  • memcached_get_sasl_set_auth_data() β€” returns MEMCACHED_SUCCESS upon success. slay. βœ…

🌈 HOME 🌈

to find out more information please check: <http://libmemcached.org/> β€” literally the mothership. πŸ¦‹


πŸ‘‘ AUTHOR πŸ‘‘

Trond Norbye, <trond.norbye@gmail.com> πŸ’œ


πŸ’« SEE ALSO πŸ’«


and that's the whole page, bestie β€” written for perl v5.42.3, dated 2026-08-19, filed under Memcac...ed_sasl(3pm). πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from