Commit b0c8ad2d authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Fix folly/io/async/test/SSLContextTest.cpp under gcc8 with -Wshadow

Summary:
[Folly] Fix `folly/io/async/test/SSLContextTest.cpp` under gcc8 with `-Wshadow`.

```
folly/io/async/test/SSLContextTest.cpp: In member function 'virtual void folly::SSLContextTest_TestLoadCertificateChain_Test::TestBody()':
folly/io/async/test/SSLContextTest.cpp:143:31: error: declaration of 'ctx' shadows a member of 'folly::SSLContextTest_TestLoadCertificateChain_Test' [-Werror=shadow]
folly/io/async/test/SSLContextTest.cpp:29:14: note: shadowed declaration is here
```

Reviewed By: knekritz

Differential Revision: D13610440

fbshipit-source-id: 3998a8a7434afdb27e9a89b3e85e87364cd2e72c
parent e2d788ff
...@@ -140,25 +140,25 @@ TEST_F(SSLContextTest, TestLoadCertKey) { ...@@ -140,25 +140,25 @@ TEST_F(SSLContextTest, TestLoadCertKey) {
TEST_F(SSLContextTest, TestLoadCertificateChain) { TEST_F(SSLContextTest, TestLoadCertificateChain) {
constexpr auto kCertChainPath = "folly/io/async/test/certs/client_chain.pem"; constexpr auto kCertChainPath = "folly/io/async/test/certs/client_chain.pem";
std::unique_ptr<SSLContext> ctx; std::unique_ptr<SSLContext> ctx2;
STACK_OF(X509) * stack; STACK_OF(X509) * stack;
SSL_CTX* sctx; SSL_CTX* sctx;
std::string contents; std::string contents;
EXPECT_TRUE(folly::readFile(kCertChainPath, contents)); EXPECT_TRUE(folly::readFile(kCertChainPath, contents));
ctx = std::make_unique<SSLContext>(); ctx2 = std::make_unique<SSLContext>();
ctx->loadCertificate(kCertChainPath, "PEM"); ctx2->loadCertificate(kCertChainPath, "PEM");
stack = nullptr; stack = nullptr;
sctx = ctx->getSSLCtx(); sctx = ctx2->getSSLCtx();
SSL_CTX_get0_chain_certs(sctx, &stack); SSL_CTX_get0_chain_certs(sctx, &stack);
ASSERT_NE(stack, nullptr); ASSERT_NE(stack, nullptr);
EXPECT_EQ(1, sk_X509_num(stack)); EXPECT_EQ(1, sk_X509_num(stack));
ctx = std::make_unique<SSLContext>(); ctx2 = std::make_unique<SSLContext>();
ctx->loadCertificateFromBufferPEM(contents); ctx2->loadCertificateFromBufferPEM(contents);
stack = nullptr; stack = nullptr;
sctx = ctx->getSSLCtx(); sctx = ctx2->getSSLCtx();
SSL_CTX_get0_chain_certs(sctx, &stack); SSL_CTX_get0_chain_certs(sctx, &stack);
ASSERT_NE(stack, nullptr); ASSERT_NE(stack, nullptr);
EXPECT_EQ(1, sk_X509_num(stack)); EXPECT_EQ(1, sk_X509_num(stack));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment