-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Actually set the TLS info based on the binary arguments (#1680)
Summary: Pull Request resolved: #1680 This completes the connection of the TLS feature to the TLS implementation at the binary layer. - Created a util function to populate the TlsInfo struct based on the arguments passed in - Modified the main file of each app to create a TlsInfo struct - passed the TlsInfo into the util functions Reviewed By: RuiyuZhu Differential Revision: D39643733 fbshipit-source-id: 9eb2f2fd82c4d06855ff4ea96c83579795e104f2
- Loading branch information
1 parent
7ccd61d
commit d3f93dc
Showing
11 changed files
with
145 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,8 @@ | |
|
||
#pragma once | ||
|
||
#include <cstdlib> | ||
#include <memory> | ||
#include <sstream> | ||
|
||
#include "folly/dynamic.h" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
#include <gtest/gtest.h> | ||
|
||
#include <cstdlib> | ||
#include <tuple> | ||
#include <vector> | ||
|
||
#include "../Util.h" | ||
|
||
namespace private_measurement { | ||
|
||
TEST(UtilTest, TestGetTlsInfoFromArguments) { | ||
auto tlsInfo = common::getTlsInfoFromArgs( | ||
false, | ||
"cert_path", | ||
"server_cert_path", | ||
"private_key_path", | ||
"passphrase_path"); | ||
|
||
EXPECT_FALSE(tlsInfo.useTls); | ||
EXPECT_STREQ(tlsInfo.rootCaCertPath.c_str(), ""); | ||
EXPECT_STREQ(tlsInfo.certPath.c_str(), ""); | ||
EXPECT_STREQ(tlsInfo.keyPath.c_str(), ""); | ||
EXPECT_STREQ(tlsInfo.passphrasePath.c_str(), ""); | ||
|
||
const char* home_dir = std::getenv("HOME"); | ||
if (home_dir == nullptr) { | ||
home_dir = ""; | ||
} | ||
|
||
std::string home_dir_string(home_dir); | ||
|
||
tlsInfo = common::getTlsInfoFromArgs( | ||
true, | ||
"cert_path", | ||
"server_cert_path", | ||
"private_key_path", | ||
"passphrase_path"); | ||
|
||
EXPECT_TRUE(tlsInfo.useTls); | ||
EXPECT_STREQ( | ||
tlsInfo.rootCaCertPath.c_str(), (home_dir_string + "/cert_path").c_str()); | ||
EXPECT_STREQ( | ||
tlsInfo.certPath.c_str(), | ||
(home_dir_string + "/server_cert_path").c_str()); | ||
EXPECT_STREQ( | ||
tlsInfo.keyPath.c_str(), (home_dir_string + "/private_key_path").c_str()); | ||
EXPECT_STREQ( | ||
tlsInfo.passphrasePath.c_str(), | ||
(home_dir_string + "/passphrase_path").c_str()); | ||
} | ||
} // namespace private_measurement |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.