---
name: "memcached_get_sasl_callbacks"
section: "3"
platform: "linux"
package: "libmemcached-awesome"
version: "1.1.4-4"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/memcached_get_sasl_callbacks"
---

# memcached\_get\_sasl\_callbacks(3)

libmemcached Documentation

## NAME

memcached\_get\_sasl\_callbacks - libmemcached Documentation

## SYNOPSIS

- **#include \<libmemcached/memcached.h\>**

  Compile and link with -lmemcached

- **void memcached\_set\_sasl\_callbacks(memcached\_st \<#\_CPPv412memcached\_st\> \*ptr, const sasl\_callback\_t \*callbacks)**

  - **Parameters**

    - •

      **ptr** -- pointer to initialized **memcached\_st** \<#\_CPPv412memcached\_st\> struct

    - •

      **callbacks** -- pointer to **sasl\_callbacks\_t** holding the callbacks to use

- **const sasl\_callback\_t \*memcached\_get\_sasl\_callbacks(memcached\_st \<#\_CPPv412memcached\_st\> \*ptr)**

  - **Parameters**

    **ptr** -- pointer to initialized **memcached\_st** \<#\_CPPv412memcached\_st\> struct

  - **Returns**

    pointer to **sasl\_callbacks\_t** holding the callbacks currently used

- **memcached\_return\_t \<#\_CPPv418memcached\_return\_t\> memcached\_set\_sasl\_auth\_data(memcached\_st \<#\_CPPv412memcached\_st\> \*ptr, const char \*username, const char \*password)**

  - **Parameters**

    - •

      **ptr** -- pointer to initialized **memcached\_st** \<#\_CPPv412memcached\_st\> struct

    - •

      **username** --

    - •

      **password** --

  - **Returns**

    **memcached\_return\_t** \<#\_CPPv418memcached\_return\_t\> indicating success

- **memcached\_return\_t \<#\_CPPv418memcached\_return\_t\> memcached\_destroy\_sasl\_auth\_data(memcached\_st \<#\_CPPv412memcached\_st\> \*ptr)**

  - **Parameters**

    **ptr** -- pointer to initialized **memcached\_st** \<#\_CPPv412memcached\_st\> struct

  - **Returns**

    **memcached\_return\_t** \<#\_CPPv418memcached\_return\_t\> indicating success

## DESCRIPTION

**libmemcached** allows you to plug in your own callbacks function used by libsasl to perform SASL authentication.

Please note that SASL requires the memcached binary protocol, and you have to specify the callbacks before you connect to the server.

**memcached\_set\_sasl\_auth\_data()** is a helper function defining the basic functionality for you, but 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()** \<#\_CPPv414memcached\_freeP12memcached\_st\> to avoid a memory leak. You should NOT call **memcached\_destroy\_sasl\_auth\_data()** if you specify your own callback function with **memcached\_set\_sasl\_callbacks()**.

## RETURN VALUE

**memcached\_get\_sasl\_callbacks()** returns the callbacks currently used by this memcached handle. **memcached\_set\_sasl\_auth\_data()** returns **MEMCACHED\_SUCCESS** \<#\_CPPv4N18memcached\_return\_t17MEMCACHED\_SUCCESSE\> upon success.

## SEE ALSO

**[memcached(1)](/memcached/1.md) \<https://linux.die.net/man/1/memcached\>** **[libmemcached(3)](/libmemcached/3.md) \<https://linux.die.net/man/3/libmemcached\>** **[memcached\_strerror(3)](/memcached_strerror/3.md) \<https://linux.die.net/man/3/memcached\_strerror\>** **[sasl\_client\_new(3)](/sasl_client_new/3.md) \<https://linux.die.net/man/3/sasl\_client\_new\>** **[sasl\_callbacks(3)](/sasl_callbacks/3.md) \<https://linux.die.net/man/3/sasl\_callbacks\>**
