Fixing the SSL_REUSE auth context string attribute.

"true" and "false" are strings, so use similar code that of the cstring variant. Otherwise, the generated properties will have an embedded zero in there.
pull/16408/head
Nicolas "Pixel" Noble 7 years ago
parent 5fb2281ada
commit 71655cf48a
  1. 4
      src/core/tsi/ssl_transport_security.cc
  2. 6
      test/core/tsi/ssl_transport_security_test.cc

@ -1049,9 +1049,9 @@ static tsi_result ssl_handshaker_result_extract_peer(
}
const char* session_reused = SSL_session_reused(impl->ssl) ? "true" : "false";
result = tsi_construct_string_peer_property(
result = tsi_construct_string_peer_property_from_cstring(
TSI_SSL_SESSION_REUSED_PEER_PROPERTY, session_reused,
strlen(session_reused) + 1, &peer->properties[peer->property_count]);
&peer->properties[peer->property_count]);
if (result != TSI_OK) return result;
peer->property_count++;

@ -208,9 +208,11 @@ static void check_session_reusage(ssl_tsi_test_fixture* ssl_fixture,
tsi_peer_get_property_by_name(peer, TSI_SSL_SESSION_REUSED_PEER_PROPERTY);
GPR_ASSERT(session_reused != nullptr);
if (ssl_fixture->session_reused) {
GPR_ASSERT(strcmp(session_reused->value.data, "true") == 0);
GPR_ASSERT(strncmp(session_reused->value.data, "true",
session_reused->value.length) == 0);
} else {
GPR_ASSERT(strcmp(session_reused->value.data, "false") == 0);
GPR_ASSERT(strncmp(session_reused->value.data, "false",
session_reused->value.length) == 0);
}
}

Loading…
Cancel
Save