Merge pull request #140 from hussainnaqvee/patch-1
[awesomized/libmemcached] / libmemcached / memcached_sasl.rst
1 SASL support
2 ============
3
4 SYNOPSIS
5 --------
6
7 #include <libmemcached/memcached.h>
8 Compile and link with -lmemcached
9
10 .. function:: void memcached_set_sasl_callbacks(memcached_st *ptr, const sasl_callback_t *callbacks)
11
12 :param ptr: pointer to initialized `memcached_st` struct
13 :param callbacks: pointer to `sasl_callbacks_t` holding the callbacks to use
14
15 .. function:: const sasl_callback_t *memcached_get_sasl_callbacks(memcached_st *ptr)
16
17 :param ptr: pointer to initialized `memcached_st` struct
18 :returns: pointer to `sasl_callbacks_t` holding the callbacks currently used
19
20 .. function:: memcached_return_t memcached_set_sasl_auth_data(memcached_st *ptr, const char *username, const char *password)
21
22 :param ptr: pointer to initialized `memcached_st` struct
23 :param username:
24 :param password:
25 :returns: `memcached_return_t` indicating success
26
27 .. function:: memcached_return_t memcached_destroy_sasl_auth_data(memcached_st *ptr)
28
29 :param ptr: pointer to initialized `memcached_st` struct
30 :returns: `memcached_return_t` indicating success
31
32 DESCRIPTION
33 -----------
34
35 `libmemcached` allows you to plug in your own callbacks function used by
36 libsasl to perform SASL authentication.
37
38 Please note that SASL requires the memcached binary protocol, and you have
39 to specify the callbacks before you connect to the server.
40
41 :func:`memcached_set_sasl_auth_data` is a helper function defining
42 the basic functionality for you, but it will store the username and password
43 in memory. If you choose to use this method you have to call
44 `memcached_destroy_sasl_auth_data` before calling `memcached_free` to avoid a
45 memory leak. You should NOT call `memcached_destroy_sasl_auth_data` if you
46 specify your own callback function with `memcached_set_sasl_callbacks`.
47
48 RETURN VALUE
49 ------------
50
51 :func:`memcached_get_sasl_callbacks` returns the callbacks currently used by
52 this memcached handle. :func:`memcached_set_sasl_auth_data` returns
53 `MEMCACHED_SUCCESS` upon success.
54
55 SEE ALSO
56 --------
57
58 .. only:: man
59
60 :manpage:`memcached(1)`
61 :manpage:`libmemcached(3)`
62 :manpage:`memcached_strerror(3)`
63 :manpage:`sasl_client_new(3)`
64 :manpage:`sasl_callbacks(3)`
65
66 .. only:: html
67
68 * :manpage:`memcached(1)`
69 * :doc:`../libmemcached`
70 * :doc:`memcached_strerror`
71 * :manpage:`sasl_client_new(3)`
72 * :manpage:`sasl_callbacks(3)`