aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar jboeuf <jboeuf@users.noreply.github.com>2015-02-20 13:23:26 -0800
committerGravatar jboeuf <jboeuf@users.noreply.github.com>2015-02-20 13:23:26 -0800
commitcc07b2d0944def65aaf9428a392d16e97021080a (patch)
tree9de872e67b62be3598caffb39909a86dd7a207ee
parent3c472d2036414efe67c81d2fe306e7fd2d23d19d (diff)
parent72743820abc861f139804b5c5e31cc8962d85b59 (diff)
Merge pull request #665 from nicolasnoble/ssl-prefix
Defining an installation prefix for grpc's root certs at compilation time.
-rw-r--r--Makefile2
-rw-r--r--src/core/security/security_context.c7
-rw-r--r--templates/Makefile.template2
3 files changed, 9 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 41cb53182d..e45ca3fb44 100644
--- a/Makefile
+++ b/Makefile
@@ -163,7 +163,7 @@ HOST_LD = $(LD)
HOST_LDXX = $(LDXX)
CPPFLAGS += $(CPPFLAGS_$(CONFIG))
-DEFINES += $(DEFINES_$(CONFIG))
+DEFINES += $(DEFINES_$(CONFIG)) INSTALL_PREFIX=\"$(prefix)\"
LDFLAGS += $(LDFLAGS_$(CONFIG))
CFLAGS += -std=c89 -pedantic
diff --git a/src/core/security/security_context.c b/src/core/security/security_context.c
index bcee55e3e1..37a312bc81 100644
--- a/src/core/security/security_context.c
+++ b/src/core/security/security_context.c
@@ -60,6 +60,12 @@
"AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:AES128-" \
"SHA256:AES256-SHA256"
+#ifndef INSTALL_PREFIX
+static const char *installed_roots_path = "/etc/grpc/roots.pem";
+#else
+static const char *installed_roots_path = INSTALL_PREFIX "/etc/grpc/roots.pem";
+#endif
+
/* -- Common methods. -- */
grpc_security_status grpc_security_context_create_handshaker(
@@ -404,6 +410,7 @@ static void init_default_pem_root_certs(void) {
default_pem_root_certs = gpr_load_file(default_root_certs_path, NULL);
gpr_free(default_root_certs_path);
}
+ (void) installed_roots_path;
}
size_t grpc_get_default_ssl_roots(const unsigned char **pem_root_certs) {
diff --git a/templates/Makefile.template b/templates/Makefile.template
index f1f1badc16..3cc1a95192 100644
--- a/templates/Makefile.template
+++ b/templates/Makefile.template
@@ -180,7 +180,7 @@ HOST_LD = $(LD)
HOST_LDXX = $(LDXX)
CPPFLAGS += $(CPPFLAGS_$(CONFIG))
-DEFINES += $(DEFINES_$(CONFIG))
+DEFINES += $(DEFINES_$(CONFIG)) INSTALL_PREFIX=\"$(prefix)\"
LDFLAGS += $(LDFLAGS_$(CONFIG))
CFLAGS += -std=c89 -pedantic