14#ifndef OPENVPN_SSL_TLS_REMOTE_H
15#define OPENVPN_SSL_TLS_REMOTE_H
21inline bool test(
const std::string &tls_remote,
const std::string &subject,
const std::string &common_name)
23 return tls_remote == subject || common_name.starts_with(tls_remote);
26inline void log(
const std::string &tls_remote,
const std::string &subject,
const std::string &common_name)
29 <<
" tls-remote: '" << tls_remote <<
"'\n"
30 <<
" Subj: '" << subject <<
"'\n"
31 <<
" CN: '" << common_name <<
'\'');
39 bool leading_dash =
true;
41 for (
size_t i = 0; i <
str.length(); ++i)
43 const char c =
str[i];
44 if (c ==
'-' && leading_dash)
50 if ((c >=
'a' && c <=
'z')
51 || (c >=
'A' && c <=
'Z')
52 || (c >=
'0' && c <=
'9')
53 || c ==
'_' || c ==
'-' || c ==
'.'
54 || c ==
'@' || c ==
':' || c ==
'/'
69 for (
size_t i = 0; i <
str.length(); ++i)
71 const char c =
str[i];
72 if ((c >=
'a' && c <=
'z')
73 || (c >=
'A' && c <=
'Z')
74 || (c >=
'0' && c <=
'9')
75 || c ==
'_' || c ==
'-' || c ==
'.'
76 || c ==
'@' || c ==
'/')
#define OPENVPN_LOG(args)
std::string sanitize_x509_name(const std::string &str)
std::string sanitize_common_name(const std::string &str)
void log(const std::string &tls_remote, const std::string &subject, const std::string &common_name)
os<< "Session Name: "<< tbc-> session_name<< '\n';os<< "Layer: "<< tbc-> layer str()<< '\n'