memcached 1.2.6 → 1.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +2 -0
- data/Manifest +206 -12
- data/Rakefile +32 -1
- data/ext/extconf.rb +10 -35
- data/ext/libmemcached-0.32/AUTHORS +7 -0
- data/ext/libmemcached-0.32/COPYING +32 -0
- data/ext/libmemcached-0.32/ChangeLog +303 -0
- data/ext/libmemcached-0.32/INSTALL +302 -0
- data/ext/libmemcached-0.32/Makefile.am +36 -0
- data/ext/libmemcached-0.32/Makefile.in +828 -0
- data/ext/libmemcached-0.32/NEWS +1 -0
- data/ext/libmemcached-0.32/README +33 -0
- data/ext/libmemcached-0.32/THANKS +14 -0
- data/ext/libmemcached-0.32/TODO +11 -0
- data/ext/libmemcached-0.32/aclocal.m4 +1852 -0
- data/ext/libmemcached-0.32/clients/Makefile.am +73 -0
- data/ext/libmemcached-0.32/clients/Makefile.in +770 -0
- data/ext/libmemcached-0.32/clients/client_options.h +32 -0
- data/ext/libmemcached-0.32/clients/execute.c +64 -0
- data/ext/libmemcached-0.32/clients/execute.h +5 -0
- data/ext/libmemcached-0.32/clients/generator.c +74 -0
- data/ext/libmemcached-0.32/clients/generator.h +20 -0
- data/ext/libmemcached-0.32/clients/memcat.c +178 -0
- data/ext/libmemcached-0.32/clients/memcp.c +251 -0
- data/ext/libmemcached-0.32/clients/memdump.c +170 -0
- data/ext/libmemcached-0.32/clients/memerror.c +80 -0
- data/ext/libmemcached-0.32/clients/memflush.c +143 -0
- data/ext/libmemcached-0.32/clients/memrm.c +160 -0
- data/ext/libmemcached-0.32/clients/memslap.c +441 -0
- data/ext/libmemcached-0.32/clients/memstat.c +326 -0
- data/ext/libmemcached-0.32/clients/utilities.c +207 -0
- data/ext/libmemcached-0.32/clients/utilities.h +41 -0
- data/ext/libmemcached-0.32/config.h.in +252 -0
- data/ext/libmemcached-0.32/config/compile +143 -0
- data/ext/libmemcached-0.32/config/config.guess +1561 -0
- data/ext/libmemcached-0.32/config/config.rpath +666 -0
- data/ext/libmemcached-0.32/config/config.sub +1686 -0
- data/ext/libmemcached-0.32/config/depcomp +630 -0
- data/ext/libmemcached-0.32/config/install-sh +520 -0
- data/ext/libmemcached-0.32/config/ltmain.sh +8406 -0
- data/ext/libmemcached-0.32/config/missing +376 -0
- data/ext/libmemcached-0.32/configure +23048 -0
- data/ext/libmemcached-0.32/configure.ac +122 -0
- data/ext/libmemcached-0.32/docs/Makefile.am +415 -0
- data/ext/libmemcached-0.32/docs/Makefile.in +918 -0
- data/ext/libmemcached-0.32/docs/libmemcached.pod +123 -0
- data/ext/libmemcached-0.32/docs/libmemcached_examples.pod +115 -0
- data/ext/libmemcached-0.32/docs/libmemcachedutil.pod +40 -0
- data/ext/libmemcached-0.32/docs/memcached_analyze.pod +52 -0
- data/ext/libmemcached-0.32/docs/memcached_auto.pod +97 -0
- data/ext/libmemcached-0.32/docs/memcached_behavior.pod +224 -0
- data/ext/libmemcached-0.32/docs/memcached_callback.pod +123 -0
- data/ext/libmemcached-0.32/docs/memcached_create.pod +61 -0
- data/ext/libmemcached-0.32/docs/memcached_delete.pod +54 -0
- data/ext/libmemcached-0.32/docs/memcached_dump.pod +53 -0
- data/ext/libmemcached-0.32/docs/memcached_flush.pod +46 -0
- data/ext/libmemcached-0.32/docs/memcached_flush_buffers.pod +42 -0
- data/ext/libmemcached-0.32/docs/memcached_generate_hash_value.pod +57 -0
- data/ext/libmemcached-0.32/docs/memcached_get.pod +161 -0
- data/ext/libmemcached-0.32/docs/memcached_memory_allocators.pod +73 -0
- data/ext/libmemcached-0.32/docs/memcached_pool.pod +77 -0
- data/ext/libmemcached-0.32/docs/memcached_quit.pod +47 -0
- data/ext/libmemcached-0.32/docs/memcached_sasl.pod +63 -0
- data/ext/libmemcached-0.32/docs/memcached_server_st.pod +75 -0
- data/ext/libmemcached-0.32/docs/memcached_servers.pod +102 -0
- data/ext/libmemcached-0.32/docs/memcached_set.pod +187 -0
- data/ext/libmemcached-0.32/docs/memcached_stats.pod +82 -0
- data/ext/libmemcached-0.32/docs/memcached_strerror.pod +46 -0
- data/ext/libmemcached-0.32/docs/memcached_user_data.pod +49 -0
- data/ext/libmemcached-0.32/docs/memcached_verbosity.pod +41 -0
- data/ext/libmemcached-0.32/docs/memcached_version.pod +56 -0
- data/ext/libmemcached-0.32/docs/memcat.pod +37 -0
- data/ext/libmemcached-0.32/docs/memcp.pod +40 -0
- data/ext/libmemcached-0.32/docs/memdump.pod +31 -0
- data/ext/libmemcached-0.32/docs/memerror.pod +30 -0
- data/ext/libmemcached-0.32/docs/memflush.pod +35 -0
- data/ext/libmemcached-0.32/docs/memrm.pod +34 -0
- data/ext/libmemcached-0.32/docs/memslap.pod +33 -0
- data/ext/libmemcached-0.32/docs/memstat.pod +35 -0
- data/ext/libmemcached-0.32/libmemcached/Makefile.am +107 -0
- data/ext/libmemcached-0.32/libmemcached/Makefile.in +1050 -0
- data/ext/libmemcached-0.32/libmemcached/byteorder.c +31 -0
- data/ext/libmemcached-0.32/libmemcached/common.h +183 -0
- data/ext/libmemcached-0.32/libmemcached/crc.c +86 -0
- data/ext/libmemcached-0.32/libmemcached/hsieh_hash.c +68 -0
- data/ext/libmemcached-0.32/libmemcached/jenkins_hash.c +213 -0
- data/ext/libmemcached-0.32/libmemcached/libmemcached.ver +1 -0
- data/ext/libmemcached-0.32/libmemcached/libmemcached_probes.d +28 -0
- data/ext/libmemcached-0.32/libmemcached/libmemcached_probes.h +78 -0
- data/ext/libmemcached-0.32/libmemcached/md5.c +354 -0
- data/ext/libmemcached-0.32/libmemcached/memcached.c +152 -0
- data/ext/libmemcached-0.32/libmemcached/memcached.h +302 -0
- data/ext/libmemcached-0.32/libmemcached/memcached.hpp +799 -0
- data/ext/libmemcached-0.32/libmemcached/memcached/README.txt +7 -0
- data/ext/libmemcached-0.32/libmemcached/memcached/protocol_binary.h +366 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_allocators.c +72 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_analyze.c +100 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_auto.c +207 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_behavior.c +285 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_callback.c +175 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_configure.h.in +23 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_connect.c +361 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_constants.h +145 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_delete.c +0 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_do.c +34 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_dump.c +79 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_fetch.c +102 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_flush.c +89 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_flush_buffers.c +22 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_get.c +495 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_get.h +87 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_hash.c +252 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_hosts.c +510 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_internal.h +31 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_io.c +547 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_io.h +59 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_key.c +28 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_parse.c +74 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_pool.h +38 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_purge.c +76 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_quit.c +75 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_response.c +528 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_result.c +57 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_result.h +59 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_sasl.c +225 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_sasl.h +44 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_server.c +159 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_server.h +93 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_stats.c +454 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_storage.c +514 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_storage.h +107 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_strerror.c +92 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_string.c +138 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_string.h +53 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_types.h +44 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_util.h +15 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_verbosity.c +36 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_version.c +112 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_watchpoint.h +38 -0
- data/ext/libmemcached-0.32/libmemcached/murmur_hash.c +76 -0
- data/ext/libmemcached-0.32/libmemcached/visibility.h +51 -0
- data/ext/libmemcached-0.32/libmemcachedutil/Makefile.am +11 -0
- data/ext/libmemcached-0.32/libmemcachedutil/Makefile.in +602 -0
- data/ext/libmemcached-0.32/libmemcachedutil/libmemcachedutil.ver +1 -0
- data/ext/libmemcached-0.32/libmemcachedutil/memcached_pool.c +170 -0
- data/ext/libmemcached-0.32/m4/ac_cxx_compile_stdcxx_0x.m4 +103 -0
- data/ext/libmemcached-0.32/m4/ac_cxx_header_stdcxx_98.m4 +67 -0
- data/ext/libmemcached-0.32/m4/acx_pthread.m4 +276 -0
- data/ext/libmemcached-0.32/m4/byteorder.m4 +40 -0
- data/ext/libmemcached-0.32/m4/deprecated.m4 +17 -0
- data/ext/libmemcached-0.32/m4/enable_utillib.m4 +16 -0
- data/ext/libmemcached-0.32/m4/extensions.m4 +94 -0
- data/ext/libmemcached-0.32/m4/hsieh.m4 +18 -0
- data/ext/libmemcached-0.32/m4/lib-prefix.m4 +221 -0
- data/ext/libmemcached-0.32/m4/libtool.m4 +7360 -0
- data/ext/libmemcached-0.32/m4/ltoptions.m4 +368 -0
- data/ext/libmemcached-0.32/m4/ltsugar.m4 +123 -0
- data/ext/libmemcached-0.32/m4/ltversion.m4 +23 -0
- data/ext/libmemcached-0.32/m4/lt~obsolete.m4 +92 -0
- data/ext/libmemcached-0.32/m4/memcached.m4 +30 -0
- data/ext/libmemcached-0.32/m4/pandora_64bit.m4 +55 -0
- data/ext/libmemcached-0.32/m4/pandora_canonical.m4 +151 -0
- data/ext/libmemcached-0.32/m4/pandora_check_compiler_version.m4 +37 -0
- data/ext/libmemcached-0.32/m4/pandora_check_cxx_standard.m4 +16 -0
- data/ext/libmemcached-0.32/m4/pandora_enable_dtrace.m4 +41 -0
- data/ext/libmemcached-0.32/m4/pandora_ensure_gcc_version.m4 +36 -0
- data/ext/libmemcached-0.32/m4/pandora_have_better_malloc.m4 +54 -0
- data/ext/libmemcached-0.32/m4/pandora_have_sasl.m4 +133 -0
- data/ext/libmemcached-0.32/m4/pandora_header_assert.m4 +23 -0
- data/ext/libmemcached-0.32/m4/pandora_libtool.m4 +15 -0
- data/ext/libmemcached-0.32/m4/pandora_optimize.m4 +79 -0
- data/ext/libmemcached-0.32/m4/pandora_shared_ptr.m4 +56 -0
- data/ext/libmemcached-0.32/m4/pandora_vc_build.m4 +32 -0
- data/ext/libmemcached-0.32/m4/pandora_warnings.m4 +262 -0
- data/ext/libmemcached-0.32/m4/pod2man.m4 +7 -0
- data/ext/libmemcached-0.32/m4/protocol_binary.m4 +23 -0
- data/ext/libmemcached-0.32/m4/setsockopt.m4 +57 -0
- data/ext/libmemcached-0.32/m4/visibility.m4 +52 -0
- data/ext/libmemcached-0.32/support/Makefile.am +4 -0
- data/ext/libmemcached-0.32/support/Makefile.in +485 -0
- data/ext/libmemcached-0.32/support/libmemcached-fc.spec.in +105 -0
- data/ext/libmemcached-0.32/support/libmemcached.pc.in +10 -0
- data/ext/libmemcached-0.32/support/libmemcached.spec +105 -0
- data/ext/libmemcached-0.32/support/libmemcached.spec.in +105 -0
- data/ext/libmemcached-0.32/support/set_benchmark.sh +5 -0
- data/ext/libmemcached-0.32/tests/Makefile.am +105 -0
- data/ext/libmemcached-0.32/tests/Makefile.in +748 -0
- data/ext/libmemcached-0.32/tests/atomsmasher.c +245 -0
- data/ext/libmemcached-0.32/tests/function.c +4781 -0
- data/ext/libmemcached-0.32/tests/ketama_test_cases.h +108 -0
- data/ext/libmemcached-0.32/tests/output.cmp +7 -0
- data/ext/libmemcached-0.32/tests/output.res +7 -0
- data/ext/libmemcached-0.32/tests/output2.res +46 -0
- data/ext/libmemcached-0.32/tests/plus.cpp +293 -0
- data/ext/libmemcached-0.32/tests/r/memcat.res +19 -0
- data/ext/libmemcached-0.32/tests/r/memcp.res +27 -0
- data/ext/libmemcached-0.32/tests/r/memrm.res +19 -0
- data/ext/libmemcached-0.32/tests/r/memslap.res +33 -0
- data/ext/libmemcached-0.32/tests/r/memstat.res +33 -0
- data/ext/libmemcached-0.32/tests/server.c +118 -0
- data/ext/libmemcached-0.32/tests/server.h +25 -0
- data/ext/libmemcached-0.32/tests/start.c +16 -0
- data/ext/libmemcached-0.32/tests/t/memcat.test +4 -0
- data/ext/libmemcached-0.32/tests/t/memcp.test +3 -0
- data/ext/libmemcached-0.32/tests/t/memrm.test +3 -0
- data/ext/libmemcached-0.32/tests/t/memslap.test +5 -0
- data/ext/libmemcached-0.32/tests/t/memstat.test +3 -0
- data/ext/libmemcached-0.32/tests/test.c +137 -0
- data/ext/libmemcached-0.32/tests/test.h +46 -0
- data/ext/libmemcached-0.32/tests/udp.c +76 -0
- data/memcached.gemspec +4 -4
- data/test/unit/memcached_test.rb +30 -0
- metadata +213 -16
- data/ext/libmemcached-0.32.tar.gz +0 -0
- data/ext/libmemcached-1.patch +0 -270
- data/ext/libmemcached-10.patch +0 -12
- data/ext/libmemcached-2.patch +0 -116
- data/ext/libmemcached-3.patch +0 -8
- data/ext/libmemcached-4.patch +0 -40
- data/ext/libmemcached-5.patch +0 -832
- data/ext/libmemcached-6.patch +0 -20
- data/ext/libmemcached-7.patch +0 -2989
- data/ext/libmemcached-8.patch +0 -137
- data/ext/libmemcached-9.patch +0 -13
- data/ext/sasl.patch +0 -29283
@@ -0,0 +1,207 @@
|
|
1
|
+
#include "libmemcached/common.h"
|
2
|
+
#include <stdio.h>
|
3
|
+
#include <ctype.h>
|
4
|
+
#include <string.h>
|
5
|
+
#include "utilities.h"
|
6
|
+
|
7
|
+
|
8
|
+
long int timedif(struct timeval a, struct timeval b)
|
9
|
+
{
|
10
|
+
register int us, s;
|
11
|
+
|
12
|
+
us = (int)(a.tv_usec - b.tv_usec);
|
13
|
+
us /= 1000;
|
14
|
+
s = (int)(a.tv_sec - b.tv_sec);
|
15
|
+
s *= 1000;
|
16
|
+
return s + us;
|
17
|
+
}
|
18
|
+
|
19
|
+
void version_command(const char *command_name)
|
20
|
+
{
|
21
|
+
printf("%s v%u.%u\n", command_name, 1, 0);
|
22
|
+
exit(0);
|
23
|
+
}
|
24
|
+
|
25
|
+
static const char *lookup_help(memcached_options option)
|
26
|
+
{
|
27
|
+
switch (option)
|
28
|
+
{
|
29
|
+
case OPT_SERVERS: return("List which servers you wish to connect to.");
|
30
|
+
case OPT_VERSION: return("Display the version of the application and then exit.");
|
31
|
+
case OPT_HELP: return("Diplay this message and then exit.");
|
32
|
+
case OPT_VERBOSE: return("Give more details on the progression of the application.");
|
33
|
+
case OPT_DEBUG: return("Provide output only useful for debugging.");
|
34
|
+
case OPT_FLAG: return("Provide flag information for storage operation.");
|
35
|
+
case OPT_EXPIRE: return("Set the expire option for the object.");
|
36
|
+
case OPT_SET: return("Use set command with memcached when storing.");
|
37
|
+
case OPT_REPLACE: return("Use replace command with memcached when storing.");
|
38
|
+
case OPT_ADD: return("Use add command with memcached when storing.");
|
39
|
+
case OPT_SLAP_EXECUTE_NUMBER: return("Number of times to execute the given test.");
|
40
|
+
case OPT_SLAP_INITIAL_LOAD: return("Number of key pairs to load before executing tests.");
|
41
|
+
case OPT_SLAP_TEST: return("Test to run (currently \"get\" or \"set\").");
|
42
|
+
case OPT_SLAP_CONCURRENCY: return("Number of users to simulate with load.");
|
43
|
+
case OPT_SLAP_NON_BLOCK: return("Set TCP up to use non-blocking IO.");
|
44
|
+
case OPT_SLAP_TCP_NODELAY: return("Set TCP socket up to use nodelay.");
|
45
|
+
case OPT_FLUSH: return("Flush servers before running tests.");
|
46
|
+
case OPT_HASH: return("Select hash type.");
|
47
|
+
case OPT_BINARY: return("Switch to binary protocol.");
|
48
|
+
case OPT_ANALYZE: return("Analyze the provided servers.");
|
49
|
+
case OPT_UDP: return("Use UDP protocol when communicating with server.");
|
50
|
+
case OPT_USERNAME: return "Username to use for SASL authentication";
|
51
|
+
case OPT_PASSWD: return "Password to use for SASL authentication";
|
52
|
+
default: WATCHPOINT_ASSERT(0);
|
53
|
+
};
|
54
|
+
|
55
|
+
WATCHPOINT_ASSERT(0);
|
56
|
+
return "forgot to document this function :)";
|
57
|
+
}
|
58
|
+
|
59
|
+
void help_command(const char *command_name, const char *description,
|
60
|
+
const struct option *long_options,
|
61
|
+
memcached_programs_help_st *options __attribute__((unused)))
|
62
|
+
{
|
63
|
+
unsigned int x;
|
64
|
+
|
65
|
+
printf("%s v%u.%u\n\n", command_name, 1, 0);
|
66
|
+
printf("\t%s\n\n", description);
|
67
|
+
printf("Current options. A '=' means the option takes a value.\n\n");
|
68
|
+
|
69
|
+
for (x= 0; long_options[x].name; x++)
|
70
|
+
{
|
71
|
+
const char *help_message;
|
72
|
+
|
73
|
+
printf("\t --%s%c\n", long_options[x].name,
|
74
|
+
long_options[x].has_arg ? '=' : ' ');
|
75
|
+
if ((help_message= lookup_help(long_options[x].val)))
|
76
|
+
printf("\t\t%s\n", help_message);
|
77
|
+
}
|
78
|
+
|
79
|
+
printf("\n");
|
80
|
+
exit(0);
|
81
|
+
}
|
82
|
+
|
83
|
+
void process_hash_option(memcached_st *memc, char *opt_hash)
|
84
|
+
{
|
85
|
+
uint64_t set;
|
86
|
+
memcached_return rc;
|
87
|
+
|
88
|
+
if (opt_hash == NULL)
|
89
|
+
return;
|
90
|
+
|
91
|
+
set= MEMCACHED_HASH_DEFAULT; /* Just here to solve warning */
|
92
|
+
if (!strcasecmp(opt_hash, "CRC"))
|
93
|
+
set= MEMCACHED_HASH_CRC;
|
94
|
+
else if (!strcasecmp(opt_hash, "FNV1_64"))
|
95
|
+
set= MEMCACHED_HASH_FNV1_64;
|
96
|
+
else if (!strcasecmp(opt_hash, "FNV1A_64"))
|
97
|
+
set= MEMCACHED_HASH_FNV1A_64;
|
98
|
+
else if (!strcasecmp(opt_hash, "FNV1_32"))
|
99
|
+
set= MEMCACHED_HASH_FNV1_32;
|
100
|
+
else if (!strcasecmp(opt_hash, "FNV1A_32"))
|
101
|
+
set= MEMCACHED_HASH_FNV1A_32;
|
102
|
+
else if (!strcasecmp(opt_hash, "NONE"))
|
103
|
+
set= MEMCACHED_HASH_NONE;
|
104
|
+
else
|
105
|
+
{
|
106
|
+
fprintf(stderr, "hash: type not recognized %s\n", opt_hash);
|
107
|
+
exit(1);
|
108
|
+
}
|
109
|
+
|
110
|
+
rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, set);
|
111
|
+
if (rc != MEMCACHED_SUCCESS)
|
112
|
+
{
|
113
|
+
fprintf(stderr, "hash: memcache error %s\n", memcached_strerror(memc, rc));
|
114
|
+
exit(1);
|
115
|
+
}
|
116
|
+
}
|
117
|
+
|
118
|
+
static char *username;
|
119
|
+
static char *passwd;
|
120
|
+
|
121
|
+
#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
|
122
|
+
static int get_username(void *context, int id, const char **result,
|
123
|
+
unsigned int *len)
|
124
|
+
{
|
125
|
+
(void)context;
|
126
|
+
if (!result || (id != SASL_CB_USER && id != SASL_CB_AUTHNAME))
|
127
|
+
return SASL_BADPARAM;
|
128
|
+
|
129
|
+
*result= username;
|
130
|
+
if (len)
|
131
|
+
*len= (username == NULL) ? 0 : (unsigned int)strlen(username);
|
132
|
+
|
133
|
+
return SASL_OK;
|
134
|
+
}
|
135
|
+
|
136
|
+
static int get_password(sasl_conn_t *conn, void *context, int id,
|
137
|
+
sasl_secret_t **psecret)
|
138
|
+
{
|
139
|
+
(void)context;
|
140
|
+
static sasl_secret_t* x;
|
141
|
+
|
142
|
+
if (!conn || ! psecret || id != SASL_CB_PASS)
|
143
|
+
return SASL_BADPARAM;
|
144
|
+
|
145
|
+
if (passwd == NULL)
|
146
|
+
{
|
147
|
+
*psecret= NULL;
|
148
|
+
return SASL_OK;
|
149
|
+
}
|
150
|
+
|
151
|
+
size_t len= strlen(passwd);
|
152
|
+
x = realloc(x, sizeof(sasl_secret_t) + len);
|
153
|
+
if (!x)
|
154
|
+
return SASL_NOMEM;
|
155
|
+
|
156
|
+
x->len = len;
|
157
|
+
strcpy((void *)x->data, passwd);
|
158
|
+
|
159
|
+
*psecret = x;
|
160
|
+
return SASL_OK;
|
161
|
+
}
|
162
|
+
|
163
|
+
/* callbacks we support */
|
164
|
+
static sasl_callback_t sasl_callbacks[] = {
|
165
|
+
{
|
166
|
+
SASL_CB_USER, &get_username, NULL
|
167
|
+
}, {
|
168
|
+
SASL_CB_AUTHNAME, &get_username, NULL
|
169
|
+
}, {
|
170
|
+
SASL_CB_PASS, &get_password, NULL
|
171
|
+
}, {
|
172
|
+
SASL_CB_LIST_END, NULL, NULL
|
173
|
+
}
|
174
|
+
};
|
175
|
+
#endif
|
176
|
+
|
177
|
+
bool initialize_sasl(memcached_st *memc, char *user, char *password)
|
178
|
+
{
|
179
|
+
#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
|
180
|
+
if (user != NULL && password != NULL)
|
181
|
+
{
|
182
|
+
username= user;
|
183
|
+
passwd= password;
|
184
|
+
|
185
|
+
if (sasl_client_init(NULL) != SASL_OK)
|
186
|
+
{
|
187
|
+
fprintf(stderr, "Failed to initialize sasl library!\n");
|
188
|
+
return false;
|
189
|
+
}
|
190
|
+
memcached_set_sasl_callbacks(memc, sasl_callbacks);
|
191
|
+
}
|
192
|
+
#else
|
193
|
+
(void)memc;
|
194
|
+
(void)user;
|
195
|
+
(void)passwd;
|
196
|
+
#endif
|
197
|
+
|
198
|
+
return true;
|
199
|
+
}
|
200
|
+
|
201
|
+
void shutdown_sasl(void)
|
202
|
+
{
|
203
|
+
#if LIBMEMCACHED_WITH_SASL_SUPPORT
|
204
|
+
if (username != NULL || passwd != NULL)
|
205
|
+
sasl_done();
|
206
|
+
#endif
|
207
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#include <getopt.h>
|
2
|
+
#include <libmemcached/memcached.h>
|
3
|
+
#include "client_options.h"
|
4
|
+
|
5
|
+
#if TIME_WITH_SYS_TIME
|
6
|
+
# include <sys/time.h>
|
7
|
+
# include <time.h>
|
8
|
+
#else
|
9
|
+
# if HAVE_SYS_TIME_H
|
10
|
+
# include <sys/time.h>
|
11
|
+
# else
|
12
|
+
# include <time.h>
|
13
|
+
# endif
|
14
|
+
#endif
|
15
|
+
|
16
|
+
#ifdef __sun
|
17
|
+
/* For some odd reason the option struct on solaris defines the argument
|
18
|
+
* as char* and not const char*
|
19
|
+
*/
|
20
|
+
#define OPTIONSTRING char*
|
21
|
+
#else
|
22
|
+
#define OPTIONSTRING const char*
|
23
|
+
#endif
|
24
|
+
|
25
|
+
typedef struct memcached_programs_help_st memcached_programs_help_st;
|
26
|
+
|
27
|
+
struct memcached_programs_help_st
|
28
|
+
{
|
29
|
+
char *not_used_yet;
|
30
|
+
};
|
31
|
+
|
32
|
+
char *strdup_cleanup(const char *str);
|
33
|
+
void cleanup(void);
|
34
|
+
long int timedif(struct timeval a, struct timeval b);
|
35
|
+
void version_command(const char *command_name);
|
36
|
+
void help_command(const char *command_name, const char *description,
|
37
|
+
const struct option *long_options,
|
38
|
+
memcached_programs_help_st *options);
|
39
|
+
void process_hash_option(memcached_st *memc, char *opt_hash);
|
40
|
+
bool initialize_sasl(memcached_st *memc, char *user, char *password);
|
41
|
+
void shutdown_sasl(void);
|
@@ -0,0 +1,252 @@
|
|
1
|
+
/* config.h.in. Generated from configure.ac by autoheader. */
|
2
|
+
|
3
|
+
/* Define if building universal (internal helper macro) */
|
4
|
+
#undef AC_APPLE_UNIVERSAL_BUILD
|
5
|
+
|
6
|
+
/* Enable big endian byteorder */
|
7
|
+
#undef BYTEORDER_BIG_ENDIAN
|
8
|
+
|
9
|
+
/* Enable little endian byteorder */
|
10
|
+
#undef BYTEORDER_LITTLE_ENDIAN
|
11
|
+
|
12
|
+
/* Define to 1 if you have the <assert.h> header file. */
|
13
|
+
#undef HAVE_ASSERT_H
|
14
|
+
|
15
|
+
/* Define to 1 if you have the <boost/shared_ptr.hpp> header file. */
|
16
|
+
#undef HAVE_BOOST_SHARED_PTR_HPP
|
17
|
+
|
18
|
+
/* Define to 1 if you have the <dlfcn.h> header file. */
|
19
|
+
#undef HAVE_DLFCN_H
|
20
|
+
|
21
|
+
/* Enables DTRACE Support */
|
22
|
+
#undef HAVE_DTRACE
|
23
|
+
|
24
|
+
/* Enables hsieh hashing support */
|
25
|
+
#undef HAVE_HSIEH_HASH
|
26
|
+
|
27
|
+
/* Have ntohll */
|
28
|
+
#undef HAVE_HTONLL
|
29
|
+
|
30
|
+
/* Define to 1 if you have the <inttypes.h> header file. */
|
31
|
+
#undef HAVE_INTTYPES_H
|
32
|
+
|
33
|
+
/* Define to 1 if you have the `c_p' library (-lc_p). */
|
34
|
+
#undef HAVE_LIBC_P
|
35
|
+
|
36
|
+
/* Enables libmemcachedutil Support */
|
37
|
+
#undef HAVE_LIBMEMCACHEDUTIL
|
38
|
+
|
39
|
+
/* Define to 1 if you have the `mtmalloc' library (-lmtmalloc). */
|
40
|
+
#undef HAVE_LIBMTMALLOC
|
41
|
+
|
42
|
+
/* Define if you have the sasl library. */
|
43
|
+
#undef HAVE_LIBSASL
|
44
|
+
|
45
|
+
/* Define if you have the sasl2 library. */
|
46
|
+
#undef HAVE_LIBSASL2
|
47
|
+
|
48
|
+
/* Define to 1 if you have the `tcmalloc' library (-ltcmalloc). */
|
49
|
+
#undef HAVE_LIBTCMALLOC
|
50
|
+
|
51
|
+
/* Define to 1 if you have the `tcmalloc-minimal' library
|
52
|
+
(-ltcmalloc-minimal). */
|
53
|
+
#undef HAVE_LIBTCMALLOC_MINIMAL
|
54
|
+
|
55
|
+
/* Define to 1 if you have the `umem' library (-lumem). */
|
56
|
+
#undef HAVE_LIBUMEM
|
57
|
+
|
58
|
+
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
|
59
|
+
to 0 otherwise. */
|
60
|
+
#undef HAVE_MALLOC
|
61
|
+
|
62
|
+
/* Define to 1 if you have the <memory> header file. */
|
63
|
+
#undef HAVE_MEMORY
|
64
|
+
|
65
|
+
/* Define to 1 if you have the <memory.h> header file. */
|
66
|
+
#undef HAVE_MEMORY_H
|
67
|
+
|
68
|
+
/* Define if you have POSIX threads libraries and header files. */
|
69
|
+
#undef HAVE_PTHREAD
|
70
|
+
|
71
|
+
/* Define to 1 if you have a working SO_RCVTIMEO */
|
72
|
+
#undef HAVE_RCVTIMEO
|
73
|
+
|
74
|
+
/* Define to 1 if your system has a GNU libc compatible `realloc' function,
|
75
|
+
and to 0 otherwise. */
|
76
|
+
#undef HAVE_REALLOC
|
77
|
+
|
78
|
+
/* Define to 1 if you have a working SO_SNDTIMEO */
|
79
|
+
#undef HAVE_SNDTIMEO
|
80
|
+
|
81
|
+
/* Define if g++ supports C++0x features. */
|
82
|
+
#undef HAVE_STDCXX_0X
|
83
|
+
|
84
|
+
/* Define to 1 if you have the <stdint.h> header file. */
|
85
|
+
#undef HAVE_STDINT_H
|
86
|
+
|
87
|
+
/* Define to 1 if you have the <stdlib.h> header file. */
|
88
|
+
#undef HAVE_STDLIB_H
|
89
|
+
|
90
|
+
/* Define to 1 if you have the <strings.h> header file. */
|
91
|
+
#undef HAVE_STRINGS_H
|
92
|
+
|
93
|
+
/* Define to 1 if you have the <string.h> header file. */
|
94
|
+
#undef HAVE_STRING_H
|
95
|
+
|
96
|
+
/* Define to 1 if you have the <sys/stat.h> header file. */
|
97
|
+
#undef HAVE_SYS_STAT_H
|
98
|
+
|
99
|
+
/* Define to 1 if you have the <sys/types.h> header file. */
|
100
|
+
#undef HAVE_SYS_TYPES_H
|
101
|
+
|
102
|
+
/* Define to 1 if you have the <tr1/memory> header file. */
|
103
|
+
#undef HAVE_TR1_MEMORY
|
104
|
+
|
105
|
+
/* Define to 1 if you have the <unistd.h> header file. */
|
106
|
+
#undef HAVE_UNISTD_H
|
107
|
+
|
108
|
+
/* Define to 1 or 0, depending whether the compiler supports simple visibility
|
109
|
+
declarations. */
|
110
|
+
#undef HAVE_VISIBILITY
|
111
|
+
|
112
|
+
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
113
|
+
*/
|
114
|
+
#undef LT_OBJDIR
|
115
|
+
|
116
|
+
/* Name of the memcached binary used in make test */
|
117
|
+
#undef MEMCACHED_BINARY
|
118
|
+
|
119
|
+
/* Define to 1 if assertions should be disabled. */
|
120
|
+
#undef NDEBUG
|
121
|
+
|
122
|
+
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
|
123
|
+
#undef NO_MINUS_C_MINUS_O
|
124
|
+
|
125
|
+
/* Name of package */
|
126
|
+
#undef PACKAGE
|
127
|
+
|
128
|
+
/* Define to the address where bug reports for this package should be sent. */
|
129
|
+
#undef PACKAGE_BUGREPORT
|
130
|
+
|
131
|
+
/* Define to the full name of this package. */
|
132
|
+
#undef PACKAGE_NAME
|
133
|
+
|
134
|
+
/* Define to the full name and version of this package. */
|
135
|
+
#undef PACKAGE_STRING
|
136
|
+
|
137
|
+
/* Define to the one symbol short name of this package. */
|
138
|
+
#undef PACKAGE_TARNAME
|
139
|
+
|
140
|
+
/* Define to the home page for this package. */
|
141
|
+
#undef PACKAGE_URL
|
142
|
+
|
143
|
+
/* Define to the version of this package. */
|
144
|
+
#undef PACKAGE_VERSION
|
145
|
+
|
146
|
+
/* Define to necessary symbol if this constant uses a non-standard name on
|
147
|
+
your system. */
|
148
|
+
#undef PTHREAD_CREATE_JOINABLE
|
149
|
+
|
150
|
+
/* The namespace in which SHARED_PTR can be found */
|
151
|
+
#undef SHARED_PTR_NAMESPACE
|
152
|
+
|
153
|
+
/* Define if ISO C++ 1998 header files are present. */
|
154
|
+
#undef STDCXX_98_HEADERS
|
155
|
+
|
156
|
+
/* Define to 1 if you have the ANSI C header files. */
|
157
|
+
#undef STDC_HEADERS
|
158
|
+
|
159
|
+
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
|
160
|
+
#undef TIME_WITH_SYS_TIME
|
161
|
+
|
162
|
+
/* Version number of package */
|
163
|
+
#undef VERSION
|
164
|
+
|
165
|
+
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
166
|
+
significant byte first (like Motorola and SPARC, unlike Intel). */
|
167
|
+
#if defined AC_APPLE_UNIVERSAL_BUILD
|
168
|
+
# if defined __BIG_ENDIAN__
|
169
|
+
# define WORDS_BIGENDIAN 1
|
170
|
+
# endif
|
171
|
+
#else
|
172
|
+
# ifndef WORDS_BIGENDIAN
|
173
|
+
# undef WORDS_BIGENDIAN
|
174
|
+
# endif
|
175
|
+
#endif
|
176
|
+
|
177
|
+
/* Number of bits in a file offset, on hosts where this is settable. */
|
178
|
+
#undef _FILE_OFFSET_BITS
|
179
|
+
|
180
|
+
/* Define for large files, on AIX-style hosts. */
|
181
|
+
#undef _LARGE_FILES
|
182
|
+
|
183
|
+
/* Define to 1 if on MINIX. */
|
184
|
+
#undef _MINIX
|
185
|
+
|
186
|
+
/* Define to 2 if the system does not provide POSIX.1 features except with
|
187
|
+
this defined. */
|
188
|
+
#undef _POSIX_1_SOURCE
|
189
|
+
|
190
|
+
/* Define to 1 if you need to in order for `stat' and other things to work. */
|
191
|
+
#undef _POSIX_SOURCE
|
192
|
+
|
193
|
+
/* Define to 500 only on HP-UX. */
|
194
|
+
#undef _XOPEN_SOURCE
|
195
|
+
|
196
|
+
/* Enable extensions on AIX 3, Interix. */
|
197
|
+
#ifndef _ALL_SOURCE
|
198
|
+
# undef _ALL_SOURCE
|
199
|
+
#endif
|
200
|
+
/* Enable GNU extensions on systems that have them. */
|
201
|
+
#ifndef _GNU_SOURCE
|
202
|
+
# undef _GNU_SOURCE
|
203
|
+
#endif
|
204
|
+
/* Enable threading extensions on Solaris. */
|
205
|
+
#ifndef _POSIX_PTHREAD_SEMANTICS
|
206
|
+
# undef _POSIX_PTHREAD_SEMANTICS
|
207
|
+
#endif
|
208
|
+
/* Enable extensions on HP NonStop. */
|
209
|
+
#ifndef _TANDEM_SOURCE
|
210
|
+
# undef _TANDEM_SOURCE
|
211
|
+
#endif
|
212
|
+
/* Enable general extensions on Solaris. */
|
213
|
+
#ifndef __EXTENSIONS__
|
214
|
+
# undef __EXTENSIONS__
|
215
|
+
#endif
|
216
|
+
|
217
|
+
|
218
|
+
/* Define to empty if `const' does not conform to ANSI C. */
|
219
|
+
#undef const
|
220
|
+
|
221
|
+
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
222
|
+
calls it, or to nothing if 'inline' is not supported under any name. */
|
223
|
+
#ifndef __cplusplus
|
224
|
+
#undef inline
|
225
|
+
#endif
|
226
|
+
|
227
|
+
/* Define to rpl_malloc if the replacement function should be used. */
|
228
|
+
#undef malloc
|
229
|
+
|
230
|
+
/* Define to rpl_realloc if the replacement function should be used. */
|
231
|
+
#undef realloc
|
232
|
+
|
233
|
+
/* Define to the equivalent of the C99 'restrict' keyword, or to
|
234
|
+
nothing if this is not supported. Do not define if restrict is
|
235
|
+
supported directly. */
|
236
|
+
#undef restrict
|
237
|
+
/* Work around a bug in Sun C++: it does not support _Restrict or
|
238
|
+
__restrict__, even though the corresponding Sun C compiler ends up with
|
239
|
+
"#define restrict _Restrict" or "#define restrict __restrict__" in the
|
240
|
+
previous line. Perhaps some future version of Sun C++ will work with
|
241
|
+
restrict; if so, hopefully it defines __RESTRICT like Sun C does. */
|
242
|
+
#if defined __SUNPRO_CC && !defined __RESTRICT
|
243
|
+
# define _Restrict
|
244
|
+
# define __restrict__
|
245
|
+
#endif
|
246
|
+
|
247
|
+
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
248
|
+
#undef size_t
|
249
|
+
|
250
|
+
/* Define to empty if the keyword `volatile' does not work. Warning: valid
|
251
|
+
code using `volatile' can become incorrect without. Disable with care. */
|
252
|
+
#undef volatile
|