TcpFilter::TcpFilter(const char* spec) {
std::vector<std::string> patterns;
- patterns = rfb::strSplit(spec, ',');
+ patterns = rfb::split(spec, ',');
for (size_t i = 0; i < patterns.size(); i++) {
if (!patterns[i].empty())
initSockets();
- parts = rfb::strSplit(&p[1], '/');
+ parts = rfb::split(&p[1], '/');
if (parts.size() > 2)
throw Exception("invalid filter specified");
sha1_update(&ctx, serverKey.size, serverKeyE);
sha1_digest(&ctx, sizeof(f), f);
const char *title = "Server key fingerprint";
- std::string text = strFormat(
+ std::string text = format(
"The server has provided the following identifying information:\n"
"Fingerprint: %02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x\n"
"Please verify that the information is correct and press \"Yes\". "
if (gnutls_x509_crt_check_hostname(crt, client->getServerName()) == 0) {
std::string text;
vlog.debug("hostname mismatch");
- text = strFormat("Hostname (%s) does not match the server "
- "certificate, do you want to continue?",
- client->getServerName());
+ text = format("Hostname (%s) does not match the server "
+ "certificate, do you want to continue?",
+ client->getServerName());
if (!msg->showMsgBox(UserMsgBox::M_YESNO,
"Certificate hostname mismatch",
text.c_str()))
if (status & (GNUTLS_CERT_SIGNER_NOT_FOUND |
GNUTLS_CERT_SIGNER_NOT_CA)) {
- text = strFormat("This certificate has been signed by an "
- "unknown authority:\n"
- "\n"
- "%s\n"
- "\n"
- "Someone could be trying to impersonate the "
- "site and you should not continue.\n"
- "\n"
- "Do you want to make an exception for this "
- "server?", info.data);
+ text = format("This certificate has been signed by an unknown "
+ "authority:\n"
+ "\n"
+ "%s\n"
+ "\n"
+ "Someone could be trying to impersonate the site "
+ "and you should not continue.\n"
+ "\n"
+ "Do you want to make an exception for this "
+ "server?", info.data);
if (!msg->showMsgBox(UserMsgBox::M_YESNO,
"Unknown certificate issuer",
}
if (status & GNUTLS_CERT_EXPIRED) {
- text = strFormat("This certificate has expired:\n"
- "\n"
- "%s\n"
- "\n"
- "Someone could be trying to impersonate the "
- "site and you should not continue.\n"
- "\n"
- "Do you want to make an exception for this "
- "server?", info.data);
+ text = format("This certificate has expired:\n"
+ "\n"
+ "%s\n"
+ "\n"
+ "Someone could be trying to impersonate the site "
+ "and you should not continue.\n"
+ "\n"
+ "Do you want to make an exception for this "
+ "server?", info.data);
if (!msg->showMsgBox(UserMsgBox::M_YESNO,
"Expired certificate",
if (status & (GNUTLS_CERT_SIGNER_NOT_FOUND |
GNUTLS_CERT_SIGNER_NOT_CA)) {
- text = strFormat("This host is previously known with a "
- "different certificate, and the new "
- "certificate has been signed by an "
- "unknown authority:\n"
- "\n"
- "%s\n"
- "\n"
- "Someone could be trying to impersonate the "
- "site and you should not continue.\n"
- "\n"
- "Do you want to make an exception for this "
- "server?", info.data);
+ text = format("This host is previously known with a different "
+ "certificate, and the new certificate has been "
+ "signed by an unknown authority:\n"
+ "\n"
+ "%s\n"
+ "\n"
+ "Someone could be trying to impersonate the site "
+ "and you should not continue.\n"
+ "\n"
+ "Do you want to make an exception for this "
+ "server?", info.data);
if (!msg->showMsgBox(UserMsgBox::M_YESNO,
"Unexpected server certificate",
}
if (status & GNUTLS_CERT_EXPIRED) {
- text = strFormat("This host is previously known with a "
- "different certificate, and the new "
- "certificate has expired:\n"
- "\n"
- "%s\n"
- "\n"
- "Someone could be trying to impersonate the "
- "site and you should not continue.\n"
- "\n"
- "Do you want to make an exception for this "
- "server?", info.data);
+ text = format("This host is previously known with a different "
+ "certificate, and the new certificate has "
+ "expired:\n"
+ "\n"
+ "%s\n"
+ "\n"
+ "Someone could be trying to impersonate the site "
+ "and you should not continue.\n"
+ "\n"
+ "Do you want to make an exception for this "
+ "server?", info.data);
if (!msg->showMsgBox(UserMsgBox::M_YESNO,
"Unexpected server certificate",
bool LogWriter::setLogParams(const char* params) {
std::vector<std::string> parts;
- parts = strSplit(params, ':');
+ parts = split(params, ':');
if (parts.size() != 3) {
fprintf(stderr,"failed to parse log params:%s\n",params);
return false;
LogWriter::setLogParams("*::0");
StringParameter::setParam(v);
std::vector<std::string> parts;
- parts = strSplit(v, ',');
+ parts = split(v, ',');
for (size_t i = 0; i < parts.size(); i++) {
if (parts[i].empty())
continue;
{
std::vector<std::string> users;
- users = strSplit(plainUsers, ',');
+ users = split(plainUsers, ',');
for (size_t i = 0; i < users.size(); i++) {
if (users[i] == "*")
{
std::list<uint32_t> result;
std::vector<std::string> types;
- types = strSplit(types_, ',');
+ types = split(types_, ',');
for (size_t i = 0; i < types.size(); i++) {
uint32_t typeNum = secTypeNum(types[i].c_str());
if (typeNum != secTypeInvalid)
namespace rfb {
- std::string strFormat(const char *fmt, ...)
+ std::string format(const char *fmt, ...)
{
va_list ap;
int len;
return out;
}
- std::vector<std::string> strSplit(const char* src,
- const char delimiter)
+ std::vector<std::string> split(const char* src,
+ const char delimiter)
{
std::vector<std::string> out;
const char *start, *stop;
namespace rfb {
// Formats according to printf(), with a dynamic allocation
- std::string strFormat(const char *fmt, ...)
+ std::string format(const char *fmt, ...)
__attribute__((__format__ (__printf__, 1, 2)));
// Splits a string with the specified delimiter
- std::vector<std::string> strSplit(const char* src,
- const char delimiter);
+ std::vector<std::string> split(const char* src,
+ const char delimiter);
// Conversion to and from a hex string
// - Add the supplied extra parameters to the command line
std::string cmdline;
- cmdline = strFormat("\"%s\" %s", buffer.buf, defaultcmdline);
+ cmdline = format("\"%s\" %s", buffer.buf, defaultcmdline);
for (i=0; i<argc; i++) {
cmdline += " \"";
cmdline += argv[i];
std::string langIdStr(binToHex(langIdBuf, sizeof(langId)));
std::string infoName;
- infoName = strFormat("\\StringFileInfo\\%s\\%s", langIdStr.c_str(), name);
+ infoName = format("\\StringFileInfo\\%s\\%s", langIdStr.c_str(), name);
// Locate the required version string within the version info
char* buffer = 0;
SendMessage(listBox, LB_DELETESTRING, 0, 0);
std::vector<std::string> hostv;
- hostv = strSplit(hosts, ',');
+ hostv = split(hosts, ',');
for (size_t i = 0; i < hostv.size(); i++) {
if (!hostv[i].empty())
SendMessage(listBox, LB_ADDSTRING, 0, (LPARAM)hostv[i].c_str());
try {
// Split the AuthHosts string into patterns to match
std::vector<std::string> patterns;
- patterns = rfb::strSplit(authHosts.c_str(), ':');
+ patterns = rfb::split(authHosts.c_str(), ':');
for (size_t i = 0; i < patterns.size(); i++) {
if (!patterns[i].empty()) {
int bits = 0;
// Split the pattern into IP address parts and process
std::vector<std::string> parts;
- parts = rfb::strSplit(&patterns[i][1], '.');
+ parts = rfb::split(&patterns[i][1], '.');
for (size_t j = 0; j < parts.size(); j++) {
if (bits)
strcat(pattern, ".");
{
ModuleFileName filename;
std::string cmdLine;
- cmdLine = strFormat("\"%s\" -noconsole -service_run", filename.buf);
+ cmdLine = format("\"%s\" -noconsole -service_run", filename.buf);
STARTUPINFO si;
ZeroMemory(&si, sizeof si);
si.cb = sizeof si;
runServer = false;
std::string result;
DWORD state = rfb::win32::getServiceState(VNCServerService::Name);
- result = strFormat("The %s Service is in the %s state.",
- VNCServerService::Name,
- rfb::win32::serviceStateName(state));
+ result = format("The %s Service is in the %s state.",
+ VNCServerService::Name,
+ rfb::win32::serviceStateName(state));
MsgBoxOrLog(result.c_str());
} else if (strcasecmp(argv[i], "-service") == 0) {
printf("Run in service mode\n");