From cc4459bdb0a17fc402dd6b84e952eb01201c33f1 Mon Sep 17 00:00:00 2001
From: "Felix A. Croes" <felix@dworkin.nl>
Date: Thu, 8 Nov 2018 15:31:05 +0100
Subject: [PATCH] YDS-2382 When no EPIC server is configured, *httpCode = 0.

---
 src/msiRegisterEpicPID.cc | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/msiRegisterEpicPID.cc b/src/msiRegisterEpicPID.cc
index d96fd8e..0e24eb4 100644
--- a/src/msiRegisterEpicPID.cc
+++ b/src/msiRegisterEpicPID.cc
@@ -109,7 +109,13 @@ extern "C" {
     std::string value       = parseMspForStr(valueIn);
     std::string uuid        = parseMspForStr(idInOut);
 
-    /* Retriece parameters from the credentials store. */
+    /* Bail if there is no EPIC server configured. */
+    if (!credentials.has("epic_url")) {
+      fillStrInMsParam(httpCodeOut, "0");
+      return 0;
+    }
+
+    /* Retrieve parameters from the credentials store. */
     std::string url(credentials.get("epic_url"));
     std::string prefix(credentials.get("epic_handle_prefix"));
     std::string key(credentials.get("epic_key"));
-- 
GitLab