| 649 | } |
| 650 | |
| 651 | static bool decrypt_repo_keys (std::vector<Key_file>& key_files, uint32_t key_version, const std::vector<std::string>& secret_keys, const std::string& keys_path) |
| 652 | { |
| 653 | bool successful = false; |
| 654 | std::vector<std::string> dirents; |
| 655 | |
| 656 | if (access(keys_path.c_str(), F_OK) == 0) { |
| 657 | dirents = get_directory_contents(keys_path.c_str()); |
| 658 | } |
| 659 | |
| 660 | for (std::vector<std::string>::const_iterator dirent(dirents.begin()); dirent != dirents.end(); ++dirent) { |
| 661 | const char* key_name = 0; |
| 662 | if (*dirent != "default") { |
| 663 | if (!validate_key_name(dirent->c_str())) { |
| 664 | continue; |
| 665 | } |
| 666 | key_name = dirent->c_str(); |
| 667 | } |
| 668 | |
| 669 | Key_file key_file; |
| 670 | if (decrypt_repo_key(key_file, key_name, key_version, secret_keys, keys_path)) { |
| 671 | key_files.push_back(key_file); |
| 672 | successful = true; |
| 673 | } |
| 674 | } |
| 675 | return successful; |
| 676 | } |
| 677 | |
| 678 | static void encrypt_repo_key (const char* key_name, const Key_file::Entry& key, const std::vector<std::pair<std::string, bool> >& collab_keys, const std::string& keys_path, std::vector<std::string>* new_files) |
| 679 | { |
no test coverage detected