26b003877e4ab162800b1944c63238e2aa8f3a25
[awesomized/libmemcached] / docs / source / libmemcached / memcached_sasl.rst
1 ============
2 SASL support
3 ============
4
5 .. index:: object: memcached_st
6
7 --------
8 SYNOPSIS
9 --------
10
11 #include <libmemcached/memcached_pool.h>
12
13 .. function:: void memcached_set_sasl_callbacks(memcached_st *ptr, const sasl_callback_t *callbacks)
14
15 .. function:: const sasl_callback_t *memcached_get_sasl_callbacks(memcached_st *ptr)
16
17 .. function:: memcached_return_t memcached_set_sasl_auth_data(memcached_st *ptr, const char *username, const char *password)
18
19 .. function:: memcached_return_t memcached_destroy_sasl_auth_data(memcached_st *ptr)
20
21 Compile and link with -lmemcached
22
23 -----------
24 DESCRIPTION
25 -----------
26
27 libmemcached(3) allows you to plug in your own callbacks function used by
28 libsasl to perform SASL authentication.
29
30 Please note that SASL requires the memcached binary protocol, and you have
31 to specify the callbacks before you connect to the server.
32
33 :func:`memcached_set_sasl_auth_data` is a helper function defining
34 the basic functionality for you, but it will store the username and password
35 in memory. If you choose to use this method you have to call
36 :type:`memcached_destroy_sasl_auth_data` before calling
37 :type:`memcached_free` to avoid a memory leak. You should NOT call
38 :type:`memcached_destroy_sasl_auth_data` if you specify your own callback
39 function with :func:`memcached_set_sasl_callbacks`.
40
41 ------
42 RETURN
43 ------
44
45 :func:`memcached_get_sasl_callbacks` returns the callbacks currently used by
46 this memcached handle. :func:`memcached_set_sasl_auth_data` returns
47 `MEMCACHED_SUCCESS` upon success.
48
49 --------
50 SEE ALSO
51 --------
52
53 .. only:: man
54
55 :manpage:`memcached(1)` :manpage:`libmemcached(3)` :manpage:`memcached_strerror(3)`