We shouldn't assume that xrdp daemon is running under root privilege.
In many cases, root privilege is not really needed for xrdp daemon.
xrdp may fail to load certificate/privkey due to lack of permissions
when running under user privilege. Checking existence of files is not
enough and xrdp should output user-friendly log in such case.
Reported by Debian user in bug 856436 [1].
[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=856436
- Changes made only in the os_calls.c file.
- Exported functions changed: g_tcp_bind g_tcp_bind_address g_tcp_connect
- Support three network configurations:
1) Normal network, with IPv6
2) Partly disabled IPv6 via sysctl.conf
3) Total disabled IPv6 via grub
Use XRDP_SOCKET_PATH in file_loc.h
Don't define any non-socket paths in file_loc.h, they should come from
the makefiles.
Define all paths unconditionally, they should not be defined elsewhere.
Pass XRDP_SOCKET_PATH as environment variable to the backends.
g_tcp_accept() and g_sck_accept() should use sockadd_in6 when IPv6 is
enabled. The former code logs client IP address always "0.0.0.0" in such
case.
Fixes#412.
Don't assume AF_INET family. Don't assume the socket is connected. Report
local address and port. Don't try to close non-sockets and invalid file
descriptors. Report errors getting socket information and closing the
socket. Use more appropriate log levels.
broken by #314. This is compatible with the fix introduced in #314.
To use non-ASCII text/filename in clipboard, chansrv needs to be run
with LC_CTYPE=*.UTF-8 because the behaviour of mbstowcs(3) function
called in chansrv depends on LC_CTYPE[1]. However #314 made
LC_CTYPE=C in chansrv context. Even if LANG and LC_* are set in
.bashrc, /etc/profile, /etc/locale.conf or something like that,
it doesn't affect in chansrv context because chansrv doesn't source
any of them unlike sesman.
So do not set LC_CTYPE to blank or "C" in g_init() in order to get
g_mbstowcs and g_wcstombs to work properly with non-ASCII UTF-8
characters in any context.
Setting LC_CTYPE to *.UTF-8 doesn't obstruct applying system
language in RHEL [2].
[1] Linux man page says:
The behavior of mbstowcs() depends on the LC_CTYPE category of
the current locale.
[2] https://bugzilla.redhat.com/show_bug.cgi?id=1290820
in case getaddrinfo(3) might fail.
In FreeBSD, AI_V4MAPPED support for getaddrinfo(3) was very recently
implemented[1]. Most of FreeBSD systems in the world do not have
this implementation yet. This will be a problem when AI_V4MAPPED
isn't supported and xrdp is built with IPv6 option. In such a case,
g_tcp_connect always fails.
Of course getaddrinfo(3) might fail in other cases. The log helps
us to know what's happening.
[1] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=198092