diff --git a/CMakeLists.txt b/CMakeLists.txt index 6e1ce1d187f0ef557053b2f8fa4b12386aebe5e1..c982368c6497bb94393ad3e2d0424a130ae5cc74 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,7 +121,7 @@ set(CPACK_GENERATOR "RPM") set(CPACK_PACKAGE_NAME "irods-uu-microservices") set(CPACK_PACKAGE_VENDOR "Utrecht University <fbyoda@uu.nl>") set(CPACK_PACKAGE_CONTACT "Utrecht University <fbyoda@uu.nl>") -set(CPACK_PACKAGE_VERSION "4.2.3_0.7.6") +set(CPACK_PACKAGE_VERSION "4.2.3_0.7.7") set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/package/description.txt") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Miscellaneous iRODS microservices developed or modified by Utrecht University.") diff --git a/src/CredentialsStore.hh b/src/CredentialsStore.hh index 2ea02eb5f26bdf0c725cf3aa18098e570744d499..2ff5a78b7f66f9e471c57760cd9860f6af26d2f7 100644 --- a/src/CredentialsStore.hh +++ b/src/CredentialsStore.hh @@ -26,6 +26,11 @@ public: } } + // check that the store is properly initialized + bool isLoaded() { + return (store != NULL); + } + // get a credential from the store const char *get(const char *key) { if (store != NULL) { diff --git a/src/msiCurlMail.cc b/src/msiCurlMail.cc index 5f0d56753e17d4ac65137879d819e5afd4bd203c..d507bfdb485b8b0d8bf3fb60fde9c1c1531b808e 100644 --- a/src/msiCurlMail.cc +++ b/src/msiCurlMail.cc @@ -192,6 +192,11 @@ extern "C" { return SYS_USER_NO_PERMISSION; } + /* Bail early if the credential store could not be loaded */ + if (!credentials.isLoaded()) { + return SYS_CONFIG_FILE_ERR; + } + /* Check input parameters. */ if (strcmp(toIn->type, STR_MS_T)) { return SYS_INVALID_INPUT_PARAM; diff --git a/src/msiGetDataCiteDOI.cc b/src/msiGetDataCiteDOI.cc index d43169863c7741e0183a304205ed7039a92e2c41..35f2323872526b5617a51d1e5494662def76fe62 100644 --- a/src/msiGetDataCiteDOI.cc +++ b/src/msiGetDataCiteDOI.cc @@ -55,6 +55,11 @@ static CredentialsStore credentials; CURLcode res; + /* Bail early if the credential store could not be loaded */ + if (!credentials.isLoaded()) { + return SYS_CONFIG_FILE_ERR; + } + /* Check input parameters. */ if (strcmp(doiIn->type, STR_MS_T)) { return SYS_INVALID_INPUT_PARAM; diff --git a/src/msiRegisterDataCiteDOI.cc b/src/msiRegisterDataCiteDOI.cc index dde08eadc96c57b4d0b5bc8136bdba9e80ed068a..071d516ffb0a2d2ff979c6467861b77d670d41d3 100644 --- a/src/msiRegisterDataCiteDOI.cc +++ b/src/msiRegisterDataCiteDOI.cc @@ -44,6 +44,11 @@ extern "C" { return SYS_USER_NO_PERMISSION; } + /* Bail early if the credential store could not be loaded */ + if (!credentials.isLoaded()) { + return SYS_CONFIG_FILE_ERR; + } + /* Check input parameters. */ if (strcmp(payloadIn->type, STR_MS_T)) { return SYS_INVALID_INPUT_PARAM; diff --git a/src/msiRegisterEpicPID.cc b/src/msiRegisterEpicPID.cc index 7b7866baa9f669136a78d2a2954976c2c59f4bae..44ea7974af7022dca9f31776f5c1e5793dfd1838 100644 --- a/src/msiRegisterEpicPID.cc +++ b/src/msiRegisterEpicPID.cc @@ -70,6 +70,11 @@ extern "C" { return SYS_USER_NO_PERMISSION; } + /* Bail early if the credentials store could not be loaded */ + if (!credentials.isLoaded()) { + return SYS_CONFIG_FILE_ERR; + } + /* Check input parameters. */ if (strcmp(valueIn->type, STR_MS_T)) { return SYS_INVALID_INPUT_PARAM; diff --git a/src/msiRemoveDataCiteMetadata.cc b/src/msiRemoveDataCiteMetadata.cc index 9573008b64dd66fa769913b58f7a33b796e97746..80f9f33b1118939c2d2c40249e1522b920915828 100644 --- a/src/msiRemoveDataCiteMetadata.cc +++ b/src/msiRemoveDataCiteMetadata.cc @@ -47,6 +47,11 @@ extern "C" { return SYS_USER_NO_PERMISSION; } + /* Bail early if the credential store could not be loaded */ + if (!credentials.isLoaded()) { + return SYS_CONFIG_FILE_ERR; + } + /* Check input parameters. */ if (strcmp(doiIn->type, STR_MS_T)) { return SYS_INVALID_INPUT_PARAM;