Skip to content

Commit

Permalink
Refactored to remove dead code
Browse files Browse the repository at this point in the history
The if() condition used before would always evaluate to false
  • Loading branch information
Telgat authored and metsma committed May 6, 2016
1 parent 3271522 commit 4fc63e4
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/crypto/X509Crypto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <openssl/x509.h>

#include <cstring>
#include <set>

using namespace digidoc;
using namespace std;
Expand Down Expand Up @@ -93,15 +94,18 @@ int X509Crypto::compareIssuerToString(const string &name) const
continue;

string obj = nameitem.substr(0, pos);
if(obj == "CN" && obj == "commonName" &&
obj == "L" && obj == "localityName" &&
obj == "ST" && obj == "stateOrProvinceName" &&
obj == "O" && obj == "organizationName" &&
obj == "OU" && obj == "organizationalUnitName" &&
obj == "C" && obj == "countryName" &&
obj == "STREET" && obj == "streetAddress" &&
obj == "DC" && obj == "domainComponent" &&
obj == "UID" && obj == "userId")

static std::set<std::string> list{"CN", "commonName",
"L", "localityName",
"ST", "stateOrProvinceName",
"O", "organizationName",
"OU", "organizationalUnitName",
"C", "countryName",
"STREET", "streetAddress",
"DC", "domainComponent",
"UID", "userId"
};
if(list.find(obj) == list.end())
continue;

SCOPE(X509_NAME_ENTRY, enta, X509_NAME_ENTRY_create_by_txt(0, obj.c_str(),
Expand Down

0 comments on commit 4fc63e4

Please sign in to comment.