Fix mcrouter-oss build
authorAnirudh Ramachandran <avr@fb.com>
Wed, 8 Mar 2017 18:10:42 +0000 (10:10 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 8 Mar 2017 18:27:23 +0000 (10:27 -0800)
Summary: D4624754 broke mcrouter-oss because that uses older OpenSSL (1.0.1).

Reviewed By: yfeldblum, jmswen

Differential Revision: D4670767

fbshipit-source-id: f297c8d3e013525bb36bd059eb40c70f0c4c2dcc

folly/ssl/OpenSSLCertUtils.cpp

index d06cdac..238fa68 100644 (file)
@@ -128,17 +128,19 @@ folly::Optional<std::string> OpenSSLCertUtils::toString(X509& x509) {
     throw std::runtime_error("Cannot allocate bio");
   }
 
-  if (X509_print_ex(
-          in.get(),
-          &x509,
-          XN_FLAG_ONELINE,
-          X509_FLAG_NO_HEADER | /* A few bytes of cert and data */
-              X509_FLAG_NO_PUBKEY | /* Public key */
-              X509_FLAG_NO_IDS | /* Issuer/subject IDs */
-              X509_FLAG_NO_AUX | /* Auxiliary info? */
-              X509_FLAG_NO_SIGDUMP | /* Prints the signature */
-              X509_FLAG_NO_SIGNAME /* Signature algorithms */
-          ) > 0) {
+  int flags = 0;
+
+  flags |= X509_FLAG_NO_HEADER | /* A few bytes of cert and data */
+      X509_FLAG_NO_PUBKEY | /* Public key */
+      X509_FLAG_NO_AUX | /* Auxiliary info? */
+      X509_FLAG_NO_SIGDUMP | /* Prints the signature */
+      X509_FLAG_NO_SIGNAME; /* Signature algorithms */
+
+#ifdef X509_FLAG_NO_IDS
+  flags |= X509_FLAG_NO_IDS; /* Issuer/subject IDs */
+#endif
+
+  if (X509_print_ex(in.get(), &x509, XN_FLAG_ONELINE, flags) > 0) {
     char* bioData = nullptr;
     size_t bioLen = BIO_get_mem_data(in.get(), &bioData);
     return std::string(bioData, bioLen);