Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Tru Huynh (pasteur.fr) 2018-03-19 07:06:56 +01:00
commit 9f808175ab
12 changed files with 194 additions and 131 deletions

View File

@ -27,7 +27,7 @@ if ERRORLEVEL 1 goto failed
cd build cd build
cmake -G "Visual Studio 15 2017 Win64" -D CMAKE_BUILD_TYPE=%B_BUILD_TYPE% -D CMAKE_PREFIX_PATH="%B_QT_FULLPATH%" -D DNSSD_LIB="%B_BONJOUR%\Lib\x64\dnssd.lib" -D QT_VERSION=%B_QT_VER% .. cmake -G "Visual Studio 15 2017 Win64" -D CMAKE_BUILD_TYPE=%B_BUILD_TYPE% -D CMAKE_PREFIX_PATH="%B_QT_FULLPATH%" -D DNSSD_LIB="%B_BONJOUR%\Lib\x64\dnssd.lib" -D QT_VERSION=%B_QT_VER% ..
if ERRORLEVEL 1 goto failed if ERRORLEVEL 1 goto failed
echo @msbuild barrier.sln /p:Platform="x64" /p:Configuration=%B_BUILD_TYPE% /m > make.bat echo @msbuild barrier.sln /p:Platform="x64" /p:Configuration=%B_BUILD_TYPE% /m %B_BUILD_OPTIONS% > make.bat
call make.bat call make.bat
if ERRORLEVEL 1 goto failed if ERRORLEVEL 1 goto failed
if exist bin\Debug ( if exist bin\Debug (

View File

@ -1,5 +1,9 @@
cmake_minimum_required (VERSION 3.4) cmake_minimum_required (VERSION 3.4)
set (BARRIER_VERSION_MAJOR 2)
set (BARRIER_VERSION_MINOR 0)
set (BARRIER_VERSION_PATCH 0)
# #
# Barrier Version # Barrier Version
# #

5
doc/UpdateManpages.txt Normal file
View File

@ -0,0 +1,5 @@
To recreate the barrierc manpage use a command like:
help2man -N --output=barrierc.1 --name='Barrier Keyboard/Mouse Client' /path/to/barrierc
And for barriers:
help2man -N --output=barriers.1 --name='Barrier Keyboard/Mouse Server' /path/to/barriers

72
doc/barrierc.1 Normal file
View File

@ -0,0 +1,72 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6.
.TH BARRIERC "1" "March 2018" "barrierc 2.0.0, protocol version 1.6" "User Commands"
.SH NAME
barrierc \- Barrier Keyboard/Mouse Client
.SH SYNOPSIS
.B barrierc
[\fI\,--yscroll <delta>\/\fR] [\fI\,--display <display>\/\fR] [\fI\,--no-xinitthreads\/\fR] [\fI\,--daemon|--no-daemon\/\fR] [\fI\,--name <screen-name>\/\fR] [\fI\,--restart|--no-restart\/\fR] [\fI\,--debug <level>\/\fR] \fI\,<server-address>\/\fR
.SH DESCRIPTION
Start the barrier client and connect to a remote server component.
.SH OPTIONS
.TP
\fB\-d\fR, \fB\-\-debug\fR <level>
filter out log messages with priority below level.
level may be: FATAL, ERROR, WARNING, NOTE, INFO,
DEBUG, DEBUG1, DEBUG2.
.TP
\fB\-n\fR, \fB\-\-name\fR <screen\-name> use screen\-name instead the hostname to identify
this screen in the configuration.
.TP
\fB\-1\fR, \fB\-\-no\-restart\fR
do not try to restart on failure.
.TP
\fB\-\-restart\fR
restart the server automatically if it fails. (*)
.TP
\fB\-l\fR \fB\-\-log\fR <file>
write log messages to file.
.TP
\fB\-\-no\-tray\fR
disable the system tray icon.
.TP
\fB\-\-enable\-drag\-drop\fR
enable file drag & drop.
.TP
\fB\-\-enable\-crypto\fR
enable the crypto (ssl) plugin.
.TP
\fB\-\-display\fR <display>
connect to the X server at <display>
.TP
\fB\-\-no\-xinitthreads\fR
do not call XInitThreads()
.TP
\fB\-f\fR, \fB\-\-no\-daemon\fR
run in the foreground.
.TP
\fB\-\-daemon\fR
run as a daemon. (*)
.TP
\fB\-\-yscroll\fR <delta>
defines the vertical scrolling delta, which is
120 by default.
.TP
\fB\-h\fR, \fB\-\-help\fR
display this help and exit.
.TP
\fB\-\-version\fR
display version information and exit.
.PP
Default options are marked with a *
.PP
The server address is of the form: [<hostname>][:<port>]. The hostname
must be the address or hostname of the server. The port overrides the
default port, 24800.
.SH COPYRIGHT
Copyright \(co 2018 Debauchee Open Source Group
.br
Copyright \(co 2012\-2016 Symless Ltd.
.br
Copyright \(co 2008\-2014 Nick Bolton
.br
Copyright \(co 2002\-2014 Chris Schoeneman

View File

@ -1,47 +0,0 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.38.2.
.TH BARRIERC "1" "June 2010" "barrierc 1.5.0, protocol version 1.3" "User Commands"
.SH NAME
barrierc \- manual page for barrierc 1.5.0, protocol version 1.3
.SH SYNOPSIS
.B barrierc
[\fI--yscroll <delta>\fR] [\fI--daemon|--no-daemon\fR] [\fI--name <screen-name>\fR] [\fI--restart|--no-restart\fR] [\fI--debug <level>\fR] \fI<server-address>\fR
.SH DESCRIPTION
Connect to a barrier mouse/keyboard sharing server.
.TP
\fB\-d\fR, \fB\-\-debug\fR <level>
filter out log messages with priority below level.
level may be: FATAL, ERROR, WARNING, NOTE, INFO,
DEBUG, DEBUGn (1\-5).
.TP
\fB\-n\fR, \fB\-\-name\fR <screen\-name> use screen\-name instead the hostname to identify
this screen in the configuration.
.TP
\fB\-1\fR, \fB\-\-no\-restart\fR
do not try to restart on failure.
.PP
* \fB\-\-restart\fR restart the server automatically if it fails.
.TP
\fB\-l\fR \fB\-\-log\fR <file>
write log messages to file.
.TP
\fB\-f\fR, \fB\-\-no\-daemon\fR
run in the foreground.
.PP
* \fB\-\-daemon\fR run as a daemon.
.TP
\fB\-\-yscroll\fR <delta>
defines the vertical scrolling delta, which is
.TP
\fB\-h\fR, \fB\-\-help\fR
display this help and exit.
.TP
\fB\-\-version\fR
display version information and exit.
.PP
* marks defaults.
.PP
The server address is of the form: [<hostname>][:<port>]. The hostname
must be the address or hostname of the server. The port overrides the
default port, 24800.
.SH COPYRIGHT
Copyright \(co 2010 Chris Schoeneman, Nick Bolton, Sorin Sbarnea

View File

@ -1,12 +1,13 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.38.2. .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6.
.TH BARRIERS "1" "June 2010" "barriers 1.5.0, protocol version 1.3" "User Commands" .TH BARRIERS "1" "March 2018" "barriers 2.0.0, protocol version 1.6" "User Commands"
.SH NAME .SH NAME
barriers \- manual page for barriers 1.5.0, protocol version 1.3 barriers \- Barrier Keyboard/Mouse Server
.SH SYNOPSIS .SH SYNOPSIS
.B barriers .B barriers
[\fI--address <address>\fR] [\fI--config <pathname>\fR] [\fI--daemon|--no-daemon\fR] [\fI--name <screen-name>\fR] [\fI--restart|--no-restart\fR] [\fI--debug <level>\fR] [\fI\,--address <address>\/\fR] [\fI\,--config <pathname>\/\fR] [\fI\,--display <display>\/\fR] [\fI\,--no-xinitthreads\/\fR] [\fI\,--daemon|--no-daemon\/\fR] [\fI\,--name <screen-name>\/\fR] [\fI\,--restart|--no-restart\/\fR] [\fI\,--debug <level>\/\fR]
.SH DESCRIPTION .SH DESCRIPTION
Start the barrier mouse/keyboard sharing server. Start the barrier server component.
.SH OPTIONS
.TP .TP
\fB\-a\fR, \fB\-\-address\fR <address> \fB\-a\fR, \fB\-\-address\fR <address>
listen for clients on the given address. listen for clients on the given address.
@ -17,23 +18,40 @@ use the named configuration file instead.
\fB\-d\fR, \fB\-\-debug\fR <level> \fB\-d\fR, \fB\-\-debug\fR <level>
filter out log messages with priority below level. filter out log messages with priority below level.
level may be: FATAL, ERROR, WARNING, NOTE, INFO, level may be: FATAL, ERROR, WARNING, NOTE, INFO,
DEBUG, DEBUGn (1\-5). DEBUG, DEBUG1, DEBUG2.
.TP .TP
\fB\-n\fR, \fB\-\-name\fR <screen\-name> use screen\-name instead the hostname to identify \fB\-n\fR, \fB\-\-name\fR <screen\-name> use screen\-name instead the hostname to identify
this screen in the configuration. this screen in the configuration.
.TP .TP
\fB\-1\fR, \fB\-\-no\-restart\fR \fB\-1\fR, \fB\-\-no\-restart\fR
do not try to restart on failure. do not try to restart on failure.
.PP .TP
* \fB\-\-restart\fR restart the server automatically if it fails. \fB\-\-restart\fR
restart the server automatically if it fails. (*)
.TP .TP
\fB\-l\fR \fB\-\-log\fR <file> \fB\-l\fR \fB\-\-log\fR <file>
write log messages to file. write log messages to file.
.TP .TP
\fB\-\-no\-tray\fR
disable the system tray icon.
.TP
\fB\-\-enable\-drag\-drop\fR
enable file drag & drop.
.TP
\fB\-\-enable\-crypto\fR
enable the crypto (ssl) plugin.
.TP
\fB\-\-display\fR <display>
connect to the X server at <display>
.TP
\fB\-\-no\-xinitthreads\fR
do not call XInitThreads()
.TP
\fB\-f\fR, \fB\-\-no\-daemon\fR \fB\-f\fR, \fB\-\-no\-daemon\fR
run in the foreground. run in the foreground.
.PP .TP
* \fB\-\-daemon\fR run as a daemon. \fB\-\-daemon\fR
run as a daemon. (*)
.TP .TP
\fB\-h\fR, \fB\-\-help\fR \fB\-h\fR, \fB\-\-help\fR
display this help and exit. display this help and exit.
@ -41,7 +59,7 @@ display this help and exit.
\fB\-\-version\fR \fB\-\-version\fR
display version information and exit. display version information and exit.
.PP .PP
* marks defaults. Default options are marked with a *
.PP .PP
The argument for \fB\-\-address\fR is of the form: [<hostname>][:<port>]. The The argument for \fB\-\-address\fR is of the form: [<hostname>][:<port>]. The
hostname must be the address or hostname of an interface on the system. hostname must be the address or hostname of an interface on the system.
@ -52,6 +70,12 @@ If no configuration file pathname is provided then the first of the
following to load successfully sets the configuration: following to load successfully sets the configuration:
.IP .IP
$HOME/.barrier.conf $HOME/.barrier.conf
/etc/barrier.conf \fI\,/etc/barrier.conf\/\fP
.SH COPYRIGHT .SH COPYRIGHT
Copyright \(co 2010 Chris Schoeneman, Nick Bolton, Sorin Sbarnea Copyright \(co 2018 Debauchee Open Source Group
.br
Copyright \(co 2012\-2016 Symless Ltd.
.br
Copyright \(co 2008\-2014 Nick Bolton
.br
Copyright \(co 2002\-2014 Chris Schoeneman

View File

@ -27,6 +27,13 @@
#include <stdint.h> #include <stdint.h>
#include <dns_sd.h> #include <dns_sd.h>
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#else
#include <stdlib.h>
#endif
static const QStringList preferedIPAddress( static const QStringList preferedIPAddress(
QStringList() << QStringList() <<
"192.168." << "192.168." <<
@ -36,12 +43,29 @@ static const QStringList preferedIPAddress(
const char* ZeroconfService:: m_ServerServiceName = "_barrierServerZeroconf._tcp"; const char* ZeroconfService:: m_ServerServiceName = "_barrierServerZeroconf._tcp";
const char* ZeroconfService:: m_ClientServiceName = "_barrierClientZeroconf._tcp"; const char* ZeroconfService:: m_ClientServiceName = "_barrierClientZeroconf._tcp";
static void silence_avahi_warning()
{
// the libavahi folks seemingly find Apple's bonjour API distasteful
// and are quite liberal in taking it out on users...unless we set
// this environmental variable before calling the avahi library.
// additionally, Microsoft does not give us a POSIX setenv() so
// we use their OS-specific API instead
const char *name = "AVAHI_COMPAT_NOWARN";
const char *value = "1";
#ifdef _WIN32
SetEnvironmentVariable(name, value);
#else
setenv(name, value, 1);
#endif
}
ZeroconfService::ZeroconfService(MainWindow* mainWindow) : ZeroconfService::ZeroconfService(MainWindow* mainWindow) :
m_pMainWindow(mainWindow), m_pMainWindow(mainWindow),
m_pZeroconfBrowser(0), m_pZeroconfBrowser(0),
m_pZeroconfRegister(0), m_pZeroconfRegister(0),
m_ServiceRegistered(false) m_ServiceRegistered(false)
{ {
silence_avahi_warning();
if (m_pMainWindow->barrierType() == MainWindow::barrierServer) { if (m_pMainWindow->barrierType() == MainWindow::barrierServer) {
if (registerService(true)) { if (registerService(true)) {
m_pZeroconfBrowser = new ZeroconfBrowser(this); m_pZeroconfBrowser = new ZeroconfBrowser(this);

View File

@ -160,7 +160,7 @@ private:
" -n, --name <screen-name> use screen-name instead the hostname to identify\n" \ " -n, --name <screen-name> use screen-name instead the hostname to identify\n" \
" this screen in the configuration.\n" \ " this screen in the configuration.\n" \
" -1, --no-restart do not try to restart on failure.\n" \ " -1, --no-restart do not try to restart on failure.\n" \
"* --restart restart the server automatically if it fails.\n" \ " --restart restart the server automatically if it fails. (*)\n" \
" -l --log <file> write log messages to file.\n" \ " -l --log <file> write log messages to file.\n" \
" --no-tray disable the system tray icon.\n" \ " --no-tray disable the system tray icon.\n" \
" --enable-drag-drop enable file drag & drop.\n" \ " --enable-drag-drop enable file drag & drop.\n" \
@ -183,7 +183,7 @@ private:
" [--daemon|--no-daemon]" " [--daemon|--no-daemon]"
# define HELP_SYS_INFO \ # define HELP_SYS_INFO \
" -f, --no-daemon run in the foreground.\n" \ " -f, --no-daemon run in the foreground.\n" \
"* --daemon run as a daemon.\n" " --daemon run as a daemon. (*)\n"
#elif SYSAPI_WIN32 #elif SYSAPI_WIN32

View File

@ -112,6 +112,9 @@ ArgParser::parseClientArgs(ClientArgs& args, int argc, const char* const* argv)
} }
} }
if (args.m_shouldExit)
return true;
// exactly one non-option argument (server-address) // exactly one non-option argument (server-address)
if (i == argc) { if (i == argc) {
LOG((CLOG_PRINT "%s: a server address or name is required" BYE, LOG((CLOG_PRINT "%s: a server address or name is required" BYE,

View File

@ -59,6 +59,7 @@
#include <iostream> #include <iostream>
#include <stdio.h> #include <stdio.h>
#include <sstream>
#define RETRY_TIME 1.0 #define RETRY_TIME 1.0
@ -119,34 +120,25 @@ ClientApp::help()
# define WINAPI_INFO # define WINAPI_INFO
#endif #endif
char buffer[2000]; std::ostringstream buffer;
sprintf( buffer << "Start the barrier client and connect to a remote server component." << std::endl
buffer, << std::endl
"Usage: %s" << "Usage: " << args().m_pname << " [--yscroll <delta>]" << WINAPI_ARG << HELP_SYS_ARGS
" [--yscroll <delta>]" << HELP_COMMON_ARGS << " <server-address>" << std::endl
WINAPI_ARG << std::endl
HELP_SYS_ARGS << "Options:" << std::endl
HELP_COMMON_ARGS << HELP_COMMON_INFO_1 << WINAPI_INFO << HELP_SYS_INFO
" <server-address>" << " --yscroll <delta> defines the vertical scrolling delta, which is" << std::endl
"\n\n" << " 120 by default." << std::endl
"Connect to a barrier mouse/keyboard sharing server.\n" << HELP_COMMON_INFO_2
"\n" << std::endl
HELP_COMMON_INFO_1 << "Default options are marked with a *" << std::endl
WINAPI_INFO << std::endl
HELP_SYS_INFO << "The server address is of the form: [<hostname>][:<port>]. The hostname" << std::endl
" --yscroll <delta> defines the vertical scrolling delta, which is\n" << "must be the address or hostname of the server. The port overrides the" << std::endl
" 120 by default.\n" << "default port, " << kDefaultPort << "." << std::endl;
HELP_COMMON_INFO_2
"\n"
"* marks defaults.\n"
"\n"
"The server address is of the form: [<hostname>][:<port>]. The hostname\n"
"must be the address or hostname of the server. The port overrides the\n"
"default port, %d.\n",
args().m_pname, kDefaultPort
);
LOG((CLOG_PRINT "%s", buffer)); LOG((CLOG_PRINT "%s", buffer.str().c_str()));
} }
const char* const char*

View File

@ -59,6 +59,7 @@
#include <iostream> #include <iostream>
#include <stdio.h> #include <stdio.h>
#include <fstream> #include <fstream>
#include <sstream>
// //
// ServerApp // ServerApp
@ -120,42 +121,31 @@ ServerApp::help()
# define WINAPI_INFO # define WINAPI_INFO
#endif #endif
char buffer[3000]; std::ostringstream buffer;
sprintf( buffer << "Start the barrier server component." << std::endl
buffer, << std::endl
"Usage: %s" << "Usage: " << args().m_pname
" [--address <address>]" << " [--address <address>]"
" [--config <pathname>]" << " [--config <pathname>]"
WINAPI_ARGS << WINAPI_ARGS << HELP_SYS_ARGS << HELP_COMMON_ARGS << std::endl
HELP_SYS_ARGS << std::endl
HELP_COMMON_ARGS << "Options:" << std::endl
"\n\n" << " -a, --address <address> listen for clients on the given address." << std::endl
"Start the barrier mouse/keyboard sharing server.\n" << " -c, --config <pathname> use the named configuration file instead." << std::endl
"\n" << HELP_COMMON_INFO_1 << WINAPI_INFO << HELP_SYS_INFO << HELP_COMMON_INFO_2 << std::endl
" -a, --address <address> listen for clients on the given address.\n" << "Default options are marked with a *" << std::endl
" -c, --config <pathname> use the named configuration file instead.\n" << std::endl
HELP_COMMON_INFO_1 << "The argument for --address is of the form: [<hostname>][:<port>]. The" << std::endl
WINAPI_INFO << "hostname must be the address or hostname of an interface on the system." << std::endl
HELP_SYS_INFO << "The default is to listen on all interfaces. The port overrides the" << std::endl
HELP_COMMON_INFO_2 << "default port, " << kDefaultPort << "." << std::endl
"\n" << std::endl
"* marks defaults.\n" << "If no configuration file pathname is provided then the first of the" << std::endl
"\n" << "following to load successfully sets the configuration:" << std::endl
"The argument for --address is of the form: [<hostname>][:<port>]. The\n" << " $HOME/" << USR_CONFIG_NAME << std::endl
"hostname must be the address or hostname of an interface on the system.\n" << " " << ARCH->concatPath(ARCH->getSystemDirectory(), SYS_CONFIG_NAME) << std::endl;
"The default is to listen on all interfaces. The port overrides the\n"
"default port, %d.\n"
"\n"
"If no configuration file pathname is provided then the first of the\n"
"following to load successfully sets the configuration:\n"
" %s\n"
" %s\n",
args().m_pname, kDefaultPort,
ARCH->concatPath(ARCH->getUserDirectory(), USR_CONFIG_NAME).c_str(),
ARCH->concatPath(ARCH->getSystemDirectory(), SYS_CONFIG_NAME).c_str()
);
LOG((CLOG_PRINT "%s", buffer)); LOG((CLOG_PRINT "%s", buffer.str().c_str()));
} }
void void

View File

@ -142,10 +142,7 @@ MSWindowsWatchdog::getUserToken(LPSECURITY_ATTRIBUTES security)
// elevate for the uac dialog (consent.exe) but this would be pointless, // elevate for the uac dialog (consent.exe) but this would be pointless,
// since barrier would re-launch as non-elevated after the desk switch, // since barrier would re-launch as non-elevated after the desk switch,
// and so would be unusable with the new elevated process taking focus. // and so would be unusable with the new elevated process taking focus.
if (m_elevateProcess if (m_elevateProcess || m_autoElevated) {
|| m_autoElevated
|| m_session.isProcessInSession("logonui.exe", NULL)) {
LOG((CLOG_DEBUG "getting elevated token, %s", LOG((CLOG_DEBUG "getting elevated token, %s",
(m_elevateProcess ? "elevation required" : "at login screen"))); (m_elevateProcess ? "elevation required" : "at login screen")));
@ -155,8 +152,7 @@ MSWindowsWatchdog::getUserToken(LPSECURITY_ATTRIBUTES security)
} }
return duplicateProcessToken(process, security); return duplicateProcessToken(process, security);
} } else {
else {
LOG((CLOG_DEBUG "getting non-elevated token")); LOG((CLOG_DEBUG "getting non-elevated token"));
return m_session.getUserToken(security); return m_session.getUserToken(security);
} }