diff options
author | Brian Aker <brian@tangent.org> | 2011-08-14 23:40:24 -0700 |
---|---|---|
committer | Brian Aker <brian@tangent.org> | 2011-08-14 23:40:24 -0700 |
commit | b77f874c7d7ff386d01eeedb44c14d3003354bae (patch) | |
tree | 4f6db74937214abd311141cc983a92d749c6b940 /clients/memdump.cc | |
parent | d61195ed2a8d1db91773e1b66f6a17372f3a4838 (diff) | |
download | libmemcached-b77f874c7d7ff386d01eeedb44c14d3003354bae.tar.gz |
Merge in fixes for SASL.
Diffstat (limited to 'clients/memdump.cc')
-rw-r--r-- | clients/memdump.cc | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/clients/memdump.cc b/clients/memdump.cc index 0e81dad4..6f3c3e53 100644 --- a/clients/memdump.cc +++ b/clients/memdump.cc @@ -11,18 +11,18 @@ #include "config.h" -#include <stdio.h> -#include <stdlib.h> -#include <inttypes.h> -#include <unistd.h> +#include <cerrno> +#include <cstdio> +#include <cstdlib> +#include <cstring> +#include <fcntl.h> #include <getopt.h> -#include <sys/types.h> +#include <inttypes.h> +#include <iostream> #include <sys/stat.h> #include <sys/types.h> -#include <fcntl.h> -#include <errno.h> -#include <strings.h> -#include <string.h> +#include <sys/types.h> +#include <unistd.h> #include <libmemcached/memcached.h> @@ -89,9 +89,19 @@ int main(int argc, char *argv[]) memcached_server_list_free(servers); memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, (uint64_t)opt_binary); - if (!initialize_sasl(memc, opt_username, opt_passwd)) + + if (opt_username and LIBMEMCACHED_WITH_SASL_SUPPORT == 0) { memcached_free(memc); + std::cerr << "--username was supplied, but binary was not built with SASL support." << std::endl; + return EXIT_FAILURE; + } + + if (opt_username and initialize_sasl(memc, opt_username, opt_passwd) == false) + { + std::cerr << "Failed to initialize SASL support." << std::endl; + + memcached_free(memc); return EXIT_FAILURE; } |