Skip to content
Snippets Groups Projects
Commit 9a081b83 authored by Jihai Fan's avatar Jihai Fan
Browse files

small changes

parent c078f1b8
Branches
No related tags found
No related merge requests found
......@@ -171,7 +171,8 @@ int cmp_san(X509 *cert, char *url){
// make sure it is a dns name
if (current_name->type == GEN_DNS) {
char *dns_name = (char *) ASN1_STRING_data(current_name->d.dNSName);
// printf("san is: %s", dns_name);
//same technique from cmp_cn
int url_len = strlen(url);
int dns_len = strlen(dns_name);
if (dns_len > url_len){
......@@ -198,7 +199,7 @@ int validate_url(X509 *cert, char *url){
int san_result = cmp_san(cert, url);
int result;
// only one fo SAN and CN should be
// only one fo SAN and CN needed to be valid
if (cn_result == 0){
result = time_result + rsa_result + ca_result + eku_result;
} else {
......@@ -258,9 +259,7 @@ int main(int argv, char** argc)
char* url = getfield(tmp, 2);
char* cert = getfield(tmp, 1);
int result = read_and_validate(cert, url);
printf("%s\n",url);
fprintf(output, "%s,%s,%i\n", cert, url, result);
// NOTE strtok clobbers tmp
fprintf(output, "%s,%s,%i\n", cert, url, result); //write to file
free(tmp);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment