bd51348bff8d3df3e0f6a612e07f37c4af50bb68
[m6w6/libmemcached] / docs / memcached_sasl.rst
1 ============
2 SASL support
3 ============
4
5 .. index:: object: memcached_st
6
7
8 --------
9 SYNOPSIS
10 --------
11
12 #include <libmemcached/memcached_pool.h>
13
14 .. c:function:: void memcached_set_sasl_callbacks(memcached_st *ptr, const sasl_callback_t *callbacks)
15
16 .. c:function:: const sasl_callback_t *memcached_get_sasl_callbacks(memcached_st *ptr)
17
18 .. c:function:: memcached_return memcached_set_sasl_auth_data(memcached_st *ptr, const char *username, const char *password)
19
20 .. c:function:: memcached_return memcached_destroy_sasl_auth_data(memcached_st *ptr)
21
22 Compile and link with -lmemcached
23
24
25
26 -----------
27 DESCRIPTION
28 -----------
29
30
31 libmemcached(3) allows you to plug in your own callbacks function used by
32 libsasl to perform SASL authentication.
33
34 Please note that SASL requires the memcached binary protocol, and you have
35 to specify the callbacks before you connect to the server.
36
37 :c:func:`memcached_set_sasl_auth_data()` is a helper function defining
38 the basic functionality for you, but it will store the username and password
39 in memory. If you choose to use this method you have to call
40 :c:type:`memcached_destroy_sasl_auth_data` before calling
41 :c:type:`memcached_free` to avoid a memory leak. You should NOT call
42 :c:type:`memcached_destroy_sasl_auth_data` if you specify your own callback
43 function with :c:func:`memcached_set_sasl_callbacks()`.
44
45 You as a client user have to initialize libsasl by using :c:type:`sasl_client_init` before enabling it in libmemcached, and you have to shut down libsasl by
46 calling :c:func:`sasl_done()` when you are done using SASL from libmemcached.
47
48
49 ------
50 RETURN
51 ------
52
53
54 :c:func:`memcached_get_sasl_callbacks()` returns the callbacks currently used
55 by this memcached handle. :c:func:`memcached_get_sasl_set_auth_data()` returns :c:type:`MEMCACHED_SUCCESS` upon success.
56
57
58 ----
59 HOME
60 ----
61
62
63 To find out more information please check:
64 `http://libmemcached.org/ <http://libmemcached.org/>`_
65
66
67 ------
68 AUTHOR
69 ------
70
71
72 Brian Aker, <brian@tangent.org>
73
74 Trond Norbye, <trond.norbye@gmail.com>
75
76
77 --------
78 SEE ALSO
79 --------
80
81
82 :manpage:`memcached(1)` :manpage:`libmemcached(3)` :manpage:`memcached_strerror(3)`