diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/client_config/subchannel_index.c | 2 | ||||
-rw-r--r-- | src/core/compression/compression_algorithm.c (renamed from src/core/compression/algorithm.c) | 0 | ||||
-rw-r--r-- | src/core/security/b64.c (renamed from src/core/security/base64.c) | 2 | ||||
-rw-r--r-- | src/core/security/b64.h (renamed from src/core/security/base64.h) | 2 | ||||
-rw-r--r-- | src/core/security/google_default_credentials.c | 2 | ||||
-rw-r--r-- | src/core/security/json_token.c | 2 | ||||
-rw-r--r-- | src/core/security/jwt_verifier.c | 2 | ||||
-rw-r--r-- | src/core/security/security_connector.c | 14 | ||||
-rw-r--r-- | src/core/support/env_linux.c | 14 | ||||
-rw-r--r-- | src/core/support/load_file.c (renamed from src/core/support/file.c) | 4 | ||||
-rw-r--r-- | src/core/support/load_file.h (renamed from src/core/support/file.h) | 16 | ||||
-rw-r--r-- | src/core/support/tmpfile.h | 55 | ||||
-rw-r--r-- | src/core/support/tmpfile_posix.c (renamed from src/core/support/file_posix.c) | 4 | ||||
-rw-r--r-- | src/core/support/tmpfile_win32.c (renamed from src/core/support/file_win32.c) | 4 |
14 files changed, 92 insertions, 31 deletions
diff --git a/src/core/client_config/subchannel_index.c b/src/core/client_config/subchannel_index.c index f78a7fd588..3f948998f9 100644 --- a/src/core/client_config/subchannel_index.c +++ b/src/core/client_config/subchannel_index.c @@ -149,11 +149,13 @@ static const gpr_avl_vtable subchannel_avl_vtable = { void grpc_subchannel_index_init(void) { g_subchannel_index = gpr_avl_create(&subchannel_avl_vtable); gpr_mu_init(&g_mu); + gpr_tls_init(&subchannel_index_exec_ctx); } void grpc_subchannel_index_shutdown(void) { gpr_mu_destroy(&g_mu); gpr_avl_unref(g_subchannel_index); + gpr_tls_destroy(&subchannel_index_exec_ctx); } grpc_subchannel *grpc_subchannel_index_find(grpc_exec_ctx *exec_ctx, diff --git a/src/core/compression/algorithm.c b/src/core/compression/compression_algorithm.c index 6f3a8eb28e..6f3a8eb28e 100644 --- a/src/core/compression/algorithm.c +++ b/src/core/compression/compression_algorithm.c diff --git a/src/core/security/base64.c b/src/core/security/b64.c index 8367c160c3..c40b528e2f 100644 --- a/src/core/security/base64.c +++ b/src/core/security/b64.c @@ -31,7 +31,7 @@ * */ -#include "src/core/security/base64.h" +#include "src/core/security/b64.h" #include <stdint.h> #include <string.h> diff --git a/src/core/security/base64.h b/src/core/security/b64.h index 31ae982691..3e3b521120 100644 --- a/src/core/security/base64.h +++ b/src/core/security/b64.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/core/security/google_default_credentials.c b/src/core/security/google_default_credentials.c index cc9c958298..458d0d3ac3 100644 --- a/src/core/security/google_default_credentials.c +++ b/src/core/security/google_default_credentials.c @@ -41,7 +41,7 @@ #include "src/core/httpcli/httpcli.h" #include "src/core/support/env.h" -#include "src/core/support/file.h" +#include "src/core/support/load_file.h" #include "src/core/surface/api_trace.h" /* -- Constants. -- */ diff --git a/src/core/security/json_token.c b/src/core/security/json_token.c index 762f02989a..372e5bfc5a 100644 --- a/src/core/security/json_token.c +++ b/src/core/security/json_token.c @@ -39,7 +39,7 @@ #include <grpc/support/log.h> #include <grpc/support/string_util.h> -#include "src/core/security/base64.h" +#include "src/core/security/b64.h" #include "src/core/support/string.h" #include <openssl/bio.h> diff --git a/src/core/security/jwt_verifier.c b/src/core/security/jwt_verifier.c index 042a117f5d..928c6c148d 100644 --- a/src/core/security/jwt_verifier.c +++ b/src/core/security/jwt_verifier.c @@ -37,7 +37,7 @@ #include <string.h> #include "src/core/httpcli/httpcli.h" -#include "src/core/security/base64.h" +#include "src/core/security/b64.h" #include "src/core/tsi/ssl_types.h" #include <grpc/support/alloc.h> diff --git a/src/core/security/security_connector.c b/src/core/security/security_connector.c index b46205323b..51a99b4492 100644 --- a/src/core/security/security_connector.c +++ b/src/core/security/security_connector.c @@ -35,20 +35,20 @@ #include <string.h> +#include <grpc/support/alloc.h> +#include <grpc/support/host_port.h> +#include <grpc/support/log.h> +#include <grpc/support/slice_buffer.h> +#include <grpc/support/string_util.h> + #include "src/core/security/credentials.h" #include "src/core/security/handshake.h" #include "src/core/security/secure_endpoint.h" #include "src/core/security/security_context.h" #include "src/core/support/env.h" -#include "src/core/support/file.h" +#include "src/core/support/load_file.h" #include "src/core/support/string.h" #include "src/core/transport/chttp2/alpn.h" - -#include <grpc/support/alloc.h> -#include <grpc/support/host_port.h> -#include <grpc/support/log.h> -#include <grpc/support/slice_buffer.h> -#include <grpc/support/string_util.h> #include "src/core/tsi/fake_transport_security.h" #include "src/core/tsi/ssl_transport_security.h" diff --git a/src/core/support/env_linux.c b/src/core/support/env_linux.c index 1ca6fa1aff..fe51f846b7 100644 --- a/src/core/support/env_linux.c +++ b/src/core/support/env_linux.c @@ -43,7 +43,9 @@ #include "src/core/support/env.h" #include <dlfcn.h> +#include <features.h> #include <stdlib.h> +#include <string.h> #include <grpc/support/log.h> #include <grpc/support/string_util.h> @@ -60,12 +62,22 @@ char *gpr_getenv(const char *name) { const char *names[] = {"secure_getenv", "__secure_getenv", "getenv"}; for (size_t i = 0; getenv_func == NULL && i < GPR_ARRAY_SIZE(names); i++) { getenv_func = (getenv_type)dlsym(RTLD_DEFAULT, names[i]); + if (getenv_func != NULL && strstr(names[i], "secure") == NULL) { + gpr_log(GPR_DEBUG, + "Warning: insecure environment read function '%s' used", + names[i]); + } } char *result = getenv_func(name); return result == NULL ? result : gpr_strdup(result); -#else +#elif __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 17) char *result = secure_getenv(name); return result == NULL ? result : gpr_strdup(result); +#else + gpr_log(GPR_DEBUG, "Warning: insecure environment read function '%s' used", + "getenv"); + char *result = getenv(name); + return result == NULL ? result : gpr_strdup(result); #endif } diff --git a/src/core/support/file.c b/src/core/support/load_file.c index 8c673dbcc6..650bd62ccb 100644 --- a/src/core/support/file.c +++ b/src/core/support/load_file.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,7 +31,7 @@ * */ -#include "src/core/support/file.h" +#include "src/core/support/load_file.h" #include <errno.h> #include <string.h> diff --git a/src/core/support/file.h b/src/core/support/load_file.h index d8b7cea44f..746319a50d 100644 --- a/src/core/support/file.h +++ b/src/core/support/load_file.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,8 +31,8 @@ * */ -#ifndef GRPC_INTERNAL_CORE_SUPPORT_FILE_H -#define GRPC_INTERNAL_CORE_SUPPORT_FILE_H +#ifndef GRPC_INTERNAL_CORE_SUPPORT_LOAD_FILE_H +#define GRPC_INTERNAL_CORE_SUPPORT_LOAD_FILE_H #include <stdio.h> @@ -42,22 +42,14 @@ extern "C" { #endif -/* File utility functions */ - /* Loads the content of a file into a slice. add_null_terminator will add a NULL terminator if non-zero. The success parameter, if not NULL, will be set to 1 in case of success and 0 in case of failure. */ gpr_slice gpr_load_file(const char *filename, int add_null_terminator, int *success); -/* Creates a temporary file from a prefix. - If tmp_filename is not NULL, *tmp_filename is assigned the name of the - created file and it is the responsibility of the caller to gpr_free it - unless an error occurs in which case it will be set to NULL. */ -FILE *gpr_tmpfile(const char *prefix, char **tmp_filename); - #ifdef __cplusplus } #endif -#endif /* GRPC_INTERNAL_CORE_SUPPORT_FILE_H */ +#endif /* GRPC_INTERNAL_CORE_SUPPORT_LOAD_FILE_H */ diff --git a/src/core/support/tmpfile.h b/src/core/support/tmpfile.h new file mode 100644 index 0000000000..cecc71e242 --- /dev/null +++ b/src/core/support/tmpfile.h @@ -0,0 +1,55 @@ +/* + * + * Copyright 2015-2016, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef GRPC_INTERNAL_CORE_SUPPORT_TMPFILE_H +#define GRPC_INTERNAL_CORE_SUPPORT_TMPFILE_H + +#include <stdio.h> + +#include <grpc/support/slice.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* Creates a temporary file from a prefix. + If tmp_filename is not NULL, *tmp_filename is assigned the name of the + created file and it is the responsibility of the caller to gpr_free it + unless an error occurs in which case it will be set to NULL. */ +FILE *gpr_tmpfile(const char *prefix, char **tmp_filename); + +#ifdef __cplusplus +} +#endif + +#endif /* GRPC_INTERNAL_CORE_SUPPORT_TMPFILE_H */ diff --git a/src/core/support/file_posix.c b/src/core/support/tmpfile_posix.c index c11c07148a..b16eeacf9d 100644 --- a/src/core/support/file_posix.c +++ b/src/core/support/tmpfile_posix.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,7 +35,7 @@ #ifdef GPR_POSIX_FILE -#include "src/core/support/file.h" +#include "src/core/support/tmpfile.h" #include <errno.h> #include <stdlib.h> diff --git a/src/core/support/file_win32.c b/src/core/support/tmpfile_win32.c index 355744f79a..3000f0029f 100644 --- a/src/core/support/file_win32.c +++ b/src/core/support/tmpfile_win32.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -44,8 +44,8 @@ #include <grpc/support/log.h> #include <grpc/support/string_util.h> -#include "src/core/support/file.h" #include "src/core/support/string_win32.h" +#include "src/core/support/tmpfile.h" FILE *gpr_tmpfile(const char *prefix, char **tmp_filename_out) { FILE *result = NULL; |