{
int match;
int index;
- char* common_name;
- int common_name_length;
- char** alt_names;
- int alt_names_count;
- int* alt_names_lengths;
+ char* common_name = NULL;
+ int common_name_length = 0;
+ char** alt_names = NULL;
+ int alt_names_count = 0;
+ int* alt_names_lengths = NULL;
boolean certificate_status;
boolean hostname_match = false;
+ boolean verification_status = false;
rdpCertificateData* certificate_data;
/* ignore certificate verification if user explicitly required it (discouraged) */
/* if the certificate is valid and the certificate name matches, verification succeeds */
if (certificate_status && hostname_match)
- return true; /* success! */
+ {
+ if (common_name)
+ xfree(common_name);
+
+ verification_status = true; /* success! */
+ }
/* if the certificate is valid but the certificate name does not match, warn user, do not accept */
if (certificate_status && !hostname_match)
char* subject;
char* fingerprint;
boolean accept_certificate = false;
- boolean verification_status = false;
issuer = crypto_cert_issuer(cert->px509);
subject = crypto_cert_subject(cert->px509);
xfree(issuer);
xfree(subject);
xfree(fingerprint);
+ }
+
+ if (common_name)
+ xfree(common_name);
- return verification_status;
+ if (alt_names)
+ {
+ for (index = 0; index < alt_names_count; index++)
+ xfree(alt_names[index]);
+
+ xfree(alt_names);
+ }
+
+ if (certificate_data)
+ {
+ xfree(certificate_data->fingerprint);
+ xfree(certificate_data->hostname);
+ xfree(certificate_data);
}
- return false;
+ return verification_status;
}
void tls_print_certificate_error(char* hostname, char* fingerprint)
char* freerdp_get_config_path(rdpSettings* settings)
{
- char* path;
-
- path = (char*) xmalloc(strlen(settings->home_path) + sizeof(FREERDP_CONFIG_DIR) + 2);
- sprintf(path, "%s/%s", settings->home_path, FREERDP_CONFIG_DIR);
+ if (settings->config_path != NULL)
+ return settings->config_path;
- if (!freerdp_check_file_exists(path))
- freerdp_mkdir(path);
+ settings->config_path = (char*) xmalloc(strlen(settings->home_path) + sizeof(FREERDP_CONFIG_DIR) + 2);
+ sprintf(settings->config_path, "%s/%s", settings->home_path, FREERDP_CONFIG_DIR);
- settings->config_path = path;
+ if (!freerdp_check_file_exists(settings->config_path))
+ freerdp_mkdir(settings->config_path);
- return path;
+ return settings->config_path;
}
char* freerdp_get_current_path(rdpSettings* settings)