Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,18 @@ elseif( UNIX )

include (FindPkgConfig)
pkg_check_modules(LIBCRYPTO REQUIRED libcrypto)
pkg_check_modules(OPENSSL REQUIRED openssl)
pkg_check_modules(SQLITE REQUIRED sqlite3)

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

include_directories( "${PROJECT_SOURCE_DIR}" ${JWT_CPP_INCLUDES} ${CURL_INCLUDES} ${LIBCRYPTO_INCLUDE_DIRS} ${SQLITE_INCLUDE_DIRS} ${UUID_INCLUDE_DIRS} )
include_directories( "${PROJECT_SOURCE_DIR}" ${JWT_CPP_INCLUDES} ${CURL_INCLUDES} ${OPENSSL_INCLUDE_DIRS} ${LIBCRYPTO_INCLUDE_DIRS} ${SQLITE_INCLUDE_DIRS} ${UUID_INCLUDE_DIRS} )

add_library(SciTokens SHARED src/scitokens.cpp src/scitokens_internal.cpp src/scitokens_cache.cpp)
target_link_libraries(SciTokens ${LIBCRYPTO_LIBRARIES} ${CURL_LIBRARIES} ${SQLITE_LIBRARIES} ${UUID_LIBRARIES})
target_link_libraries(SciTokens ${OPENSSL_LIBRARIES} ${LIBCRYPTO_LIBRARIES} ${CURL_LIBRARIES} ${SQLITE_LIBRARIES} ${UUID_LIBRARIES})

if ( NOT APPLE AND UNIX )
set_target_properties(SciTokens PROPERTIES LINK_FLAGS "-Wl,--version-script=${PROJECT_SOURCE_DIR}/configs/export-symbols")
Expand Down
2 changes: 1 addition & 1 deletion src/scitokens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ int validator_validate(Validator validator, SciToken scitoken, char **err_msg) {

try {
real_validator->verify(*real_scitoken);
} catch (std::exception exc) {
} catch (std::exception &exc) {
if (err_msg) {*err_msg = strdup(exc.what());}
return -1;
}
Expand Down
9 changes: 4 additions & 5 deletions src/scitokens_internal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,13 @@ rs256_from_coords(const std::string &e_str, const std::string &n_str) {
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);

std::unique_ptr<RSA, decltype(&RSA_free)> rsa(RSA_new(), RSA_free);
#if OPENSSL_VERSION_NUMBER < 0x10100000L
rsa->e = e_bignum.get();
rsa->n = n_bignum.get();
rsa->d = nullptr;
#else
RSA_set0_key(rsa.get(), n_bignum.get(), e_bignum.get(), nullptr);
#endif
e_bignum.release();
n_bignum.release();

Expand Down Expand Up @@ -300,11 +304,6 @@ normalize_absolute_path(const std::string &path) {
}


int empty_validator(const char *, char **) {
return 0;
}


}


Expand Down
2 changes: 1 addition & 1 deletion src/scitokens_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ class Enforcer {
try {
m_validator.verify(scitoken);
return true;
} catch (std::runtime_error) {
} catch (std::runtime_error &) {
return false;
}
}
Expand Down