mirror of
https://github.com/openappsec/openappsec.git
synced 2025-06-28 16:41:02 +03:00
Checking for empty strings
This commit is contained in:
parent
a3014ab381
commit
2649b84207
@ -127,7 +127,7 @@ DetailsResolver::Impl::isReverseProxy()
|
|||||||
{
|
{
|
||||||
#if defined(gaia) || defined(smb)
|
#if defined(gaia) || defined(smb)
|
||||||
auto is_reverse_proxy = DetailsResolvingHanlder::getCommandOutput("cpprod_util CPPROD_IsConfigured CPwaap");
|
auto is_reverse_proxy = DetailsResolvingHanlder::getCommandOutput("cpprod_util CPPROD_IsConfigured CPwaap");
|
||||||
if (is_reverse_proxy.ok()) {
|
if (is_reverse_proxy.ok() && !is_reverse_proxy.unpack().empty()) {
|
||||||
return is_reverse_proxy.unpack().front() == '1';
|
return is_reverse_proxy.unpack().front() == '1';
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -142,7 +142,7 @@ DetailsResolver::Impl::isKernelVersion3OrHigher()
|
|||||||
"| cut -d '.' -f 1 | awk -F: '{ if ( $1 >= 3 ) {print 1} else {print 0}}'";
|
"| cut -d '.' -f 1 | awk -F: '{ if ( $1 >= 3 ) {print 1} else {print 0}}'";
|
||||||
|
|
||||||
auto is_gogo = DetailsResolvingHanlder::getCommandOutput(cmd);
|
auto is_gogo = DetailsResolvingHanlder::getCommandOutput(cmd);
|
||||||
if (is_gogo.ok()) {
|
if (is_gogo.ok() && !is_gogo.unpack().empty()) {
|
||||||
return is_gogo.unpack().front() == '1';
|
return is_gogo.unpack().front() == '1';
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -155,7 +155,7 @@ DetailsResolver::Impl::isGwNotVsx()
|
|||||||
static const string is_vsx_cmd = "cpprod_util FWisVSX";
|
static const string is_vsx_cmd = "cpprod_util FWisVSX";
|
||||||
auto is_gw = DetailsResolvingHanlder::getCommandOutput(is_gw_cmd);
|
auto is_gw = DetailsResolvingHanlder::getCommandOutput(is_gw_cmd);
|
||||||
auto is_vsx = DetailsResolvingHanlder::getCommandOutput(is_vsx_cmd);
|
auto is_vsx = DetailsResolvingHanlder::getCommandOutput(is_vsx_cmd);
|
||||||
if (is_gw.ok() && is_vsx.ok()) {
|
if (is_gw.ok() && is_vsx.ok() && !is_gw.unpack().empty() && !is_vsx.unpack().empty()) {
|
||||||
return is_gw.unpack().front() == '1' && is_vsx.unpack().front() == '0';
|
return is_gw.unpack().front() == '1' && is_vsx.unpack().front() == '0';
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -108,7 +108,7 @@ DetailsResolvingHanlder::Impl::getCommandOutput(const string &cmd)
|
|||||||
if (!result.ok()) return result;
|
if (!result.ok()) return result;
|
||||||
|
|
||||||
auto unpacked_result = result.unpack();
|
auto unpacked_result = result.unpack();
|
||||||
if (unpacked_result.back() == '\n') unpacked_result.pop_back();
|
if (!unpacked_result.empty() && unpacked_result.back() == '\n') unpacked_result.pop_back();
|
||||||
|
|
||||||
return unpacked_result;
|
return unpacked_result;
|
||||||
}
|
}
|
||||||
|
@ -1893,6 +1893,7 @@ private:
|
|||||||
auto result = i_shell_cmd->getExecOutput(openssl_dir_cmd);
|
auto result = i_shell_cmd->getExecOutput(openssl_dir_cmd);
|
||||||
if (result.ok()) {
|
if (result.ok()) {
|
||||||
string val_openssl_dir = result.unpack();
|
string val_openssl_dir = result.unpack();
|
||||||
|
if (val_openssl_dir.empty()) return;
|
||||||
if (val_openssl_dir.back() == '\n') val_openssl_dir.pop_back();
|
if (val_openssl_dir.back() == '\n') val_openssl_dir.pop_back();
|
||||||
dbgTrace(D_ORCHESTRATOR)
|
dbgTrace(D_ORCHESTRATOR)
|
||||||
<< "Adding OpenSSL default directory to agent details. Directory: "
|
<< "Adding OpenSSL default directory to agent details. Directory: "
|
||||||
|
Loading…
x
Reference in New Issue
Block a user