diff options
author | Tomasz Frydrych <[email protected]> | 2017-05-01 15:03:52 +0200 |
---|---|---|
committer | Tomasz Frydrych <[email protected]> | 2017-05-01 15:03:52 +0200 |
commit | 87c0fae706140b0a2a7a3fda9dd813474172fa2a (patch) | |
tree | 28930efab4d290dcebb89666d46050edd06703fd /src/cli/credentials.h | |
parent | 29cc6bebe132a34f882d450b35a69bf71bb3e27b (diff) |
Reformat code with astyle + fix code style
Diffstat (limited to 'src/cli/credentials.h')
-rw-r--r-- | src/cli/credentials.h | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/cli/credentials.h b/src/cli/credentials.h index 71acdc83d..99733e42b 100644 --- a/src/cli/credentials.h +++ b/src/cli/credentials.h @@ -18,8 +18,12 @@ inline bool value_exists(const std::vector<std::string>& vec, const std::string& val) { for(size_t i = 0; i != vec.size(); ++i) + { if(vec[i] == val) + { return true; + } + } return false; } @@ -64,7 +68,7 @@ class Basic_Credentials_Manager : public Botan::Credentials_Manager // TODO: make path configurable const std::vector<std::string> paths = { "/etc/ssl/certs", "/usr/share/ca-certificates" }; - for(auto&& path : paths) + for(auto const& path : paths) { std::shared_ptr<Botan::Certificate_Store> cs(new Botan::Certificate_Store_In_Memory(path)); m_certstores.push_back(cs); @@ -84,10 +88,14 @@ class Basic_Credentials_Manager : public Botan::Credentials_Manager // don't ask for client certs if(type == "tls-server") + { return v; + } - for(auto&& cs : m_certstores) + for(auto const& cs : m_certstores) + { v.push_back(cs.get()); + } return v; } @@ -99,13 +107,17 @@ class Basic_Credentials_Manager : public Botan::Credentials_Manager { BOTAN_UNUSED(type); - for(auto&& i : m_creds) + for(auto const& i : m_creds) { if(std::find(algos.begin(), algos.end(), i.key->algo_name()) == algos.end()) + { continue; + } if(hostname != "" && !i.certs[0].matches_dns_name(hostname)) + { continue; + } return i.certs; } @@ -117,10 +129,12 @@ class Basic_Credentials_Manager : public Botan::Credentials_Manager const std::string& /*type*/, const std::string& /*context*/) override { - for(auto&& i : m_creds) + for(auto const& i : m_creds) { if(cert == i.certs[0]) + { return i.key.get(); + } } return nullptr; @@ -129,8 +143,8 @@ class Basic_Credentials_Manager : public Botan::Credentials_Manager private: struct Certificate_Info { - std::vector<Botan::X509_Certificate> certs; - std::shared_ptr<Botan::Private_Key> key; + std::vector<Botan::X509_Certificate> certs; + std::shared_ptr<Botan::Private_Key> key; }; std::vector<Certificate_Info> m_creds; |