X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=clients%2Fmemcp.cc;h=228362513905beabef0108285301d6c48f3d741f;hb=026339d350e4cbec41951eea4d64bda5caf9febc;hp=3869242b171c8cff803dda17624d4c3b0606bee2;hpb=ae6bc7501efd5aeaaee92dabe2da0ec2d1625c5b;p=awesomized%2Flibmemcached diff --git a/clients/memcp.cc b/clients/memcp.cc index 3869242b..22836251 100644 --- a/clients/memcp.cc +++ b/clients/memcp.cc @@ -11,21 +11,23 @@ #include "config.h" -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include -#include +#include +#ifdef HAVE_STRINGS_H +#include +#endif #include #include -#include -#include -#include -#include #include -#include -#include +#include +#include #include @@ -114,12 +116,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; + } + } + while (optind < argc) { struct stat sbuf; @@ -206,7 +221,6 @@ int main(int argc, char *argv[]) free(opt_servers); if (opt_hash) free(opt_hash); - shutdown_sasl(); return return_code; }