Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update auth.cpp #27

Closed
wants to merge 1 commit into from
Closed
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
20 changes: 20 additions & 0 deletions auth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1261,6 +1261,26 @@ std::string KeyAuth::api::req(std::string data, std::string url) {

debugInfo(data, url, to_return);

struct curl_certinfo* ci;
code = curl_easy_getinfo(curl, CURLINFO_CERTINFO, &ci);

if (!code) {
bool issuer_found = false;

for (int i = 0; i < ci->num_of_certs; i++) {
struct curl_slist* slist;

for (slist = ci->certinfo[i]; slist; slist = slist->next) {
if (std::strstr(slist->data, XorStr("Google Trust Services").c_str()) != NULL || std::strstr(slist->data, XorStr("Let's Encrypt").c_str()) != NULL) {
issuer_found = true;
}
}
}

if (!issuer_found)
error(XorStr("SSL certificate couldn't be verified"));
}

return to_return;
}
void error(std::string message) {
Expand Down