From: Remi Gacogne Date: Thu, 8 Apr 2021 16:24:21 +0000 (+0200) Subject: rec: Be more straightforward in rec_control for 'hash-password' X-Git-Tag: dnsdist-1.7.0-alpha1~12^2~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f5e1e8c32f8c8dc4b1ece9299f05b5bfe931246;p=thirdparty%2Fpdns.git rec: Be more straightforward in rec_control for 'hash-password' --- diff --git a/pdns/rec_control.cc b/pdns/rec_control.cc index 77bdfe789c..6e61171eef 100644 --- a/pdns/rec_control.cc +++ b/pdns/rec_control.cc @@ -109,7 +109,6 @@ int main(int argc, char** argv) const vector&commands=arg().getCommands(); string command; - string password; int fd = -1; unsigned int i = 0; while (i < commands.size()) { @@ -145,7 +144,9 @@ int main(int argc, char** argv) else if (commands.at(i) == "hash-password") { if (commands.size() > (i + 1)) { ++i; - password = commands.at(i); + auto password = commands.at(i); + cout << hashPassword(password) << endl; + return 0; } else { throw PDNSException("Command needs a password argument"); @@ -154,11 +155,6 @@ int main(int argc, char** argv) ++i; } - if (!password.empty()) { - cout << hashPassword(password) << endl; - return 0; - } - auto timeout = arg().asNum("timeout"); RecursorControlChannel rccS; rccS.connect(arg()["socket-dir"], sockname);