Skip to content

Commit d6ac21b

Browse files
authored
Merge pull request #11 from bbockelm/fix_build_failures
Fix build failures
2 parents 9e452aa + 3001212 commit d6ac21b

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,18 @@ elseif( UNIX )
3131

3232
include (FindPkgConfig)
3333
pkg_check_modules(LIBCRYPTO REQUIRED libcrypto)
34+
pkg_check_modules(OPENSSL REQUIRED openssl)
3435
pkg_check_modules(SQLITE REQUIRED sqlite3)
3536

37+
# pkg_check_modules fails to return an absolute path on RHEL7. Set the
38+
# link directories accordingly.
39+
link_directories(${OPENSSL_LIBRARY_DIRS} ${LIBCRYPTO_LIBRARY_DIRS})
3640
endif()
3741

38-
include_directories( "${PROJECT_SOURCE_DIR}" ${JWT_CPP_INCLUDES} ${CURL_INCLUDES} ${LIBCRYPTO_INCLUDE_DIRS} ${SQLITE_INCLUDE_DIRS} ${UUID_INCLUDE_DIRS} )
42+
include_directories( "${PROJECT_SOURCE_DIR}" ${JWT_CPP_INCLUDES} ${CURL_INCLUDES} ${OPENSSL_INCLUDE_DIRS} ${LIBCRYPTO_INCLUDE_DIRS} ${SQLITE_INCLUDE_DIRS} ${UUID_INCLUDE_DIRS} )
3943

4044
add_library(SciTokens SHARED src/scitokens.cpp src/scitokens_internal.cpp src/scitokens_cache.cpp)
41-
target_link_libraries(SciTokens ${LIBCRYPTO_LIBRARIES} ${CURL_LIBRARIES} ${SQLITE_LIBRARIES} ${UUID_LIBRARIES})
45+
target_link_libraries(SciTokens ${OPENSSL_LIBRARIES} ${LIBCRYPTO_LIBRARIES} ${CURL_LIBRARIES} ${SQLITE_LIBRARIES} ${UUID_LIBRARIES})
4246

4347
if ( NOT APPLE AND UNIX )
4448
set_target_properties(SciTokens PROPERTIES LINK_FLAGS "-Wl,--version-script=${PROJECT_SOURCE_DIR}/configs/export-symbols")

src/scitokens.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ int validator_validate(Validator validator, SciToken scitoken, char **err_msg) {
216216

217217
try {
218218
real_validator->verify(*real_scitoken);
219-
} catch (std::exception exc) {
219+
} catch (std::exception &exc) {
220220
if (err_msg) {*err_msg = strdup(exc.what());}
221221
return -1;
222222
}

src/scitokens_internal.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,13 @@ rs256_from_coords(const std::string &e_str, const std::string &n_str) {
238238
std::unique_ptr<BIGNUM, decltype(&BN_free)> n_bignum(BN_bin2bn(reinterpret_cast<const unsigned char *>(n_decode.c_str()), n_decode.size(), nullptr), BN_free);
239239

240240
std::unique_ptr<RSA, decltype(&RSA_free)> rsa(RSA_new(), RSA_free);
241+
#if OPENSSL_VERSION_NUMBER < 0x10100000L
241242
rsa->e = e_bignum.get();
242243
rsa->n = n_bignum.get();
243244
rsa->d = nullptr;
245+
#else
246+
RSA_set0_key(rsa.get(), n_bignum.get(), e_bignum.get(), nullptr);
247+
#endif
244248
e_bignum.release();
245249
n_bignum.release();
246250

@@ -300,11 +304,6 @@ normalize_absolute_path(const std::string &path) {
300304
}
301305

302306

303-
int empty_validator(const char *, char **) {
304-
return 0;
305-
}
306-
307-
308307
}
309308

310309

src/scitokens_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ class Enforcer {
384384
try {
385385
m_validator.verify(scitoken);
386386
return true;
387-
} catch (std::runtime_error) {
387+
} catch (std::runtime_error &) {
388388
return false;
389389
}
390390
}

0 commit comments

Comments
 (0)