X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=clients%2Fmemdump.cc;h=2b7b96fa50d13c959330f9af9972963ec3fe285f;hb=026339d350e4cbec41951eea4d64bda5caf9febc;hp=0e81dad491849f43c8b9b668b5f2cdd640bc3f63;hpb=67456d74f5bd4f354a360d70da503dc58cbe5971;p=awesomized%2Flibmemcached diff --git a/clients/memdump.cc b/clients/memdump.cc index 0e81dad4..2b7b96fa 100644 --- a/clients/memdump.cc +++ b/clients/memdump.cc @@ -11,18 +11,18 @@ #include "config.h" -#include -#include -#include -#include +#include +#include +#include +#include +#include #include -#include +#include +#include #include #include -#include -#include -#include -#include +#include +#include #include @@ -89,12 +89,25 @@ 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) + { + memcached_return_t ret; + if (memcached_failed(ret= memcached_set_sasl_auth_data(memc, opt_username, opt_passwd))) + { + std::cerr << memcached_last_error_message(memc) << std::endl; + memcached_free(memc); + return EXIT_FAILURE; + } + } + rc= memcached_dump(memc, callbacks, NULL, 1); if (rc != MEMCACHED_SUCCESS) @@ -112,8 +125,6 @@ int main(int argc, char *argv[]) if (opt_hash) free(opt_hash); - shutdown_sasl(); - return EXIT_SUCCESS; }