Commit Graph

697 Commits

Author SHA1 Message Date
metalefty
8516e6f97b Merge pull request #476 from proski/auth
Fix compile warnings for non-default authentication methods
2016-11-16 17:08:15 +09:00
metalefty
b89956d06e Merge pull request #485 from proski/code-standards
Code standards
2016-11-16 17:05:21 +09:00
metalefty
d335c93a75 Merge pull request #480 from proski/strncat
Fix potential buffer overflow in strncat() invocation
2016-11-16 17:02:33 +09:00
Pavel Roskin
35b336272b Fix compilation with C++ 2016-11-15 22:40:06 -08:00
Pavel Roskin
16c3bbdb8d Remove all tabs in sources 2016-11-15 22:40:06 -08:00
Pavel Roskin
e9d064e390 Don't try to create .vnc directory if it exists
Report system error if it cannot be created.
2016-11-15 22:39:22 -08:00
Pavel Roskin
60029514a6 Report system error if the VNC password file cannot be created 2016-11-15 22:39:22 -08:00
Pavel Roskin
e9a0324cb3 Fix compile warnings for non-default authentication methods
Include string.h for strcmp(). Don't define _XOPEN_SOURCE, it conflicts
with libc headers and hides putpwent(). Make input strings constant. Fix
functions to match their declarations.
2016-11-15 22:38:56 -08:00
Pavel Roskin
92423a466e Fix potential buffer overflow in strncat() invocation
strncat() will copy at most the specified number of characters and append
the null character on top of that. strlen() doesn't count the final null
character.
2016-11-15 22:38:21 -08:00
Koichiro IWAO
cb1960e0fc config: use semicolon to comment out descriptions in config files
and use number sign to comment out actual configurations.
For example:

    ; if set to true, enables foobar
    #foobar=true
2016-11-16 14:15:44 +09:00
Koichiro IWAO
4f2d94505a config: unify all boolean values in config to true/false 2016-11-16 14:15:44 +09:00
Pavel Roskin
0d72cced46 Omit numbers from the "param" keys, they are not needed
Users assume that they need to renumber the parameters. That makes
parameter editing more involved than it needs to be.
2016-11-15 20:55:03 -08:00
metalefty
94901c9989 Merge pull request #454 from metalefty/change-chansrv-log-path
chansrv: change chansrv log path to ${XDG_DATA_HOME}/xrdp
2016-11-07 09:56:31 +09:00
Dominik George
c90bc13d39
Move -logfile /dev/null option for easier commenting in debug scenarios. 2016-10-28 16:45:05 +02:00
Koichiro IWAO
7d017482f6 chansrv: change chansrv log path to ${XDG_DATA_HOME}/xrdp
like Xorg's logfile is written to ${XDG_DATA_HOME}/xorg/Xorg.n.log.

If XDG_DATA_HOME is not defined, the log path will be
${HOME}/.local/share/xrdp.
2016-10-25 14:52:43 +09:00
Pavel Roskin
b28a986071 Fix memory leak in xrdp-sesman on config reload 2016-10-21 20:15:50 +00:00
Pavel Roskin
dc60a80b86 Memory leak fix: keep X server path in the parameter list
g_cfg->xorg_params, g_cfg->vnc_params and g_cfg->rdp_params don't have
auto_free enabled, so removing an item from one of those lists won't free
its contents.

It's better not to change those lists, as they represent the actual
config file and could be reused. Instead, omit the 0th parameter (the
executable path) from copying to xserver_params.

Found by Valgrind.
2016-10-21 20:15:50 +00:00
Pavel Roskin
e17a56efb6 Call auth_end() exactly once in scp_v0_process()
As discovered by Valgrind, it wasn't called at all in case of a
successful session creation, which leaked memory.
2016-10-21 20:15:50 +00:00
Pavel Roskin
65ac8e758b Fix memory leak: free session data
Call scp_session_destroy() in the functions that call
scp_session_create() and nowhere else.

As found by Valgrind, the session data is not freed if the session is
created successfully.
2016-10-21 20:15:50 +00:00
Pavel Roskin
a370306f75 Get rid of EXTRA_LIBS, use variables with more specific names 2016-10-20 10:43:02 -07:00
Pavel Roskin
5c69f3cd57 Eliminate EXTRA_FLAGS, it's a poor name, use AM_LDFLAGS 2016-10-20 10:43:02 -07:00
Pavel Roskin
0422734fc7 Merge EXTRA_DEFINES and EXTRA_INCLUDES into AM_CPPFLAGS
AM_CPPFLAGS is a documented Automake variable for C preprocessor flags
that should not be overridden when compiling the package.

There is no need to have two additional variables that are ultimately
merged into AM_CPPFLAGS.

Their names are also confusing. EXTDA_DIST is a documented Automake
variable. Everything else that starts with "EXTRA" is not.
2016-10-20 10:43:02 -07:00
Pavel Roskin
6fef1e4eb5 Use const pointers in function arguments when possible 2016-10-17 08:54:07 -07:00
Pavel Roskin
c3b99de739 Fix wrong comments in sesman config printing code 2016-10-17 08:54:07 -07:00
Pavel Roskin
bf08892622 Fix incorrect description of auth_userpass() return value 2016-10-17 08:54:07 -07:00
Pavel Roskin
a618d4f757 Don't use final newline in log calls, it's already appended 2016-10-17 08:54:07 -07:00
Pavel Roskin
424cef464b Log malloc errors with LOG_LEVEL_ERROR 2016-10-17 08:38:22 -07:00
Pavel Roskin
945833a94f Don't close socket in scp_process_start(), the caller closes it 2016-09-08 20:26:19 -07:00
Pavel Roskin
f7c27f05cf g_term_event is a wait object, not TCP socket, delete it correctly 2016-09-08 20:26:19 -07:00
Pavel Roskin
931fb90832 sesrun: remove unused g_sck and write-only g_pid 2016-09-08 20:26:19 -07:00
Pavel Roskin
d605310bdc sesman: don't close listening socket in signal handler
It is closed when the main loop terminates.
2016-09-08 20:26:19 -07:00
Koichiro IWAO
9f277e4445 chansrv: pathname also should be URL decoded
because 1st argument to clipboard_get_file() is given as URL encoded.
Decoding only filename is incomplete.

Without this fix, clipboard file doesn't work in case pathname
contains non-ASCII characters or non-alphanumeric ASCII characters.
2016-08-30 15:49:58 +09:00
jsorg71
8353baab3d Merge pull request #390 from proski/june21
Cleanups and C++ compatibility
2016-08-05 14:38:41 -07:00
jsorg71
81fe939dd3 Merge pull request #388 from metalefty/freebsd/fuse
sesman: Add /sbin to PATH for FreeBSD
2016-08-05 14:22:50 -07:00
speidy
f2addd346f Merge branch 'devel' of https://github.com/neutrinolabs/xrdp into devel 2016-07-26 13:13:56 -04:00
speidy
c9b55e3691 sesman: env_set_user, fix potential bof issues 2016-07-22 04:48:37 -04:00
Kentaro Hayashi
8f3fb2f7c8 chansrv: avoid chansrv SEGV when xinode is NULL
When xfuse_create_file_in_xrdp_fs is failed, it returns NULL.

Without this fix, xinode->size causes SEGV, so implementation is changed
to return -1 and check the return value in caller.
2016-07-21 16:02:21 +09:00
Jay Sorg
9ccbfb6985 chansrv: added mp3 compression from Speidy 2016-07-13 17:44:07 -07:00
Pavel Roskin
2c13ef5c6d Use enum logLevels consistently for log levels 2016-07-08 04:29:57 +00:00
Pavel Roskin
cbe413bd8b Fix return type of devredir_fuse_data_peek and devredir_fuse_data_dequeue 2016-07-08 04:29:56 +00:00
Pavel Roskin
c5ca0332be Use cast when applying boolean OR to enum 2016-07-08 04:29:51 +00:00
Pavel Roskin
d1efb0d5ba Fix signed to unsigned comparisons reported by g++ 6.1.0 2016-07-08 04:29:51 +00:00
Pavel Roskin
5829323ad8 Use g_new or g_new0 when C++ compiler would complain about implicit cast 2016-07-08 04:29:49 +00:00
Pavel Roskin
bde4925f0e Cast appdata_ptr explicitly, needed for C++ compatibility 2016-07-08 04:29:47 +00:00
Pavel Roskin
4b05bb2ebd Mark g_drdynvc_chan_id as extern in g_drdynvc_chan_id, it's in chansrv.c 2016-07-08 04:29:44 +00:00
Pavel Roskin
aaa89ad4e6 Use const unsigned for hex arrays
Some constants are too big for the signed type.
2016-07-08 04:29:43 +00:00
Pavel Roskin
aeeb3d2c2e Fix warnings detected by -Wwrite-strings 2016-07-08 04:29:42 +00:00
Pavel Roskin
951e632757 Make program_name constant, don't duplicate or free it 2016-07-08 04:27:07 +00:00
Pavel Roskin
b00ca6e03d Remove commented out config_read_logging(), the code is long dead 2016-07-08 04:26:59 +00:00
Pavel Roskin
1ded8ec437 Remove unused string support in scp_session_set_addr()
Using the same argument for binary and text data is not a good idea. If
string support is ever needed, it should be a separate function.

Remove SCP_ADDRESS_TYPE_IPV4_BIN and SCP_ADDRESS_TYPE_IPV6_BIN, use
SCP_ADDRESS_TYPE_IPV4 and SCP_ADDRESS_TYPE_IPV6, which simplifies the
code.
2016-07-08 04:15:41 +00:00
Pavel Roskin
f908528a00 Downgrade "libscp initialized" to LOG_LEVEL_DEBUG, remove line number
It's a bad style to start the log with a cryptic warning.
2016-07-08 04:15:39 +00:00
Pavel Roskin
f7ef9bb938 Fix scp_init() invocation, it takes no arguments 2016-07-08 04:15:38 +00:00
Pavel Roskin
77b380c0b5 Fix format warnings in log_message() calls 2016-06-21 16:30:16 -07:00
Pavel Roskin
be1d034f91 Report pid and listening address/port for xrdp and xrdp-sesman
For xrdp-sesman, don't report that the daemon is listening to a port if
it fails to attach to that port. Don't use LOG_LEVEL_ALWAYS for startup
message, it's not a critical error.
2016-06-21 16:30:15 -07:00
Pavel Roskin
a77ae440a7 Rename SESMAN_CFG_X11DISPLAYOFFSET to SESMAN_CFG_SESS_X11DISPLAYOFFSET
Move it to other session options in config.h. X11DisplayOffset is part of
the [Sessions] section.
2016-06-21 16:30:15 -07:00
Pavel Roskin
ae5bb5bf9c Fix incorrect use of "it's" and "its", adjust wording 2016-06-21 16:30:15 -07:00
Koichiro IWAO
c0ac8251f7 sesman: Add /sbin to PATH for FreeBSD
to enable to execute FUSE mount program.

The place of FUSE mount programs are:

FreeBSD   : /sbin/mount_fusefs
GNU/Linux : /bin/fusermount

See also #387.
2016-06-20 09:47:37 +09:00
Pavel Roskin
1403652c72 Remove unused variable in devredir_cvt_from_unicode_len() 2016-05-06 18:58:16 -07:00
Pavel Roskin
f2d326cbed Remove unused variables from dev_redir_proc_query_dir_response() 2016-05-06 18:58:16 -07:00
Pavel Roskin
0dd0426e6f Check XGetWindowProperty() return code in clipboard_event_property_notify() 2016-05-06 18:31:03 -07:00
Pavel Roskin
72019d3611 Use better symbols to protect include files 2016-05-05 00:06:26 -07:00
Pavel Roskin
ca9cbcafc8 Typo fixes 2016-05-04 23:33:30 -07:00
jsorg71
fdb146740f Merge pull request #360 from proski/format-warnings
Warning fixes
2016-05-03 00:52:58 -07:00
Pavel Roskin
f93074a430 Add unnamed semaphore support on Mac OS
sem_init() is not functional on Mac OS. Use the Grand Central Dispatch
implementation.

Make libscp_lock.c use semaphores through the thread_calls wrapper.
2016-04-23 00:26:46 -07:00
Pavel Roskin
70f3d4c5e2 Fix warnings for unused variables read from byte streams 2016-04-23 00:18:38 -07:00
Pavel Roskin
95e1603f9d Fix recently introduced warnings in session.c
Use of tabs is fixed as well.
2016-04-21 23:03:40 -07:00
Pavel Roskin
0629b25d5f Fix warnings about unused variables and functions 2016-04-21 22:27:27 -07:00
Pavel Roskin
e65bd6b7d7 Fix more format warnings 2016-04-21 21:21:17 -07:00
jsorg71
00a11f77ce Merge pull request #359 from metalefty/sesman/configurable-xserver-path
sesman: do not hardcode Xorg/X11rdp/Xvnc executables
2016-04-18 13:29:15 -07:00
Koichiro IWAO
cfdce461c3 Do not attempt to trap SIGKILL part 2
it doesn't work on any OS.
2016-04-11 16:43:12 +09:00
Koichiro IWAO
cf2b629462 sesman: do not hardcode Xorg/X11rdp/Xvnc executables
In RHEL and its clones, /usr/bin/Xorg is set suid-root. To execute
Xorg with user privileges, /etc/pam.d/xserver needs be edited [1],
or suid bit of Xorg binary needs to be dropped.

In order to keep Xorg and /etc/pam.d/xserver untouched, preparing
non-suid version of Xorg as /usr/bin/Xorg.non-suid for example is
the simplest solution. However, Xorg.non-suid cannot be executed
since it is hardcoded to execute Xorg in sesman.

This change makes more flexible to execute Xorg with non-standard
name or not in PATH environment variable.

[1] https://www.centos.org/forums/viewtopic.php?t=21185
2016-04-07 18:34:43 +09:00
Koichiro IWAO
fb08623b66 sesman: brief xorg_params, no logic change 2016-04-07 16:27:23 +09:00
NerdKnight
99ebe1340f Fix compile error "format not a string literal and no format arguments [-Werror=format-security]" 2016-03-28 14:55:20 -03:00
Jay Sorg
a6cba63a89 fix a warning 2016-03-16 14:40:24 -07:00
Jay Sorg
689ffe79d9 fix warnings, move some calls to os_calls 2016-03-16 14:32:14 -07:00
Jay Sorg
38241f2a0b Fix all format warnings and some unused variable warnings 2016-03-14 17:04:08 -07:00
Jay Sorg
7393579205 Don't attempt to intercept SIGKILL, it doesn't work on any OS 2016-03-14 16:33:49 -07:00
Itamar Reis Peixoto
cfbb00c6cb Merge pull request #333 from proski/key-install
Key install (generate rsakeys.ini during make install)
2016-02-24 06:38:02 -05:00
jsorg71
f53b3bb737 Merge pull request #326 from metalefty/pulseaudio-6.0
pulse: fix build pulseaudio 6.0 or higher
2016-02-23 23:19:59 -08:00
Pavel Roskin
22e6f3e2f7 Use SCRIPTS for executable scripts, don't use "chmod 755" 2016-02-22 23:13:16 -08:00
Pavel Roskin
7642675ddf Use "dist_" prefix to minimize use of EXTRA_DIST
"dist" is ignored in presense of "noinst", so keep noinst_man_MANS.
2016-02-22 22:11:57 -08:00
Pavel Roskin
59a5fb0ddb Move headers from EXTRA_DIST to sources, sort alphabetically
There should be no functional difference.
2016-02-21 23:06:48 -08:00
Koichiro IWAO
93f7bcb71b pulse: fix build pulseaudio 6.0 or higher
Discovered in #321.  The number of argument for pa_rtpoll_run have
been changed since 6.0.

>=6.0 : int pa_rtpoll_run(pa_rtpoll *f);
<6.0  : int pa_rtpoll_run(pa_rtpoll *f, bool wait);

Check pulseaudio version by PA_CHECK_VERSION macro introduced since
pulseaudio 0.9.16.  In case PA_CHECK_VERSION is not defined,
pa_rtpoll_run takes 2 arguments.
2016-02-18 00:45:33 +09:00
Pavel Roskin
50cbf01044 xrdp-sesadmin: show help and exit if mandatory arguments are not given
Don't mark password as mandatory, it's asked if not provided on the
command line.
2016-02-14 10:27:17 -08:00
Pavel Roskin
92a6833e9b Fix typos 2016-02-13 20:41:07 -08:00
Pavel Roskin
fe055e989a Fix connection month display in xrdp-sesadmin
tm_mon in `struct tm` uses 0 for January.

`struct session_data` and `struct SCP_DISCONNECTED_SESSION` don't specify
how dates are stored. But considering the code in sestest and sesadmin,
all date components are stored as displayed.
2016-02-13 18:31:47 -08:00
Pavel Roskin
81779ddb01 Use lowercase program names for syslog
Other programs typically use the same case as their execulables.
2016-02-13 18:14:42 -08:00
Pavel Roskin
dcab7552db Stop redefining libdir, use moduledir for ${libdir}/xrdp
libdir is for shared and static libraries. Some xrdp libraries are loaded
dynamically from a non-standard directory, so they are used like modules.

Having separate libdir and moduledir would eventually allow to separate
dynamically loaded modules from shared libraries.
2016-02-12 23:52:46 -08:00
Pavel Roskin
ffc4efb9ce Don't ignore files known to git
That can cause unexpected behavior, especially with third party tools.
The ignored files will be lost if the source tree is re-imported to
another git repository, unless special care is taken.

Whitelist all non-generated makefiles.

To whitelist instfiles/pam.d/xrdp-sesman, add path to all generated
executables listed in the top-level .gitignore, sort .gitignore
alphabetically.

Add mkinstalldir, it's used by Automake on some systems.
2016-02-12 23:52:46 -08:00
Pavel Roskin
22e808a186 Add missing spaces in the strings that are split for line wrapping 2016-02-12 23:52:45 -08:00
Pavel Roskin
09709d3ced xcon: include unistd.h, it's needed for select() on MacOS 2016-02-12 23:52:45 -08:00
Pavel Roskin
85840863da startwm.sh: make sure sourced scripts are readable
Strictly speaking, both existence and readability should be checked.
However, chances of ~/.profile being a directory or a FIFO are very small
compared to its chances of being non-readable due to some
misconfiguration.

Put "if" and "then" on the same line for consistency with other checks.
Improve comment and pseudocode formatting.
2016-02-12 23:52:45 -08:00
Jay Sorg
ac901fd283 sesman: add missing break 2016-02-11 17:52:44 -08:00
Itamar Reis Peixoto
09a69fbec2 remove duplicated call to scp_session_set_bpp 2016-02-11 11:54:43 -02:00
Pavel Roskin
a61349c1d3 Allow sessions with 32 bpp 2016-02-10 09:30:23 -08:00
Pavel Roskin
5d23d007e9 Check return value of scp_session_set_bpp() 2016-02-10 09:30:23 -08:00
Itamar Reis Peixoto
ee436aeec9 Merge pull request #309 from proski/devel
Fixes for autotools, compile warnings and MacOS compatibility
2016-02-08 22:37:44 -02:00
Pavel Roskin
5575197eaa sesman: don't set LANG, let initialization scripts take care of it
Setting LANG to en_US.UTF-8 suppresses language settings from
/etc/locale.conf

See https://bugzilla.redhat.com/show_bug.cgi?id=1290820
2016-02-07 22:50:14 -08:00
Pavel Roskin
5de1d31a75 Change an unconditional #warning to a comment
Notes about software design should not be shown as warnings to everybody
who compiles the code. Warnings should be about unexpected conditions
detected at the compile time.
2016-01-31 23:42:16 -08:00
Pavel Roskin
f1ba2b2c9d xcon: include sys/types.h for select() and related macros 2016-01-31 23:35:40 -08:00