static BOOL certificate_split_line(char* line, char** host, UINT16* port,
char**subject, char**issuer,
char** fingerprint);
+static BOOL certificate_line_is_comment(const char* line, size_t length)
+{
+ while(length > 0)
+ {
+ switch(*line)
+ {
+ case ' ':
+ case '\t':
+ line++;
+ length--;
+ break;
+ case '#':
+ return TRUE;
+ default:
+ return FALSE;
+ }
+ }
+
+ if (length < 1)
+ return TRUE;
+
+ return FALSE;
+}
BOOL certificate_store_init(rdpCertificateStore* certificate_store)
{
if (length > 0)
{
- if (!certificate_split_line(pline, &hostname, &port,
+ if (certificate_line_is_comment(pline, length))
+ {
+ }
+ else if (!certificate_split_line(pline, &hostname, &port,
&subject, &issuer, &fingerprint))
WLog_WARN(TAG, "Invalid %s entry %s!",
certificate_known_hosts_file, pline);
char* issuer = NULL;
char* tdata;
- if (!certificate_split_line(pline, &hostname, &port, &subject, &issuer, &fingerprint))
+ if (certificate_line_is_comment(pline, length))
+ {
+ }
+ else if (!certificate_split_line(pline, &hostname, &port, &subject, &issuer, &fingerprint))
WLog_WARN(TAG, "Skipping invalid %s entry %s!",
certificate_known_hosts_file, pline);
else
"legacyurl aa:bb:cc:dd\n"
};
char* hosts[] = {
- "someurl 3389 ff:11:22:dd subject issuer\r\n",
- "otherurl\t3389\taa:bb:cc:dd\tsubject2\tissuer2\r",
+ "#somecomment\r\n"
+ "someurl 3389 ff:11:22:dd subject issuer\r\n"
+ " \t#anothercomment\r\n"
+ "otherurl\t3389\taa:bb:cc:dd\tsubject2\tissuer2\r"
};
FILE* fl = NULL;
FILE* fc = NULL;