Skip to content

Commit

Permalink
[7229] Run clang-format.
Browse files Browse the repository at this point in the history
  • Loading branch information
korydraughn committed Dec 5, 2024
1 parent e8da5ea commit 8bc6254
Show file tree
Hide file tree
Showing 39 changed files with 417 additions and 324 deletions.
3 changes: 2 additions & 1 deletion lib/core/include/irods/authentication_plugin_framework.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ namespace irods::experimental::auth
using plugin_type = authentication_base;

std::string scheme = _scheme;
std::transform(scheme.begin(), scheme.end(), scheme.begin(), [](unsigned char _ch) { return std::tolower(_ch); });
std::transform(
scheme.begin(), scheme.end(), scheme.begin(), [](unsigned char _ch) { return std::tolower(_ch); });

const std::string name = fmt::format("irods_auth_plugin-{}_{}", scheme, _type);

Expand Down
6 changes: 2 additions & 4 deletions lib/core/include/irods/experimental_plugin_framework.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,8 @@ namespace irods::experimental::api {
static auto resolve_api_plugin(const std::string& operation, const std::string& type)
{
std::string lower{operation};
std::transform(lower.begin(),
lower.end(),
lower.begin(),
[](unsigned char _ch) { return std::tolower(_ch); });
std::transform(
lower.begin(), lower.end(), lower.begin(), [](unsigned char _ch) { return std::tolower(_ch); });

base* plugin{};
auto err = irods::load_plugin<base>(
Expand Down
9 changes: 4 additions & 5 deletions lib/core/include/irods/irods_client_server_negotiation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,10 @@ namespace irods

/// =-=-=-=-=-=-=-
/// @brief function which manages the TLS and Auth negotiations with the client
error client_server_negotiation_for_server(
irods::network_object_ptr, // server connection handle
std::string&, // results of negotiation
bool, // boolean indicating whether client-server negotiation is needed
RsComm&); // RsComm initialized during agent startup
error client_server_negotiation_for_server(irods::network_object_ptr, // server connection handle
std::string&, // results of negotiation
bool, // boolean indicating whether client-server negotiation is needed
RsComm&); // RsComm initialized during agent startup

/// =-=-=-=-=-=-=-
/// @brief function which manages the TLS and Auth negotiations with the client
Expand Down
6 changes: 3 additions & 3 deletions lib/core/include/irods/irods_load_plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ namespace irods
}
else {
rodsEnv env;
int status = getRodsEnv( &env );
if ( !status ) {
if ( strlen( env.irodsPluginDirectory ) > 0 ) {
int status = getRodsEnv(&env);
if (!status) {
if (strlen(env.irodsPluginDirectory) > 0) {
plugin_home = env.irodsPluginDirectory;
}
}
Expand Down
5 changes: 1 addition & 4 deletions lib/core/include/irods/irods_query.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@ namespace irods

std::string lowered{_str};
std::transform(
lowered.begin(),
lowered.end(),
lowered.begin(),
[](unsigned char _ch) { return std::tolower(_ch); });
lowered.begin(), lowered.end(), lowered.begin(), [](unsigned char _ch) { return std::tolower(_ch); });

if(GEN_STR == lowered) {
return GENERAL;
Expand Down
6 changes: 3 additions & 3 deletions lib/core/include/irods/rodsGenQuery.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,9 @@ primary ordering column.
#define COL_RULE_EXEC_LAST_EXE_TIME 1010
#define COL_RULE_EXEC_STATUS 1011
#define COL_RULE_EXEC_CONTEXT 1012
#define COL_RULE_EXEC_LOCK_HOST 1013
#define COL_RULE_EXEC_LOCK_HOST_PID 1014
#define COL_RULE_EXEC_LOCK_TIME 1015
#define COL_RULE_EXEC_LOCK_HOST 1013
#define COL_RULE_EXEC_LOCK_HOST_PID 1014
#define COL_RULE_EXEC_LOCK_TIME 1015

/* R_TOKN_MAIN */
#define COL_TOKEN_NAMESPACE 1100
Expand Down
4 changes: 3 additions & 1 deletion lib/core/src/clientLogin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,9 @@ int clientLogin(rcComm_t* _comm, const char* _context, const char* _scheme_overr
// =-=-=-=-=-=-=-
// ensure scheme is lower case for comparison
std::string lower_scheme = auth_scheme;
std::transform( auth_scheme.begin(), auth_scheme.end(), auth_scheme.begin(), [](unsigned char _ch) { return std::tolower(_ch); });
std::transform(auth_scheme.begin(), auth_scheme.end(), auth_scheme.begin(), [](unsigned char _ch) {
return std::tolower(_ch);
});

// =-=-=-=-=-=-=-
// filter out the pam auth as it is an extra special
Expand Down
4 changes: 1 addition & 3 deletions lib/core/src/getRodsEnv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,9 +626,7 @@ extern "C" {
_env->irodsTransBufferSizeForParaTrans );

env_var = irods::KW_CFG_IRODS_PLUGIN_DIRECTORY;
capture_string_env_var(
env_var,
_env->irodsPluginDirectory );
capture_string_env_var(env_var, _env->irodsPluginDirectory);

capture_integer_env_var(irods::KW_CFG_IRODS_TCP_KEEPALIVE_INTVL_IN_SECONDS, _env->tcp_keepalive_intvl);
capture_integer_env_var(irods::KW_CFG_IRODS_TCP_KEEPALIVE_PROBES, _env->tcp_keepalive_probes);
Expand Down
9 changes: 3 additions & 6 deletions lib/core/src/irods_buffer_encryption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,9 @@ namespace irods {
salt_size_( _salt_sz ),
num_hash_rounds_( _num_rnds ),
algorithm_( _algo ) {

std::transform(
algorithm_.begin(),
algorithm_.end(),
algorithm_.begin(),
[](unsigned char _ch) { return std::tolower(_ch); });
std::transform(algorithm_.begin(), algorithm_.end(), algorithm_.begin(), [](unsigned char _ch) {
return std::tolower(_ch);
});

// =-=-=-=-=-=-=-
// select some sane defaults
Expand Down
3 changes: 2 additions & 1 deletion lib/core/src/irods_client_negotiation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ namespace irods
/// =-=-=-=-=-=-=-
/// @brief function which determines if a client/server negotiation is needed
/// on the server side
bool do_client_server_negotiation_for_server(const char* _neg) {
bool do_client_server_negotiation_for_server(const char* _neg)
{
// if it is set then check for our magic token which requests
// the negotiation, if it is not the magic token, move on
return _neg && std::string_view{_neg} == REQ_SVR_NEG;
Expand Down
20 changes: 10 additions & 10 deletions lib/core/src/irods_default_paths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ namespace irods
return path.lexically_normal();
}

fs::path
get_irods_sbin_directory() {
fs::path get_irods_sbin_directory()
{
fs::path install_sbindir{IRODS_DEFAULT_PATH_SBINDIR};
install_sbindir = install_sbindir.lexically_normal();
return get_irods_directory_impl(install_sbindir);
Expand All @@ -105,8 +105,8 @@ namespace irods
return get_irods_directory_impl(install_confdir);
}

fs::path
get_irods_runstate_directory() {
fs::path get_irods_runstate_directory()
{
fs::path install_runstatedir{IRODS_DEFAULT_PATH_RUNSTATEDIR};
install_runstatedir = install_runstatedir.lexically_normal();
return get_irods_directory_impl(install_runstatedir);
Expand All @@ -126,18 +126,18 @@ namespace irods
return get_irods_directory_impl(install_plugdir);
}

fs::path
get_irods_stacktrace_directory() {
fs::path get_irods_stacktrace_directory()
{
return get_irods_home_directory() / "stacktraces";
}

fs::path
get_irods_proc_directory() {
fs::path get_irods_proc_directory()
{
return get_irods_home_directory() / "log/proc";
}

fs::path
get_irods_msiExecCmd_bin_directory() {
fs::path get_irods_msiExecCmd_bin_directory()
{
return get_irods_home_directory() / "msiExecCmd_bin";
}
} // namespace irods
9 changes: 6 additions & 3 deletions lib/core/src/irods_server_properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ namespace irods
file_path_ = _path;
std::ifstream in{file_path_};
if (!in) {
THROW(FILE_OPEN_ERR, fmt::format("[{}:{}] - Failed to open configuration file [{}]", __func__, __LINE__, file_path_));
THROW(FILE_OPEN_ERR,
fmt::format("[{}:{}] - Failed to open configuration file [{}]", __func__, __LINE__, file_path_));
}

config_props_ = json::parse(in);
Expand All @@ -229,7 +230,8 @@ namespace irods

std::ifstream in{file_path_};
if (!in) {
THROW(FILE_OPEN_ERR, fmt::format("[{}:{}] - Failed to open configuration file [{}]", __func__, __LINE__, file_path_));
THROW(FILE_OPEN_ERR,
fmt::format("[{}:{}] - Failed to open configuration file [{}]", __func__, __LINE__, file_path_));
}

config_props_ = json::parse(in);
Expand All @@ -253,7 +255,8 @@ namespace irods
else {
std::ifstream in{file_path_};
if (!in) {
THROW(FILE_OPEN_ERR, fmt::format("[{}:{}] - Failed to open configuration file [{}]", __func__, __LINE__, file_path_));
THROW(FILE_OPEN_ERR,
fmt::format("[{}:{}] - Failed to open configuration file [{}]", __func__, __LINE__, file_path_));
}
new_values = json::parse(in);
}
Expand Down
20 changes: 9 additions & 11 deletions lib/core/src/sockComm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,29 +521,27 @@ sockOpenForInConn( rsComm_t *rsComm, int *portNum, char **addr, int proto ) {

/* rsAcceptConn - Server accept connection */

int
rsAcceptConn( rsComm_t *_comm ) {
socklen_t len = sizeof( _comm->remoteAddr );
int rsAcceptConn(rsComm_t* _comm)
{
socklen_t len = sizeof(_comm->remoteAddr);

const int saved_socket_flags = fcntl( _comm->sock, F_GETFL );
int status = fcntl( _comm->sock, F_SETFL, saved_socket_flags | O_NONBLOCK );
const int saved_socket_flags = fcntl(_comm->sock, F_GETFL);
int status = fcntl(_comm->sock, F_SETFL, saved_socket_flags | O_NONBLOCK);
if ( status < 0 ) {
rodsLogError( LOG_NOTICE, status, "failed to set flags with nonblock on fnctl" );
}
const int newSock = accept( _comm->sock, ( struct sockaddr * ) &_comm->remoteAddr, &len );
status = fcntl( _comm->sock, F_SETFL, saved_socket_flags );
const int newSock = accept(_comm->sock, (struct sockaddr*) &_comm->remoteAddr, &len);
status = fcntl(_comm->sock, F_SETFL, saved_socket_flags);
if ( status < 0 ) {
rodsLogError( LOG_NOTICE, status, "failed to revert flags on fnctl" );
}

if ( newSock < 0 ) {
const int status = SYS_SOCK_ACCEPT_ERR - errno;
rodsLogError( LOG_NOTICE, status,
"rsAcceptConn: accept error for socket %d",
_comm->sock );
rodsLogError(LOG_NOTICE, status, "rsAcceptConn: accept error for socket %d", _comm->sock);
return newSock;
}
rodsSetSockOpt( newSock, _comm->windowSize );
rodsSetSockOpt(newSock, _comm->windowSize);

return newSock;
}
Expand Down
30 changes: 10 additions & 20 deletions lib/hasher/src/checksum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,9 @@ int chksumLocFile(
env_policy = env.rodsMatchHashPolicy;
// =-=-=-=-=-=-=-
// hash scheme keywords are all lowercase
std::transform(
env_scheme.begin(),
env_scheme.end(),
env_scheme.begin(),
[](unsigned char _ch) { return std::tolower(_ch); });
std::transform(env_scheme.begin(), env_scheme.end(), env_scheme.begin(), [](unsigned char _ch) {
return std::tolower(_ch);
});
}

// =-=-=-=-=-=-=-
Expand All @@ -72,11 +70,9 @@ int chksumLocFile(
hash_scheme = _hash_scheme;
// =-=-=-=-=-=-=-
// hash scheme keywords are all lowercase
std::transform(
hash_scheme.begin(),
hash_scheme.end(),
hash_scheme.begin(),
[](unsigned char _ch) { return std::tolower(_ch); });
std::transform(hash_scheme.begin(), hash_scheme.end(), hash_scheme.begin(), [](unsigned char _ch) {
return std::tolower(_ch);
});
}
else {
hash_scheme = env_scheme;
Expand All @@ -85,17 +81,11 @@ int chksumLocFile(

// =-=-=-=-=-=-=-
// hash scheme keywords are all lowercase
std::transform(hash_scheme.begin(), hash_scheme.end(), hash_scheme.begin(), [](unsigned char _ch) {
return std::tolower(_ch);
});
std::transform(
hash_scheme.begin(),
hash_scheme.end(),
hash_scheme.begin(),
[](unsigned char _ch) { return std::tolower(_ch); });
std::transform(
env_scheme.begin(),
env_scheme.end(),
env_scheme.begin(),
[](unsigned char _ch) { return std::tolower(_ch); });

env_scheme.begin(), env_scheme.end(), env_scheme.begin(), [](unsigned char _ch) { return std::tolower(_ch); });

// =-=-=-=-=-=-=-
// verify checksum scheme against configuration
Expand Down
5 changes: 4 additions & 1 deletion plugins/auth_legacy/src/pam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,10 @@ int run_pam_auth_check(
}
close( p2cp[1] );
const auto binary = irods::get_irods_sbin_directory() / "irodsPamAuthCheck";
i = execl(binary.c_str(), binary.c_str(), _username.c_str(), static_cast<char*>(nullptr)); // NOLINT(cppcoreguidelines-pro-type-vararg)
i = execl(binary.c_str(),
binary.c_str(),
_username.c_str(),
static_cast<char*>(nullptr)); // NOLINT(cppcoreguidelines-pro-type-vararg)
perror( "execl" );
printf( "execl failed %d\n", i );
}
Expand Down
Loading

0 comments on commit 8bc6254

Please sign in to comment.