diff options
author | Craig Tiller <craig.tiller@gmail.com> | 2015-01-27 10:18:09 -0800 |
---|---|---|
committer | Craig Tiller <craig.tiller@gmail.com> | 2015-01-27 10:18:09 -0800 |
commit | 6437bd5037518953b159ae5321cd72eaaeb4ed03 (patch) | |
tree | 6df55f3880b5c6a4fb77bf737cb834467a24fae6 /src/core/security | |
parent | 103481ec8a7d93e0b120c639aa0c879e5e0aff88 (diff) | |
parent | 1159dcf5bc98460e0408cb30609dd1dafa8d31a4 (diff) |
Merge github.com:google/grpc into javascript
Diffstat (limited to 'src/core/security')
-rw-r--r-- | src/core/security/credentials.c | 17 | ||||
-rw-r--r-- | src/core/security/json_token.c | 2 | ||||
-rw-r--r-- | src/core/security/secure_endpoint.c | 2 | ||||
-rw-r--r-- | src/core/security/security_context.c | 2 |
4 files changed, 8 insertions, 15 deletions
diff --git a/src/core/security/credentials.c b/src/core/security/credentials.c index 628963e46c..2f75556e7b 100644 --- a/src/core/security/credentials.c +++ b/src/core/security/credentials.c @@ -36,9 +36,9 @@ #include "src/core/httpcli/httpcli.h" #include "src/core/iomgr/iomgr.h" #include "src/core/security/json_token.h" +#include "src/core/support/string.h" #include <grpc/support/alloc.h> #include <grpc/support/log.h> -#include <grpc/support/string.h> #include <grpc/support/sync.h> #include <grpc/support/time.h> @@ -157,7 +157,7 @@ static void ssl_server_destroy(grpc_server_credentials *creds) { if (c->config.pem_private_keys[i] != NULL) { gpr_free(c->config.pem_private_keys[i]); } - if (c->config.pem_cert_chains[i]!= NULL) { + if (c->config.pem_cert_chains[i] != NULL) { gpr_free(c->config.pem_cert_chains[i]); } } @@ -354,7 +354,6 @@ grpc_oauth2_token_fetcher_credentials_parse_server_response( cJSON *access_token = NULL; cJSON *token_type = NULL; cJSON *expires_in = NULL; - size_t new_access_token_size = 0; json = cJSON_Parse(null_terminated_body); if (json == NULL) { gpr_log(GPR_ERROR, "Could not parse JSON from %s", null_terminated_body); @@ -384,12 +383,8 @@ grpc_oauth2_token_fetcher_credentials_parse_server_response( status = GRPC_CREDENTIALS_ERROR; goto end; } - new_access_token_size = strlen(token_type->valuestring) + 1 + - strlen(access_token->valuestring) + 1; - new_access_token = gpr_malloc(new_access_token_size); - /* C89 does not have snprintf :(. */ - sprintf(new_access_token, "%s %s", token_type->valuestring, - access_token->valuestring); + gpr_asprintf(&new_access_token, "%s %s", token_type->valuestring, + access_token->valuestring); token_lifetime->tv_sec = expires_in->valueint; token_lifetime->tv_nsec = 0; if (*token_elem != NULL) grpc_mdelem_unref(*token_elem); @@ -539,9 +534,7 @@ static void service_account_fetch_oauth2( response_cb(metadata_req, &response); return; } - body = gpr_malloc(strlen(GRPC_SERVICE_ACCOUNT_POST_BODY_PREFIX) + - strlen(jwt) + 1); - sprintf(body, "%s%s", GRPC_SERVICE_ACCOUNT_POST_BODY_PREFIX, jwt); + gpr_asprintf(&body, "%s%s", GRPC_SERVICE_ACCOUNT_POST_BODY_PREFIX, jwt); memset(&request, 0, sizeof(grpc_httpcli_request)); request.host = GRPC_SERVICE_ACCOUNT_HOST; request.path = GRPC_SERVICE_ACCOUNT_TOKEN_PATH; diff --git a/src/core/security/json_token.c b/src/core/security/json_token.c index 14ee758e8b..82bd9b505a 100644 --- a/src/core/security/json_token.c +++ b/src/core/security/json_token.c @@ -37,9 +37,9 @@ #include <grpc/support/alloc.h> #include <grpc/support/log.h> -#include <grpc/support/string.h> #include "src/core/security/base64.h" +#include "src/core/support/string.h" #include <openssl/bio.h> #include <openssl/evp.h> diff --git a/src/core/security/secure_endpoint.c b/src/core/security/secure_endpoint.c index e73767c1aa..9f12cf5d60 100644 --- a/src/core/security/secure_endpoint.c +++ b/src/core/security/secure_endpoint.c @@ -32,11 +32,11 @@ */ #include "src/core/security/secure_endpoint.h" +#include "src/core/support/string.h" #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/slice_buffer.h> #include <grpc/support/slice.h> -#include <grpc/support/string.h> #include <grpc/support/sync.h> #include "src/core/tsi/transport_security_interface.h" diff --git a/src/core/security/security_context.c b/src/core/security/security_context.c index cce3c7fe04..58cd458415 100644 --- a/src/core/security/security_context.c +++ b/src/core/security/security_context.c @@ -39,12 +39,12 @@ #include "src/core/channel/http_client_filter.h" #include "src/core/security/credentials.h" #include "src/core/security/secure_endpoint.h" +#include "src/core/support/string.h" #include "src/core/surface/lame_client.h" #include "src/core/transport/chttp2/alpn.h" #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/slice_buffer.h> -#include <grpc/support/string.h> #include "src/core/tsi/fake_transport_security.h" #include "src/core/tsi/ssl_transport_security.h" |