X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=clients%2Fmemflush.cc;h=1ef1bfde52629e9775573c8f6ef57691c46503a0;hb=c88563b65a81ad1743f26ad66376704d84043a33;hp=848bc1e7d1677937d620afd91fc9a1171b6bc35a;hpb=ae6bc7501efd5aeaaee92dabe2da0ec2d1625c5b;p=awesomized%2Flibmemcached diff --git a/clients/memflush.cc b/clients/memflush.cc index 848bc1e7..1ef1bfde 100644 --- a/clients/memflush.cc +++ b/clients/memflush.cc @@ -10,10 +10,12 @@ */ #include "config.h" -#include -#include -#include +#include +#include #include +#include +#include + #include #include "client_options.h" #include "utilities.h" @@ -60,12 +62,24 @@ int main(int argc, char *argv[]) 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_flush(memc, opt_expire); if (rc != MEMCACHED_SUCCESS) { @@ -80,8 +94,6 @@ int main(int argc, char *argv[]) free(opt_servers); - shutdown_sasl(); - return EXIT_SUCCESS; }