350
355
, _monitors (NULL)
351
356
, _title ("SPICEc:%d")
352
357
, _sys_key_intercept_mode (false)
353
, _enable_controller (false)
358
, _enable_controller (false)
355
360
, _gui_mode (GUI_MODE_FULL)
356
361
#endif // USE_GUI
383
388
_canvas_types[0] = CANVAS_OPTION_SW;
386
_host_auth_opt.type_flags = RedPeer::HostAuthOptions::HOST_AUTH_OP_NAME;
391
_host_auth_opt.type_flags = SPICE_SSL_VERIFY_OP_HOSTNAME;
388
393
Platform::get_app_data_dir(_host_auth_opt.CA_file, app_name);
389
394
Platform::path_append(_host_auth_opt.CA_file, CA_FILE_NAME);
1187
1192
void Application::sync_keyboard_modifiers()
1189
1194
uint32_t modifiers = Platform::get_keyboard_modifiers();
1190
for (int i = 0; i < sizeof(modifier_keys) / sizeof(modifier_keys[0]); i++) {
1195
for (size_t i = 0; i < sizeof(modifier_keys) / sizeof(modifier_keys[0]); i++) {
1191
1196
if (modifiers & modifier_keys[i].modifier) {
1192
1197
on_key_down(modifier_keys[i].key);
2016
2021
bool Application::set_host_cert_subject(const char* subject, const char* arg0)
2018
if (!_host_auth_opt.set_cert_subject(subject)) {
2019
Platform::term_printf("%s: bad cert subject %s", arg0, subject);
2020
_exit_code = SPICEC_ERROR_CODE_INVALID_ARG;
2023
std::string subject_str(subject);
2024
std::string::const_iterator iter = subject_str.begin();
2026
_host_auth_opt.type_flags = SPICE_SSL_VERIFY_OP_SUBJECT;
2027
_host_auth_opt.host_subject = subject;
2029
/* the follow is only checking code, subject is parsed later
2030
ssl_verify.c. We keep simply because of better error message... */
2032
if ((iter == subject_str.end()) || (*iter == ',')) {
2033
RedPeer::HostAuthOptions::CertFieldValuePair entry_pair;
2034
size_t value_pos = entry.find_first_of('=');
2035
if ((value_pos == std::string::npos) || (value_pos == (entry.length() - 1))) {
2036
Platform::term_printf("%s: host_subject bad format: assignment for %s is missing\n",
2037
arg0, entry.c_str());
2038
_exit_code = SPICEC_ERROR_CODE_INVALID_ARG;
2041
size_t start_pos = entry.find_first_not_of(' ');
2042
if ((start_pos == std::string::npos) || (start_pos == value_pos)) {
2043
Platform::term_printf("%s: host_subject bad format: first part of assignment must be non empty in %s\n",
2044
arg0, entry.c_str());
2045
_exit_code = SPICEC_ERROR_CODE_INVALID_ARG;
2048
entry_pair.first = entry.substr(start_pos, value_pos - start_pos);
2049
entry_pair.second = entry.substr(value_pos + 1);
2050
DBG(0, "subject entry: %s=%s", entry_pair.first.c_str(), entry_pair.second.c_str());
2051
if (iter == subject_str.end()) {
2055
} else if (*iter == '\\') {
2057
if (iter == subject_str.end()) {
2058
LOG_WARN("single \\ in host subject");
2059
entry.append(1, '\\');
2061
} else if ((*iter == '\\') || (*iter == ',')) {
2062
entry.append(1, *iter);
2064
LOG_WARN("single \\ in host subject");
2065
entry.append(1, '\\');
2069
entry.append(1, *iter);
2027
2077
bool Application::set_canvas_option(CmdLineParser& parser, char *val, const char* arg0)
2269
2319
#ifdef USE_SMARTCARD
2270
2320
parser.add(SPICE_OPT_SMARTCARD, "smartcard", "enable smartcard channel");
2271
2321
parser.add(SPICE_OPT_NOSMARTCARD, "nosmartcard", "disable smartcard channel");
2272
parser.add(SPICE_OPT_SMARTCARD_CERT, "smartcard-cert", "Use virtual reader+card with given cert(s)",
2273
"smartcard-cert", true);
2322
parser.add(SPICE_OPT_SMARTCARD_CERT, "smartcard-cert",
2323
"Use virtual reader+card with given cert(s)",
2324
"smartcard-cert", true);
2274
2325
parser.set_multi(SPICE_OPT_SMARTCARD_CERT, ',');
2275
2326
parser.add(SPICE_OPT_SMARTCARD_DB, "smartcard-db", "Use given db for smartcard certs", "smartcard-db", true);
2498
2549
if (type >= log_level && log_file != NULL) {
2499
fprintf(log_file, "%ld %s [%llu:%llu] %s: %s\n", (long)time(NULL), type_as_char[type],
2500
(long long int)Platform::get_process_id(), (long long int)Platform::get_thread_id(),
2550
fprintf(log_file,"%ld %s [%" PRIu64 ":%" PRIu64 "] %s: %s\n",
2551
(long)time(NULL), type_as_char[type],
2552
Platform::get_process_id(),
2553
Platform::get_thread_id(),
2501
2554
function_to_func_name(function).c_str(),
2502
2555
formated_message.c_str());
2506
2559
if (type >= LOG_WARN) {