Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
33c7f1038c | ||
|
4fe4b436d7 | ||
|
64e2291274 | ||
|
7ea609e91a | ||
|
44d8b601ba | ||
|
04f121f214 | ||
|
bc6b29ae88 | ||
|
9533e7fa2e | ||
|
0bc3ee2cd7 |
21
.cirrus.yml
21
.cirrus.yml
@ -1,21 +0,0 @@
|
||||
FreeBSD_task:
|
||||
matrix:
|
||||
env:
|
||||
SSL: libressl
|
||||
matrix:
|
||||
freebsd_instance:
|
||||
image_family: freebsd-13-3
|
||||
prepare_script:
|
||||
- pkg install -y $SSL git autoconf automake libtool pkgconf opus jpeg-turbo fdk-aac pixman libX11 libXfixes libXrandr libxkbfile nasm fusefs-libs3 check imlib2 freetype2 cmocka ibus
|
||||
- git submodule update --init --recursive
|
||||
configure_script:
|
||||
- ./bootstrap
|
||||
- env CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib ./configure --localstatedir=/var --enable-strict-locations --with-pkgconfigdir=/usr/local/libdata/pkgconfig --enable-strict-locations --enable-ibus --enable-ipv6 --enable-opus --enable-jpeg --enable-fdkaac --enable-painter --enable-pixman --enable-fuse --with-imlib2 --with-freetype2
|
||||
build_script:
|
||||
- make -j $(sysctl -n hw.ncpu || echo 4)
|
||||
check_script:
|
||||
- make check
|
||||
install_script:
|
||||
- make install
|
||||
test_script:
|
||||
- /usr/local/sbin/xrdp -v
|
1
.github/FUNDING.yml
vendored
1
.github/FUNDING.yml
vendored
@ -1 +0,0 @@
|
||||
open_collective: xrdp-project
|
112
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
112
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@ -1,112 +0,0 @@
|
||||
name: "🕷️ Bug report"
|
||||
description: Report errors or unexpected behavior
|
||||
labels:
|
||||
- "bug"
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Before submitting a bug, read the [FAQ](https://github.com/neutrinolabs/xrdp/wiki/Tips-and-FAQ). **In particular, on systemd-based systems. make sure you are not logged in on the console as the same user you are trying to use for xrdp**
|
||||
|
||||
Please do not include links to images or videos on external websites. These are not guaranteed to always be available, and could be used to compromise web browsers.
|
||||
|
||||
Videos hosted on github have a size limit (currently 10MB). If your video is larger than this, please upload it to https://youtube.com
|
||||
- type: input
|
||||
attributes:
|
||||
label: xrdp version
|
||||
placeholder: 0.9.20
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Detailed xrdp version, build options
|
||||
description: Copy & paste the result of `xrdp --version`. DO NOT remove `~~~` but paste the result between two `~~~`.
|
||||
value: |
|
||||
~~~
|
||||
Paste the result between `~~~`. Please DO NOT remove `~~~`!
|
||||
~~~
|
||||
- type: input
|
||||
attributes:
|
||||
label: Operating system & version
|
||||
placeholder: "Ubuntu 22.04 / AlmaLinux 9 / FreeBSD 13.2 / etc"
|
||||
description: Tell us about your operating system. See PRETTY_NAME
|
||||
in /etc/os-release if you don't know.
|
||||
|
||||
Note we are currently unable to provide direct support for Red Hat
|
||||
Enterprise Linux. Either reproduce the issue on CentOS/Alma/Rocky
|
||||
OS, or contact Red Hat directly for support.
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
attributes:
|
||||
label: Installation method
|
||||
description: How was xrdp installed from?
|
||||
options:
|
||||
- dnf / apt / zypper / pkg / etc
|
||||
- Homebrew / MacPorts
|
||||
- git clone & make install
|
||||
- Doesn't matter
|
||||
- other
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
attributes:
|
||||
label: Which backend do you use?
|
||||
description: Tell us about xrdp backend and version you're using. Typically, it would be either Xvnc or xorgxrdp or rarely NeutrionRDP / FreeRDP.
|
||||
placeholder: Xvnc (tigervnc-1.12.0-13.el9_2)
|
||||
- type: input
|
||||
attributes:
|
||||
label: What desktop environment do you use?
|
||||
description: Tell us about your desktop (e.g. GNOME / KDE / Xfce / xterm). If you're certain the bug you about to report is not desktop specific, fill "any" here.
|
||||
placeholder: GNOME
|
||||
- type: input
|
||||
attributes:
|
||||
label: Environment xrdp running on
|
||||
description: Tell us whether xrdp is running on a VM, or if on a physical machine what graphics cards are installed.
|
||||
- type: input
|
||||
attributes:
|
||||
label: What's your client?
|
||||
description: If you issue occurs with specific clients, tell us the client app name, app version client os version and platform.
|
||||
placeholder: Microsoft's official client from Mac App Store, running on macOS Ventura.
|
||||
- type: dropdown
|
||||
attributes:
|
||||
label: Area(s) with issue?
|
||||
description: What things had an issue? Check all that apply.
|
||||
multiple: true
|
||||
options:
|
||||
- Audio redirection
|
||||
- Authentication
|
||||
- Crashes such as segfault
|
||||
- Clipboard
|
||||
- Compatiblity aginst clients
|
||||
- Compile error
|
||||
- File transfer / drive redirection
|
||||
- Graphic glitches
|
||||
- Keyboard / Mouse
|
||||
- Network
|
||||
- Performance
|
||||
- Session manager (sesman)
|
||||
- Smartcard
|
||||
- Other
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Steps to reproduce
|
||||
placeholder: Having detailed steps helps us reproduce the bug.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: ✔️ Expected Behavior
|
||||
placeholder: What were you expecting?
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: ❌ Actual Behavior
|
||||
placeholder: What happened instead?
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Anything else?
|
||||
description: Links? References? Anything that will give us more context about the issue you are encountering! We recommend attaching `xrdp.log`, `xrdp-sesman.log`, `xrdp/xorg.conf` or screenshots to clarify context.
|
5
.github/ISSUE_TEMPLATE/config.yml
vendored
5
.github/ISSUE_TEMPLATE/config.yml
vendored
@ -1,5 +0,0 @@
|
||||
contact_links:
|
||||
- name: Questions
|
||||
about: If you are new to xrdp and want to ask community for help, raise it as Q&A in discussion.
|
||||
url: https://github.com/neutrinolabs/xrdp/discussions/new?category=q-a
|
||||
|
233
.github/workflows/build.yml
vendored
233
.github/workflows/build.yml
vendored
@ -1,233 +0,0 @@
|
||||
name: build and test
|
||||
on:
|
||||
push:
|
||||
branches-ignore:
|
||||
- "gh-pages"
|
||||
tags-ignore:
|
||||
- "v0.[0-8]**"
|
||||
pull_request:
|
||||
branches-ignore:
|
||||
- "gh-pages"
|
||||
|
||||
jobs:
|
||||
build_and_test:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
|
||||
# Minimal 64-bit arch builds
|
||||
- CC: gcc
|
||||
feature_set: min
|
||||
arch: amd64
|
||||
os: ubuntu-latest
|
||||
unittests: false
|
||||
DISTCHECK: false
|
||||
|
||||
- CC: g++
|
||||
feature_set: min
|
||||
arch: amd64
|
||||
os: ubuntu-latest
|
||||
unittests: false
|
||||
DISTCHECK: false
|
||||
|
||||
- CC: clang
|
||||
feature_set: min
|
||||
arch: amd64
|
||||
os: ubuntu-latest
|
||||
unittests: false
|
||||
DISTCHECK: false
|
||||
|
||||
# Maximal 64-bit arch builds
|
||||
- CC: gcc
|
||||
feature_set: max
|
||||
arch: amd64
|
||||
os: ubuntu-latest
|
||||
unittests: true
|
||||
DISTCHECK: true
|
||||
|
||||
- CC: g++
|
||||
feature_set: max
|
||||
arch: amd64
|
||||
os: ubuntu-latest
|
||||
unittests: false
|
||||
DISTCHECK: false
|
||||
|
||||
- CC: clang
|
||||
feature_set: max
|
||||
arch: amd64
|
||||
os: ubuntu-latest
|
||||
unittests: true
|
||||
DISTCHECK: true
|
||||
|
||||
- CC: clang
|
||||
feature_set: max
|
||||
arch: amd64
|
||||
os: ubuntu-latest
|
||||
unittests: true
|
||||
DISTCHECK: false
|
||||
name_extra: and AddressSanitized
|
||||
CFLAGS: "-fsanitize=address -ggdb"
|
||||
LDFLAGS: "-fsanitize=address"
|
||||
|
||||
# Maximal debug 64-bit arch builds
|
||||
# Check we can also do a static build without
|
||||
# installing .a files
|
||||
- CC: gcc
|
||||
feature_set: max
|
||||
arch: amd64
|
||||
os: ubuntu-latest
|
||||
unittests: true
|
||||
DISTCHECK: false
|
||||
name_extra: and DEBUG
|
||||
CONF_FLAGS_EXTRA: "--enable-devel-all --disable-static"
|
||||
|
||||
# Maximal 32-bit arch builds
|
||||
- CC: gcc
|
||||
feature_set: max
|
||||
arch: i386
|
||||
os: ubuntu-latest
|
||||
unittests: true
|
||||
DISTCHECK: false
|
||||
name_extra: for 32-bit arch (legacy OS)
|
||||
CFLAGS: "-m32"
|
||||
LDFLAGS: "-m32"
|
||||
|
||||
- CC: g++
|
||||
feature_set: max
|
||||
arch: i386
|
||||
os: ubuntu-latest
|
||||
unittests: false
|
||||
DISTCHECK: false
|
||||
name_extra: for 32-bit arch (legacy OS)
|
||||
CFLAGS: "-m32"
|
||||
LDFLAGS: "-m32"
|
||||
|
||||
- CC: clang
|
||||
feature_set: max
|
||||
arch: i386
|
||||
os: ubuntu-latest
|
||||
unittests: true
|
||||
DISTCHECK: false
|
||||
name_extra: for 32-bit arch (legacy OS)
|
||||
CFLAGS: "-m32"
|
||||
LDFLAGS: "-m32"
|
||||
|
||||
name: ${{ matrix.feature_set }} features with ${{ matrix.CC }} ${{ matrix.name_extra }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
env:
|
||||
CC: ${{ matrix.CC }}
|
||||
CFLAGS: ${{ matrix.CFLAGS }}
|
||||
LDFLAGS: ${{ matrix.LDFLAGS }}
|
||||
|
||||
# HACK (2020-11-16): github actions doesn't support YAML anchors/aliases to
|
||||
# avoid repeating long config values. So instead the config values are defined
|
||||
# as environment variables using a naming convention with fields that come from
|
||||
# the job config. These environment variables are then referenced as regular
|
||||
# environment variables via the naming convention in the "define env" step to
|
||||
# define the standard environment variable used in the rest of the steps.
|
||||
CONF_FLAGS_amd64_min: "--disable-ipv6 --disable-jpeg --disable-fuse --disable-mp3lame
|
||||
--disable-fdkaac --disable-opus --disable-rfxcodec --disable-painter
|
||||
--disable-pixman --disable-utmp"
|
||||
CONF_FLAGS_amd64_max: "--enable-ibus --enable-ipv6 --enable-jpeg --enable-fuse
|
||||
--enable-mp3lame --enable-fdkaac --enable-opus --enable-rfxcodec
|
||||
--enable-painter --enable-pixman --enable-utmp
|
||||
--with-imlib2 --with-freetype2 --enable-tests --with-x264"
|
||||
CONF_FLAGS_i386_max: "--enable-ibus --enable-ipv6 --enable-jpeg
|
||||
--enable-mp3lame --enable-opus --enable-rfxcodec
|
||||
--enable-painter --disable-pixman --with-imlib2
|
||||
--with-freetype2 --host=i686-linux --enable-tests"
|
||||
|
||||
PKG_CONFIG_PATH_i386: "/usr/lib/i386-linux-gnu/pkgconfig"
|
||||
steps:
|
||||
- name: "Define feature and arch dependent environment variables"
|
||||
# Note: any "variable=value" written to the $GITHUB_ENV file will be
|
||||
# defined as an environment variable for all future steps in this job
|
||||
# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
|
||||
run: |
|
||||
echo "CONF_FLAGS=$CONF_FLAGS_${{ matrix.arch }}_${{ matrix.feature_set }} ${{ matrix.CONF_FLAGS_EXTRA }}" >> $GITHUB_ENV
|
||||
echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH_${{ matrix.arch }}" >> $GITHUB_ENV
|
||||
- uses: actions/checkout@v4
|
||||
- name: "Install Dependencies"
|
||||
# See https://github.com/actions/runner-images/issues/7192
|
||||
run: |
|
||||
echo RESET grub-efi/install_devices | sudo debconf-communicate grub-pc
|
||||
sudo scripts/install_xrdp_build_dependencies_with_apt.sh ${{ matrix.feature_set }} ${{ matrix.arch }} --allow-downgrades --allow-remove-essential --allow-change-held-packages
|
||||
- name: Bootstrap
|
||||
run: ./bootstrap
|
||||
- name: configure
|
||||
run: ./configure $CONF_FLAGS
|
||||
- name: make
|
||||
run: make -j $(nproc)
|
||||
- name: unittests
|
||||
if: ${{ matrix.unittests }}
|
||||
run: make check -j $(nproc) || (cat tests/*/test-suite.log && exit 1)
|
||||
- name: distcheck
|
||||
id: dist_check
|
||||
if: ${{ matrix.DISTCHECK }}
|
||||
run: make distcheck -j $(nproc)
|
||||
- name: "Artifact: test-suite.log distcheck"
|
||||
uses: actions/upload-artifact@v3
|
||||
if: always() && steps.dist_check.outcome == 'failure'
|
||||
with:
|
||||
name: test-suite-distcheck-${{ matrix.cc }}-${{ matrix.feature_set }}
|
||||
path: ${{ github.workspace }}/xrdp-*/_build/sub/tests/xrdp/test-suite.log
|
||||
|
||||
cppcheck:
|
||||
name: cppcheck
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CC: gcc
|
||||
# This is required to use a version of cppcheck other than that
|
||||
# supplied with the operating system
|
||||
CPPCHECK_VER: "2.16.0"
|
||||
CPPCHECK_REPO: https://github.com/danmar/cppcheck.git
|
||||
steps:
|
||||
# Set steps.os.outputs.image to the specific OS (e.g. 'ubuntu20')
|
||||
- name: Get operating system name and version.
|
||||
id: os
|
||||
run: echo "image=$ImageOS" >>$GITHUB_OUTPUT
|
||||
shell: bash
|
||||
- uses: actions/checkout@v4
|
||||
- name: Cache cppcheck
|
||||
uses: actions/cache@v4
|
||||
env:
|
||||
cache-name: cache-cppcheck
|
||||
with:
|
||||
path: ~/cppcheck.local
|
||||
key: ${{ steps.os.outputs.image }}-build-${{ env.cache-name }}-${{ env.CPPCHECK_VER }}
|
||||
- run: sudo scripts/install_cppcheck_dependencies_with_apt.sh $CPPCHECK_VER
|
||||
- run: ./bootstrap
|
||||
- run: ./configure
|
||||
- run: scripts/install_cppcheck.sh $CPPCHECK_REPO $CPPCHECK_VER
|
||||
- run: scripts/run_cppcheck.sh -v $CPPCHECK_VER
|
||||
|
||||
code_formatting_check:
|
||||
name: code formatting check
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CC: gcc
|
||||
# This is required to use a version of astyle other than that
|
||||
# supplied with the operating system
|
||||
ASTYLE_VER: 3.4.14
|
||||
ASTYLE_REPO: https://gitlab.com/saalen/astyle.git
|
||||
steps:
|
||||
# Set steps.os.outputs.image to the specific OS (e.g. 'ubuntu20')
|
||||
- name: Get operating system name and version.
|
||||
id: os
|
||||
run: echo "image=$ImageOS" >>$GITHUB_OUTPUT
|
||||
shell: bash
|
||||
- uses: actions/checkout@v4
|
||||
- name: Cache astyle
|
||||
uses: actions/cache@v4
|
||||
env:
|
||||
cache-name: cache-astyle
|
||||
with:
|
||||
path: ~/astyle.local
|
||||
key: ${{ steps.os.outputs.image }}-build-${{ env.cache-name }}-${{ env.ASTYLE_VER }}
|
||||
- run: sudo scripts/install_astyle_dependencies_with_apt.sh
|
||||
- run: scripts/install_astyle.sh $ASTYLE_REPO $ASTYLE_VER
|
||||
- name: Format code with astyle
|
||||
run: scripts/run_astyle.sh -v $ASTYLE_VER
|
||||
- name: Check code formatting
|
||||
run: git diff --exit-code
|
50
.github/workflows/coverity.yml
vendored
50
.github/workflows/coverity.yml
vendored
@ -1,50 +0,0 @@
|
||||
name: Coverity
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
scan:
|
||||
name: scan
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.repository_owner == 'neutrinolabs' }}
|
||||
env:
|
||||
CC: gcc
|
||||
CONF_FLAGS_amd64_max: "--enable-ipv6 --enable-jpeg --enable-fuse --enable-mp3lame
|
||||
--enable-fdkaac --enable-opus --enable-rfxcodec --enable-painter
|
||||
--enable-pixman --enable-utmp
|
||||
--with-imlib2 --with-freetype2 --enable-tests"
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Download Coverity build tool
|
||||
run: |
|
||||
wget -c -N https://scan.coverity.com/download/linux64 --post-data "token=${{ secrets.COVERITY_SCAN_TOKEN }}&project=neutrinolabs/xrdp" -O coverity_tool.tar.gz
|
||||
mkdir coverity_tool
|
||||
tar xzf coverity_tool.tar.gz --strip 1 -C coverity_tool
|
||||
|
||||
- name: "Install Dependencies"
|
||||
run: |
|
||||
echo RESET grub-efi/install_devices | sudo debconf-communicate grub-pc
|
||||
sudo scripts/install_xrdp_build_dependencies_with_apt.sh max amd64 --allow-downgrades --allow-remove-essential --allow-change-held-packages
|
||||
- name: Bootstrap
|
||||
run: ./bootstrap
|
||||
- name: configure
|
||||
run: ./configure $CONF_FLAGS_amd64_max
|
||||
- name: make
|
||||
run: |
|
||||
export PATH=`pwd`/coverity_tool/bin:$PATH
|
||||
cov-build --dir cov-int make -j $(nproc)
|
||||
|
||||
- name: Submit build result to Coverity Scan
|
||||
run: |
|
||||
tar czvf cov.tar.gz cov-int
|
||||
curl --form token=${{ secrets.COVERITY_SCAN_TOKEN }} \
|
||||
--form email=meta@vmeta.jp \
|
||||
--form file=@cov.tar.gz \
|
||||
--form version="Commit $GITHUB_SHA" \
|
||||
--form description="Build submitted via CI" \
|
||||
https://scan.coverity.com/builds?project=neutrinolabs/xrdp
|
||||
|
47
.gitignore
vendored
47
.gitignore
vendored
@ -1,12 +1,11 @@
|
||||
*~
|
||||
*.a
|
||||
aclocal.m4
|
||||
AUTHORS
|
||||
autom4te.cache/
|
||||
ChangeLog
|
||||
compile
|
||||
config_ac.h
|
||||
config_ac-h.in
|
||||
config.c
|
||||
config.guess
|
||||
config.log
|
||||
config.status
|
||||
@ -14,52 +13,26 @@ config.sub
|
||||
configure
|
||||
depcomp
|
||||
.deps/
|
||||
fontutils/xrdp-dumpfv1
|
||||
fontutils/xrdp-mkfv1
|
||||
genkeymap/xrdp-genkeymap
|
||||
install-sh
|
||||
instfiles/pam.d/xrdp-sesman
|
||||
instfiles/*.service
|
||||
keygen/xrdp-keygen
|
||||
*.la
|
||||
.libs
|
||||
libtool
|
||||
*.lo
|
||||
*.log
|
||||
ltmain.sh
|
||||
Makefile
|
||||
Makefile.in
|
||||
missing
|
||||
mkinstalldirs
|
||||
NEWS
|
||||
*.o
|
||||
README
|
||||
sesman/chansrv/xrdp-chansrv
|
||||
sesman/sesexec/xrdp-sesexec
|
||||
sesman/tools/xrdp-authtest
|
||||
sesman/tools/xrdp-dis
|
||||
sesman/tools/xrdp-sesadmin
|
||||
sesman/tools/xrdp-sesrun
|
||||
sesman/tools/xrdp-sestest
|
||||
sesman/tools/xrdp-xcon
|
||||
sesman/xrdp-sesman
|
||||
sesman/sesman.ini
|
||||
*.so
|
||||
stamp-h1
|
||||
tap-driver.sh
|
||||
test-driver
|
||||
tests/common/test_common
|
||||
tests/libipm/test_libipm
|
||||
tests/libxrdp/test_libxrdp
|
||||
tests/memtest/memtest
|
||||
tests/xrdp/test_xrdp
|
||||
tools/devel/tcp_proxy/tcp_proxy
|
||||
tools/chkpriv/xrdp-chkpriv
|
||||
tools/chkpriv/xrdp-droppriv
|
||||
*.trs
|
||||
waitforx/waitforx
|
||||
xrdp-chansrv
|
||||
xrdp-genkeymap
|
||||
xrdp-keygen
|
||||
xrdp-sesadmin
|
||||
xrdp-sesman
|
||||
xrdp-sesrun
|
||||
xrdp-sessvc
|
||||
xrdp-sestest
|
||||
xrdp-dis
|
||||
xrdp/xrdp
|
||||
xrdp/xrdp.ini
|
||||
xrdp_configure_options.h
|
||||
xrdpapi/xrdp-xrdpapi-simple
|
||||
.vscode/*
|
||||
|
13
.gitmodules
vendored
13
.gitmodules
vendored
@ -1,13 +0,0 @@
|
||||
[submodule "librfxcodec"]
|
||||
path = librfxcodec
|
||||
url = https://github.com/neutrinolabs/librfxcodec.git
|
||||
branch = .
|
||||
ignore = untracked
|
||||
[submodule "libpainter"]
|
||||
path = libpainter
|
||||
url = https://github.com/neutrinolabs/libpainter.git
|
||||
branch = .
|
||||
ignore = untracked
|
||||
[submodule "ulalaca"]
|
||||
path = ulalaca
|
||||
url = https://github.com/neutrinolabs/ulalaca-xrdp.git
|
482
COPYING
482
COPYING
@ -1,176 +1,372 @@
|
||||
Apache License, Version 2.0
|
||||
|
||||
Version 2.0, January 2004
|
||||
special clause for libxrdp and librdp, both based on rdesktop
|
||||
these libraries link to openssl
|
||||
|
||||
http://www.apache.org/licenses/
|
||||
This software is released under the GNU General Public License
|
||||
(reproduced below) with the additional exemption that compiling,
|
||||
linking, and/or using OpenSSL together with this software is
|
||||
allowed.
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
---
|
||||
|
||||
1. Definitions.
|
||||
special clause for xrdp, that main executable
|
||||
for linking with proprietary modules
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, and
|
||||
distribution as defined by Sections 1 through 9 of this document.
|
||||
Linking this library statically or dynamically with other modules
|
||||
is making a combined work based on this library. Thus, the terms
|
||||
and conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the
|
||||
copyright owner that is granting the License.
|
||||
As a special exception, the copyright holders of this library
|
||||
give you permission to link this library with independent modules
|
||||
to produce an executable, regardless of the license terms of
|
||||
these independent modules, and to copy and distribute the resulting
|
||||
executable under terms of your choice, provided that you also meet,
|
||||
for each linked independent module, the terms and conditions of the
|
||||
license of that module. An independent module is a module which is
|
||||
not derived from or based on this library. If you modify this
|
||||
library, you may extend this exception to your version of the
|
||||
library, but you are not obliged to do so. If you do not wish
|
||||
to do so, delete this exception statement from your version.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all other
|
||||
entities that control, are controlled by, or are under common control
|
||||
with that entity. For the purposes of this definition, "control" means
|
||||
(i) the power, direct or indirect, to cause the direction or management
|
||||
of such entity, whether by contract or otherwise, or (ii) ownership of
|
||||
fifty percent (50%) or more of the outstanding shares, or
|
||||
(iii) beneficial ownership of such entity.
|
||||
---
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising
|
||||
permissions granted by this License.
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation source,
|
||||
and configuration files.
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical transformation
|
||||
or translation of a Source form, including but not limited to compiled
|
||||
object code, generated documentation, and conversions to other media types.
|
||||
Preamble
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or Object form,
|
||||
made available under the License, as indicated by a copyright notice that is
|
||||
included in or attached to the work (an example is provided in the Appendix below).
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form,
|
||||
that is based on (or derived from) the Work and for which the editorial
|
||||
revisions, annotations, elaborations, or other modifications represent, as a
|
||||
whole, an original work of authorship. For the purposes of this License,
|
||||
Derivative Works shall not include works that remain separable from, or
|
||||
merely link (or bind by name) to the interfaces of, the Work and
|
||||
Derivative Works thereof.
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including the original
|
||||
version of the Work and any modifications or additions to that Work or Derivative
|
||||
Works thereof, that is intentionally submitted to Licensor for inclusion in the
|
||||
Work by the copyright owner or by an individual or Legal Entity authorized to
|
||||
submit on behalf of the copyright owner. For the purposes of this definition,
|
||||
"submitted" means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems, and
|
||||
issue tracking systems that are managed by, or on behalf of, the Licensor for
|
||||
the purpose of discussing and improving the Work, but excluding communication
|
||||
that is conspicuously marked or otherwise designated in writing by the copyright
|
||||
owner as "Not a Contribution."
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
|
||||
of whom a Contribution has been received by Licensor and subsequently incorporated
|
||||
within the Work.
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of this License,
|
||||
each Contributor hereby grants to You a perpetual, worldwide, non-exclusive,
|
||||
no-charge, royalty-free, irrevocable copyright license to reproduce, prepare
|
||||
Derivative Works of, publicly display, publicly perform, sublicense, and distribute
|
||||
the Work and such Derivative Works in Source or Object form.
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of this License,
|
||||
each Contributor hereby grants to You a perpetual, worldwide, non-exclusive,
|
||||
no-charge, royalty-free, irrevocable (except as stated in this section) patent
|
||||
license to make, have made, use, offer to sell, sell, import, and otherwise transfer
|
||||
the Work, where such license applies only to those patent claims licensable by such
|
||||
Contributor that are necessarily infringed by their Contribution(s) alone or by
|
||||
combination of their Contribution(s) with the Work to which such Contribution(s) was
|
||||
submitted. If You institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution
|
||||
incorporated within the Work constitutes direct or contributory patent infringement,
|
||||
then any patent licenses granted to You under this License for that Work shall
|
||||
terminate as of the date such litigation is filed.
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative
|
||||
Works thereof in any medium, with or without modifications, and in Source or Object
|
||||
form, provided that You meet the following conditions:
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
You must give any other recipients of the Work or Derivative Works a copy of this
|
||||
License; and
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
You must cause any modified files to carry prominent notices stating that You changed
|
||||
the files; and
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
You must retain, in the Source form of any Derivative Works that You distribute,
|
||||
all copyright, patent, trademark, and attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of the Derivative Works; and
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
If the Work includes a "NOTICE" text file as part of its distribution, then any
|
||||
Derivative Works that You distribute must include a readable copy of the attribution
|
||||
notices contained within such NOTICE file, excluding those notices that do not pertain
|
||||
to any part of the Derivative Works, in at least one of the following places: within a
|
||||
NOTICE text file distributed as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or, within a display
|
||||
generated by the Derivative Works, if and wherever such third-party notices normally
|
||||
appear. The contents of the NOTICE file are for informational purposes only and do not
|
||||
modify the License. You may add Your own attribution notices within Derivative Works
|
||||
that You distribute, alongside or as an addendum to the NOTICE text from the Work,
|
||||
provided that such additional attribution notices cannot be construed as modifying
|
||||
the License. You may add Your own copyright statement to Your modifications and may
|
||||
provide additional or different license terms and conditions for use, reproduction,
|
||||
or distribution of Your modifications, or for any such Derivative Works as a whole,
|
||||
provided Your use, reproduction, and distribution of the Work otherwise complies
|
||||
with the conditions stated in this License.
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution
|
||||
intentionally submitted for inclusion in the Work by You to the Licensor shall be under
|
||||
the terms and conditions of this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify the terms of any
|
||||
separate license agreement you may have executed with Licensor regarding such Contributions.
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade names, trademarks,
|
||||
service marks, or product names of the Licensor, except as required for reasonable and
|
||||
customary use in describing the origin of the Work and reproducing the content of
|
||||
the NOTICE file.
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing,
|
||||
Licensor provides the Work (and each Contributor provides its Contributions) on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
|
||||
including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT,
|
||||
MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for
|
||||
determining the appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory, whether in tort
|
||||
(including negligence), contract, or otherwise, unless required by applicable law
|
||||
(such as deliberate and grossly negligent acts) or agreed to in writing, shall any
|
||||
Contributor be liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a result of this
|
||||
License or out of the use or inability to use the Work (including but not limited to
|
||||
damages for loss of goodwill, work stoppage, computer failure or malfunction, or any
|
||||
and all other commercial damages or losses), even if such Contributor has been advised
|
||||
of the possibility of such damages.
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing the Work or
|
||||
Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance
|
||||
of support, warranty, indemnity, or other liability obligations and/or rights consistent
|
||||
with this License. However, in accepting such obligations, You may act only on Your
|
||||
own behalf and on Your sole responsibility, not on behalf of any other Contributor,
|
||||
and only if You agree to indemnify, defend, and hold each Contributor harmless for any
|
||||
liability incurred by, or claims asserted against, such Contributor by reason of your
|
||||
accepting any such warranty or additional liability.
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work
|
||||
To apply the Apache License to your work, attach the following boilerplate notice,
|
||||
with the fields enclosed by brackets "[]" replaced with your own identifying
|
||||
information. (Don't include the brackets!) The text should be enclosed in the
|
||||
appropriate comment syntax for the file format. We also recommend that a file or class
|
||||
name and description of purpose be included on the same "printed page" as the
|
||||
copyright notice for easier identification within third-party archives.
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 19yy <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
||||
|
69
Makefile.am
69
Makefile.am
@ -1,76 +1,23 @@
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
AM_DISTCHECK_CONFIGURE_FLAGS = \
|
||||
--without-systemdsystemunitdir \
|
||||
--enable-strict-locations \
|
||||
--enable-tests
|
||||
EXTRA_DIST = bootstrap COPYING design.txt faq-compile.txt faq-general.txt file-loc.txt install.txt prog_std.txt readme.txt
|
||||
|
||||
EXTRA_DIST = \
|
||||
COPYING \
|
||||
README.md \
|
||||
NEWS.md \
|
||||
astyle_config.as \
|
||||
bootstrap \
|
||||
coding_style.md \
|
||||
m4 \
|
||||
vrplayer
|
||||
|
||||
if XRDP_NEUTRINORDP
|
||||
NEUTRINORDPDIR = neutrinordp
|
||||
if XRDP_FREERDP1
|
||||
FREERDPDIR = freerdp1
|
||||
else
|
||||
NEUTRINORDPDIR =
|
||||
FREERDPDIR =
|
||||
endif
|
||||
|
||||
if XRDP_XRDPVR
|
||||
XRDPVRDIR = xrdpvr
|
||||
else
|
||||
XRDPVRDIR =
|
||||
endif
|
||||
|
||||
if XRDP_PAINTER
|
||||
PAINTERDIR = libpainter
|
||||
else
|
||||
PAINTERDIR =
|
||||
endif
|
||||
|
||||
if XRDP_RFXCODEC
|
||||
RFXCODECDIR = librfxcodec
|
||||
else
|
||||
RFXCODECDIR =
|
||||
endif
|
||||
|
||||
if XRDP_ULALACA
|
||||
ULALACADIR = ulalaca
|
||||
else
|
||||
ULALACADIR =
|
||||
endif
|
||||
|
||||
# This should not be dictionary order but build order
|
||||
SUBDIRS = \
|
||||
third_party \
|
||||
third_party/tomlc99 \
|
||||
common \
|
||||
vnc \
|
||||
rdp \
|
||||
xup \
|
||||
mc \
|
||||
$(NEUTRINORDPDIR) \
|
||||
libipm \
|
||||
$(FREERDPDIR) \
|
||||
libxrdp \
|
||||
$(PAINTERDIR) \
|
||||
$(RFXCODECDIR) \
|
||||
sesman \
|
||||
xrdp \
|
||||
fontutils \
|
||||
sesman \
|
||||
keygen \
|
||||
waitforx \
|
||||
docs \
|
||||
instfiles \
|
||||
genkeymap \
|
||||
xrdpapi \
|
||||
pkgconfig \
|
||||
$(XRDPVRDIR) \
|
||||
$(ULALACADIR) \
|
||||
tests \
|
||||
tools
|
||||
|
||||
distclean-local:
|
||||
-rm -f xrdp_configure_options.h
|
||||
xrdpapi
|
||||
|
651
NEWS.md
651
NEWS.md
@ -1,651 +0,0 @@
|
||||
# Release notes for xrdp v0.9.19 (2022/03/17)
|
||||
|
||||
## General announcements
|
||||
* Running xrdp and xrdp-sesman on separate hosts is still supported by this release, but is now deprecated. This is not secure. A future release will replace the TCP socket used between these processes with a Unix Domain Socket, and then cross-host running will not be possible.
|
||||
|
||||
## New features
|
||||
* Both inbound and outbound clipboards can now be restricted for text, files or images [Sponsored by @CyberTrust @clear-code and @kenhys] (#2087)
|
||||
|
||||
## Bug fixes
|
||||
* [CVE-2022-23613](https://www.cve.org/CVERecord?id=CVE-2022-23613): Privilege escalation on xrdp-sesman (This fix is also in the out-of-band v0.9.18.1 release)
|
||||
* The versions of imlib2 used on RHEL 7 and 8 are now detected correctly (#2118)
|
||||
* Some situations where zombie processes could exist have been resolved (#2146, #2151, #2168)
|
||||
* Some null-pointer exceptions which can happen in the logging module have been addressed (#2149)
|
||||
* Some minor logging errors have been corrected (#2152)
|
||||
* The signal handling in sesman has been reworked to prevent race conditions when a child exits. This has also made it possible to reliably reload the sesman configuration with SIGHUP (#1729, #2168)
|
||||
|
||||
## Internal changes
|
||||
* Versions 0.13 and later of checklib can undefine the pre-processor symbol `HAVE_STDINT_H`. The xrdp tests now build successfully against these versions (#2124)
|
||||
* OpenSSL packaging changes (#2130):-
|
||||
- The OpenSSL 3 EVP interface is now fully supported
|
||||
- When building against OpenSSL 3, an internal implementation of the RC4 cipher is used instead of the implementation from the OpenSSL legacy provider
|
||||
- The wrapping of the OpenSSL library has been improved which should make it simpler to provide an alternative cryptographic provider in the future, if required
|
||||
- The logging of TLS/non-TLS security negotiation has been improved
|
||||
* cppcheck version used for CI bumped to 2.7 (#2140)
|
||||
* The `s_check()` macro which is easily mis-used has been removed (#2144)
|
||||
* Status values for the DRDYNVC channel are now available in `libxrdp/xrdp_channel.h`
|
||||
|
||||
## Changes for packagers or developers
|
||||
* On OpenSSL 3 systems, there is now no need to build with the `-Wno-error=deprecated-declarations` flag
|
||||
|
||||
## Known issues
|
||||
|
||||
* On-the-fly resolution change requires the Microsoft Store version of Remote Desktop client but sometimes crashes on connect (#1869)
|
||||
* xrdp's login dialog is not relocated at the center of the new resolution after on-the-fly resolution change happens (#1867)
|
||||
|
||||
-----------------------
|
||||
|
||||
# Release notes for xrdp v0.9.18.1 (2022/02/08)
|
||||
|
||||
This is a security fix release that includes fixes for the following privilege escalation vulnerability.
|
||||
|
||||
* [CVE-2022-23613: Privilege escalation on xrdp-sesman](https://www.cve.org/CVERecord?id=CVE-2022-23613)
|
||||
|
||||
Users who uses xrdp v0.9.17 or v0.9.18 are recommended to update to this version.
|
||||
|
||||
## Special thanks
|
||||
|
||||
Thanks to [Gilad Kleinman](https://github.com/giladkl) reporting the vulnerability and reviewing fix.
|
||||
|
||||
-----------------------
|
||||
|
||||
# Release notes for xrdp v0.9.18 (2022/01/10)
|
||||
|
||||
## General announcements
|
||||
* Running xrdp and xrdp-sesman on separate hosts is still supported by this release, but is now deprecated. This is not secure. A future release will replace the TCP socket used between these processes with a Unix Domain Socket, and then cross-host running will not be possible.
|
||||
* Special thanks for @trishume for contributing code to the RFX codec
|
||||
|
||||
## New features
|
||||
* Backgrounds and logos on the login screen can now be zoomed and scaled (#1962)
|
||||
* Small change for Alpine Linux support (#2005)
|
||||
* loongarch support (#2057)
|
||||
* Improved Fail2ban support (#1976)
|
||||
|
||||
## Bug fixes
|
||||
* Logging is improved for security protocol level decisions (#1974, #1975)
|
||||
* An unnecessary log error message which is always generated when running neutrinordp has been removed (#2016)
|
||||
* An incorrect development log message has been fixed (#2074)
|
||||
* Some informational and error messages written to the console on stdout have been removed or replaced with log messages (#2078 #2080)
|
||||
* Failure to attach to the memory area shared with xorgxrdp is now logged (#2065)
|
||||
* A regression in the VNC module logging which might cause a connection to drop out has been identified and fixed (#1989)
|
||||
* Remote drive redirection now works if printer redirection is also requested by the client (#327)
|
||||
* Some file names could not be copied from the client to the server over the clipboard. This is now fixed (#1992, #1995)
|
||||
* A config value has been added which allows copy-pasting of files to work with Nautilus for GNOME 3 versions >= 3.29.92 (#1994, #1996)
|
||||
* Clipboard now works properly when files can't be read (#1997 #2001)
|
||||
* (xorgxrdp v0.2.18) The screen is fully refreshed after initialising shared memory which should fix black screen problems like #1964
|
||||
* An incorrect initialisation reported by @qarmin has been fixed (#1909)
|
||||
* Some minor memory leaks have been fixed (#2014 #2028)
|
||||
* A hard hang in chansrv when copying files from the remote system has been addressed (#2032)
|
||||
* Users can now capitalise username and password on the login screen if required (#2061)
|
||||
* Some failed size checks in the fastpath code with `--enable-devel-streamcheck` have been addressed (#2066,#2070)
|
||||
* Log level for clipboard restriction has been promoted from DEVEL DEBUG to INFO (#2088)
|
||||
* A buffer overflow in the RFX codec associated with large screens has been fixed (#2087)
|
||||
|
||||
## Internal changes
|
||||
* Some 64-bit packages are removed during the 32-bit CI build process in an attempt to make this more robust (#1985)
|
||||
* Minor improvements to error checking and logging for file copy-paste (#1996)
|
||||
* Now uses cppcheck 2.6 for CI builds (#2008)
|
||||
* Generated systemd unit files now ignored by git (#2006)
|
||||
* More internal tests (#2015)
|
||||
* Some unnecessary files have been removed from the distribution (#2030)
|
||||
* The `which` command in shell scripts has been replaced with `command -v` (#2067)
|
||||
* Additional unit tests added for `g_file_get_size()` (#1988)
|
||||
* A compiler warning with -O3 on gcc 11.1 has been addressed (#2105)
|
||||
* An unused declaration for xrdp_wm_drdynvc_up has been removed (#2098)
|
||||
* The SCP V0 code has been unified, which will make it easier to update and replace (#2011)
|
||||
* Monitor processing unit tests for existing xrdp_sec function have been added (#1932)
|
||||
* The librfxcodec has been updated as part of #2087, and also to add stack frames to assemble code to assist debugging
|
||||
|
||||
## Changes for packagers or developers
|
||||
* The `--with-imlib2` option has been added. If xrdp is built with imlib2, the login screen supports more image formats for the background and logo, and better quality zooming and scaling (#1962)
|
||||
|
||||
## Known issues
|
||||
|
||||
* On-the-fly resolution change requires the Microsoft Store version of Remote Desktop client but sometimes crashes on connect (#1869)
|
||||
* xrdp's login dialog is not relocated at the center of the new resolution after on-the-fly resolution change happens (#1867)
|
||||
|
||||
-----------------------
|
||||
|
||||
# Release notes for xrdp v0.9.17 (2021/08/31)
|
||||
|
||||
## General announcements
|
||||
* Running xrdp and xrdp-sesman on separate hosts is still supported by this release, but is now deprecated. This is not secure. A future release will replace the TCP socket used between these processes with a Unix Domain Socket, and then cross-host running will not be possible.
|
||||
|
||||
## New features
|
||||
* The IP address, port, and user name of NeutrinoRDP Proxy connection are logged in xrdp.log - these connections may not have a sesman log to use (#1873)
|
||||
* The performance settings for NeutrinoRDP can be now configured (#1903)
|
||||
* Support for Alpine Linux in startwm.sh (#1965)
|
||||
* clipboard: log file transfer for the purpose of audit (#1954)
|
||||
* Client's Keyboard layout now can be overridden by xrdp configuration for debugging purposes (#1952)
|
||||
|
||||
## Bug fixes
|
||||
* PAM_USER environment variable is not set when using pam_exec module (#1882)
|
||||
* Allow common channel settings to be overridden for modules as well as chansrv (#1899)
|
||||
* The text only-copy/paste interface for the VNC module (used only when chansrv is not active) has been improved (#1900)
|
||||
* The unsupported `tcutils` utility has been removed (#1943)
|
||||
* The quality of TLS logging has been improved (#1926)
|
||||
* Keyboard information is now passed correctly through NeuutrinoRDP, and can be overridden if required (#1934)
|
||||
* A message is now logged in the sesman log for unsuccessful login attempts detailing the user used (#1947)
|
||||
|
||||
|
||||
## Internal changes
|
||||
* astyle formatting is now checked during CI builds (#1879)
|
||||
* Generalise development build options, and add --enable-devel-streamcheck (#1887)
|
||||
* Now uses cppcheck 2.5 for CI builds (#1938)
|
||||
* The SCP protocol is now using a standard `struct trans` for messaging rather than its own thing (#1925)
|
||||
|
||||
## Changes for packagers or developers
|
||||
* The `--enable-xrdpdebug` developer option has been replaced with finer-grained `--enable-devel-*` options. Consequently, specifying `--enable-xrdpdebug` is now an error (#1913)
|
||||
|
||||
## Known issues
|
||||
|
||||
* On-the-fly resolution change requires the Microsoft Store version of Remote Desktop client but sometimes crashes on connect (#1869)
|
||||
* xrdp's login dialog is not relocated at the center of the new resolution after on-the-fly resolution change happens (#1867)
|
||||
|
||||
-----------------------
|
||||
|
||||
# Release notes for xrdp v0.9.16 (2021/04/30)
|
||||
|
||||
## New features
|
||||
* On-the-fly resolution change now supported for Xvnc and Xorg (#448, #1820) - thanks to @Nexarian for this significant first contribution. See the following YouTube video for a demo.
|
||||
* [Windows] https://youtu.be/cZ0ebieZHeA
|
||||
* [Mac] https://youtu.be/6kfAkyLUgFY
|
||||
* xrdp can now use key algorithms other than RSA for TLS (#1776)
|
||||
* Do not spit on the console 2nd stage (inspired by Debian) #1762
|
||||
* Unified and improved logging (#1742, #1767, #1802, #1806, #1807, #1826, #1843) - thanks to @aquesnel for this detailed work.
|
||||
* Other logging level fixes (#1864)
|
||||
* chansrv can now work on `DISPLAY=:0` so it can be used with x11vnc/Vino/etc sessions (#1849)
|
||||
|
||||
## Bug fixes
|
||||
* Fix some regressions in sesman auth modules (#1769)
|
||||
* Minor manpage fixes (#1787)
|
||||
* Fix TS_PLAY_SOUND_PDU_DATA to set the correct frequency and duration (#1793)
|
||||
* Fix password leakage to logs in NeutrinoRDP module (#1872) - thanks to @TOMATO-ONE for reporting.
|
||||
|
||||
## Internal changes
|
||||
* cppcheck version for CI bumped to 2.4 (#1771, #1836)
|
||||
* FreeBSD version for CI bumped to 12-2 (#1804)
|
||||
* Support for check unit test framework added (#1843, #1860)
|
||||
* FreeBSD FUSE module now compiles under CI but needs additional work (#1856)
|
||||
* Compilation support added for additional Debian platforms (#1818)
|
||||
* Refactoring:-
|
||||
* Confusing preprocessor macro USE_NOPAM replaced with USE_PAM (#1800)
|
||||
* Window manager states in xrdp executable now use symbolic constants instead of numbers (#1803)
|
||||
* Documentation improvements
|
||||
* KRDC added to client list (#1817)
|
||||
* Platform support tier added (#1822)
|
||||
* README file revised (#1863)
|
||||
* Don't install test+development executables by default (#1858)
|
||||
|
||||
## Changes for packagers
|
||||
These changes are likely to impact operating system package builders and those building xrdp from source.
|
||||
* (#1843, #1860) This release introduces an additional optional compile-time dependency on the `check` unit test framework. The dependency is recommended when packaging for compile-time tests.
|
||||
* (#1858) The executables `memtest` and `tcp_proxy` are no longer copied to the sbin directory on a package install.
|
||||
|
||||
## Known issues
|
||||
|
||||
* On-the-fly resolution change requires the Microsoft Store version of Remote Desktop client but sometimes crashes on connect (#1869)
|
||||
* xrdp's login dialog is not relocated at the center of the new resolution after on-the-fly resolution change happens (#1867)
|
||||
|
||||
-----------------------
|
||||
|
||||
# Release notes for xrdp v0.9.15 (2020/12/28)
|
||||
|
||||
## New features
|
||||
* Allow token sign in without autologon for SSO (#1667 #1668)
|
||||
* Norwegian keyboard support (#1675)
|
||||
* Improved config support for chansrv (#1635)
|
||||
* Unified chansrv, sesman and libxrdp logging (#1633 #1708 #1738) - thanks to @aquesnel
|
||||
* Support SUSE move to /usr/etc (#1702)
|
||||
* Parameters may now be specified for user-specified shell (#1270 #1695)
|
||||
* xrdp executables now allow alternative config files to be specified with -c (#1588 #1650 #1651)
|
||||
* sesrun improvements (#1741)
|
||||
* Drive redirection location can now be specified (#1048)
|
||||
* Now compiles on RISC-V (#1761)
|
||||
|
||||
## Bug fixes
|
||||
* Additional buffer overflow checks (#1662)
|
||||
* FUSE support now builds on 32-bit platforms (#1682)
|
||||
* genkeymap array size conflict fixed (#1691)
|
||||
* Buffering issue with neutrinordp over a slow link fixed (#1608 1634)
|
||||
* Various documentation fixes (#1704 #1741 #1755 #1759)
|
||||
* Prevent PAM info message from causing authentication failure (#1727)
|
||||
* Cosmetic fixes for minor issues (#1751 #1755 #1749)
|
||||
* Try harder to clean up socket files on session exit (#1740 #1756)
|
||||
* xrdp-chansrv become defunct in docker while file copy (#1658)
|
||||
|
||||
## Internal changes
|
||||
* Compilation warnings with newer compilers (#1659 #1680)
|
||||
* Continuation Integration checks on 32-bit platforms now include FUSE support (#1682)
|
||||
* Continuation Integration builds now default to the Ubuntu Focal platform (#1666)
|
||||
* FUSE type tidy-ups (#1686)
|
||||
* Switch from Travis CI to GitHub Actions (#1728 #1732)
|
||||
* Easier to set up console logging for utilities (#1711)
|
||||
|
||||
-----------------------
|
||||
|
||||
# Release notes for xrdp v0.9.14 (2020/08/31)
|
||||
|
||||
## New features
|
||||
* VNC multi-monitor support if you are using a suitable Xvnc server #1343
|
||||
* VNC sessions now resize by default on reconnection if you are using a suitable Xvnc server #1343
|
||||
* Support Slackware for PAM #1558 #1560
|
||||
* Support Programmer Dvorak Keyboard #1663
|
||||
|
||||
**[HEADS UP]** The VNC changes are significant. They described in more detail on the following wiki page.
|
||||
* [Xvnc backend : Multi monitor and resize support](https://github.com/neutrinolabs/xrdp/wiki/Xvnc-backend-:-Multi-monitor-and-resize-support)
|
||||
|
||||
## Bug fixes
|
||||
* Fix odd shift key behavior (workaround) #397 #1522
|
||||
* Fix Xorg path in the document for Arch Linux #1448 #1529
|
||||
* Fix Xorg path in the document for CentOS 8 #1646 #1647
|
||||
* Fix internal username/password buffer is smaller than RDP protocol specification #1648 #1653
|
||||
* Fix possible memory out-of-bounds accesses #1549
|
||||
* Fix memory allocation overflow #1557
|
||||
* Prevent chansrv input channels being scanned during a server reset #1595
|
||||
* Ignore TS_MULTIFRAGMENTUPDATE_CAPABILITYSET from client if fp disabled #1593
|
||||
* Minor manpage fixes #1611
|
||||
|
||||
## Other changes
|
||||
* CI error fixes
|
||||
* Introduce cppcheck
|
||||
|
||||
## Known issues
|
||||
* FreeRDP 2.0.0-rc4 or later might not able to connect to xrdp due to
|
||||
xrdp's bad-mannered behaviour, add `+glyph-cache` option to FreeRDP to connect #1266
|
||||
* Audio redirection by MP3 codec doesn't sound with some client, use AAC instead #965
|
||||
|
||||
# Release notes for xrdp v0.9.13.1 (2020/06/30)
|
||||
|
||||
This is a security fix release that includes fixes for the following local buffer overflow vulnerability.
|
||||
|
||||
* [CVE-2020-4044: Local users can perform a buffer overflow attack against the xrdp-sesman service and then impersonate it](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-4044)
|
||||
|
||||
This update is recommended for all xrdp users.
|
||||
|
||||
## Special thanks
|
||||
|
||||
Thanks to [Ashley Newson](https://github.com/ashleynewson) reporting the vulnerability and reviewing fix.
|
||||
|
||||
-----------------------
|
||||
|
||||
# Release notes for xrdp v0.9.13 (2020/03/11)
|
||||
|
||||
This release is an intermediate bugfix release. The previous version v0.9.12 has some regressions on drive redirection.
|
||||
|
||||
## Bug fixes (drive redirection related)
|
||||
* Fix chansrv crashes with segmentation fault (regression in #1449) #1487
|
||||
* Drive redirection now supports Guacamole client #1505 #1507
|
||||
* Prevent a coredump in the event of a corrupted file system #1507
|
||||
* Resolve double-free in `chansrv_fuse` #1469
|
||||
|
||||
## Bug fixes (other)
|
||||
* Fix the issue `xrdp --version | less` will show empty output #1471 #1472
|
||||
* Fix some warnings found by cppcheck #1479 #1481 #1484 #1485
|
||||
|
||||
## Other changes
|
||||
* Add FreeBSD CI test #1466
|
||||
* Move Microsoft-defined constants into separate includes #1470
|
||||
* Perform cppcheck during CI test #1493
|
||||
* Support mousex button 8/9 #1478
|
||||
|
||||
## Known issues
|
||||
* FreeRDP 2.0.0-rc4 or later might not able to connect to xrdp due to
|
||||
xrdp's bad-mannered behaviour, add `+glyph-cache` option to FreeRDP to connect #1266
|
||||
* Audio redirection by MP3 codec doesn't sound with some client, use AAC instead #965
|
||||
|
||||
-----------------------
|
||||
|
||||
# Release notes for xrdp v0.9.12 (2019/12/28)
|
||||
|
||||
## Bug fixes
|
||||
* Fix "The log reference is NULL" error when sesman startup #1425
|
||||
* Fix behavior when shmem_id changes #1439
|
||||
* Make vsock config accept -1 for cid and port #1441
|
||||
* Cleanup refresh rect and check stream bounds #1437
|
||||
* Significant improvements in drive redirection #1449
|
||||
* Fix build on macOS Catalina #1462
|
||||
|
||||
## Other changes
|
||||
* Proprietary microphone redirection via rdpsnd is now default off
|
||||
RDP compatible microphone redirection is on instead #1427
|
||||
* Skip connecting to chansrv when no channels enabled #1393
|
||||
* Add openSUSE's pam rules #1442
|
||||
* Do not terminate xrdp daemon when caught SIGHUP #1319
|
||||
|
||||
## Known issues
|
||||
* FreeRDP 2.0.0-rc4 or later might not able to connect to xrdp due to
|
||||
xrdp's bad-mannered behaviour, add `+glyph-cache` option to FreeRDP to connect #1266
|
||||
* Audio redirection by MP3 codec doesn't sound with some client, use AAC instead #965
|
||||
|
||||
# Release notes for xrdp v0.9.11 (2019/08/19)
|
||||
|
||||
## New features
|
||||
* Suppress output (do not draw screen when client window is minimized) #1330
|
||||
* Audio input (microphone) redirection compatible with [MS-RDPEAI](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpeai/d04ffa42-5a0f-4f80-abb1-cc26f71c9452) #1369
|
||||
* Now xrdp can listen on more than one port #1124 #1366
|
||||
|
||||
## Bug fixes
|
||||
* Fix the issue audio redirection sometimes sounds with long delay #1363
|
||||
* Check term event for more responsive shutdown #1372
|
||||
|
||||
## Known issues
|
||||
* FreeRDP 2.0.0-rc4 or later might not able to connect to xrdp due to
|
||||
xrdp's bad-mannered behaviour, add `+glyph-cache` option to FreeRDP to connect #1266
|
||||
* Audio redirection by MP3 codec doesn't sound with some client, use AAC instead #965
|
||||
|
||||
-----------------------
|
||||
|
||||
# Release notes for xrdp v0.9.11 (2019/08/19)
|
||||
|
||||
## New features
|
||||
* Suppress output (do not draw screen when client window is minimized) #1330
|
||||
* Audio input (microphone) redirection compatible with [MS-RDPEAI](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpeai/d04ffa42-5a0f-4f80-abb1-cc26f71c9452) #1369
|
||||
* Now xrdp can listen on more than one port #1124 #1366
|
||||
|
||||
## Bug fixes
|
||||
* Fix the issue audio redirection sometimes sounds with long delay #1363
|
||||
* Check term event for more responsive shutdown #1372
|
||||
|
||||
## Known issues
|
||||
* FreeRDP 2.0.0-rc4 or later might not able to connect to xrdp due to
|
||||
xrdp's bad-mannered behaviour, add `+glyph-cache` option to FreeRDP to connect #1266
|
||||
* Audio redirection by MP3 codec doesn't sound with some client, use AAC instead #965
|
||||
|
||||
-----------------------
|
||||
|
||||
# Release notes for xrdp v0.9.10 (2019/04/18)
|
||||
|
||||
## Special thanks
|
||||
Thank you for matt335672 contributing to lots of improvements in drive redirection!
|
||||
|
||||
## New features
|
||||
* Restrict outbound (server->client) clipboard transfer, configured in `sesman.ini` #1298
|
||||
|
||||
## Bug fixes
|
||||
* Fix the issue libscp v1 not setting width but height twice #1293
|
||||
* Fix the issue reconnecting to session causes duplicate drive entries in fuse fs #1299
|
||||
* Fix default_wm and reconnect_sh refer wrong path after sesman caught SIGUP #1315 #1331
|
||||
* Shutdown xrdp more responsively #1325
|
||||
* Improve remote file lookup in drive redirection #996 #1327
|
||||
* Overwriting & appending to existing files is are now supported #1327
|
||||
|
||||
## Other changes
|
||||
* Add Danish Keyboard #1290
|
||||
* Put xrdp- prefix to some executables appear in man page #1313
|
||||
* Replace some URLs from SF.net to xrdp.org #1313
|
||||
|
||||
## Known issues
|
||||
* FreeRDP 2.0.0-rc4 or later might not able to connect to xrdp due to
|
||||
xrdp's bad-mannered behaviour, add `+glyph-cache` option to FreeRDP to connect #1266
|
||||
* Audio redirection by MP3 codec doesn't sound with some client, use AAC instead #965
|
||||
|
||||
-----------------------
|
||||
|
||||
# Release notes for xrdp v0.9.9 (2018/12/25)
|
||||
|
||||
## Release cycle
|
||||
From the next release, release cycle will be changed from quarterly to every
|
||||
4 months. xrdp will be released in April, August, December.
|
||||
|
||||
## New features
|
||||
* Disconnection by idle timeout (requires xorgxrdp v0.2.9 or later) #1227
|
||||
* Glyph cache v2 (fixes no font issue on iOS/macOS/Android client) #367 #1235
|
||||
|
||||
## Bug fixes
|
||||
* Fix xrdp-chansrv crashes caused in drive redirection #1202 #1225
|
||||
* Fix build with FDK AAC v2 #1257
|
||||
* Do not enable RemoteApp if the INFO_RAIL flag is not set (RDP-RDP proxy) #1253
|
||||
|
||||
## Other changes
|
||||
* Add Spanish Latin Amarican keyboard #1237 #1240 #1244
|
||||
* Dynamic channel improvements #1222 #1224
|
||||
* Remove some deprecated sesman session types #1232
|
||||
* Refactoring and cleanups
|
||||
|
||||
## Known issues
|
||||
* FreeRDP 2.0.0-rc4 or later might not able to connect to xrdp due to
|
||||
xrdp's bad-mannered behaviour, add `+glyph-cache` option to FreeRDP to connect #1266
|
||||
* Audio redirection by MP3 codec doesn't sound with some client, use AAC instead #965
|
||||
|
||||
-----------------------
|
||||
|
||||
# Release notes for xrdp v0.9.8 (2018/09/25)
|
||||
|
||||
## Deprecation notice
|
||||
We removed TLSv1 and TLSv1.1 from the default config. The current default is TLSv1.2
|
||||
and TLSv1.3. Users can whenever re-enable these early TLS versions by editing xrdp.
|
||||
To use TLSv1.3, OpenSSL or LibreSSL must support TLSv1.3. You can know the OpenSSL
|
||||
or LibreSSL version by `xrdp --version` command that compiled with xrdp.
|
||||
|
||||
## Other topics
|
||||
|
||||
Pulseaudio modules has been removed from xrdp source tree since it is actually
|
||||
independent and not part of xrdp. The repository has been moved to:
|
||||
https://github.com/neutrinolabs/pulseaudio-module-xrdp
|
||||
|
||||
If you want to use audio redirection, make sure install the module separately.
|
||||
|
||||
## New features
|
||||
* Add TLSv1.3 support #1193
|
||||
|
||||
## Bug fixes
|
||||
* Ensure unmount redirected drive on fatal X error #1140
|
||||
|
||||
## Other changes
|
||||
* Show more helpful message if xrdp-dis failed #1206
|
||||
* Pass pulse socket name via environment variable #1198
|
||||
* Fix xrdp's log path in man page #1168
|
||||
|
||||
# Release notes for xrdp v0.9.7 (2018/06/29)
|
||||
|
||||
## Deprecation notice
|
||||
x11rdp has been removed from xrdp reposiory and stored in the separate repository.
|
||||
Checkout [x11rdp repository](https://github.com/neutrionlabs/x11rdp) if you still need x11rdp.
|
||||
In most cases, [xorgxrdp](https://github.com/neutrinolabs/xorgxrdp) can replace x11rdp.
|
||||
|
||||
## Bug fixes
|
||||
* Fix endianness detection on ppc64el #1082
|
||||
* Fix a bug xrdp file copy slow #1112 #1132
|
||||
* Copy the PAM session environment for the reconnect script #1120
|
||||
* Accept fullpath for DefaultWindowManager, ReconnectScript #1147
|
||||
|
||||
## Other changes
|
||||
* Add PAM support for Arch Linux #1078
|
||||
* Show OpenSSL version to '--version' CLI option #1096
|
||||
* Separate x11rdp from xrdp repository #1104
|
||||
* Support sesrun start xorgxrdp sessions #1108
|
||||
* Show configure summary when configure is done #1126 #1134 #1137
|
||||
* Less spit on the console when sesman starts #1142
|
||||
* Fix memory leaks #1146
|
||||
* Separate rc script for FreeBSD into xrdp and xrdp-sesman #1153
|
||||
* Improve documents and helps
|
||||
|
||||
## Known issues
|
||||
* Audio redirection by MP3 codec doesn't sound with some client, use AAC instead #965
|
||||
|
||||
-----------------------
|
||||
|
||||
# Release notes for xrdp v0.9.6 (2018/03/26)
|
||||
|
||||
## Compatibility notice
|
||||
Exclamation mark (`!`) has been removed from comment out symbol of config files.
|
||||
Use number sign (`#`) or semicolon (`;`) instead. As a result of this change, now
|
||||
you can use exclamation mark as config value such as in `tls_ciphers`.
|
||||
|
||||
```
|
||||
tls_ciphers=HIGH:!aNULL:!eNULL:!EXPORT:!RC4
|
||||
```
|
||||
|
||||
See also: #1033
|
||||
|
||||
## macOS supports
|
||||
Please note that xrdp still doesn't support macOS officially so far.
|
||||
However, a volunteer is working on macOS compatibility.
|
||||
|
||||
* Generate dylibs for macOS #1015
|
||||
* Add PAM support for macOS #1021
|
||||
|
||||
## Bug fixes
|
||||
* Make listen check before daemon fork #988
|
||||
* Fix xrdp sometimes become zombie processes #1000
|
||||
* Include hostname in sesman password file name #1006 #1007 #1076
|
||||
* Fix default startwm.sh to use bash explicitly #1009 #1049
|
||||
* Fix the issue FreeBSD doesn't acknowledge terminated sessions #1016 #1030
|
||||
|
||||
## Other changes
|
||||
* Add Swiss French keyboard #1053
|
||||
* Improve perfect forward secrecy, explicitly enable ECDHE/DHE #1024 #1052 #1063
|
||||
* Lots of leak fixes, cleanups and refactoring
|
||||
|
||||
## Known issues
|
||||
* Audio redirection by MP3 codec doesn't sound with some client, use AAC instead #965
|
||||
|
||||
-----------------------
|
||||
|
||||
# Release notes for xrdp v0.9.5 (2017/12/27)
|
||||
|
||||
## Security fixes
|
||||
* Fix local denial of service [CVE-2017-16927](http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-16927) #958 #979
|
||||
|
||||
## New features
|
||||
* Add a new log level TRACE more verbose than DEBUG #835 #944
|
||||
* SSH agent forwarding via RDP #867 #868 FreeRDP/FreeRDP#4122
|
||||
* Support horizontal wheel properly #928
|
||||
|
||||
## Bug fixes
|
||||
|
||||
* Avoid use of hard-coded sesman port #895
|
||||
* Workaround for corrupted display with Windows Server 2008 using NeutrinoRDP #869
|
||||
* Fix glitch in audio redirection by AAC #910 #936
|
||||
* Implement vsock support #930 #935 #948
|
||||
* Avoid 100% CPU usage on SSL accept #956
|
||||
|
||||
## Other changes
|
||||
* Add US Dvorak keyboard #929
|
||||
* Suppress some misleading logs #964
|
||||
* Add Finnish keyboard #972
|
||||
* Add more user-friendlier description about Xorg config #974
|
||||
* Renew pulseaudio document #984 #985
|
||||
* Lots of cleanups and refactoring
|
||||
|
||||
## Known issues
|
||||
* Audio redirection by MP3 codec doesn't sound with some client, use AAC instead #965
|
||||
|
||||
-----------------------
|
||||
|
||||
# Release notes for xrdp v0.9.4 (2017/09/28)
|
||||
|
||||
## New features
|
||||
* Accept prefill credentials in base64 form #153 #811
|
||||
* Indroduce AAC encoder to audio redirection (requires Windows 10 client)
|
||||
|
||||
## Bugfixes
|
||||
* Fix ocasional SEGV in drive redirection #838
|
||||
* Fix client's IP addresses in xrdp-sesman.log are always logged as `0.0.0.0` #878 #882
|
||||
* Fix `ls_background_image` didn't accept full path #776 #853
|
||||
* Fix misuse of hidelogwindow #414 #876
|
||||
* Fix WTSVirtualChannelWrite return code #859
|
||||
* Fix no longer needed socket files remained in the socket dir #812 #831
|
||||
* Make creating socket path a bit more robust #823
|
||||
|
||||
## Other changes
|
||||
* Add Belgian keyboard #858
|
||||
* Add a PAM file for FreeBSD #824
|
||||
* Several refactorings and cosmetic changes
|
||||
|
||||
## Known issues
|
||||
* Windows 10 (1703) shows black blank screen in RemoteFX mode
|
||||
* This issue is already fixed at Insider Preview build 16273
|
||||
|
||||
-----------------------
|
||||
|
||||
# Release notes for xrdp v0.9.3.1 (2017/08/16)
|
||||
|
||||
This release fixes a trivial packaging issue #848 occurred in v0.9.3. The issue only affects systemd systems. This release is principally for distro packagers or users who compile & install xrdp from source.
|
||||
|
||||
Users who running xrdp on these systems don't need to upgrade from v0.9.3 to v0.9.3.1.
|
||||
|
||||
* Linux systems without systemd
|
||||
* non-Linux systems such as BSD operating systems
|
||||
|
||||
-----------------------
|
||||
|
||||
# Release notes for xrdp v0.9.3 (2017/07/15)
|
||||
|
||||
## New features
|
||||
* Log user-friendly messages when certificate/privkey is inaccessible
|
||||
|
||||
## Bugfixes
|
||||
* Now sesman sets mandatory LOGNAME environment variable #725
|
||||
* Now sesman ensures socket directory present #801
|
||||
* Exit with failure status if port already in use #644
|
||||
* Eliminate some hard coded paths
|
||||
* Fix glitches with IPv4 struct initialization #803
|
||||
* Fix some keyboard layout integration (UK, Spanish)
|
||||
* Fix handle OS when IPv6 disabled #714
|
||||
* Fix issues around systemd session #778
|
||||
* Fix protocol error when 32 bit color and non RemoteFX session #737 #804
|
||||
* Fix sesadmin shows error when no sessions #797
|
||||
* Fix TLS spins 100% CPU #728
|
||||
* Fix Xvnc backend disconnects when some data copied to clipboard #755
|
||||
* Pick up the first section if given section(domain) doesn't match anything #750
|
||||
|
||||
## Other changes
|
||||
* Change xrdp-chansrv log path to include display number
|
||||
* Optimize startwm.sh for SUSE
|
||||
* Several cleanups and optimizations
|
||||
|
||||
## Known issues
|
||||
* Windows 10 (1703) shows black blank screen in RemoteFX mode
|
||||
|
||||
-----------------------
|
||||
|
||||
# Release notes for xrdp v0.9.2 (2017/03/30)
|
||||
## New features
|
||||
* RemoteFX codec support is now enabled by default.
|
||||
* Bitmap updates support is now enabled by default.
|
||||
* TLS ciphers suites and version is now logged.
|
||||
* Connected computer name is now logged.
|
||||
* Switched to Xorg (xorgxrdp) as the default backend now.
|
||||
* Miscellaneous RemoteFX codec mode improvements.
|
||||
* Socket directory is configurable at the compile time.
|
||||
|
||||
## Bugfixes
|
||||
* Parallels client for MacOS / iOS can now connect (audio redirection must be disabled on client or xrdp server though).
|
||||
* MS RDP client for iOS can now connect using TLS security layer.
|
||||
* MS RDP client for Android can now connect to xrdp.
|
||||
* Large resolutions (4K) can be used with RemoteFX graphics.
|
||||
* Multiple RemoteApps can be opened throguh NeutrinoRDP proxy.
|
||||
* tls_ciphers in xrdp.ini is not limited to 63 chars anymore, it's variable-length.
|
||||
* Fixed an issue where tls_ciphers were ignored and rdp security layer could be used instead.
|
||||
* Kill disconnected sessions feature is working with Xorg (xorgxrdp) backend.
|
||||
* Miscellaneous code cleanup and memory issues fixes.
|
||||
|
||||
-----------------------
|
||||
|
||||
# Release notes for xrdp v0.9.1 (2016/12/21)
|
||||
## New features
|
||||
* New xorgxrdp backend using existing Xorg with additional modules
|
||||
* Improvements to X11rdp backend
|
||||
* Support for IPv6 (disabled by default)
|
||||
* Initial support for RemoteFX Codec (disabled by default)
|
||||
* Support for TLS security layer (preferred over RDP layer if supported by the client)
|
||||
* Support for disabling deprecated SSLv3 protocol and for selecting custom cipher suites in xrdp.ini
|
||||
* Support for bidirectional fastpath (enabled in both directions by default)
|
||||
* Support clients that don't support drawing orders, such as MS RDP client for Android, ChromeRDP (disabled by default)
|
||||
* More configurable login screen
|
||||
* Support for new virtual channels:
|
||||
* rdpdr: device redirection
|
||||
* rdpsnd: audio output
|
||||
* cliprdr: clipboard
|
||||
* xrdpvr: xrdp video redirection channel (can be used along with NeutrinoRDP client)
|
||||
* Support for disabling virtual channels globally or by session type
|
||||
* Allow to specify the path for backends (Xorg, X11rdp, Xvnc)
|
||||
* Added files for systemd support
|
||||
* Multi-monitor support
|
||||
* xrdp-chansrv stroes logs in `${XDG_DATA_HOME}/xrdp` now
|
||||
|
||||
## Security fixes
|
||||
* User's password could be recovered from the Xvnc password file
|
||||
* X11 authentication was not used
|
151
README.md
151
README.md
@ -1,151 +0,0 @@
|
||||
[![Build Status](https://github.com/neutrinolabs/xrdp/actions/workflows/build.yml/badge.svg)](https://github.com/neutrinolabs/xrdp/actions)
|
||||
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/neutrinolabs/xrdp-questions)
|
||||
![Apache-License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)
|
||||
|
||||
[![Latest Version](https://img.shields.io/github/v/release/neutrinolabs/xrdp.svg?label=Latest%20Version)](https://github.com/neutrinolabs/xrdp/releases)
|
||||
|
||||
# xrdp - an open source RDP server
|
||||
|
||||
## Overview
|
||||
|
||||
**xrdp** provides a graphical login to remote machines using Microsoft
|
||||
Remote Desktop Protocol (RDP). xrdp accepts connections from a variety of RDP clients:
|
||||
* FreeRDP
|
||||
* rdesktop
|
||||
* KRDC
|
||||
* NeutrinoRDP
|
||||
* Windows MSTSC (Microsoft Terminal Services Client, aka `mstsc.exe`)
|
||||
* Microsoft Remote Desktop (found on Microsoft Store, which is distinct from MSTSC)
|
||||
|
||||
Many of these work on some or all of Windows, Mac OS, iOS, and/or Android.
|
||||
|
||||
RDP transport is encrypted using TLS by default.
|
||||
|
||||
![demo](https://github.com/neutrinolabs/xrdp/raw/gh-pages/xrdp_demo.gif)
|
||||
|
||||
## Features
|
||||
|
||||
### Remote Desktop Access
|
||||
|
||||
* Connect to a Linux desktop using RDP from anywhere (requires
|
||||
[xorgxrdp](https://github.com/neutrinolabs/xorgxrdp) Xorg module)
|
||||
* Reconnect to an existing session
|
||||
* Session resizing (both on-connect and on-the-fly)
|
||||
* RDP/VNC proxy (connect to another RDP/VNC server via xrdp)
|
||||
|
||||
### Access to Remote Resources
|
||||
* Two-way clipboard transfer (text, bitmap, file)
|
||||
* Audio redirection ([requires to build additional modules](https://github.com/neutrinolabs/xrdp/wiki/How-to-set-up-audio-redirection))
|
||||
* Microphone redirection ([requires to build additional modules](https://github.com/neutrinolabs/xrdp/wiki/How-to-set-up-audio-redirection))
|
||||
* Drive redirection (mount local client drives on remote machine)
|
||||
|
||||
## Supported Platforms
|
||||
|
||||
**xrdp** primarily targets GNU/Linux operating system. x86 (including x86-64)
|
||||
and ARM processors are most mature architecture to run xrdp on.
|
||||
See also [Platform Support Tier](https://github.com/neutrinolabs/xrdp/wiki/Platform-Support-Tier).
|
||||
|
||||
Some components such as xorgxrdp and RemoteFX codec have special optimization
|
||||
for x86 using SIMD instructions. So running xrdp on x86 processors will get
|
||||
fully accelerated experience.
|
||||
|
||||
## Quick Start
|
||||
|
||||
Most Linux distributions should distribute the latest release of xrdp in their
|
||||
repository. You would need xrdp and xorgxrdp packages for the best
|
||||
experience. It is recommended that xrdp depends on xorgxrdp, so it should
|
||||
be sufficient to install xrdp. If xorgxrdp is not provided, use Xvnc
|
||||
server.
|
||||
|
||||
xrdp listens on 3389/tcp. Make sure your firewall accepts connection to
|
||||
3389/tcp from where you want to access.
|
||||
|
||||
### Ubuntu / Debian
|
||||
```bash
|
||||
apt install xrdp
|
||||
```
|
||||
|
||||
### Fedora, RHEL and derivatives
|
||||
|
||||
If you're not running Fedora, make sure to enable EPEL packages first.
|
||||
|
||||
```bash
|
||||
dnf install epel-release
|
||||
```
|
||||
|
||||
(All systems) Install xrdp with:-
|
||||
|
||||
```bash
|
||||
dnf install xrdp
|
||||
```
|
||||
|
||||
## Compiling
|
||||
|
||||
See also https://github.com/neutrinolabs/xrdp/wiki#building-from-sources
|
||||
|
||||
### Prerequisites
|
||||
|
||||
To compile xrdp from the packaged sources, you need basic build tools - a
|
||||
compiler (**gcc** or **clang**) and the **make** program. Additionally,
|
||||
you would need **openssl-devel**, **pam-devel**, **libX11-devel**,
|
||||
**libXfixes-devel**, **libXrandr-devel**. More additional software would
|
||||
be needed depending on your configuration.
|
||||
|
||||
To compile xrdp from a checked out git repository, you would additionally
|
||||
need **autoconf**, **automake**, **libtool** and **pkg-config**.
|
||||
|
||||
### Get the source and build it
|
||||
|
||||
If compiling from the packaged source, unpack the tarball and change to the
|
||||
resulting directory.
|
||||
|
||||
If compiling from a checked out repository, please make sure you've got the submodules
|
||||
cloned too (use `git clone --recursive https://github.com/neutrinolabs/xrdp`)
|
||||
|
||||
Then run following commands to compile and install xrdp:
|
||||
```bash
|
||||
./bootstrap
|
||||
./configure
|
||||
make
|
||||
sudo make install
|
||||
```
|
||||
|
||||
If you want to use audio redirection, you need to build and install additional
|
||||
pulseaudio modules. The build instructions can be found at wiki.
|
||||
|
||||
* [How to set up audio redirection](https://github.com/neutrinolabs/xrdp/wiki/How-to-set-up-audio-redirection)
|
||||
|
||||
## Directory Structure
|
||||
|
||||
```
|
||||
xrdp
|
||||
├── common ······ common code
|
||||
├── docs ········ documentation
|
||||
├── fontutils ··· font handling utilities
|
||||
├── genkeymap ··· keymap generator
|
||||
├── instfiles ··· installable data file
|
||||
├── keygen ······ xrdp RSA key pair generator
|
||||
├── libpainter ·· painter library
|
||||
├── librfxcodec · RFX codec library
|
||||
├── libxrdp ····· core RDP protocol implementation
|
||||
├── m4 ·········· Autoconf macros
|
||||
├── mc ·········· media center module
|
||||
├── neutrinordp · RDP client module for proxying RDP connections using NeutrinoRDP
|
||||
├── pkgconfig ··· pkg-config configuration
|
||||
├── scripts ····· build scripts
|
||||
├┬─ sesman ······ session manager for xrdp
|
||||
|├── chansrv ···· channel server for xrdp
|
||||
|├── libsesman ·· Code common to sesman and its related executables
|
||||
|└── tools ······ session management tools for sys admins
|
||||
├── tests ······· tests for the code
|
||||
├┬─ tools ······· tools
|
||||
|└┬─ devel ······ development tools
|
||||
| ├── gtcp_proxy GTK app that forwards TCP connections to a remote host
|
||||
| └── tcp_proxy · CLI app that forwards TCP connections to a remote host
|
||||
├── vnc ········· VNC client module for xrdp
|
||||
├── vrplayer ···· QT player redirecting video/audio to clients over xrdpvr channel
|
||||
├── xrdp ········ main server code
|
||||
├── xrdpapi ····· virtual channel API
|
||||
├── xrdpvr ······ API for playing media over RDP
|
||||
└── xup ········· xorgxrdp client module
|
||||
```
|
12
SECURITY.md
12
SECURITY.md
@ -1,12 +0,0 @@
|
||||
# Security Policy
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
Please DO NOT report any security issues to public GitHub issue.
|
||||
|
||||
If you find a security vulnerability please kindly inform us via [Report Form](https://github.com/neutrinolabs/xrdp/security/advisories/new) so that we can fix the security problem to protect a lot of users around the world as soon as possible.
|
||||
|
||||
If you have anything else you want to report privately to developers, send us an email to the following email address. This is a private mailing list not open for public viewing.
|
||||
|
||||
* [xrdp-core@googlegroups.com](mailto:xrdp-core@googlegroups.com)
|
||||
|
@ -1,63 +0,0 @@
|
||||
|
||||
# detached brackets
|
||||
--style=allman
|
||||
|
||||
# 4 spaces, no tabs
|
||||
--indent=spaces=4
|
||||
|
||||
# for C++ files only
|
||||
--indent-classes
|
||||
|
||||
# Indent 'switch' blocks so that the 'case X:' statements are indented in the switch block.
|
||||
# The entire case block is indented.
|
||||
--indent-switches
|
||||
|
||||
# Add extra indentation to namespace blocks. This option has no effect on Java files.
|
||||
--indent-namespaces
|
||||
|
||||
# Converts tabs into spaces in the non-indentation part of the line.
|
||||
--convert-tabs
|
||||
|
||||
# requires --convert-tabs to work properly
|
||||
--indent-preproc-define
|
||||
|
||||
--indent-col1-comments
|
||||
|
||||
--min-conditional-indent=2
|
||||
|
||||
--max-continuation-indent=40
|
||||
|
||||
# Insert space padding around operators.
|
||||
--pad-oper
|
||||
|
||||
# Insert space padding after paren headers only (e.g. 'if', 'for', 'while'...).
|
||||
--pad-header
|
||||
|
||||
|
||||
# Add brackets to unbracketed one line conditional statements (e.g. 'if', 'for', 'while'...).
|
||||
--add-braces
|
||||
|
||||
--align-pointer=name
|
||||
|
||||
# Do not retain a backup of the original file. The original file is purged after it is formatted.
|
||||
--suffix=none
|
||||
|
||||
# For each directory in the command line, process all subdirectories recursively.
|
||||
--recursive
|
||||
|
||||
# Exclude git submodule directories and generated files.
|
||||
--exclude=libpainter
|
||||
--exclude=librfxcodec
|
||||
--exclude=xrdp_configure_options.h
|
||||
|
||||
# ignore errors from generated files that do not exist
|
||||
--ignore-exclude-errors
|
||||
|
||||
# Preserve the original file's date and time modified.
|
||||
--preserve-date
|
||||
|
||||
# Formatted files display mode. Display only the files that have been formatted.
|
||||
# Do not display files that are unchanged.
|
||||
--formatted
|
||||
|
||||
--lineend=linux
|
29
bootstrap
29
bootstrap
@ -1,46 +1,37 @@
|
||||
#!/bin/sh
|
||||
|
||||
command -v autoconf
|
||||
which autoconf
|
||||
if ! test $? -eq 0
|
||||
then
|
||||
echo "error, install autoconf"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
command -v automake
|
||||
which automake
|
||||
if ! test $? -eq 0
|
||||
then
|
||||
echo "error, install automake"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
command -v libtool || command -v libtoolize
|
||||
which libtool
|
||||
if ! test $? -eq 0
|
||||
then
|
||||
echo "error, install libtool"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
command -v pkg-config
|
||||
which pkg-config
|
||||
if ! test $? -eq 0
|
||||
then
|
||||
echo "error, install pkg-config"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! test -f libpainter/configure.ac
|
||||
then
|
||||
git submodule update --init libpainter
|
||||
fi
|
||||
|
||||
if ! test -f librfxcodec/configure.ac
|
||||
then
|
||||
git submodule update --init librfxcodec
|
||||
fi
|
||||
|
||||
if ! test -f ulalaca/Makefile.am
|
||||
then
|
||||
git submodule update --init ulalaca
|
||||
fi
|
||||
|
||||
touch configure.ac
|
||||
touch NEWS
|
||||
touch AUTHORS
|
||||
touch README
|
||||
touch ChangeLog
|
||||
ln -s ../config.c $PWD/sesman/tools/config.c
|
||||
autoreconf -fvi
|
||||
|
210
coding_style.md
210
coding_style.md
@ -1,210 +0,0 @@
|
||||
XRdp Coding Style
|
||||
=================
|
||||
|
||||
The coding style used by XRdp is described below.
|
||||
|
||||
The XRdp project uses astyle (artistic style) to format the code. Astyle
|
||||
requires a configuration file that describes how you want your code
|
||||
formatted. This file is present in the XRdp root directory and is named
|
||||
`astyle_config.as`.
|
||||
|
||||
Here is how we run the astyle command:
|
||||
|
||||
astyle --options=/path/to/file/astyle_config.as "*.c"
|
||||
|
||||
This coding style is a work in progress and is still evolving.
|
||||
|
||||
|
||||
Language Standard
|
||||
-----------------
|
||||
|
||||
Try to make all code compile with both C and C++ compiler. C++ is more
|
||||
strict, which makes the code safer.
|
||||
|
||||
|
||||
Indentation
|
||||
-----------
|
||||
|
||||
* 4 spaces per indent
|
||||
* No tabs for any indents
|
||||
|
||||
☞
|
||||
|
||||
if (fd < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
Line wrapping
|
||||
-------------
|
||||
|
||||
* Keep lines not longer than 80 chars
|
||||
* Align wrapped argument to the first argument
|
||||
|
||||
☞
|
||||
|
||||
log_message("connection aborted: error %d",
|
||||
ret);
|
||||
|
||||
|
||||
Variable names
|
||||
--------------
|
||||
|
||||
* Use lowercase with underscores as needed
|
||||
* Don't use camelCase
|
||||
* Preprocessor constants should be uppercase
|
||||
|
||||
☞
|
||||
|
||||
#define BUF_SIZE 1024
|
||||
int fd;
|
||||
int bytes_in_stream;
|
||||
|
||||
|
||||
Variable declaration
|
||||
--------------------
|
||||
|
||||
* Each variable is declared on a separate line
|
||||
|
||||
☞
|
||||
|
||||
int i;
|
||||
int j;
|
||||
|
||||
|
||||
Whitespace
|
||||
----------
|
||||
|
||||
* Use blank lines to group statements
|
||||
* Use at most one empty line between statements
|
||||
* For pointers and references, use a single space before * or & but not after
|
||||
* Use one space after a cast
|
||||
* No space before square brackets
|
||||
|
||||
☞
|
||||
|
||||
char *cptr;
|
||||
int *iptr;
|
||||
cptr = (char *) malloc(1024);
|
||||
|
||||
write(fd, &buf[12], 16);
|
||||
|
||||
|
||||
Function declarations
|
||||
---------------------
|
||||
|
||||
* Use newline before function name
|
||||
|
||||
☞
|
||||
|
||||
static int
|
||||
value_ok(int val)
|
||||
{
|
||||
return (val >= 0);
|
||||
}
|
||||
|
||||
|
||||
Braces
|
||||
------
|
||||
|
||||
* Opening brace is always on a separate line
|
||||
* Align braces with the line preceding the opening brace
|
||||
|
||||
☞
|
||||
|
||||
struct stream
|
||||
{
|
||||
int flags;
|
||||
char *data;
|
||||
};
|
||||
|
||||
void
|
||||
process_data(struct stream *s)
|
||||
{
|
||||
if (stream == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
`if` statements
|
||||
---------------
|
||||
|
||||
* Always use braces
|
||||
* Put both braces on separate lines
|
||||
|
||||
☞
|
||||
|
||||
if (val <= 0xff)
|
||||
{
|
||||
out_uint8(s, val);
|
||||
}
|
||||
else if (val <= 0xffff)
|
||||
{
|
||||
out_uint16_le(s, val);
|
||||
}
|
||||
else
|
||||
{
|
||||
out_uint32_le(s, val);
|
||||
}
|
||||
|
||||
|
||||
`for` statements
|
||||
----------------
|
||||
|
||||
* Always use braces
|
||||
* Put both braces on separate lines
|
||||
|
||||
☞
|
||||
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
printf("i = %d\n", i);
|
||||
}
|
||||
|
||||
|
||||
`while` and `do while` statements
|
||||
---------------------------------
|
||||
|
||||
* Always use braces
|
||||
* `while` after the closing brace is on the same line
|
||||
|
||||
☞
|
||||
|
||||
while (cptr)
|
||||
{
|
||||
cptr—;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
cptr--;
|
||||
} while (cptr);
|
||||
|
||||
|
||||
`switch` statements
|
||||
-------------------
|
||||
|
||||
* Indent `case` once
|
||||
* Indent statements under `case` one more time
|
||||
* Put both braces on separate lines
|
||||
|
||||
☞
|
||||
|
||||
switch (cmd)
|
||||
{
|
||||
case READ:
|
||||
read(fd, buf, 1024);
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("bad cmd\n");
|
||||
}
|
||||
|
||||
Comments
|
||||
--------
|
||||
|
||||
Use /* */ for comments
|
||||
Don't use //
|
@ -1,79 +1,27 @@
|
||||
if XRDP_PIXMAN
|
||||
PIXMAN_SOURCES =
|
||||
else
|
||||
PIXMAN_SOURCES = pixman-region16.c pixman-region.h
|
||||
endif
|
||||
EXTRA_DIST = d3des.h arch.h os_calls.h list.h file.h parse.h defines.h file_loc.h log.h os_calls.h ssl_calls.h thread_calls.h trans.h xrdp_constants.h
|
||||
|
||||
EXTRA_DIST = pixman-region.c
|
||||
|
||||
include_HEADERS = \
|
||||
ms-erref.h \
|
||||
ms-fscc.h \
|
||||
ms-rdpbcgr.h \
|
||||
ms-rdpeclip.h \
|
||||
ms-rdpefs.h \
|
||||
ms-rdpegdi.h \
|
||||
ms-rdpele.h \
|
||||
ms-rdperp.h \
|
||||
ms-rdpedisp.h \
|
||||
ms-smb2.h \
|
||||
xrdp_client_info.h \
|
||||
xrdp_constants.h \
|
||||
xrdp_rail.h \
|
||||
xrdp_scancode_defs.h \
|
||||
xrdp_sockets.h
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
AM_CFLAGS = \
|
||||
-DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
|
||||
-DXRDP_SBIN_PATH=\"${sbindir}\" \
|
||||
-DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \
|
||||
-DXRDP_PID_PATH=\"${localstatedir}/run\" \
|
||||
-DXRDP_LOG_PATH=\"${localstatedir}/log\"
|
||||
|
||||
# -no-suppress is an automake-specific flag which is needed
|
||||
# to prevent us missing compiler errors in some circumstances
|
||||
# (see https://github.com/neutrinolabs/xrdp/pull/1843 )
|
||||
AM_CFLAGS = -no-suppress $(OPENSSL_CFLAGS)
|
||||
|
||||
module_LTLIBRARIES = \
|
||||
lib_LTLIBRARIES = \
|
||||
libcommon.la
|
||||
|
||||
libcommon_la_SOURCES = \
|
||||
arch.h \
|
||||
base64.h \
|
||||
base64.c \
|
||||
defines.h \
|
||||
fifo.c \
|
||||
fifo.h \
|
||||
d3des.c \
|
||||
file.c \
|
||||
file.h \
|
||||
guid.c \
|
||||
guid.h \
|
||||
list.c \
|
||||
list.h \
|
||||
list16.c \
|
||||
list16.h \
|
||||
log.c \
|
||||
log.h \
|
||||
os_calls.c \
|
||||
os_calls.h \
|
||||
parse.c \
|
||||
parse.h \
|
||||
rail.h \
|
||||
scancode.c \
|
||||
scancode.h \
|
||||
ssl_calls.c \
|
||||
ssl_calls.h \
|
||||
string_calls.c \
|
||||
string_calls.h \
|
||||
thread_calls.c \
|
||||
thread_calls.h \
|
||||
trans.c \
|
||||
trans.h \
|
||||
unicode_defines.h \
|
||||
$(PIXMAN_SOURCES)
|
||||
trans.c
|
||||
|
||||
libcommon_la_LIBADD = \
|
||||
-lpthread \
|
||||
$(OPENSSL_LIBS) \
|
||||
$(DLOPEN_LIBS)
|
||||
-lcrypto \
|
||||
-lssl \
|
||||
-lpthread
|
||||
|
195
common/arch.h
195
common/arch.h
@ -1,110 +1,42 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Jay Sorg 2004-2014
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
Copyright (c) 2004-2010 Jay Sorg
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#if !defined(ARCH_H)
|
||||
#define ARCH_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(HAVE_STDINT_H)
|
||||
#include <stdint.h>
|
||||
#else
|
||||
typedef signed char int8_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef signed short int16_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef signed int int32_t;
|
||||
typedef unsigned int uint32_t;
|
||||
#if defined(_WIN64)
|
||||
typedef signed __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
typedef signed __int64 intptr_t;
|
||||
typedef unsigned __int64 uintptr_t;
|
||||
#else
|
||||
typedef signed long long int64_t;
|
||||
typedef unsigned long long uint64_t;
|
||||
typedef signed long intptr_t;
|
||||
typedef unsigned long uintptr_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef int bool_t;
|
||||
|
||||
// Define Unicode character types
|
||||
#if defined(HAVE_UCHAR_H)
|
||||
#include <uchar.h>
|
||||
#elif defined(HAVE_STDINT_H)
|
||||
typedef uint_least16_t char16_t;
|
||||
typedef uint_least32_t char32_t;
|
||||
#else
|
||||
typedef uint16_t char16_t;
|
||||
typedef uint32_t char32_t;
|
||||
#endif
|
||||
|
||||
/* you can define L_ENDIAN or B_ENDIAN and NEED_ALIGN or NO_NEED_ALIGN
|
||||
in the makefile to override */
|
||||
|
||||
/* check endianness */
|
||||
#if !(defined(L_ENDIAN) || defined(B_ENDIAN))
|
||||
#if !defined(__BYTE_ORDER) && defined(__linux__)
|
||||
#include <endian.h>
|
||||
#endif
|
||||
|
||||
#if defined(BYTE_ORDER)
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
/* check endianess */
|
||||
#if defined(__sparc__) || defined(__PPC__) || defined(__ppc__) || \
|
||||
defined(__hppa__)
|
||||
#define B_ENDIAN
|
||||
#else
|
||||
#define L_ENDIAN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !(defined(L_ENDIAN) || defined(B_ENDIAN))
|
||||
#if defined(__sparc__) || \
|
||||
defined(__s390__) || defined (__s390x__) || \
|
||||
defined(__hppa__) || defined (__m68k__) || \
|
||||
(defined(__PPC__) && defined(__BIG_ENDIAN__)) || \
|
||||
(defined(__ppc__) && defined(__BIG_ENDIAN__))
|
||||
#define B_ENDIAN
|
||||
#else
|
||||
#define L_ENDIAN
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* check if we need to align data */
|
||||
#if !(defined(NEED_ALIGN) || defined(NO_NEED_ALIGN))
|
||||
#if defined(__sparc__) || defined(__alpha__) || defined(__hppa__) || \
|
||||
defined(__AIX__) || defined(__m68k__) || defined(__mips__) || \
|
||||
defined(__ia64__) || defined(__arm__) || defined(__sh__) || \
|
||||
(defined(__PPC__) && defined(__BIG_ENDIAN__)) || \
|
||||
(defined(__ppc__) && defined(__BIG_ENDIAN__)) || \
|
||||
defined(__loongarch__) || defined(__e2k__)
|
||||
defined(__AIX__) || defined(__PPC__) || defined(__mips__) || \
|
||||
defined(__ia64__) || defined(__ppc__) || defined(__arm__)
|
||||
#define NEED_ALIGN
|
||||
#elif defined(__x86__) || defined(__x86_64__) || \
|
||||
defined(__AMD64__) || defined(_M_IX86) || defined (_M_AMD64) || \
|
||||
defined(__i386__) || defined(__aarch64__) || \
|
||||
defined(__PPC__) || defined(__LITTLE_ENDIAN__) || \
|
||||
defined(__s390__) || defined (__s390x__) || \
|
||||
defined(__riscv)
|
||||
#define NO_NEED_ALIGN
|
||||
#else
|
||||
#warning unknown arch
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -117,6 +49,14 @@ typedef uint32_t char32_t;
|
||||
#define THREAD_CC
|
||||
#endif
|
||||
|
||||
#if defined(__BORLANDC__) || defined(_WIN32)
|
||||
#define APP_CC __fastcall
|
||||
#define DEFAULT_CC __cdecl
|
||||
#else
|
||||
#define APP_CC
|
||||
#define DEFAULT_CC
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
#if defined(__BORLANDC__)
|
||||
#define EXPORT_CC _export __cdecl
|
||||
@ -127,48 +67,37 @@ typedef uint32_t char32_t;
|
||||
#define EXPORT_CC
|
||||
#endif
|
||||
|
||||
#ifndef DEFINED_Ts
|
||||
#define DEFINED_Ts
|
||||
typedef int8_t ti8;
|
||||
typedef uint8_t tui8;
|
||||
typedef int8_t tsi8;
|
||||
typedef int16_t ti16;
|
||||
typedef uint16_t tui16;
|
||||
typedef int16_t tsi16;
|
||||
typedef int32_t ti32;
|
||||
typedef uint32_t tui32;
|
||||
typedef int32_t tsi32;
|
||||
typedef int64_t ti64;
|
||||
typedef uint64_t tui64;
|
||||
typedef int64_t tsi64;
|
||||
typedef bool_t tbool;
|
||||
typedef intptr_t tbus;
|
||||
typedef intptr_t tintptr;
|
||||
|
||||
/* socket */
|
||||
typedef char ti8;
|
||||
typedef unsigned char tui8;
|
||||
typedef signed char tsi8;
|
||||
typedef short ti16;
|
||||
typedef unsigned short tui16;
|
||||
typedef signed short tsi16;
|
||||
typedef int ti32;
|
||||
typedef unsigned int tui32;
|
||||
typedef signed int tsi32;
|
||||
#if defined(_WIN64)
|
||||
/* Microsoft's VC++ compiler uses the more backwards-compatible LLP64 model.
|
||||
Most other 64 bit compilers(Solaris, AIX, HP, Linux, Mac OS X) use
|
||||
the LP64 model.
|
||||
long is 32 bits in LLP64 model, 64 bits in LP64 model. */
|
||||
typedef __int64 tbus;
|
||||
#else
|
||||
typedef long tbus;
|
||||
#endif
|
||||
typedef tbus thandle;
|
||||
typedef tbus tintptr;
|
||||
/* wide char, socket */
|
||||
#if defined(_WIN32)
|
||||
typedef unsigned short twchar;
|
||||
typedef unsigned int tsock;
|
||||
typedef unsigned __int64 tui64;
|
||||
typedef signed __int64 tsi64;
|
||||
#else
|
||||
typedef int twchar;
|
||||
typedef int tsock;
|
||||
#endif
|
||||
#endif /* DEFINED_Ts */
|
||||
|
||||
/* format string verification */
|
||||
#if defined(HAVE_FUNC_ATTRIBUTE_FORMAT)
|
||||
#define printflike(arg_format, arg_first_check) \
|
||||
__attribute__((__format__(__printf__, arg_format, arg_first_check)))
|
||||
#else
|
||||
#define printflike(arg_format, arg_first_check)
|
||||
#endif
|
||||
|
||||
/* module interface */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
tintptr mod_init(void);
|
||||
int mod_exit(tintptr);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
typedef unsigned long long tui64;
|
||||
typedef signed long long tsi64;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
254
common/base64.c
254
common/base64.c
@ -1,254 +0,0 @@
|
||||
/**
|
||||
* Copyright (C) 2022 Matt Burt, all xrdp contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file common/base64.c
|
||||
* @brief Base64 encoder / decoder
|
||||
*/
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include <config_ac.h>
|
||||
#endif
|
||||
|
||||
#include "string_calls.h"
|
||||
|
||||
#include "base64.h"
|
||||
|
||||
/*
|
||||
* Values for invalid and padding characters, used in the charmap
|
||||
* for converting base64 to binary
|
||||
*
|
||||
* These values are specially chosen to make it easy to detect padding or
|
||||
* invalid characters by or-ing together the values looked up in
|
||||
* a base64 quantum */
|
||||
#define E_INVALID 0x40
|
||||
#define E_PAD 0x80
|
||||
|
||||
/* Determine the character set on this platform */
|
||||
#if ('a' == 0x61 && 'z' == 0x7a ) && \
|
||||
('A' == 0x41 && 'Z' == 0x5a ) && \
|
||||
('0' == 0x30 && '9' == 0x39 )
|
||||
# define PLATFORM_IS_ASCII 1
|
||||
#else
|
||||
# error "Unrecognised character set on this platform"
|
||||
#endif /* character set check */
|
||||
|
||||
|
||||
/*
|
||||
* Define a table to map the base64 character values to bit values.
|
||||
*/
|
||||
#ifdef PLATFORM_IS_ASCII
|
||||
#define CHARMAP_BASE 0x28
|
||||
#define E_IV E_INVALID /* For table alignment */
|
||||
const unsigned char charmap[] =
|
||||
{
|
||||
/* 0x28 */ E_IV, E_IV, E_IV, 0x3e, E_IV, E_IV, E_IV, 0x3f,
|
||||
/* 0x30 */ 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b,
|
||||
/* 0x38 */ 0x3c, 0x3d, E_IV, E_IV, E_IV, E_PAD, E_IV, E_IV,
|
||||
/* 0x40 */ E_IV, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
|
||||
/* 0x48 */ 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
|
||||
/* 0x50 */ 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
|
||||
/* 0x58 */ 0x17, 0x18, 0x19, E_IV, E_IV, E_IV, E_IV, E_IV,
|
||||
/* 0x60 */ E_IV, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
|
||||
/* 0x68 */ 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
|
||||
/* 0x70 */ 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30,
|
||||
/* 0x78 */ 0x31, 0x32, 0x33
|
||||
};
|
||||
#undef E_IV
|
||||
#endif /* PLATFORM_IS_ASCII */
|
||||
|
||||
|
||||
/**
|
||||
* Lookup a value in the charmap
|
||||
*
|
||||
* @param x - byte to lookup. Only referenced once so can safely have
|
||||
* side effects.
|
||||
* @param dest - destination to assign result to.
|
||||
*/
|
||||
#define CM_LOOKUP(x,dest) \
|
||||
{ \
|
||||
unsigned int t = (unsigned int)(x) - CHARMAP_BASE;\
|
||||
dest = (t < sizeof(charmap)) ? charmap[t] : E_INVALID; \
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
int
|
||||
base64_decode(const char *src, char *dst, size_t dst_len, size_t *actual_len)
|
||||
{
|
||||
*actual_len = 0;
|
||||
size_t src_len;
|
||||
size_t src_i = 0;
|
||||
size_t dst_i = 0;
|
||||
unsigned int a; /* Four characters of base64 quantum */
|
||||
unsigned int b;
|
||||
unsigned int c;
|
||||
unsigned int d;
|
||||
unsigned int v;
|
||||
|
||||
#define OUTPUT_CHAR(x) \
|
||||
{ \
|
||||
if (dst_i < dst_len) \
|
||||
{ \
|
||||
dst[dst_i] = (x);\
|
||||
} \
|
||||
++dst_i; \
|
||||
}
|
||||
|
||||
src_len = g_strlen(src);
|
||||
|
||||
while (src_i < src_len)
|
||||
{
|
||||
if ((src_len - src_i) >= 4)
|
||||
{
|
||||
/* Usual case - full quantum */
|
||||
CM_LOOKUP(src[src_i++], a);
|
||||
CM_LOOKUP(src[src_i++], b);
|
||||
CM_LOOKUP(src[src_i++], c);
|
||||
CM_LOOKUP(src[src_i++], d);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Add padding on the end to make up the full quantum */
|
||||
CM_LOOKUP(src[src_i++], a);
|
||||
b = E_PAD;
|
||||
c = E_PAD;
|
||||
d = E_PAD;
|
||||
if ((src_len - src_i) > 0)
|
||||
{
|
||||
CM_LOOKUP(src[src_i++], b);
|
||||
}
|
||||
if ((src_len - src_i) > 0)
|
||||
{
|
||||
CM_LOOKUP(src[src_i++], c);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Bitwise-or the translated quantum values together, so that
|
||||
* any invalid or padding characters can be detected with a
|
||||
* single test */
|
||||
v = a | b | c | d;
|
||||
|
||||
if ((v & E_INVALID) != 0)
|
||||
{
|
||||
return -1; /* At least one invalid character */
|
||||
}
|
||||
|
||||
if ((v & E_PAD) == 0)
|
||||
{
|
||||
/* No padding - a full quantum */
|
||||
v = (a << 18) | (b << 12) | (c << 6) | d;
|
||||
OUTPUT_CHAR(v >> 16);
|
||||
OUTPUT_CHAR((v >> 8) & 0xff);
|
||||
OUTPUT_CHAR(v & 0xff);
|
||||
}
|
||||
else if (((a | b | c) & E_PAD) == 0)
|
||||
{
|
||||
/* No padding in the first 3 chars, so the padding must
|
||||
* be at the end */
|
||||
v = (a << 10) | (b << 4) | (c >> 2);
|
||||
OUTPUT_CHAR(v >> 8);
|
||||
OUTPUT_CHAR(v & 0xff);
|
||||
}
|
||||
else if (((a | b) & E_PAD) == 0 && c == d)
|
||||
{
|
||||
/* No padding in first two chars, so if the last two chars are
|
||||
* equal, they must both be padding */
|
||||
v = (a << 2) | (b >> 4);
|
||||
OUTPUT_CHAR(v);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Illegal padding */
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
*actual_len = dst_i;
|
||||
return 0;
|
||||
|
||||
#undef OUTPUT_CHAR
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
size_t
|
||||
base64_encode(const char *src, size_t src_len, char *dst, size_t dst_len)
|
||||
{
|
||||
char *p = dst;
|
||||
size_t src_i = 0;
|
||||
size_t max_src_len;
|
||||
unsigned int v;
|
||||
static const char *b64chr =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
"abcdefghijklmnopqrstuvwxyz"
|
||||
"0123456789+/=";
|
||||
|
||||
/* Each three octets of the source results in four bytes at the output,
|
||||
* plus we need a terminator. So we can work out the maximum number of
|
||||
* source octets we can process */
|
||||
if (dst_len == 0)
|
||||
{
|
||||
max_src_len = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
max_src_len = (dst_len - 1) / 4 * 3;
|
||||
}
|
||||
|
||||
if (src_len > max_src_len)
|
||||
{
|
||||
src_len = max_src_len;
|
||||
}
|
||||
|
||||
while (src_i < src_len)
|
||||
{
|
||||
switch (src_len - src_i)
|
||||
{
|
||||
case 1:
|
||||
v = (unsigned int)(unsigned char)src[src_i++] << 4;
|
||||
*p++ = b64chr[v >> 6];
|
||||
*p++ = b64chr[v & 0x3f];
|
||||
*p++ = b64chr[64];
|
||||
*p++ = b64chr[64];
|
||||
break;
|
||||
|
||||
case 2:
|
||||
v = (unsigned int)(unsigned char)src[src_i++] << 10;
|
||||
v |= (unsigned int)(unsigned char)src[src_i++] << 2;
|
||||
*p++ = b64chr[v >> 12];
|
||||
*p++ = b64chr[(v >> 6) & 0x3f];
|
||||
*p++ = b64chr[v & 0x3f];
|
||||
*p++ = b64chr[64];
|
||||
break;
|
||||
|
||||
default:
|
||||
v = (unsigned int)(unsigned char)src[src_i++] << 16;
|
||||
v |= (unsigned int)(unsigned char)src[src_i++] << 8;
|
||||
v |= (unsigned int)(unsigned char)src[src_i++];
|
||||
*p++ = b64chr[v >> 18];
|
||||
*p++ = b64chr[(v >> 12) & 0x3f];
|
||||
*p++ = b64chr[(v >> 6) & 0x3f];
|
||||
*p++ = b64chr[v & 0x3f];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
*p = '\0';
|
||||
|
||||
return src_len;
|
||||
}
|
@ -1,82 +0,0 @@
|
||||
/**
|
||||
* Copyright (C) 2021 Koichiro Iwao, all xrdp contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file common/base64.h
|
||||
* @brief Base64 encoder / decoder
|
||||
*
|
||||
* Base-64 is described in RFC4648. The following notes apply to this
|
||||
* implementation:-
|
||||
* - The only supported characters are [A-Za-z0-9+/=]. At present,
|
||||
* embedded linefeeds and URL encodings are not supported.
|
||||
*
|
||||
*/
|
||||
|
||||
#if !defined(BASE64_CALLS_H)
|
||||
#define BASE64_CALLS_H
|
||||
|
||||
#include "arch.h"
|
||||
|
||||
/*
|
||||
* Decodes a base64 string
|
||||
*
|
||||
* @param src Pointer to null-terminated source
|
||||
* @param dst Pointer to output buffer
|
||||
* @param dst_len Length of above. No more than this is written to the
|
||||
* output buffer
|
||||
* @param actual_len Pointer to value to receive actual length of decoded data
|
||||
* @return 0 for success, 1 for an invalid input string
|
||||
*
|
||||
* The following notes apply to this implementation:-
|
||||
* - Embedded padding is supported, provided it only occurs at the end
|
||||
* of a quantum as described in RFC4648(4). This allows concatenated
|
||||
* encodings to be fed into the decoder.
|
||||
* - Padding of the last quantum is assumed if not provided.
|
||||
* - Excess padding of the last quantum is ignored.
|
||||
*
|
||||
* Only dst_len bytes at most are written to the output. The length
|
||||
* returned in actual_len however represents how much buffer is needed for
|
||||
* a correct result. This may be more than dst_len, and enables the caller
|
||||
* to detect a potential buffer overflow
|
||||
*/
|
||||
int
|
||||
base64_decode(const char *src, char *dst, size_t dst_len, size_t *actual_len);
|
||||
|
||||
/*
|
||||
* Encodes a buffer as base64
|
||||
*
|
||||
* @param src Pointer to source
|
||||
* @param src_len Length of above.
|
||||
* @param dst Pointer to output buffer for null-terminated string
|
||||
* @param dst_len Length of above. No more than this is written to the
|
||||
* output buffer
|
||||
* @return Number of source characters processed
|
||||
*
|
||||
* The following notes apply to this implementation:-
|
||||
* - Padding of the last quantum is always written if the number of
|
||||
* source bytes is not divisible by 3.
|
||||
*
|
||||
* The number of source characters processed is always returned. If
|
||||
* the destination buffer is too small for all the output plus a
|
||||
* terminator, the returned value from this procedure will be less than
|
||||
* src_len. In this case no padding characters will have been written,
|
||||
* and the remaining characters can be converted with more calls to
|
||||
* this procedure.
|
||||
*/
|
||||
size_t
|
||||
base64_encode(const char *src, size_t src_len, char *dst, size_t dst_len);
|
||||
|
||||
#endif /* BASE64_CALLS_H */
|
432
common/d3des.c
Normal file
432
common/d3des.c
Normal file
@ -0,0 +1,432 @@
|
||||
/*
|
||||
* This is D3DES (V5.09) by Richard Outerbridge with the double and
|
||||
* triple-length support removed for use in VNC. Also the bytebit[] array
|
||||
* has been reversed so that the most significant bit in each byte of the
|
||||
* key is ignored, not the least significant.
|
||||
*
|
||||
* These changes are:
|
||||
* Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
/* D3DES (V5.09) -
|
||||
*
|
||||
* A portable, public domain, version of the Data Encryption Standard.
|
||||
*
|
||||
* Written with Symantec's THINK (Lightspeed) C by Richard Outerbridge.
|
||||
* Thanks to: Dan Hoey for his excellent Initial and Inverse permutation
|
||||
* code; Jim Gillogly & Phil Karn for the DES key schedule code; Dennis
|
||||
* Ferguson, Eric Young and Dana How for comparing notes; and Ray Lau,
|
||||
* for humouring me on.
|
||||
*
|
||||
* Copyright (c) 1988,1989,1990,1991,1992 by Richard Outerbridge.
|
||||
* (GEnie : OUTER; CIS : [71755,204]) Graven Imagery, 1992.
|
||||
*/
|
||||
|
||||
#include "d3des.h"
|
||||
|
||||
static void scrunch(unsigned char *, unsigned long *);
|
||||
static void unscrun(unsigned long *, unsigned char *);
|
||||
static void desfunc(unsigned long *, unsigned long *);
|
||||
static void cookey(unsigned long *);
|
||||
|
||||
static unsigned long KnL[32] = { 0L };
|
||||
/*
|
||||
static unsigned long KnR[32] = { 0L };
|
||||
static unsigned long Kn3[32] = { 0L };
|
||||
static unsigned char Df_Key[24] = {
|
||||
0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,
|
||||
0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10,
|
||||
0x89,0xab,0xcd,0xef,0x01,0x23,0x45,0x67 };
|
||||
*/
|
||||
|
||||
static unsigned short bytebit[8] = {
|
||||
01, 02, 04, 010, 020, 040, 0100, 0200 };
|
||||
|
||||
static unsigned long bigbyte[24] = {
|
||||
0x800000L, 0x400000L, 0x200000L, 0x100000L,
|
||||
0x80000L, 0x40000L, 0x20000L, 0x10000L,
|
||||
0x8000L, 0x4000L, 0x2000L, 0x1000L,
|
||||
0x800L, 0x400L, 0x200L, 0x100L,
|
||||
0x80L, 0x40L, 0x20L, 0x10L,
|
||||
0x8L, 0x4L, 0x2L, 0x1L };
|
||||
|
||||
/* Use the key schedule specified in the Standard (ANSI X3.92-1981). */
|
||||
|
||||
static unsigned char pc1[56] = {
|
||||
56, 48, 40, 32, 24, 16, 8, 0, 57, 49, 41, 33, 25, 17,
|
||||
9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35,
|
||||
62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21,
|
||||
13, 5, 60, 52, 44, 36, 28, 20, 12, 4, 27, 19, 11, 3 };
|
||||
|
||||
static unsigned char totrot[16] = {
|
||||
1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28 };
|
||||
|
||||
static unsigned char pc2[48] = {
|
||||
13, 16, 10, 23, 0, 4, 2, 27, 14, 5, 20, 9,
|
||||
22, 18, 11, 3, 25, 7, 15, 6, 26, 19, 12, 1,
|
||||
40, 51, 30, 36, 46, 54, 29, 39, 50, 44, 32, 47,
|
||||
43, 48, 38, 55, 33, 52, 45, 41, 49, 35, 28, 31 };
|
||||
|
||||
/* Thanks to James Gillogly & Phil Karn! */
|
||||
void rfbDesKey(unsigned char *key, int edf)
|
||||
{
|
||||
register int i, j, l, m, n;
|
||||
unsigned char pc1m[56], pcr[56];
|
||||
unsigned long kn[32];
|
||||
|
||||
for ( j = 0; j < 56; j++ ) {
|
||||
l = pc1[j];
|
||||
m = l & 07;
|
||||
pc1m[j] = (key[l >> 3] & bytebit[m]) ? 1 : 0;
|
||||
}
|
||||
for( i = 0; i < 16; i++ ) {
|
||||
if( edf == DE1 ) m = (15 - i) << 1;
|
||||
else m = i << 1;
|
||||
n = m + 1;
|
||||
kn[m] = kn[n] = 0L;
|
||||
for( j = 0; j < 28; j++ ) {
|
||||
l = j + totrot[i];
|
||||
if( l < 28 ) pcr[j] = pc1m[l];
|
||||
else pcr[j] = pc1m[l - 28];
|
||||
}
|
||||
for( j = 28; j < 56; j++ ) {
|
||||
l = j + totrot[i];
|
||||
if( l < 56 ) pcr[j] = pc1m[l];
|
||||
else pcr[j] = pc1m[l - 28];
|
||||
}
|
||||
for( j = 0; j < 24; j++ ) {
|
||||
if( pcr[pc2[j]] ) kn[m] |= bigbyte[j];
|
||||
if( pcr[pc2[j+24]] ) kn[n] |= bigbyte[j];
|
||||
}
|
||||
}
|
||||
cookey(kn);
|
||||
return;
|
||||
}
|
||||
|
||||
static void cookey(register unsigned long *raw1)
|
||||
{
|
||||
register unsigned long *cook, *raw0;
|
||||
unsigned long dough[32];
|
||||
register int i;
|
||||
|
||||
cook = dough;
|
||||
for( i = 0; i < 16; i++, raw1++ ) {
|
||||
raw0 = raw1++;
|
||||
*cook = (*raw0 & 0x00fc0000L) << 6;
|
||||
*cook |= (*raw0 & 0x00000fc0L) << 10;
|
||||
*cook |= (*raw1 & 0x00fc0000L) >> 10;
|
||||
*cook++ |= (*raw1 & 0x00000fc0L) >> 6;
|
||||
*cook = (*raw0 & 0x0003f000L) << 12;
|
||||
*cook |= (*raw0 & 0x0000003fL) << 16;
|
||||
*cook |= (*raw1 & 0x0003f000L) >> 4;
|
||||
*cook++ |= (*raw1 & 0x0000003fL);
|
||||
}
|
||||
rfbUseKey(dough);
|
||||
return;
|
||||
}
|
||||
|
||||
void rfbCPKey(register unsigned long *into)
|
||||
{
|
||||
register unsigned long *from, *endp;
|
||||
|
||||
from = KnL, endp = &KnL[32];
|
||||
while( from < endp ) *into++ = *from++;
|
||||
return;
|
||||
}
|
||||
|
||||
void rfbUseKey(register unsigned long *from)
|
||||
{
|
||||
register unsigned long *to, *endp;
|
||||
|
||||
to = KnL, endp = &KnL[32];
|
||||
while( to < endp ) *to++ = *from++;
|
||||
return;
|
||||
}
|
||||
|
||||
void rfbDes(unsigned char *inblock, unsigned char *outblock)
|
||||
{
|
||||
unsigned long work[2];
|
||||
|
||||
scrunch(inblock, work);
|
||||
desfunc(work, KnL);
|
||||
unscrun(work, outblock);
|
||||
return;
|
||||
}
|
||||
|
||||
static void scrunch(register unsigned char *outof, register unsigned long *into)
|
||||
{
|
||||
*into = (*outof++ & 0xffL) << 24;
|
||||
*into |= (*outof++ & 0xffL) << 16;
|
||||
*into |= (*outof++ & 0xffL) << 8;
|
||||
*into++ |= (*outof++ & 0xffL);
|
||||
*into = (*outof++ & 0xffL) << 24;
|
||||
*into |= (*outof++ & 0xffL) << 16;
|
||||
*into |= (*outof++ & 0xffL) << 8;
|
||||
*into |= (*outof & 0xffL);
|
||||
return;
|
||||
}
|
||||
|
||||
static void unscrun(register unsigned long *outof, register unsigned char *into)
|
||||
{
|
||||
*into++ = (unsigned char)((*outof >> 24) & 0xffL);
|
||||
*into++ = (unsigned char)((*outof >> 16) & 0xffL);
|
||||
*into++ = (unsigned char)((*outof >> 8) & 0xffL);
|
||||
*into++ = (unsigned char)( *outof++ & 0xffL);
|
||||
*into++ = (unsigned char)((*outof >> 24) & 0xffL);
|
||||
*into++ = (unsigned char)((*outof >> 16) & 0xffL);
|
||||
*into++ = (unsigned char)((*outof >> 8) & 0xffL);
|
||||
*into = (unsigned char)( *outof & 0xffL);
|
||||
return;
|
||||
}
|
||||
|
||||
static unsigned long SP1[64] = {
|
||||
0x01010400L, 0x00000000L, 0x00010000L, 0x01010404L,
|
||||
0x01010004L, 0x00010404L, 0x00000004L, 0x00010000L,
|
||||
0x00000400L, 0x01010400L, 0x01010404L, 0x00000400L,
|
||||
0x01000404L, 0x01010004L, 0x01000000L, 0x00000004L,
|
||||
0x00000404L, 0x01000400L, 0x01000400L, 0x00010400L,
|
||||
0x00010400L, 0x01010000L, 0x01010000L, 0x01000404L,
|
||||
0x00010004L, 0x01000004L, 0x01000004L, 0x00010004L,
|
||||
0x00000000L, 0x00000404L, 0x00010404L, 0x01000000L,
|
||||
0x00010000L, 0x01010404L, 0x00000004L, 0x01010000L,
|
||||
0x01010400L, 0x01000000L, 0x01000000L, 0x00000400L,
|
||||
0x01010004L, 0x00010000L, 0x00010400L, 0x01000004L,
|
||||
0x00000400L, 0x00000004L, 0x01000404L, 0x00010404L,
|
||||
0x01010404L, 0x00010004L, 0x01010000L, 0x01000404L,
|
||||
0x01000004L, 0x00000404L, 0x00010404L, 0x01010400L,
|
||||
0x00000404L, 0x01000400L, 0x01000400L, 0x00000000L,
|
||||
0x00010004L, 0x00010400L, 0x00000000L, 0x01010004L };
|
||||
|
||||
static unsigned long SP2[64] = {
|
||||
0x80108020L, 0x80008000L, 0x00008000L, 0x00108020L,
|
||||
0x00100000L, 0x00000020L, 0x80100020L, 0x80008020L,
|
||||
0x80000020L, 0x80108020L, 0x80108000L, 0x80000000L,
|
||||
0x80008000L, 0x00100000L, 0x00000020L, 0x80100020L,
|
||||
0x00108000L, 0x00100020L, 0x80008020L, 0x00000000L,
|
||||
0x80000000L, 0x00008000L, 0x00108020L, 0x80100000L,
|
||||
0x00100020L, 0x80000020L, 0x00000000L, 0x00108000L,
|
||||
0x00008020L, 0x80108000L, 0x80100000L, 0x00008020L,
|
||||
0x00000000L, 0x00108020L, 0x80100020L, 0x00100000L,
|
||||
0x80008020L, 0x80100000L, 0x80108000L, 0x00008000L,
|
||||
0x80100000L, 0x80008000L, 0x00000020L, 0x80108020L,
|
||||
0x00108020L, 0x00000020L, 0x00008000L, 0x80000000L,
|
||||
0x00008020L, 0x80108000L, 0x00100000L, 0x80000020L,
|
||||
0x00100020L, 0x80008020L, 0x80000020L, 0x00100020L,
|
||||
0x00108000L, 0x00000000L, 0x80008000L, 0x00008020L,
|
||||
0x80000000L, 0x80100020L, 0x80108020L, 0x00108000L };
|
||||
|
||||
static unsigned long SP3[64] = {
|
||||
0x00000208L, 0x08020200L, 0x00000000L, 0x08020008L,
|
||||
0x08000200L, 0x00000000L, 0x00020208L, 0x08000200L,
|
||||
0x00020008L, 0x08000008L, 0x08000008L, 0x00020000L,
|
||||
0x08020208L, 0x00020008L, 0x08020000L, 0x00000208L,
|
||||
0x08000000L, 0x00000008L, 0x08020200L, 0x00000200L,
|
||||
0x00020200L, 0x08020000L, 0x08020008L, 0x00020208L,
|
||||
0x08000208L, 0x00020200L, 0x00020000L, 0x08000208L,
|
||||
0x00000008L, 0x08020208L, 0x00000200L, 0x08000000L,
|
||||
0x08020200L, 0x08000000L, 0x00020008L, 0x00000208L,
|
||||
0x00020000L, 0x08020200L, 0x08000200L, 0x00000000L,
|
||||
0x00000200L, 0x00020008L, 0x08020208L, 0x08000200L,
|
||||
0x08000008L, 0x00000200L, 0x00000000L, 0x08020008L,
|
||||
0x08000208L, 0x00020000L, 0x08000000L, 0x08020208L,
|
||||
0x00000008L, 0x00020208L, 0x00020200L, 0x08000008L,
|
||||
0x08020000L, 0x08000208L, 0x00000208L, 0x08020000L,
|
||||
0x00020208L, 0x00000008L, 0x08020008L, 0x00020200L };
|
||||
|
||||
static unsigned long SP4[64] = {
|
||||
0x00802001L, 0x00002081L, 0x00002081L, 0x00000080L,
|
||||
0x00802080L, 0x00800081L, 0x00800001L, 0x00002001L,
|
||||
0x00000000L, 0x00802000L, 0x00802000L, 0x00802081L,
|
||||
0x00000081L, 0x00000000L, 0x00800080L, 0x00800001L,
|
||||
0x00000001L, 0x00002000L, 0x00800000L, 0x00802001L,
|
||||
0x00000080L, 0x00800000L, 0x00002001L, 0x00002080L,
|
||||
0x00800081L, 0x00000001L, 0x00002080L, 0x00800080L,
|
||||
0x00002000L, 0x00802080L, 0x00802081L, 0x00000081L,
|
||||
0x00800080L, 0x00800001L, 0x00802000L, 0x00802081L,
|
||||
0x00000081L, 0x00000000L, 0x00000000L, 0x00802000L,
|
||||
0x00002080L, 0x00800080L, 0x00800081L, 0x00000001L,
|
||||
0x00802001L, 0x00002081L, 0x00002081L, 0x00000080L,
|
||||
0x00802081L, 0x00000081L, 0x00000001L, 0x00002000L,
|
||||
0x00800001L, 0x00002001L, 0x00802080L, 0x00800081L,
|
||||
0x00002001L, 0x00002080L, 0x00800000L, 0x00802001L,
|
||||
0x00000080L, 0x00800000L, 0x00002000L, 0x00802080L };
|
||||
|
||||
static unsigned long SP5[64] = {
|
||||
0x00000100L, 0x02080100L, 0x02080000L, 0x42000100L,
|
||||
0x00080000L, 0x00000100L, 0x40000000L, 0x02080000L,
|
||||
0x40080100L, 0x00080000L, 0x02000100L, 0x40080100L,
|
||||
0x42000100L, 0x42080000L, 0x00080100L, 0x40000000L,
|
||||
0x02000000L, 0x40080000L, 0x40080000L, 0x00000000L,
|
||||
0x40000100L, 0x42080100L, 0x42080100L, 0x02000100L,
|
||||
0x42080000L, 0x40000100L, 0x00000000L, 0x42000000L,
|
||||
0x02080100L, 0x02000000L, 0x42000000L, 0x00080100L,
|
||||
0x00080000L, 0x42000100L, 0x00000100L, 0x02000000L,
|
||||
0x40000000L, 0x02080000L, 0x42000100L, 0x40080100L,
|
||||
0x02000100L, 0x40000000L, 0x42080000L, 0x02080100L,
|
||||
0x40080100L, 0x00000100L, 0x02000000L, 0x42080000L,
|
||||
0x42080100L, 0x00080100L, 0x42000000L, 0x42080100L,
|
||||
0x02080000L, 0x00000000L, 0x40080000L, 0x42000000L,
|
||||
0x00080100L, 0x02000100L, 0x40000100L, 0x00080000L,
|
||||
0x00000000L, 0x40080000L, 0x02080100L, 0x40000100L };
|
||||
|
||||
static unsigned long SP6[64] = {
|
||||
0x20000010L, 0x20400000L, 0x00004000L, 0x20404010L,
|
||||
0x20400000L, 0x00000010L, 0x20404010L, 0x00400000L,
|
||||
0x20004000L, 0x00404010L, 0x00400000L, 0x20000010L,
|
||||
0x00400010L, 0x20004000L, 0x20000000L, 0x00004010L,
|
||||
0x00000000L, 0x00400010L, 0x20004010L, 0x00004000L,
|
||||
0x00404000L, 0x20004010L, 0x00000010L, 0x20400010L,
|
||||
0x20400010L, 0x00000000L, 0x00404010L, 0x20404000L,
|
||||
0x00004010L, 0x00404000L, 0x20404000L, 0x20000000L,
|
||||
0x20004000L, 0x00000010L, 0x20400010L, 0x00404000L,
|
||||
0x20404010L, 0x00400000L, 0x00004010L, 0x20000010L,
|
||||
0x00400000L, 0x20004000L, 0x20000000L, 0x00004010L,
|
||||
0x20000010L, 0x20404010L, 0x00404000L, 0x20400000L,
|
||||
0x00404010L, 0x20404000L, 0x00000000L, 0x20400010L,
|
||||
0x00000010L, 0x00004000L, 0x20400000L, 0x00404010L,
|
||||
0x00004000L, 0x00400010L, 0x20004010L, 0x00000000L,
|
||||
0x20404000L, 0x20000000L, 0x00400010L, 0x20004010L };
|
||||
|
||||
static unsigned long SP7[64] = {
|
||||
0x00200000L, 0x04200002L, 0x04000802L, 0x00000000L,
|
||||
0x00000800L, 0x04000802L, 0x00200802L, 0x04200800L,
|
||||
0x04200802L, 0x00200000L, 0x00000000L, 0x04000002L,
|
||||
0x00000002L, 0x04000000L, 0x04200002L, 0x00000802L,
|
||||
0x04000800L, 0x00200802L, 0x00200002L, 0x04000800L,
|
||||
0x04000002L, 0x04200000L, 0x04200800L, 0x00200002L,
|
||||
0x04200000L, 0x00000800L, 0x00000802L, 0x04200802L,
|
||||
0x00200800L, 0x00000002L, 0x04000000L, 0x00200800L,
|
||||
0x04000000L, 0x00200800L, 0x00200000L, 0x04000802L,
|
||||
0x04000802L, 0x04200002L, 0x04200002L, 0x00000002L,
|
||||
0x00200002L, 0x04000000L, 0x04000800L, 0x00200000L,
|
||||
0x04200800L, 0x00000802L, 0x00200802L, 0x04200800L,
|
||||
0x00000802L, 0x04000002L, 0x04200802L, 0x04200000L,
|
||||
0x00200800L, 0x00000000L, 0x00000002L, 0x04200802L,
|
||||
0x00000000L, 0x00200802L, 0x04200000L, 0x00000800L,
|
||||
0x04000002L, 0x04000800L, 0x00000800L, 0x00200002L };
|
||||
|
||||
static unsigned long SP8[64] = {
|
||||
0x10001040L, 0x00001000L, 0x00040000L, 0x10041040L,
|
||||
0x10000000L, 0x10001040L, 0x00000040L, 0x10000000L,
|
||||
0x00040040L, 0x10040000L, 0x10041040L, 0x00041000L,
|
||||
0x10041000L, 0x00041040L, 0x00001000L, 0x00000040L,
|
||||
0x10040000L, 0x10000040L, 0x10001000L, 0x00001040L,
|
||||
0x00041000L, 0x00040040L, 0x10040040L, 0x10041000L,
|
||||
0x00001040L, 0x00000000L, 0x00000000L, 0x10040040L,
|
||||
0x10000040L, 0x10001000L, 0x00041040L, 0x00040000L,
|
||||
0x00041040L, 0x00040000L, 0x10041000L, 0x00001000L,
|
||||
0x00000040L, 0x10040040L, 0x00001000L, 0x00041040L,
|
||||
0x10001000L, 0x00000040L, 0x10000040L, 0x10040000L,
|
||||
0x10040040L, 0x10000000L, 0x00040000L, 0x10001040L,
|
||||
0x00000000L, 0x10041040L, 0x00040040L, 0x10000040L,
|
||||
0x10040000L, 0x10001000L, 0x10001040L, 0x00000000L,
|
||||
0x10041040L, 0x00041000L, 0x00041000L, 0x00001040L,
|
||||
0x00001040L, 0x00040040L, 0x10000000L, 0x10041000L };
|
||||
|
||||
static void desfunc(register unsigned long* block, register unsigned long *keys)
|
||||
{
|
||||
register unsigned long fval, work, right, leftt;
|
||||
register int round;
|
||||
|
||||
leftt = block[0];
|
||||
right = block[1];
|
||||
work = ((leftt >> 4) ^ right) & 0x0f0f0f0fL;
|
||||
right ^= work;
|
||||
leftt ^= (work << 4);
|
||||
work = ((leftt >> 16) ^ right) & 0x0000ffffL;
|
||||
right ^= work;
|
||||
leftt ^= (work << 16);
|
||||
work = ((right >> 2) ^ leftt) & 0x33333333L;
|
||||
leftt ^= work;
|
||||
right ^= (work << 2);
|
||||
work = ((right >> 8) ^ leftt) & 0x00ff00ffL;
|
||||
leftt ^= work;
|
||||
right ^= (work << 8);
|
||||
right = ((right << 1) | ((right >> 31) & 1L)) & 0xffffffffL;
|
||||
work = (leftt ^ right) & 0xaaaaaaaaL;
|
||||
leftt ^= work;
|
||||
right ^= work;
|
||||
leftt = ((leftt << 1) | ((leftt >> 31) & 1L)) & 0xffffffffL;
|
||||
|
||||
for( round = 0; round < 8; round++ ) {
|
||||
work = (right << 28) | (right >> 4);
|
||||
work ^= *keys++;
|
||||
fval = SP7[ work & 0x3fL];
|
||||
fval |= SP5[(work >> 8) & 0x3fL];
|
||||
fval |= SP3[(work >> 16) & 0x3fL];
|
||||
fval |= SP1[(work >> 24) & 0x3fL];
|
||||
work = right ^ *keys++;
|
||||
fval |= SP8[ work & 0x3fL];
|
||||
fval |= SP6[(work >> 8) & 0x3fL];
|
||||
fval |= SP4[(work >> 16) & 0x3fL];
|
||||
fval |= SP2[(work >> 24) & 0x3fL];
|
||||
leftt ^= fval;
|
||||
work = (leftt << 28) | (leftt >> 4);
|
||||
work ^= *keys++;
|
||||
fval = SP7[ work & 0x3fL];
|
||||
fval |= SP5[(work >> 8) & 0x3fL];
|
||||
fval |= SP3[(work >> 16) & 0x3fL];
|
||||
fval |= SP1[(work >> 24) & 0x3fL];
|
||||
work = leftt ^ *keys++;
|
||||
fval |= SP8[ work & 0x3fL];
|
||||
fval |= SP6[(work >> 8) & 0x3fL];
|
||||
fval |= SP4[(work >> 16) & 0x3fL];
|
||||
fval |= SP2[(work >> 24) & 0x3fL];
|
||||
right ^= fval;
|
||||
}
|
||||
|
||||
right = (right << 31) | (right >> 1);
|
||||
work = (leftt ^ right) & 0xaaaaaaaaL;
|
||||
leftt ^= work;
|
||||
right ^= work;
|
||||
leftt = (leftt << 31) | (leftt >> 1);
|
||||
work = ((leftt >> 8) ^ right) & 0x00ff00ffL;
|
||||
right ^= work;
|
||||
leftt ^= (work << 8);
|
||||
work = ((leftt >> 2) ^ right) & 0x33333333L;
|
||||
right ^= work;
|
||||
leftt ^= (work << 2);
|
||||
work = ((right >> 16) ^ leftt) & 0x0000ffffL;
|
||||
leftt ^= work;
|
||||
right ^= (work << 16);
|
||||
work = ((right >> 4) ^ leftt) & 0x0f0f0f0fL;
|
||||
leftt ^= work;
|
||||
right ^= (work << 4);
|
||||
*block++ = right;
|
||||
*block = leftt;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Validation sets:
|
||||
*
|
||||
* Single-length key, single-length plaintext -
|
||||
* Key : 0123 4567 89ab cdef
|
||||
* Plain : 0123 4567 89ab cde7
|
||||
* Cipher : c957 4425 6a5e d31d
|
||||
*
|
||||
* Double-length key, single-length plaintext -
|
||||
* Key : 0123 4567 89ab cdef fedc ba98 7654 3210
|
||||
* Plain : 0123 4567 89ab cde7
|
||||
* Cipher : 7f1d 0a77 826b 8aff
|
||||
*
|
||||
* Double-length key, double-length plaintext -
|
||||
* Key : 0123 4567 89ab cdef fedc ba98 7654 3210
|
||||
* Plain : 0123 4567 89ab cdef 0123 4567 89ab cdff
|
||||
* Cipher : 27a0 8440 406a df60 278f 47cf 42d6 15d7
|
||||
*
|
||||
* Triple-length key, single-length plaintext -
|
||||
* Key : 0123 4567 89ab cdef fedc ba98 7654 3210 89ab cdef 0123 4567
|
||||
* Plain : 0123 4567 89ab cde7
|
||||
* Cipher : de0b 7c06 ae5e 0ed5
|
||||
*
|
||||
* Triple-length key, double-length plaintext -
|
||||
* Key : 0123 4567 89ab cdef fedc ba98 7654 3210 89ab cdef 0123 4567
|
||||
* Plain : 0123 4567 89ab cdef 0123 4567 89ab cdff
|
||||
* Cipher : ad0d 1b30 ac17 cf07 0ed1 1c63 81e4 4de5
|
||||
*
|
||||
* d3des V5.0a rwo 9208.07 18:44 Graven Imagery
|
||||
**********************************************************************/
|
56
common/d3des.h
Normal file
56
common/d3des.h
Normal file
@ -0,0 +1,56 @@
|
||||
#ifndef D3DES_H
|
||||
#define D3DES_H
|
||||
|
||||
/*
|
||||
* This is D3DES (V5.09) by Richard Outerbridge with the double and
|
||||
* triple-length support removed for use in VNC.
|
||||
*
|
||||
* These changes are:
|
||||
* Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
/* d3des.h -
|
||||
*
|
||||
* Headers and defines for d3des.c
|
||||
* Graven Imagery, 1992.
|
||||
*
|
||||
* Copyright (c) 1988,1989,1990,1991,1992 by Richard Outerbridge
|
||||
* (GEnie : OUTER; CIS : [71755,204])
|
||||
*/
|
||||
|
||||
#define EN0 0 /* MODE == encrypt */
|
||||
#define DE1 1 /* MODE == decrypt */
|
||||
|
||||
extern void rfbDesKey(unsigned char *, int);
|
||||
/* hexkey[8] MODE
|
||||
* Sets the internal key register according to the hexadecimal
|
||||
* key contained in the 8 bytes of hexkey, according to the DES,
|
||||
* for encryption or decryption according to MODE.
|
||||
*/
|
||||
|
||||
extern void rfbUseKey(unsigned long *);
|
||||
/* cookedkey[32]
|
||||
* Loads the internal key register with the data in cookedkey.
|
||||
*/
|
||||
|
||||
extern void rfbCPKey(unsigned long *);
|
||||
/* cookedkey[32]
|
||||
* Copies the contents of the internal key register into the storage
|
||||
* located at &cookedkey[0].
|
||||
*/
|
||||
|
||||
extern void rfbDes(unsigned char *, unsigned char *);
|
||||
/* from[8] to[8]
|
||||
* Encrypts/Decrypts (according to the key currently loaded in the
|
||||
* internal key register) one block of eight bytes at address 'from'
|
||||
* into the block at address 'to'. They can be the same.
|
||||
*/
|
||||
|
||||
/* d3des.h V5.09 rwo 9208.04 15:06 Graven Imagery
|
||||
********************************************************************/
|
||||
|
||||
#endif
|
@ -1,26 +1,36 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Jay Sorg 2004-2014
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* main define/macro file
|
||||
*/
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
xrdp: A Remote Desktop Protocol server.
|
||||
Copyright (C) Jay Sorg 2004-2009
|
||||
|
||||
main define/macro file
|
||||
|
||||
*/
|
||||
|
||||
#ifndef DEFINES_H
|
||||
#define DEFINES_H
|
||||
|
||||
/* check for debug */
|
||||
#ifdef XRDP_DEBUG
|
||||
#define DEBUG(args) g_writeln args;
|
||||
#define LIB_DEBUG(_mod, _text) _mod->server_msg(_mod, _text, 1);
|
||||
#else
|
||||
#define DEBUG(args)
|
||||
#define LIB_DEBUG(_mod, _text)
|
||||
#endif
|
||||
/* other macros */
|
||||
#undef MIN
|
||||
#define MIN(x1, x2) ((x1) < (x2) ? (x1) : (x2))
|
||||
@ -32,29 +42,26 @@
|
||||
#define LOWORD(in) ((in) & 0x0000ffff)
|
||||
#undef MAKELONG
|
||||
#define MAKELONG(lo, hi) ((((hi) & 0xffff) << 16) | ((lo) & 0xffff))
|
||||
#define UNUSED_VAR(x) ((void) (x))
|
||||
|
||||
/* graphics macros */
|
||||
#define MAKERECT(r, x, y, cx, cy) \
|
||||
{ (r).left = x; (r).top = y; (r).right = (x) + (cx); (r).bottom = (y) + (cy); }
|
||||
{ (r).left = x; (r).top = y; (r).right = (x) + (cx); (r).bottom = (y) + (cy); }
|
||||
#define ISRECTEMPTY(r) (((r).right <= (r).left) || ((r).bottom <= (r).top))
|
||||
#define RECTOFFSET(r, dx, dy) \
|
||||
{ (r).left += dx; (r).top += dy; (r).right += dx; (r).bottom += dy; }
|
||||
{ (r).left += dx; (r).top += dy; (r).right += dx; (r).bottom += dy; }
|
||||
#define GETPIXEL8(d, x, y, w) (*(((unsigned char*)d) + ((y) * (w) + (x))))
|
||||
#define GETPIXEL16(d, x, y, w) (*(((unsigned short*)d) + ((y) * (w) + (x))))
|
||||
#define GETPIXEL32(d, x, y, w) (*(((unsigned int*)d) + ((y) * (w) + (x))))
|
||||
#define SETPIXEL8(d, x, y, w, v) \
|
||||
(*(((unsigned char*)d) + ((y) * (w) + (x))) = (v))
|
||||
(*(((unsigned char*)d) + ((y) * (w) + (x))) = (v))
|
||||
#define SETPIXEL16(d, x, y, w, v) \
|
||||
(*(((unsigned short*)d) + ((y) * (w) + (x))) = (v))
|
||||
(*(((unsigned short*)d) + ((y) * (w) + (x))) = (v))
|
||||
#define SETPIXEL32(d, x, y, w, v) \
|
||||
(*(((unsigned int*)d) + ((y) * (w) + (x))) = (v))
|
||||
(*(((unsigned int*)d) + ((y) * (w) + (x))) = (v))
|
||||
#define COLOR8(r, g, b) \
|
||||
( \
|
||||
( \
|
||||
(((r) >> 5) << 0) | \
|
||||
(((g) >> 5) << 3) | \
|
||||
(((b) >> 6) << 6) \
|
||||
)
|
||||
)
|
||||
#define COLOR15(r, g, b) ((((r) >> 3) << 10) | (((g) >> 3) << 5) | ((b) >> 3))
|
||||
#define COLOR16(r, g, b) ((((r) >> 3) << 11) | (((g) >> 2) << 5) | ((b) >> 3))
|
||||
#define COLOR24RGB(r, g, b) (((r) << 16) | ((g) << 8) | (b))
|
||||
@ -63,45 +70,37 @@
|
||||
#define HGREEN(c) ((c & 0x00ff00) >> 8)
|
||||
#define HBLUE(c) ((c & 0x0000ff))
|
||||
#define HCOLOR(bpp,c) \
|
||||
( \
|
||||
( \
|
||||
(bpp==8?COLOR8(HRED(c),HGREEN(c),HBLUE(c)): \
|
||||
(bpp==15?COLOR15(HRED(c),HGREEN(c),HBLUE(c)): \
|
||||
(bpp==16?COLOR16(HRED(c),HGREEN(c),HBLUE(c)): \
|
||||
(bpp>=24?COLOR24BGR(HRED(c),HGREEN(c),HBLUE(c)):c) \
|
||||
(bpp==24?COLOR24BGR(HRED(c),HGREEN(c),HBLUE(c)):c) \
|
||||
) \
|
||||
) \
|
||||
) \
|
||||
)
|
||||
)
|
||||
#define SPLITCOLOR15(r, g, b, c) \
|
||||
{ \
|
||||
{ \
|
||||
r = (((c) >> 7) & 0xf8) | (((c) >> 12) & 0x7); \
|
||||
g = (((c) >> 2) & 0xf8) | (((c) >> 8) & 0x7); \
|
||||
b = (((c) << 3) & 0xf8) | (((c) >> 2) & 0x7); \
|
||||
}
|
||||
}
|
||||
#define SPLITCOLOR16(r, g, b, c) \
|
||||
{ \
|
||||
{ \
|
||||
r = (((c) >> 8) & 0xf8) | (((c) >> 13) & 0x7); \
|
||||
g = (((c) >> 3) & 0xfc) | (((c) >> 9) & 0x3); \
|
||||
b = (((c) << 3) & 0xf8) | (((c) >> 2) & 0x7); \
|
||||
}
|
||||
}
|
||||
#define SPLITCOLOR32(r, g, b, c) \
|
||||
{ \
|
||||
{ \
|
||||
r = ((c) >> 16) & 0xff; \
|
||||
g = ((c) >> 8) & 0xff; \
|
||||
b = (c) & 0xff; \
|
||||
}
|
||||
}
|
||||
/* font macros */
|
||||
#define FONT_DATASIZE_FROM_GEOMETRY(width,height) \
|
||||
((((height) * (((width) + 7) / 8)) + 3) & ~3)
|
||||
#define FONT_DATASIZE(f) FONT_DATASIZE_FROM_GEOMETRY((f->width), (f->height))
|
||||
|
||||
#define FONT_DATASIZE(f) \
|
||||
((((f)->height * (((f)->width + 7) / 8)) + 3) & ~3);
|
||||
/* use crc for bitmap cache lookups */
|
||||
#define USE_CRC
|
||||
|
||||
#define XR_RGB2BGR(a_ulColor) \
|
||||
(a_ulColor & 0xFF000000) | \
|
||||
((a_ulColor & 0x00FF0000) >> 16) | \
|
||||
(a_ulColor & 0x0000FF00) | \
|
||||
((a_ulColor & 0x000000FF) << 16)
|
||||
|
||||
#endif
|
||||
|
263
common/fifo.c
263
common/fifo.c
@ -1,263 +0,0 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Matt Burt 2023
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file common/fifo.c
|
||||
* @brief Fifo for storing generic pointers
|
||||
*
|
||||
* Defines an unbounded FIFO-queue for void * pointers
|
||||
*
|
||||
* The stored pointers are called 'items' below.
|
||||
*
|
||||
* Items are stored in groups called 'chunks'. Chunks are linked together
|
||||
* in a chain:-
|
||||
*
|
||||
* +-------------+ +--------+ +--------+ +--------+
|
||||
* | first_chunk |--->| next |--->| next |--->| NULL |<-+
|
||||
* | last_chunk |-+ +--------+ +--------+ +--------+ |
|
||||
* | . . . | | | item.0 | | item.0 | | item.0 | |
|
||||
* +-------------+ | | ... | | ... | | ... | |
|
||||
* | | item.n | | item.n | | item.n | |
|
||||
* | +--------+ +--------+ +--------+ |
|
||||
* | |
|
||||
* +------------------------------------------+
|
||||
*
|
||||
* This allows items to be added to the FIFO by allocating blocks
|
||||
* as each one fills up.
|
||||
*
|
||||
* The code to read from the FIFO de-allocates blocks as each one is
|
||||
* consumed.
|
||||
*
|
||||
* There is always at least one chunk in the FIFO.
|
||||
*/
|
||||
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include <config_ac.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "fifo.h"
|
||||
|
||||
#define ITEMS_PER_CHUNK 31
|
||||
|
||||
struct chunk
|
||||
{
|
||||
struct chunk *next;
|
||||
void *items[ITEMS_PER_CHUNK];
|
||||
};
|
||||
|
||||
struct fifo
|
||||
{
|
||||
struct chunk *first_chunk;
|
||||
struct chunk *last_chunk;
|
||||
/** Next address to write in 'last_chunk' */
|
||||
unsigned short writer;
|
||||
/** Next address to read in 'first_chunk' */
|
||||
unsigned short reader;
|
||||
/** Item destructor function, or NULL */
|
||||
fifo_item_destructor item_destructor;
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
struct fifo *
|
||||
fifo_create(fifo_item_destructor item_destructor)
|
||||
{
|
||||
struct fifo *result = NULL;
|
||||
struct chunk *cptr = (struct chunk *)malloc(sizeof(struct chunk));
|
||||
if (cptr != NULL)
|
||||
{
|
||||
/* 'next' pointer in last block is always NULL */
|
||||
cptr->next = NULL;
|
||||
result = (struct fifo *)malloc(sizeof(struct fifo));
|
||||
if (result == NULL)
|
||||
{
|
||||
free(cptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
result->first_chunk = cptr;
|
||||
result->last_chunk = cptr;
|
||||
result->writer = 0;
|
||||
result->reader = 0;
|
||||
result->item_destructor = item_destructor;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* Internal function to call the destructor function on all items in the fifo
|
||||
*
|
||||
* @param self fifo. Can't be NULL
|
||||
* @param closure Additional argument to destructor function
|
||||
*/
|
||||
static void
|
||||
call_item_destructor(struct fifo *self, void *closure)
|
||||
{
|
||||
if (self->item_destructor != NULL)
|
||||
{
|
||||
struct chunk *cptr = self->first_chunk;
|
||||
unsigned int i = self->reader;
|
||||
|
||||
// Process all the chunks up to the last one
|
||||
while (cptr != self->last_chunk)
|
||||
{
|
||||
(*self->item_destructor)(cptr->items[i++], closure);
|
||||
if (i == ITEMS_PER_CHUNK)
|
||||
{
|
||||
cptr = cptr->next;
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Process all the items in the last chunk
|
||||
while (i < self->writer)
|
||||
{
|
||||
(*self->item_destructor)(cptr->items[i++], closure);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
void
|
||||
fifo_delete(struct fifo *self, void *closure)
|
||||
{
|
||||
if (self != NULL)
|
||||
{
|
||||
call_item_destructor(self, closure);
|
||||
|
||||
// Now free all the chunks
|
||||
struct chunk *cptr = self->first_chunk;
|
||||
while (cptr != NULL)
|
||||
{
|
||||
struct chunk *next = cptr->next;
|
||||
free(cptr);
|
||||
cptr = next;
|
||||
}
|
||||
|
||||
free(self);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
void
|
||||
fifo_clear(struct fifo *self, void *closure)
|
||||
{
|
||||
if (self != NULL)
|
||||
{
|
||||
call_item_destructor(self, closure);
|
||||
|
||||
// Now free all the chunks except the last one
|
||||
struct chunk *cptr = self->first_chunk;
|
||||
while (cptr->next != NULL)
|
||||
{
|
||||
struct chunk *next = cptr->next;
|
||||
free(cptr);
|
||||
cptr = next;
|
||||
}
|
||||
|
||||
// Re-initialise fifo fields
|
||||
self->first_chunk = cptr;
|
||||
self->last_chunk = cptr;
|
||||
self->reader = 0;
|
||||
self->writer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int
|
||||
fifo_add_item(struct fifo *self, void *item)
|
||||
{
|
||||
int rv = 0;
|
||||
if (self != NULL && item != NULL)
|
||||
{
|
||||
if (self->writer == ITEMS_PER_CHUNK)
|
||||
{
|
||||
// Add another chunk to the chain
|
||||
struct chunk *cptr;
|
||||
cptr = (struct chunk *)malloc(sizeof(struct chunk));
|
||||
if (cptr == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
cptr->next = NULL;
|
||||
self->last_chunk->next = cptr;
|
||||
self->last_chunk = cptr;
|
||||
self->writer = 0;
|
||||
}
|
||||
|
||||
self->last_chunk->items[self->writer++] = item;
|
||||
rv = 1;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void *
|
||||
fifo_remove_item(struct fifo *self)
|
||||
{
|
||||
void *item = NULL;
|
||||
if (self != NULL)
|
||||
{
|
||||
// More than one chunk in the fifo?
|
||||
if (self->first_chunk != self->last_chunk)
|
||||
{
|
||||
/* We're not reading the last chunk. There
|
||||
* must be something in the fifo */
|
||||
item = self->first_chunk->items[self->reader++];
|
||||
|
||||
/* At the end of this chunk? */
|
||||
if (self->reader == ITEMS_PER_CHUNK)
|
||||
{
|
||||
struct chunk *old_chunk = self->first_chunk;
|
||||
self->first_chunk = old_chunk->next;
|
||||
free(old_chunk);
|
||||
self->reader = 0;
|
||||
}
|
||||
}
|
||||
else if (self->reader < self->writer)
|
||||
{
|
||||
/* We're reading the last chunk */
|
||||
item = self->first_chunk->items[self->reader++];
|
||||
if (self->reader == self->writer)
|
||||
{
|
||||
// fifo is now empty. We can reset the pointers
|
||||
// to prevent unnecessary allocations in the future.
|
||||
self->reader = 0;
|
||||
self->writer = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
int
|
||||
fifo_is_empty(struct fifo *self)
|
||||
{
|
||||
return (self == NULL ||
|
||||
(self->first_chunk == self->last_chunk &&
|
||||
self->reader == self->writer));
|
||||
}
|
@ -1,98 +0,0 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Laxmikant Rashinkar 2004-2014
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file common/fifo.h
|
||||
* @brief Fifo for storing generic pointers
|
||||
*
|
||||
* Declares an unbounded FIFO-queue for void * pointers
|
||||
*/
|
||||
|
||||
#ifndef _FIFO_H
|
||||
#define _FIFO_H
|
||||
|
||||
struct fifo;
|
||||
|
||||
/**
|
||||
* Function used by fifo_clear()/fifo_delete() to destroy items
|
||||
*
|
||||
* @param item Item being deleted
|
||||
* @param closure Additional argument to function
|
||||
*
|
||||
* Use this function to free any allocated storage (e.g. if the items
|
||||
* are dynamically allocated)
|
||||
*/
|
||||
typedef void (*fifo_item_destructor)(void *item, void *closure);
|
||||
|
||||
/**
|
||||
* Create new fifo
|
||||
*
|
||||
* @param item_destructor Destructor for fifo items, or NULL for none
|
||||
* @return fifo, or NULL if no memory
|
||||
*/
|
||||
struct fifo *
|
||||
fifo_create(fifo_item_destructor item_destructor);
|
||||
|
||||
/**
|
||||
* Delete an existing fifo
|
||||
*
|
||||
* Any existing entries on the fifo are passed in order to the
|
||||
* item destructor specified when the fifo was created.
|
||||
*
|
||||
* @param self fifo to delete (may be NULL)
|
||||
* @param closure Additional parameter for fifo item destructor
|
||||
*/
|
||||
void
|
||||
fifo_delete(struct fifo *self, void *closure);
|
||||
|
||||
/**
|
||||
* Clear(empty) an existing fifo
|
||||
*
|
||||
* Any existing entries on the fifo are passed in order to the
|
||||
* item destructor specified when the fifo was created.
|
||||
*
|
||||
* @param self fifo to clear (may be NULL)
|
||||
* @param closure Additional parameter for fifo item destructor
|
||||
*/
|
||||
void
|
||||
fifo_clear(struct fifo *self, void *closure);
|
||||
|
||||
/** Add an item to a fifo
|
||||
* @param self fifo
|
||||
* @param item Item to add
|
||||
* @return 1 if successful, 0 for no memory, or tried to add NULL
|
||||
*/
|
||||
int
|
||||
fifo_add_item(struct fifo *self, void *item);
|
||||
|
||||
/** Remove an item from a fifo
|
||||
* @param self fifo
|
||||
* @return item if successful, NULL for no items in FIFO
|
||||
*/
|
||||
void *
|
||||
fifo_remove_item(struct fifo *self);
|
||||
|
||||
/** Is fifo empty?
|
||||
*
|
||||
* @param self fifo
|
||||
* @return 1 if fifo is empty, 0 if not
|
||||
*/
|
||||
int
|
||||
fifo_is_empty(struct fifo *self);
|
||||
|
||||
#endif
|
277
common/file.c
277
common/file.c
@ -1,106 +1,79 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Jay Sorg 2004-2014
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* read a config file
|
||||
*/
|
||||
/*
|
||||
Copyright (c) 2004-2012 Jay Sorg
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include <config_ac.h>
|
||||
#endif
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
read a config file
|
||||
*/
|
||||
|
||||
#include "arch.h"
|
||||
#include "os_calls.h"
|
||||
#include "string_calls.h"
|
||||
#include "list.h"
|
||||
#include "file.h"
|
||||
#include "parse.h"
|
||||
|
||||
#define FILE_MAX_LINE_BYTES 2048
|
||||
|
||||
static int
|
||||
file_read_ini_line(struct stream *s, char *text, int text_bytes);
|
||||
|
||||
/*****************************************************************************/
|
||||
/* look up for a section name within str (i.e. pattern [section_name])
|
||||
* if a section name is found, this function return 1 and copy the section
|
||||
* inplace of str. */
|
||||
static int
|
||||
line_lookup_for_section_name(char *str, int str_bytes)
|
||||
{
|
||||
int name_index_start;
|
||||
int index;
|
||||
char c;
|
||||
|
||||
name_index_start = -1;
|
||||
index = 0;
|
||||
while ((c = str[index]) != 0)
|
||||
{
|
||||
if (c == '[')
|
||||
{
|
||||
name_index_start = index + 1;
|
||||
}
|
||||
else if (c == ']' && name_index_start > 0)
|
||||
{
|
||||
if (name_index_start + index >= str_bytes)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
for (index = index - name_index_start; index > 0; index--)
|
||||
{
|
||||
str[0] = str[name_index_start];
|
||||
str++;
|
||||
}
|
||||
str[0] = 0;
|
||||
return 1;
|
||||
}
|
||||
++index;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error
|
||||
returns 0 if everything is ok
|
||||
returns 1 if problem reading file */
|
||||
static int
|
||||
l_file_read_sections(int fd, int max_file_size, struct list *names)
|
||||
static int APP_CC
|
||||
l_file_read_sections(int fd, int max_file_size, struct list* names)
|
||||
{
|
||||
struct stream *s;
|
||||
char text[FILE_MAX_LINE_BYTES];
|
||||
struct stream* s;
|
||||
char text[256];
|
||||
char c;
|
||||
int in_it;
|
||||
int in_it_index;
|
||||
int len;
|
||||
int index;
|
||||
int rv;
|
||||
|
||||
rv = 0;
|
||||
g_file_seek(fd, 0);
|
||||
g_memset(text, 0, FILE_MAX_LINE_BYTES);
|
||||
in_it_index = 0;
|
||||
in_it = 0;
|
||||
g_memset(text, 0, 256);
|
||||
list_clear(names);
|
||||
make_stream(s);
|
||||
init_stream(s, max_file_size);
|
||||
len = g_file_read(fd, s->data, max_file_size);
|
||||
|
||||
if (len > 0)
|
||||
{
|
||||
s->end = s->p + len;
|
||||
while (file_read_ini_line(s, text, FILE_MAX_LINE_BYTES) == 0)
|
||||
for (index = 0; index < len; index++)
|
||||
{
|
||||
if (line_lookup_for_section_name(text, FILE_MAX_LINE_BYTES) != 0)
|
||||
in_uint8(s, c);
|
||||
if (c == '[')
|
||||
{
|
||||
list_add_strdup(names, text);
|
||||
in_it = 1;
|
||||
}
|
||||
else if (c == ']')
|
||||
{
|
||||
list_add_item(names, (tbus)g_strdup(text));
|
||||
in_it = 0;
|
||||
in_it_index = 0;
|
||||
g_memset(text, 0, 256);
|
||||
}
|
||||
else if (in_it)
|
||||
{
|
||||
text[in_it_index] = c;
|
||||
in_it_index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -108,52 +81,39 @@ l_file_read_sections(int fd, int max_file_size, struct list *names)
|
||||
{
|
||||
rv = 1;
|
||||
}
|
||||
|
||||
free_stream(s);
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Read a line in the stream 's', removing comments.
|
||||
* returns error
|
||||
* returns 0 if everything is ok
|
||||
* returns 1 if problem reading file */
|
||||
static int
|
||||
file_read_ini_line(struct stream *s, char *text, int text_bytes)
|
||||
static int APP_CC
|
||||
file_read_line(struct stream* s, char* text)
|
||||
{
|
||||
int i;
|
||||
int skip_to_end;
|
||||
int at_end;
|
||||
char c;
|
||||
char* hold;
|
||||
|
||||
skip_to_end = 0;
|
||||
|
||||
if (!s_check_rem(s, 1))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
hold = s->p;
|
||||
i = 0;
|
||||
in_uint8(s, c);
|
||||
|
||||
while (c != 10 && c != 13)
|
||||
{
|
||||
/* these mean skip the rest of the line */
|
||||
if (c == '#' || c == ';')
|
||||
if (c == '#' || c == '!' || c == ';')
|
||||
{
|
||||
skip_to_end = 1;
|
||||
}
|
||||
|
||||
if (!skip_to_end)
|
||||
{
|
||||
text[i] = c;
|
||||
i++;
|
||||
if (i >= text_bytes)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (s_check_rem(s, 1))
|
||||
{
|
||||
in_uint8(s, c);
|
||||
@ -164,11 +124,9 @@ file_read_ini_line(struct stream *s, char *text, int text_bytes)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (c == 10 || c == 13)
|
||||
{
|
||||
at_end = 0;
|
||||
|
||||
while (c == 10 || c == 13)
|
||||
{
|
||||
if (s_check_rem(s, 1))
|
||||
@ -181,23 +139,24 @@ file_read_ini_line(struct stream *s, char *text, int text_bytes)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!at_end)
|
||||
{
|
||||
s->p--;
|
||||
}
|
||||
}
|
||||
|
||||
text[i] = 0;
|
||||
|
||||
if (text[0] == '[')
|
||||
{
|
||||
s->p = hold;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
static int
|
||||
file_split_name_value(char *text, char *name, char *value)
|
||||
static int APP_CC
|
||||
file_split_name_value(char* text, char* name, char* value)
|
||||
{
|
||||
int len;
|
||||
int i;
|
||||
@ -211,10 +170,9 @@ file_split_name_value(char *text, char *name, char *value)
|
||||
name[0] = 0;
|
||||
value[0] = 0;
|
||||
len = g_strlen(text);
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
if (text[i] == '=' && !on_to)
|
||||
if (text[i] == '=')
|
||||
{
|
||||
on_to = 1;
|
||||
}
|
||||
@ -231,7 +189,6 @@ file_split_name_value(char *text, char *name, char *value)
|
||||
name[name_index] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
g_strtrim(name, 3); /* trim both right and left */
|
||||
g_strtrim(value, 3); /* trim both right and left */
|
||||
return 0;
|
||||
@ -239,84 +196,86 @@ file_split_name_value(char *text, char *name, char *value)
|
||||
|
||||
/*****************************************************************************/
|
||||
/* return error */
|
||||
static int
|
||||
l_file_read_section(int fd, int max_file_size, const char *section,
|
||||
struct list *names, struct list *values)
|
||||
static int APP_CC
|
||||
l_file_read_section(int fd, int max_file_size, const char* section,
|
||||
struct list* names, struct list* values)
|
||||
{
|
||||
struct stream *s;
|
||||
char *data;
|
||||
char *text;
|
||||
char *name;
|
||||
char *value;
|
||||
char *lvalue;
|
||||
struct stream* s;
|
||||
char text[512];
|
||||
char name[512];
|
||||
char value[512];
|
||||
char* lvalue;
|
||||
char c;
|
||||
int in_it;
|
||||
int in_it_index;
|
||||
int len;
|
||||
int index;
|
||||
int file_size;
|
||||
|
||||
data = (char *) g_malloc(FILE_MAX_LINE_BYTES * 3, 0);
|
||||
text = data;
|
||||
name = text + FILE_MAX_LINE_BYTES;
|
||||
value = name + FILE_MAX_LINE_BYTES;
|
||||
|
||||
file_size = 32 * 1024; /* 32 K file size limit */
|
||||
g_file_seek(fd, 0);
|
||||
g_memset(text, 0, FILE_MAX_LINE_BYTES);
|
||||
in_it_index = 0;
|
||||
in_it = 0;
|
||||
g_memset(text, 0, 512);
|
||||
list_clear(names);
|
||||
list_clear(values);
|
||||
make_stream(s);
|
||||
init_stream(s, file_size);
|
||||
len = g_file_read(fd, s->data, file_size);
|
||||
|
||||
if (len > 0)
|
||||
{
|
||||
s->end = s->p + len;
|
||||
while (file_read_ini_line(s, text, FILE_MAX_LINE_BYTES) == 0)
|
||||
for (index = 0; index < len; index++)
|
||||
{
|
||||
if (line_lookup_for_section_name(text, FILE_MAX_LINE_BYTES) != 0)
|
||||
in_uint8(s, c);
|
||||
if (c == '[')
|
||||
{
|
||||
in_it = 1;
|
||||
}
|
||||
else if (c == ']')
|
||||
{
|
||||
if (g_strcasecmp(section, text) == 0)
|
||||
{
|
||||
while (file_read_ini_line(s, text,
|
||||
FILE_MAX_LINE_BYTES) == 0)
|
||||
file_read_line(s, text);
|
||||
while (file_read_line(s, text) == 0)
|
||||
{
|
||||
if (line_lookup_for_section_name(text, FILE_MAX_LINE_BYTES) != 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (g_strlen(text) > 0)
|
||||
{
|
||||
file_split_name_value(text, name, value);
|
||||
list_add_strdup(names, name);
|
||||
|
||||
list_add_item(names, (tbus)g_strdup(name));
|
||||
if (value[0] == '$')
|
||||
{
|
||||
lvalue = g_getenv(value + 1);
|
||||
|
||||
if (lvalue != 0)
|
||||
{
|
||||
list_add_strdup(values, lvalue);
|
||||
list_add_item(values, (tbus)g_strdup(lvalue));
|
||||
}
|
||||
else
|
||||
{
|
||||
list_add_strdup(values, "");
|
||||
list_add_item(values, (tbus)g_strdup(""));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
list_add_strdup(values, value);
|
||||
list_add_item(values, (tbus)g_strdup(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
free_stream(s);
|
||||
g_free(data);
|
||||
return 0;
|
||||
}
|
||||
in_it = 0;
|
||||
in_it_index = 0;
|
||||
g_memset(text, 0, 512);
|
||||
}
|
||||
else if (in_it)
|
||||
{
|
||||
text[in_it_index] = c;
|
||||
in_it_index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
free_stream(s);
|
||||
g_free(data);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -325,37 +284,33 @@ l_file_read_section(int fd, int max_file_size, const char *section,
|
||||
returns 0 if everything is ok
|
||||
returns 1 if problem reading file */
|
||||
/* 32 K file size limit */
|
||||
int
|
||||
file_read_sections(int fd, struct list *names)
|
||||
int APP_CC
|
||||
file_read_sections(int fd, struct list* names)
|
||||
{
|
||||
return l_file_read_sections(fd, 32 * 1024, names);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* return error */
|
||||
/* this function should be preferred over file_read_sections because it can
|
||||
/* this function should be prefered over file_read_sections because it can
|
||||
read any file size */
|
||||
int
|
||||
file_by_name_read_sections(const char *file_name, struct list *names)
|
||||
int APP_CC
|
||||
file_by_name_read_sections(const char* file_name, struct list* names)
|
||||
{
|
||||
int fd;
|
||||
int file_size;
|
||||
int rv;
|
||||
|
||||
file_size = g_file_get_size(file_name);
|
||||
|
||||
if (file_size < 1)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
fd = g_file_open_ro(file_name);
|
||||
|
||||
if (fd < 0)
|
||||
fd = g_file_open(file_name);
|
||||
if (fd < 1)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
rv = l_file_read_sections(fd, file_size, names);
|
||||
g_file_close(fd);
|
||||
return rv;
|
||||
@ -364,39 +319,35 @@ file_by_name_read_sections(const char *file_name, struct list *names)
|
||||
/*****************************************************************************/
|
||||
/* return error */
|
||||
/* 32 K file size limit */
|
||||
int
|
||||
file_read_section(int fd, const char *section,
|
||||
struct list *names, struct list *values)
|
||||
int APP_CC
|
||||
file_read_section(int fd, const char* section,
|
||||
struct list* names, struct list* values)
|
||||
{
|
||||
return l_file_read_section(fd, 32 * 1024, section, names, values);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* return error */
|
||||
/* this function should be preferred over file_read_section because it can
|
||||
/* this function should be prefered over file_read_section because it can
|
||||
read any file size */
|
||||
int
|
||||
file_by_name_read_section(const char *file_name, const char *section,
|
||||
struct list *names, struct list *values)
|
||||
int APP_CC
|
||||
file_by_name_read_section(const char* file_name, const char* section,
|
||||
struct list* names, struct list* values)
|
||||
{
|
||||
int fd;
|
||||
int file_size;
|
||||
int rv;
|
||||
|
||||
file_size = g_file_get_size(file_name);
|
||||
|
||||
if (file_size < 1)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
fd = g_file_open_ro(file_name);
|
||||
|
||||
if (fd < 0)
|
||||
fd = g_file_open(file_name);
|
||||
if (fd < 1)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
rv = l_file_read_section(fd, file_size, section, names, values);
|
||||
g_file_close(fd);
|
||||
return rv;
|
||||
|
@ -1,37 +1,41 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Jay Sorg 2004-2014
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* read a config file
|
||||
*/
|
||||
/*
|
||||
Copyright (c) 2004-2010 Jay Sorg
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
read a config file
|
||||
*/
|
||||
|
||||
#if !defined(FILE_H)
|
||||
#define FILE_H
|
||||
|
||||
#include "arch.h"
|
||||
|
||||
int
|
||||
file_read_sections(int fd, struct list *names);
|
||||
int
|
||||
file_by_name_read_sections(const char *file_name, struct list *names);
|
||||
int
|
||||
file_read_section(int fd, const char *section,
|
||||
struct list *names, struct list *values);
|
||||
int
|
||||
file_by_name_read_section(const char *file_name, const char *section,
|
||||
struct list *names, struct list *values);
|
||||
int APP_CC
|
||||
file_read_sections(int fd, struct list* names);
|
||||
int APP_CC
|
||||
file_by_name_read_sections(const char* file_name, struct list* names);
|
||||
int APP_CC
|
||||
file_read_section(int fd, const char* section,
|
||||
struct list* names, struct list* values);
|
||||
int APP_CC
|
||||
file_by_name_read_section(const char* file_name, const char* section,
|
||||
struct list* names, struct list* values);
|
||||
|
||||
#endif
|
||||
|
42
common/file_loc.h
Normal file
42
common/file_loc.h
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
xrdp: A Remote Desktop Protocol server.
|
||||
Copyright (C) Jay Sorg 2004-2010
|
||||
|
||||
default file locations for log, config, etc
|
||||
|
||||
*/
|
||||
|
||||
#if !defined(FILE_LOC_H)
|
||||
#define FILE_LOC_H
|
||||
|
||||
#if !defined(XRDP_CFG_PATH)
|
||||
#define XRDP_CFG_PATH "/etc/xrdp"
|
||||
#endif
|
||||
|
||||
#if !defined(XRDP_PID_PATH)
|
||||
#define XRDP_PID_PATH "/var/run"
|
||||
#endif
|
||||
|
||||
#if !defined(XRDP_SBIN_PATH)
|
||||
#define XRDP_SBIN_PATH "/usr/local/sbin"
|
||||
#endif
|
||||
|
||||
#if !defined(XRDP_SHARE_PATH)
|
||||
#define XRDP_SHARE_PATH "/usr/local/share/xrdp"
|
||||
#endif
|
||||
|
||||
#endif
|
100
common/guid.c
100
common/guid.c
@ -1,100 +0,0 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) 2021 Matt Burt, all xrdp contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file common/guid.c
|
||||
* @brief GUID manipulation definitions
|
||||
*/
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include <config_ac.h>
|
||||
#endif
|
||||
|
||||
#include "guid.h"
|
||||
#include "os_calls.h"
|
||||
#include "string_calls.h"
|
||||
|
||||
enum
|
||||
{
|
||||
/* Field offsets in the UUID */
|
||||
E_CLOCK_SEQ_HI_AND_RESERVED = 8,
|
||||
E_TIME_HI_AND_VERSION_MSB = 7,
|
||||
/* UUID versions from RFC4122 section 4.1.3 */
|
||||
E_UUID_VERSION_RANDOM = 4
|
||||
};
|
||||
|
||||
struct guid
|
||||
guid_new(void)
|
||||
{
|
||||
struct guid guid = {0};
|
||||
g_random(guid.g, sizeof(guid.g));
|
||||
/* Show this UUID as conforming to RFC4122 (section 4.1.1) */
|
||||
guid.g[E_CLOCK_SEQ_HI_AND_RESERVED] &= ~0x40; /* Clear bit 6 */
|
||||
guid.g[E_CLOCK_SEQ_HI_AND_RESERVED] |= (char)0x80; /* Set bit 7 */
|
||||
|
||||
guid.g[E_TIME_HI_AND_VERSION_MSB] &= ~0xf0;
|
||||
guid.g[E_TIME_HI_AND_VERSION_MSB] |= (E_UUID_VERSION_RANDOM << 4);
|
||||
|
||||
return guid;
|
||||
}
|
||||
|
||||
void
|
||||
guid_clear(struct guid *guid)
|
||||
{
|
||||
g_memset(&guid->g, '\x00', GUID_SIZE);
|
||||
}
|
||||
|
||||
int
|
||||
guid_is_set(const struct guid *guid)
|
||||
{
|
||||
unsigned int i;
|
||||
int rv = 0;
|
||||
if (guid != NULL)
|
||||
{
|
||||
for (i = 0 ; i < GUID_SIZE; ++i)
|
||||
{
|
||||
if (guid->g[i] != '\x00')
|
||||
{
|
||||
rv = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
||||
}
|
||||
|
||||
const char *guid_to_str(const struct guid *src, char *dest)
|
||||
{
|
||||
const unsigned char *guid = (const unsigned char *)src->g;
|
||||
|
||||
/*
|
||||
* Flipping integers into little-endian
|
||||
* See also: https://devblogs.microsoft.com/oldnewthing/20220928-00/?p=107221
|
||||
*/
|
||||
g_sprintf(dest, "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X",
|
||||
guid[3], guid[2], guid[1], guid[0],
|
||||
guid[5], guid[4],
|
||||
guid[7], guid[6],
|
||||
guid[8], guid[9],
|
||||
guid[10], guid[11], guid[12], guid[13], guid[14], guid[15]);
|
||||
|
||||
return dest;
|
||||
}
|
@ -1,94 +0,0 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Jay Sorg 2004-2021
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file common/guid.h
|
||||
* @brief GUID manipulation declarations
|
||||
*/
|
||||
|
||||
#ifndef GUID_H
|
||||
#define GUID_H
|
||||
|
||||
#include "arch.h"
|
||||
|
||||
#define GUID_SIZE 16 /* bytes */
|
||||
#define GUID_STR_SIZE (GUID_SIZE * 2 + 4 + 1) /* w/ 4 hyphens + null terminator */
|
||||
|
||||
|
||||
/**
|
||||
* Use a struct for the guid so we can easily copy by assignment.
|
||||
* We use an array of char so that
|
||||
* we can compare GUIDs with a straight memcmp()
|
||||
*
|
||||
* Some fields of the GUID are in little-endian-order as specified by
|
||||
* [MS-DTYP]. This is at odds with RFC4122 which specifies big-endian
|
||||
* order for all fields.
|
||||
*
|
||||
* Octets RFC4122 field
|
||||
* ------ -------------
|
||||
* 0-3 time_low (little-endian)
|
||||
* 4-5 time_mid (little-endian)
|
||||
* 6-7 time_hi_and_version (little-endian)
|
||||
* 8 clock_seq_hi_and_reserved
|
||||
* 9 clock_seq_low (in order)
|
||||
* 10-15 node
|
||||
*/
|
||||
struct guid
|
||||
{
|
||||
char g[GUID_SIZE];
|
||||
};
|
||||
|
||||
/**
|
||||
* Get an initialised GUID
|
||||
*
|
||||
* The GUID is compatible with RFC4122 section 4.4.
|
||||
*
|
||||
* @return new GUID
|
||||
*/
|
||||
struct guid guid_new(void);
|
||||
|
||||
/**
|
||||
* Clears an initialised GUID, so guid_is_set() returns true
|
||||
*
|
||||
* @param guid GUID to clear
|
||||
*/
|
||||
void
|
||||
guid_clear(struct guid *guid);
|
||||
|
||||
/**
|
||||
* Checks if a GUID is initialised
|
||||
*
|
||||
* @param guid GUID to check (can be NULL)
|
||||
* @return non-zero if GUID is set
|
||||
*/
|
||||
int
|
||||
guid_is_set(const struct guid *guid);
|
||||
|
||||
/**
|
||||
* Converts a GUID to a string representation
|
||||
*
|
||||
* @param guid GUID to represent
|
||||
* @param dest destionation pointer to at least GUID_STR_SIZE
|
||||
* bytes to store the representation
|
||||
* @return dest is returned for convenience
|
||||
*/
|
||||
const char *guid_to_str(const struct guid *guid, char *dest);
|
||||
|
||||
#endif
|
||||
|
394
common/list.c
394
common/list.c
@ -1,80 +1,47 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Jay Sorg 2004-2014
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* simple list
|
||||
*/
|
||||
/*
|
||||
Copyright (c) 2004-2010 Jay Sorg
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include <config_ac.h>
|
||||
#endif
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
simple list
|
||||
*/
|
||||
|
||||
#include "arch.h"
|
||||
#include "os_calls.h"
|
||||
#include "string_calls.h"
|
||||
#include "list.h"
|
||||
#include "log.h"
|
||||
|
||||
enum
|
||||
/*****************************************************************************/
|
||||
struct list* APP_CC
|
||||
list_create(void)
|
||||
{
|
||||
DEFAULT_LIST_SIZE = 10,
|
||||
DEFAULT_GROW_BY_SIZE = 10
|
||||
};
|
||||
struct list* self;
|
||||
|
||||
/******************************************************************************/
|
||||
struct list *
|
||||
list_create_sized(unsigned int size)
|
||||
{
|
||||
struct list *self;
|
||||
|
||||
if (size < DEFAULT_LIST_SIZE)
|
||||
{
|
||||
size = DEFAULT_LIST_SIZE;
|
||||
}
|
||||
self = (struct list *)calloc(sizeof(struct list), 1);
|
||||
if (self != NULL)
|
||||
{
|
||||
self->items = (tbus *)malloc(sizeof(tbus) * size);
|
||||
if (self->items == NULL)
|
||||
{
|
||||
free(self);
|
||||
self = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
self->grow_by = DEFAULT_GROW_BY_SIZE;
|
||||
self->alloc_size = size;
|
||||
}
|
||||
}
|
||||
self = (struct list*)g_malloc(sizeof(struct list), 1);
|
||||
self->grow_by = 10;
|
||||
self->alloc_size = 10;
|
||||
self->items = (tbus*)g_malloc(sizeof(tbus) * 10, 1);
|
||||
return self;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
struct list *
|
||||
list_create(void)
|
||||
{
|
||||
return list_create_sized(DEFAULT_LIST_SIZE);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
void
|
||||
list_delete(struct list *self)
|
||||
/*****************************************************************************/
|
||||
void APP_CC
|
||||
list_delete(struct list* self)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -82,68 +49,52 @@ list_delete(struct list *self)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (self->auto_free)
|
||||
{
|
||||
for (i = 0; i < self->count; i++)
|
||||
{
|
||||
free((void *)self->items[i]);
|
||||
g_free((void*)self->items[i]);
|
||||
self->items[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
free(self->items);
|
||||
free(self);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
static int
|
||||
grow_list(struct list *self)
|
||||
{
|
||||
int rv = 1;
|
||||
unsigned int new_alloc_size = self->alloc_size + self->grow_by;
|
||||
tbus *p = (tbus *)realloc(self->items, sizeof(tbus) * new_alloc_size);
|
||||
if (p == NULL)
|
||||
{
|
||||
rv = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
self->alloc_size = new_alloc_size;
|
||||
self->items = p;
|
||||
}
|
||||
return rv;
|
||||
g_free(self->items);
|
||||
g_free(self);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int
|
||||
list_add_item(struct list *self, tbus item)
|
||||
void APP_CC
|
||||
list_add_item(struct list* self, tbus item)
|
||||
{
|
||||
if (self->count == self->alloc_size && !grow_list(self))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
tbus* p;
|
||||
int i;
|
||||
|
||||
if (self->count >= self->alloc_size)
|
||||
{
|
||||
i = self->alloc_size;
|
||||
self->alloc_size += self->grow_by;
|
||||
p = (tbus*)g_malloc(sizeof(tbus) * self->alloc_size, 1);
|
||||
g_memcpy(p, self->items, sizeof(tbus) * i);
|
||||
g_free(self->items);
|
||||
self->items = p;
|
||||
}
|
||||
self->items[self->count] = item;
|
||||
self->count++;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
tbus
|
||||
list_get_item(const struct list *self, int index)
|
||||
/*****************************************************************************/
|
||||
tbus APP_CC
|
||||
list_get_item(struct list* self, int index)
|
||||
{
|
||||
if (index < 0 || index >= self->count)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return self->items[index];
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
void
|
||||
list_clear(struct list *self)
|
||||
/*****************************************************************************/
|
||||
void APP_CC
|
||||
list_clear(struct list* self)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -151,20 +102,20 @@ list_clear(struct list *self)
|
||||
{
|
||||
for (i = 0; i < self->count; i++)
|
||||
{
|
||||
free((void *)self->items[i]);
|
||||
g_free((void*)self->items[i]);
|
||||
self->items[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
g_free(self->items);
|
||||
self->count = 0;
|
||||
self->grow_by = DEFAULT_GROW_BY_SIZE;
|
||||
self->alloc_size = DEFAULT_LIST_SIZE;
|
||||
self->items = (tbus *)realloc(self->items, sizeof(tbus) * self->alloc_size);
|
||||
self->grow_by = 10;
|
||||
self->alloc_size = 10;
|
||||
self->items = (tbus*)g_malloc(sizeof(tbus) * 10, 1);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
int
|
||||
list_index_of(struct list *self, tbus item)
|
||||
/*****************************************************************************/
|
||||
int APP_CC
|
||||
list_index_of(struct list* self, tbus item)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -175,13 +126,12 @@ list_index_of(struct list *self, tbus item)
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
void
|
||||
list_remove_item(struct list *self, int index)
|
||||
/*****************************************************************************/
|
||||
void APP_CC
|
||||
list_remove_item(struct list* self, int index)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -189,219 +139,79 @@ list_remove_item(struct list *self, int index)
|
||||
{
|
||||
if (self->auto_free)
|
||||
{
|
||||
free((void *)self->items[index]);
|
||||
g_free((void*)self->items[index]);
|
||||
self->items[index] = 0;
|
||||
}
|
||||
|
||||
for (i = index; i < (self->count - 1); i++)
|
||||
{
|
||||
self->items[i] = self->items[i + 1];
|
||||
}
|
||||
|
||||
self->count--;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
list_insert_item(struct list *self, int index, tbus item)
|
||||
/*****************************************************************************/
|
||||
void APP_CC
|
||||
list_insert_item(struct list* self, int index, tbus item)
|
||||
{
|
||||
tbus* p;
|
||||
int i;
|
||||
|
||||
if (index > self->count)
|
||||
if (index == self->count)
|
||||
{
|
||||
index = self->count;
|
||||
list_add_item(self, item);
|
||||
return;
|
||||
}
|
||||
else if (index < 0)
|
||||
if (index >= 0 && index < self->count)
|
||||
{
|
||||
index = 0;
|
||||
}
|
||||
|
||||
if (self->count == self->alloc_size && !grow_list(self))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Move all the items above this location up one
|
||||
for (i = self->count ; i > index ; --i)
|
||||
{
|
||||
self->items[i] = self->items[i - 1];
|
||||
}
|
||||
|
||||
self->count++;
|
||||
|
||||
if (self->count > self->alloc_size)
|
||||
{
|
||||
i = self->alloc_size;
|
||||
self->alloc_size += self->grow_by;
|
||||
p = (tbus*)g_malloc(sizeof(tbus) * self->alloc_size, 1);
|
||||
g_memcpy(p, self->items, sizeof(tbus) * i);
|
||||
g_free(self->items);
|
||||
self->items = p;
|
||||
}
|
||||
for (i = (self->count - 2); i >= index; i--)
|
||||
{
|
||||
self->items[i + 1] = self->items[i];
|
||||
}
|
||||
self->items[index] = item;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
int
|
||||
list_add_strdup(struct list *self, const char *str)
|
||||
{
|
||||
int rv;
|
||||
char *dup;
|
||||
|
||||
if (str == NULL)
|
||||
{
|
||||
rv = list_add_item(self, (tintptr)str);
|
||||
}
|
||||
else if ((dup = g_strdup(str)) == NULL)
|
||||
{
|
||||
rv = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
rv = list_add_item(self, (tintptr)dup);
|
||||
if (!rv)
|
||||
{
|
||||
g_free(dup);
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
int
|
||||
list_add_strdup_multi(struct list *self, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int entry_count = self->count;
|
||||
const char *s;
|
||||
int rv = 1;
|
||||
|
||||
va_start(ap, self);
|
||||
while ((s = va_arg(ap, const char *)) != NULL)
|
||||
{
|
||||
if (!list_add_strdup(self, s))
|
||||
{
|
||||
rv = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
va_end(ap);
|
||||
|
||||
if (rv == 0)
|
||||
{
|
||||
// Remove the additional items we added
|
||||
while (self->count > entry_count)
|
||||
{
|
||||
list_remove_item(self, self->count - 1);
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
/******************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/* append one list to another using strdup for each item in the list */
|
||||
/* begins copy at start_index, a zero based index on the source list */
|
||||
int
|
||||
list_append_list_strdup(struct list *self, struct list *dest, int start_index)
|
||||
/* begins copy at start_index, a zero based index on the soure list */
|
||||
void APP_CC
|
||||
list_append_list_strdup(struct list* self, struct list* dest, int start_index)
|
||||
{
|
||||
int index;
|
||||
int rv = 1;
|
||||
int entry_dest_count = dest->count;
|
||||
tbus item;
|
||||
char* dup;
|
||||
|
||||
for (index = start_index; index < self->count; index++)
|
||||
{
|
||||
const char *item = (const char *)list_get_item(self, index);
|
||||
if (!list_add_strdup(dest, item))
|
||||
{
|
||||
rv = 0;
|
||||
break;
|
||||
item = list_get_item(self, index);
|
||||
dup = g_strdup((char*)item);
|
||||
list_add_item(dest, (tbus)dup);
|
||||
}
|
||||
}
|
||||
|
||||
if (rv == 0)
|
||||
{
|
||||
// Remove the additional items we added
|
||||
while (dest->count > entry_dest_count)
|
||||
{
|
||||
list_remove_item(dest, dest->count - 1);
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
void
|
||||
list_dump_items(struct list *self)
|
||||
/*****************************************************************************/
|
||||
void APP_CC
|
||||
list_dump_items(struct list* self)
|
||||
{
|
||||
int index;
|
||||
|
||||
if (self->count == 0)
|
||||
{
|
||||
LOG_DEVEL(LOG_LEVEL_TRACE, "List is empty");
|
||||
g_writeln("List is empty");
|
||||
}
|
||||
|
||||
for (index = 0; index < self->count; index++)
|
||||
{
|
||||
LOG_DEVEL(LOG_LEVEL_TRACE, "%d: %p", index, (void *) list_get_item(self, index));
|
||||
g_writeln("%d: %s", index, list_get_item(self, index));
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
split_string_append_fragment(const char **start, const char *end,
|
||||
struct list *list)
|
||||
{
|
||||
unsigned int len = end - *start;
|
||||
// Check for an unexpected terminator in the string
|
||||
const char *term = (const char *)memchr(*start, '\0', len);
|
||||
if (term != NULL)
|
||||
{
|
||||
end = term;
|
||||
len = end - *start;
|
||||
}
|
||||
char *copy = (char *)malloc(len + 1);
|
||||
if (copy == NULL)
|
||||
{
|
||||
list_delete(list);
|
||||
return 0;
|
||||
}
|
||||
g_memcpy(copy, *start, len);
|
||||
copy[len] = '\0';
|
||||
if (!list_add_item(list, (tintptr)copy))
|
||||
{
|
||||
g_free(copy);
|
||||
list_delete(list);
|
||||
return 0;
|
||||
}
|
||||
*start = end + 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
struct list *
|
||||
split_string_into_list(const char *str, char character)
|
||||
{
|
||||
struct list *result = list_create();
|
||||
if (result == NULL)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
result->auto_free = 1;
|
||||
|
||||
if (str == NULL)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
const char *p;
|
||||
while ((p = g_strchr(str, character)) != NULL)
|
||||
{
|
||||
if (!split_string_append_fragment(&str, p, result))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (*str != '\0')
|
||||
{
|
||||
if (!split_string_append_fragment(&str, str + g_strlen(str), result))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
187
common/list.h
187
common/list.h
@ -1,22 +1,26 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Jay Sorg 2004-2014
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* simple list
|
||||
*/
|
||||
/*
|
||||
Copyright (c) 2004-2010 Jay Sorg
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
simple list
|
||||
*/
|
||||
|
||||
#if !defined(LIST_H)
|
||||
#define LIST_H
|
||||
@ -26,137 +30,32 @@
|
||||
/* list */
|
||||
struct list
|
||||
{
|
||||
tintptr *items;
|
||||
tbus* items;
|
||||
int count;
|
||||
int alloc_size;
|
||||
int grow_by;
|
||||
int auto_free;
|
||||
};
|
||||
|
||||
struct list *
|
||||
struct list* APP_CC
|
||||
list_create(void);
|
||||
/**
|
||||
* Creates a list with at least the specified number of items
|
||||
* reserved
|
||||
* @param size Number of items to reserve
|
||||
* @return list, or NULL if no memory
|
||||
*/
|
||||
struct list *
|
||||
list_create_sized(unsigned int size);
|
||||
void
|
||||
list_delete(struct list *self);
|
||||
/**
|
||||
* Adds an item to a list
|
||||
* @param self The list
|
||||
* @param item The item to add
|
||||
* @result 0 if a memory allocation failure occurred. In this
|
||||
* case the item is not added
|
||||
*
|
||||
* Memory allocation failures will not occur if the list is
|
||||
* sized appropriately when created.
|
||||
*/
|
||||
int
|
||||
list_add_item(struct list *self, tintptr item);
|
||||
tintptr
|
||||
list_get_item(const struct list *self, int index);
|
||||
void
|
||||
list_clear(struct list *self);
|
||||
int
|
||||
list_index_of(struct list *self, tintptr item);
|
||||
void
|
||||
list_remove_item(struct list *self, int index);
|
||||
/**
|
||||
* Inserts an item into a list
|
||||
* @param self The list
|
||||
* @param index The location to insert the item before
|
||||
* @param item The item to add
|
||||
* @result 0 if a memory allocation failure occurred. In this
|
||||
* case the item is not added
|
||||
*
|
||||
* Memory allocation failures will not occur if the list is
|
||||
* sized appropriately when created.
|
||||
*/
|
||||
int
|
||||
list_insert_item(struct list *self, int index, tintptr item);
|
||||
/**
|
||||
* Adds strings to a list from another list
|
||||
* @param self The source list
|
||||
* @param dest Destination list
|
||||
* @param start_index Index to start on the source list (zero based)
|
||||
*
|
||||
* @result 0 if a memory allocation failure occurred. In this
|
||||
* case the destination list is unaltered.
|
||||
*
|
||||
* Strings from the source list are copied with strdup()
|
||||
* The dest list should have auto_free set, or memory leaks will occur
|
||||
*/
|
||||
int
|
||||
list_append_list_strdup(struct list *self, struct list *dest, int start_index);
|
||||
void
|
||||
list_dump_items(struct list *self);
|
||||
|
||||
/**
|
||||
* Appends a string fragment to a list
|
||||
* @param[in,out] start Pointer to start of fragment (by reference)
|
||||
* @param end Pointer to one past end of fragment
|
||||
* @param list List to append to
|
||||
* @result 1 for success
|
||||
*
|
||||
* In the event of a memory failure, 0 is returned and the list is deleted.
|
||||
*/
|
||||
int
|
||||
split_string_append_fragment(const char **start, const char *end,
|
||||
struct list *list);
|
||||
|
||||
/**
|
||||
* Splits a string on a separation character and then returns a list of
|
||||
* the string split by the character, without the character contained within
|
||||
* the pieces.
|
||||
*
|
||||
* The list must be disposed of by the caller.
|
||||
*
|
||||
* @param str String to split.
|
||||
* @param character Character used as the delimiter between strings.
|
||||
* @param start_index Index to start on the source list (zero based)
|
||||
*
|
||||
* @result 0 if a memory allocation failure occurred.
|
||||
*
|
||||
* String fragments in the list are created with strdup()
|
||||
*/
|
||||
struct list *
|
||||
split_string_into_list(const char *str, char character);
|
||||
|
||||
/**
|
||||
* As list_add_item() but for a C string
|
||||
*
|
||||
* This is a convenience function for a common operation
|
||||
* @param self List to append to
|
||||
* @param str String to append
|
||||
*
|
||||
* The passed-in string is strdup'd onto the list, so if auto_free
|
||||
* isn't set, memory leaks will occur.
|
||||
*
|
||||
* A NULL pointer will be added as a NULL entry.
|
||||
*
|
||||
* @result 0 if any memory allocation failure occurred. In this case
|
||||
* the list is unchanged.
|
||||
*/
|
||||
|
||||
int
|
||||
list_add_strdup(struct list *self, const char *str);
|
||||
|
||||
/**
|
||||
* Add multiple strings to a list
|
||||
*
|
||||
* This is a convenience function for a common operation
|
||||
* @param self List to append to
|
||||
* @param ... Strings to append. Terminate the list with a NULL.
|
||||
*
|
||||
* @result 0 if any memory allocation failure occurred. In this case
|
||||
* the list is unchanged.
|
||||
*/
|
||||
|
||||
int
|
||||
list_add_strdup_multi(struct list *self, ...);
|
||||
void APP_CC
|
||||
list_delete(struct list* self);
|
||||
void APP_CC
|
||||
list_add_item(struct list* self, tbus item);
|
||||
tbus APP_CC
|
||||
list_get_item(struct list* self, int index);
|
||||
void APP_CC
|
||||
list_clear(struct list* self);
|
||||
int APP_CC
|
||||
list_index_of(struct list* self, tbus item);
|
||||
void APP_CC
|
||||
list_remove_item(struct list* self, int index);
|
||||
void APP_CC
|
||||
list_insert_item(struct list* self, int index, tbus item);
|
||||
void APP_CC
|
||||
list_append_list_strdup(struct list* self, struct list* dest, int start_index);
|
||||
void APP_CC
|
||||
list_dump_items(struct list* self);
|
||||
|
||||
#endif
|
||||
|
192
common/list16.c
192
common/list16.c
@ -1,192 +0,0 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Jay Sorg 2004-2014
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* simple list
|
||||
*/
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include <config_ac.h>
|
||||
#endif
|
||||
|
||||
#include "arch.h"
|
||||
#include "os_calls.h"
|
||||
#include "list16.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
struct list16 *
|
||||
list16_create(void)
|
||||
{
|
||||
struct list16 *self;
|
||||
|
||||
self = (struct list16 *)g_malloc(sizeof(struct list16), 0);
|
||||
list16_init(self);
|
||||
return self;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void
|
||||
list16_delete(struct list16 *self)
|
||||
{
|
||||
if (self == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
list16_deinit(self);
|
||||
g_free(self);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void
|
||||
list16_init(struct list16 *self)
|
||||
{
|
||||
g_memset(self, 0, sizeof(struct list16));
|
||||
self->max_count = 4;
|
||||
self->items = self->mitems;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void
|
||||
list16_deinit(struct list16 *self)
|
||||
{
|
||||
if (self->items != self->mitems)
|
||||
{
|
||||
g_free(self->items);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void
|
||||
list16_add_item(struct list16 *self, tui16 item)
|
||||
{
|
||||
tui16 *p;
|
||||
int i;
|
||||
|
||||
if (self->count >= self->max_count)
|
||||
{
|
||||
i = self->max_count;
|
||||
self->max_count += 4;
|
||||
p = (tui16 *)g_malloc(sizeof(tui16) * self->max_count, 1);
|
||||
g_memcpy(p, self->items, sizeof(tui16) * i);
|
||||
if (self->items != self->mitems)
|
||||
{
|
||||
g_free(self->items);
|
||||
}
|
||||
self->items = p;
|
||||
}
|
||||
|
||||
self->items[self->count] = item;
|
||||
self->count++;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
tui16
|
||||
list16_get_item(struct list16 *self, int index)
|
||||
{
|
||||
if (index < 0 || index >= self->count)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return self->items[index];
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void
|
||||
list16_clear(struct list16 *self)
|
||||
{
|
||||
if (self->items != self->mitems)
|
||||
{
|
||||
g_free(self->items);
|
||||
}
|
||||
self->count = 0;
|
||||
self->max_count = 4;
|
||||
self->items = self->mitems;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int
|
||||
list16_index_of(struct list16 *self, tui16 item)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < self->count; i++)
|
||||
{
|
||||
if (self->items[i] == item)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void
|
||||
list16_remove_item(struct list16 *self, int index)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (index >= 0 && index < self->count)
|
||||
{
|
||||
for (i = index; i < (self->count - 1); i++)
|
||||
{
|
||||
self->items[i] = self->items[i + 1];
|
||||
}
|
||||
|
||||
self->count--;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void
|
||||
list16_insert_item(struct list16 *self, int index, tui16 item)
|
||||
{
|
||||
tui16 *p;
|
||||
int i;
|
||||
|
||||
if (index == self->count)
|
||||
{
|
||||
list16_add_item(self, item);
|
||||
return;
|
||||
}
|
||||
|
||||
if (index >= 0 && index < self->count)
|
||||
{
|
||||
self->count++;
|
||||
|
||||
if (self->count > self->max_count)
|
||||
{
|
||||
i = self->max_count;
|
||||
self->max_count += 4;
|
||||
p = (tui16 *)g_malloc(sizeof(tui16) * self->max_count, 1);
|
||||
g_memcpy(p, self->items, sizeof(tui16) * i);
|
||||
if (self->items != self->mitems)
|
||||
{
|
||||
g_free(self->items);
|
||||
}
|
||||
self->items = p;
|
||||
}
|
||||
|
||||
for (i = (self->count - 2); i >= index; i--)
|
||||
{
|
||||
self->items[i + 1] = self->items[i];
|
||||
}
|
||||
|
||||
self->items[index] = item;
|
||||
}
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Jay Sorg 2004-2014
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* simple list
|
||||
*/
|
||||
|
||||
#if !defined(LIST16_H)
|
||||
#define LIST16_H
|
||||
|
||||
#include "arch.h"
|
||||
|
||||
/* list */
|
||||
struct list16
|
||||
{
|
||||
tui16 *items;
|
||||
int count;
|
||||
int max_count;
|
||||
tui16 mitems[4];
|
||||
};
|
||||
|
||||
struct list16 *
|
||||
list16_create(void);
|
||||
void
|
||||
list16_delete(struct list16 *self);
|
||||
void
|
||||
list16_init(struct list16 *self);
|
||||
void
|
||||
list16_deinit(struct list16 *self);
|
||||
void
|
||||
list16_add_item(struct list16 *self, tui16 item);
|
||||
tui16
|
||||
list16_get_item(struct list16 *self, int index);
|
||||
void
|
||||
list16_clear(struct list16 *self);
|
||||
int
|
||||
list16_index_of(struct list16 *self, tui16 item);
|
||||
void
|
||||
list16_remove_item(struct list16 *self, int index);
|
||||
void
|
||||
list16_insert_item(struct list16 *self, int index, tui16 item);
|
||||
|
||||
#endif
|
1012
common/log.c
1012
common/log.c
File diff suppressed because it is too large
Load Diff
404
common/log.h
404
common/log.h
@ -1,20 +1,25 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Jay Sorg 2004-2014
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
Copyright (c) 2005-2012 Jay Sorg
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef LOG_H
|
||||
#define LOG_H
|
||||
@ -22,30 +27,18 @@
|
||||
#include <pthread.h>
|
||||
|
||||
#include "arch.h"
|
||||
#include "defines.h"
|
||||
#include "list.h"
|
||||
|
||||
/* Check the config_ac.h file is included so we know whether to enable the
|
||||
* development macros
|
||||
*/
|
||||
#ifndef CONFIG_AC_H
|
||||
# error config_ac.h not visible in log.h
|
||||
#endif
|
||||
|
||||
/* logging buffer size */
|
||||
#define LOG_BUFFER_SIZE 8192
|
||||
#define LOGGER_NAME_SIZE 50
|
||||
#define LOG_BUFFER_SIZE 1024
|
||||
|
||||
/* logging levels */
|
||||
enum logLevels
|
||||
{
|
||||
LOG_LEVEL_ALWAYS = 0,
|
||||
LOG_LEVEL_ERROR, /* for describing non-recoverable error states in a request or method */
|
||||
LOG_LEVEL_WARNING, /* for describing recoverable error states in a request or method */
|
||||
LOG_LEVEL_INFO, /* for low verbosity and high level descriptions of normal operations */
|
||||
LOG_LEVEL_DEBUG, /* for medium verbosity and low level descriptions of normal operations */
|
||||
LOG_LEVEL_TRACE, /* for high verbosity and low level descriptions of normal operations (eg. method or wire tracing) */
|
||||
LOG_LEVEL_NEVER,
|
||||
LOG_LEVEL_ERROR,
|
||||
LOG_LEVEL_WARNING,
|
||||
LOG_LEVEL_INFO,
|
||||
LOG_LEVEL_DEBUG
|
||||
};
|
||||
|
||||
/* startup return values */
|
||||
@ -61,160 +54,30 @@ enum logReturns
|
||||
};
|
||||
|
||||
#define SESMAN_CFG_LOGGING "Logging"
|
||||
#define SESMAN_CFG_LOGGING_LOGGER "LoggingPerLogger"
|
||||
#define SESMAN_CFG_LOG_FILE "LogFile"
|
||||
#define SESMAN_CFG_LOG_LEVEL "LogLevel"
|
||||
#define SESMAN_CFG_LOG_ENABLE_CONSOLE "EnableConsole"
|
||||
#define SESMAN_CFG_LOG_CONSOLE_LEVEL "ConsoleLevel"
|
||||
#define SESMAN_CFG_LOG_ENABLE_SYSLOG "EnableSyslog"
|
||||
#define SESMAN_CFG_LOG_SYSLOG_LEVEL "SyslogLevel"
|
||||
#define SESMAN_CFG_LOG_ENABLE_PID "EnableProcessId"
|
||||
|
||||
/* enable threading */
|
||||
/*#define LOG_ENABLE_THREAD*/
|
||||
|
||||
#ifdef USE_DEVEL_LOGGING
|
||||
|
||||
#define LOG_PER_LOGGER_LEVEL
|
||||
|
||||
/**
|
||||
* @brief Logging macro for messages that are for an XRDP developer to
|
||||
* understand and debug XRDP code.
|
||||
*
|
||||
* Note: all log levels are relevant to help a developer understand XRDP at
|
||||
* different levels of granularity.
|
||||
*
|
||||
* Note: the logging function calls are removed when USE_DEVEL_LOGGING is
|
||||
* NOT defined.
|
||||
*
|
||||
* Note: when the build is configured with --enable-devel-logging, then
|
||||
* the log level can be configured per the source file name or method name
|
||||
* (with the suffix "()") in the [LoggingPerLogger]
|
||||
* section of the configuration file.
|
||||
*
|
||||
* For example:
|
||||
* ```
|
||||
* [LoggingPerLogger]
|
||||
* xrdp.c=DEBUG
|
||||
* main()=WARNING
|
||||
* ```
|
||||
*
|
||||
* @param lvl, the log level
|
||||
* @param msg, the log text as a printf format c-string
|
||||
* @param ... the arguments for the printf format c-string
|
||||
*/
|
||||
#define LOG_DEVEL(log_level, args...) \
|
||||
log_message_with_location(__func__, __FILE__, __LINE__, log_level, args)
|
||||
|
||||
/**
|
||||
* @brief Logging macro for messages that are for a system administrator to
|
||||
* configure and run XRDP on their machine.
|
||||
*
|
||||
* Note: the logging function calls contain additional code location info when
|
||||
* USE_DEVEL_LOGGING is defined.
|
||||
*
|
||||
* @param lvl, the log level
|
||||
* @param msg, the log text as a printf format c-string
|
||||
* @param ... the arguments for the printf format c-string
|
||||
*/
|
||||
#define LOG(log_level, args...) \
|
||||
log_message_with_location(__func__, __FILE__, __LINE__, log_level, args)
|
||||
|
||||
/**
|
||||
* @brief Logging macro for logging the contents of a byte array using a hex
|
||||
* dump format.
|
||||
*
|
||||
* Note: the logging function calls are removed when USE_DEVEL_LOGGING is
|
||||
* NOT defined.
|
||||
*
|
||||
* @param log_level, the log level
|
||||
* @param message, a message prefix for the hex dump. Note: no printf like
|
||||
* formatting is done to this message.
|
||||
* @param buffer, a pointer to the byte array to log as a hex dump
|
||||
* @param length, the length of the byte array to log
|
||||
*/
|
||||
#define LOG_DEVEL_HEXDUMP(log_level, message, buffer, length) \
|
||||
log_hexdump_with_location(__func__, __FILE__, __LINE__, log_level, message, buffer, length)
|
||||
|
||||
/**
|
||||
* @brief Logging macro for logging the contents of a byte array using a hex
|
||||
* dump format.
|
||||
*
|
||||
* @param log_level, the log level
|
||||
* @param message, a message prefix for the hex dump. Note: no printf like
|
||||
* formatting is done to this message.
|
||||
* @param buffer, a pointer to the byte array to log as a hex dump
|
||||
* @param length, the length of the byte array to log
|
||||
*/
|
||||
#define LOG_HEXDUMP(log_level, message, buffer, length) \
|
||||
log_hexdump_with_location(__func__, __FILE__, __LINE__, log_level, message, buffer, length)
|
||||
|
||||
#define LOG_DEVEL_LEAKING_FDS(exe,min,max) log_devel_leaking_fds(exe,min,max)
|
||||
|
||||
#ifdef DEBUG
|
||||
#define LOG_DBG(args...) log_message(LOG_LEVEL_DEBUG, args);
|
||||
#else
|
||||
#define LOG(log_level, args...) log_message(log_level, args)
|
||||
#define LOG_HEXDUMP(log_level, message, buffer, length) \
|
||||
log_hexdump(log_level, message, buffer, length)
|
||||
|
||||
/* Since log_message() returns a value ensure that the elided versions of
|
||||
* LOG_DEVEL and LOG_DEVEL_HEXDUMP also "fake" returning the success value
|
||||
*/
|
||||
#define LOG_DEVEL(log_level, args...) UNUSED_VAR(LOG_STARTUP_OK)
|
||||
#define LOG_DEVEL_HEXDUMP(log_level, message, buffer, length) UNUSED_VAR(LOG_STARTUP_OK)
|
||||
|
||||
#define LOG_DEVEL_LEAKING_FDS(exe,min,max)
|
||||
#endif
|
||||
|
||||
/* Flags values for log_start() */
|
||||
|
||||
/**
|
||||
* Dump the log config on startup
|
||||
*/
|
||||
#define LOG_START_DUMP_CONFIG (1<<0)
|
||||
|
||||
/**
|
||||
* Restart the logging system.
|
||||
*
|
||||
* On a restart, existing files are not closed. This is because the
|
||||
* files may be shared by sub-processes, and the result will not be what the
|
||||
* user expects
|
||||
*/
|
||||
#define LOG_START_RESTART (1<<1)
|
||||
|
||||
#ifdef LOG_PER_LOGGER_LEVEL
|
||||
enum log_logger_type
|
||||
{
|
||||
LOG_TYPE_FILE = 0,
|
||||
LOG_TYPE_FUNCTION,
|
||||
};
|
||||
|
||||
struct log_logger_level
|
||||
{
|
||||
enum logLevels log_level;
|
||||
enum log_logger_type logger_type;
|
||||
char logger_name[LOGGER_NAME_SIZE + 1];
|
||||
};
|
||||
#define LOG_DBG(args...)
|
||||
#endif
|
||||
|
||||
struct log_config
|
||||
{
|
||||
const char *program_name; /* Pointer to static storage */
|
||||
char *log_file; /* Dynamically allocated */
|
||||
char* program_name;
|
||||
char* log_file;
|
||||
int fd;
|
||||
enum logLevels log_level;
|
||||
int enable_console;
|
||||
enum logLevels console_level;
|
||||
unsigned int log_level;
|
||||
int enable_syslog;
|
||||
enum logLevels syslog_level;
|
||||
#ifdef LOG_PER_LOGGER_LEVEL
|
||||
struct list *per_logger_level;
|
||||
#endif
|
||||
int dump_on_start;
|
||||
int enable_pid;
|
||||
#ifdef LOG_ENABLE_THREAD
|
||||
unsigned int syslog_level;
|
||||
pthread_mutex_t log_lock;
|
||||
pthread_mutexattr_t log_lock_attr;
|
||||
#endif
|
||||
};
|
||||
|
||||
/* internal functions, only used in log.c if this ifdef is defined.*/
|
||||
@ -223,12 +86,12 @@ struct log_config
|
||||
/**
|
||||
*
|
||||
* @brief Starts the logging subsystem
|
||||
* @param l_cfg logging system configuration
|
||||
* @param l_cfg loggging system configuration
|
||||
* @return
|
||||
*
|
||||
*/
|
||||
enum logReturns
|
||||
internal_log_start(struct log_config *l_cfg);
|
||||
enum logReturns DEFAULT_CC
|
||||
internal_log_start(struct log_config* l_cfg);
|
||||
|
||||
/**
|
||||
*
|
||||
@ -236,16 +99,16 @@ internal_log_start(struct log_config *l_cfg);
|
||||
* @param l_cfg pointer to the logging subsystem to stop
|
||||
*
|
||||
*/
|
||||
enum logReturns
|
||||
internal_log_end(struct log_config *l_cfg);
|
||||
enum logReturns DEFAULT_CC
|
||||
internal_log_end(struct log_config* l_cfg);
|
||||
|
||||
/**
|
||||
* Converts a log level to a string
|
||||
* @param lvl, the loglevel
|
||||
* @param str pointer where the string will be stored.
|
||||
*/
|
||||
void
|
||||
internal_log_lvl2str(const enum logLevels lvl, char *str);
|
||||
void DEFAULT_CC
|
||||
internal_log_lvl2str(const enum logLevels lvl, char* str);
|
||||
|
||||
/**
|
||||
*
|
||||
@ -254,181 +117,76 @@ internal_log_lvl2str(const enum logLevels lvl, char *str);
|
||||
* @return The corresponding level or LOG_LEVEL_DEBUG if error
|
||||
*
|
||||
*/
|
||||
enum logLevels
|
||||
internal_log_text2level(const char *buf);
|
||||
enum logLevels DEFAULT_CC
|
||||
internal_log_text2level(char* s);
|
||||
|
||||
/**
|
||||
* A function that init our struct that holds all state and
|
||||
* also init its content.
|
||||
* @return LOG_STARTUP_OK or LOG_ERROR_MALLOC
|
||||
*/
|
||||
struct log_config *
|
||||
enum logReturns DEFAULT_CC
|
||||
internalInitAndAllocStruct(void);
|
||||
|
||||
/**
|
||||
* Print the contents of the logging config to stdout.
|
||||
*/
|
||||
void
|
||||
internal_log_config_dump(struct log_config *config);
|
||||
|
||||
/**
|
||||
* the log function that all files use to log an event.
|
||||
* @param lvl, the loglevel
|
||||
* @param override_destination_level, if true then the destination log level is not used
|
||||
* @param override_log_level, the loglevel instead of the destination log level if override_destination_level is true
|
||||
* @param msg, the logtext.
|
||||
* @param ap, the values for the message format arguments
|
||||
* Read configuration from a file and store the values in lists.
|
||||
* @param file
|
||||
* @param lc
|
||||
* @param param_n
|
||||
* @param param_v
|
||||
* @param applicationName, the application name used in the log events.
|
||||
* @return
|
||||
*/
|
||||
enum logReturns
|
||||
internal_log_message(const enum logLevels lvl,
|
||||
const bool_t override_destination_level,
|
||||
const enum logLevels override_log_level,
|
||||
const char *msg,
|
||||
va_list ap);
|
||||
|
||||
/**
|
||||
* @param log_level, the log level
|
||||
* @param override_destination_level, if true then the destination log level is ignored.
|
||||
* @param override_log_level, the log level to use instead of the destination log level
|
||||
* if override_destination_level is true
|
||||
* @return true if at least one log destination will accept a message logged at the given level.
|
||||
*/
|
||||
bool_t
|
||||
internal_log_is_enabled_for_level(const enum logLevels log_level,
|
||||
const bool_t override_destination_level,
|
||||
const enum logLevels override_log_level);
|
||||
|
||||
/**
|
||||
* @param function_name, the function name (typically the __func__ macro)
|
||||
* @param file_name, the file name (typically the __FILE__ macro)
|
||||
* @param[out] log_level_return, the log level to use instead of the destination log level
|
||||
* @return true if the logger location overrides the destination log levels
|
||||
*/
|
||||
bool_t
|
||||
internal_log_location_overrides_level(const char *function_name,
|
||||
const char *file_name,
|
||||
enum logLevels *log_level_return);
|
||||
|
||||
enum logReturns DEFAULT_CC
|
||||
internal_config_read_logging(int file, struct log_config* lc,
|
||||
struct list* param_n,
|
||||
struct list* param_v,
|
||||
const char *applicationName);
|
||||
/*End of internal functions*/
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This function initialize the log facilities according to the configuration
|
||||
* file, that is described by the in parameter.
|
||||
* @param iniFile
|
||||
* @param applicationName the name that is used in the log for the running
|
||||
* application
|
||||
* @param flags Flags to affect the operation of the call
|
||||
* @param applicationName, the name that is used in the log for the running application
|
||||
* @return LOG_STARTUP_OK on success
|
||||
*/
|
||||
enum logReturns
|
||||
log_start(const char *iniFile, const char *applicationName,
|
||||
unsigned int flags);
|
||||
enum logReturns DEFAULT_CC
|
||||
log_start(const char* iniFile, const char* applicationName);
|
||||
|
||||
/**
|
||||
* An alternative log_start where the caller gives the params directly.
|
||||
* @param config
|
||||
* @return
|
||||
*
|
||||
* @post to avoid memory leaks, the config argument must be free'ed using
|
||||
* `log_config_free()`
|
||||
*/
|
||||
enum logReturns
|
||||
log_start_from_param(const struct log_config *src_log_config);
|
||||
|
||||
/**
|
||||
* Sets up a suitable log config for writing to the console only
|
||||
* (i.e. for a utility)
|
||||
*
|
||||
* The config can be customised by the caller before calling
|
||||
* log_start_from_param()
|
||||
*
|
||||
* @param Default log level
|
||||
* @param Log level name, or NULL. This can be used to provide an
|
||||
* override to the default log level, by environment variable or
|
||||
* argument.
|
||||
*
|
||||
* @return pointer to struct log_config.
|
||||
*/
|
||||
struct log_config *
|
||||
log_config_init_for_console(enum logLevels lvl, const char *override_name);
|
||||
|
||||
/**
|
||||
* Read configuration from a file and store the values in the returned
|
||||
* log_config.
|
||||
* @param file
|
||||
* @param applicationName, the application name used in the log events.
|
||||
* @param section_prefix, prefix for the logging sections to parse
|
||||
* @param iniParams
|
||||
* @return
|
||||
*/
|
||||
struct log_config *
|
||||
log_config_init_from_config(const char *iniFilename,
|
||||
const char *applicationName,
|
||||
const char *section_prefix);
|
||||
|
||||
/**
|
||||
* Free the memory for the log_config struct.
|
||||
*/
|
||||
enum logReturns
|
||||
log_config_free(struct log_config *config);
|
||||
|
||||
enum logReturns DEFAULT_CC
|
||||
log_start_from_param(const struct log_config *iniParams);
|
||||
/**
|
||||
* Function that terminates all logging
|
||||
* @return
|
||||
*/
|
||||
enum logReturns
|
||||
enum logReturns DEFAULT_CC
|
||||
log_end(void);
|
||||
|
||||
/**
|
||||
* the log function that all files use to log an event.
|
||||
*
|
||||
* Please prefer to use the LOG and LOG_DEVEL macros instead of this function directly.
|
||||
*
|
||||
* @param lvl, the loglevel
|
||||
* @param msg, the logtext.
|
||||
* @param ...
|
||||
* @return
|
||||
*/
|
||||
enum logReturns
|
||||
log_message(const enum logLevels lvl, const char *msg, ...) printflike(2, 3);
|
||||
|
||||
enum logReturns
|
||||
log_hexdump(const enum logLevels log_level,
|
||||
const char *msg,
|
||||
const char *p,
|
||||
int len);
|
||||
enum logReturns DEFAULT_CC
|
||||
log_message(const enum logLevels lvl, const char* msg, ...);
|
||||
|
||||
/**
|
||||
* the log function that all files use to log an event,
|
||||
* with the function name and file line.
|
||||
*
|
||||
* Please prefer to use the LOG and LOG_DEVEL macros instead of this function directly.
|
||||
* @brief Reads configuration
|
||||
* @param s translates the strings "1", "true" and "yes" in 1 (true) and
|
||||
* other strings in 0
|
||||
* @return 0 on success, 1 on failure
|
||||
*
|
||||
* @param function_name, the function name (typically the __func__ macro)
|
||||
* @param file_name, the file name (typically the __FILE__ macro)
|
||||
* @param line_number, the line number in the file (typically the __LINE__ macro)
|
||||
* @param lvl, the loglevel
|
||||
* @param msg, the logtext.
|
||||
* @param ...
|
||||
* @return
|
||||
*/
|
||||
enum logReturns
|
||||
log_message_with_location(const char *function_name,
|
||||
const char *file_name,
|
||||
const int line_number,
|
||||
const enum logLevels lvl,
|
||||
const char *msg,
|
||||
...) printflike(5, 6);
|
||||
|
||||
enum logReturns
|
||||
log_hexdump_with_location(const char *function_name,
|
||||
const char *file_name,
|
||||
const int line_number,
|
||||
const enum logLevels log_level,
|
||||
const char *msg,
|
||||
const char *p,
|
||||
int len);
|
||||
int APP_CC text2bool(char* s);
|
||||
|
||||
/**
|
||||
* This function returns the configured file name for the logfile
|
||||
@ -437,28 +195,4 @@ log_hexdump_with_location(const char *function_name,
|
||||
* @return
|
||||
*/
|
||||
char *getLogFile(char *replybuf, int bufsize);
|
||||
|
||||
/**
|
||||
* Returns formatted datetime for log
|
||||
* @return
|
||||
*/
|
||||
char *getFormattedDateTime(char *replybuf, int bufsize);
|
||||
|
||||
#ifdef USE_DEVEL_LOGGING
|
||||
/**
|
||||
* Log open file descriptors not cloexec before execing another program
|
||||
*
|
||||
* Used to ensure file descriptors aren't leaking when running
|
||||
* non-privileged executables
|
||||
*
|
||||
* Use the LOG_DEVEL_LEAKING_FDS() macro to invoke this function
|
||||
*
|
||||
* @param exe Executable we're about to launch
|
||||
* @param min Minimum FD to consider
|
||||
* @param max Maximum FD to consider + 1, or -1 for no upper FD
|
||||
*/
|
||||
void
|
||||
log_devel_leaking_fds(const char *exe, int min, int max);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -1,43 +0,0 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* MS-ERREF : Definitions from [MS-ERREF]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* References to MS-ERREF are currently correct for v20180912 of that
|
||||
* document
|
||||
*/
|
||||
|
||||
#if !defined(MS_ERREF_H)
|
||||
#define MS_ERREF_H
|
||||
|
||||
/*
|
||||
* NTSTATUS codes (section 2.3)
|
||||
*/
|
||||
enum NTSTATUS
|
||||
{
|
||||
STATUS_SUCCESS = 0x00000000,
|
||||
|
||||
STATUS_NO_MORE_FILES = 0x80000006,
|
||||
|
||||
STATUS_UNSUCCESSFUL = 0xc0000001,
|
||||
STATUS_NO_SUCH_FILE = 0xc000000f,
|
||||
STATUS_ACCESS_DENIED = 0xc0000022,
|
||||
STATUS_OBJECT_NAME_INVALID = 0xc0000033,
|
||||
STATUS_OBJECT_NAME_NOT_FOUND = 0xc0000034,
|
||||
STATUS_SHARING_VIOLATION = 0xc0000043,
|
||||
STATUS_NOT_SUPPORTED = 0xc00000bb
|
||||
};
|
||||
|
||||
#endif /* MS_ERREF_H */
|
@ -1,64 +0,0 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* MS-FSCC : Definitions from [MS-FSCC]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* References to MS-FSCC are currently correct for v20190923 of that
|
||||
* document
|
||||
*/
|
||||
|
||||
#if !defined(MS_FSCC_H)
|
||||
#define MS_FSCC_H
|
||||
|
||||
/*
|
||||
* File system ioctl codes (section 2.3)
|
||||
*/
|
||||
#define FSCTL_DELETE_OBJECT_ID 0x900a0
|
||||
|
||||
/*
|
||||
* File information classes (section 2.4)
|
||||
*/
|
||||
enum FS_INFORMATION_CLASS
|
||||
{
|
||||
FileAllocationInformation = 19, /* Set */
|
||||
FileBasicInformation = 4, /* Query, Set */
|
||||
FileBothDirectoryInformation = 3, /* Query */
|
||||
FileDirectoryInformation = 1, /* Query */
|
||||
FileDispositionInformation = 13, /* Set */
|
||||
FileEndOfFileInformation = 20, /* Set */
|
||||
FileFullDirectoryInformation = 2, /* Query */
|
||||
FileNamesInformation = 12, /* Query */
|
||||
FileRenameInformation = 10, /* Set */
|
||||
FileStandardInformation = 5 /* Query */
|
||||
};
|
||||
|
||||
/*
|
||||
* Size of structs above without trailing RESERVED fields (MS-RDPEFS
|
||||
* 2.2.3.3.8)
|
||||
*/
|
||||
#define FILE_BASIC_INFORMATION_SIZE 36
|
||||
#define FILE_STD_INFORMATION_SIZE 22
|
||||
#define FILE_END_OF_FILE_INFORMATION_SIZE 8
|
||||
|
||||
/* Windows file attributes (section 2.6) */
|
||||
#define W_FILE_ATTRIBUTE_DIRECTORY 0x00000010
|
||||
#define W_FILE_ATTRIBUTE_READONLY 0x00000001
|
||||
#define W_FILE_ATTRIBUTE_SYSTEM 0x00000004
|
||||
#define W_FILE_ATTRIBUTE_NORMAL 0x00000080
|
||||
|
||||
#endif /* MS_FSCC_H */
|
||||
|
||||
|
||||
|
@ -1,601 +0,0 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* MS-RDPBCGR : Definitions from [MS-RDPBCGR]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* References to MS-RDPBCGR are currently correct for v20190923 of that
|
||||
* document
|
||||
*/
|
||||
|
||||
#if !defined(MS_RDPBCGR_H)
|
||||
#define MS_RDPBCGR_H
|
||||
|
||||
/* RDP Security Negotiation codes */
|
||||
#define RDP_NEG_REQ 0x01 /* MS-RDPBCGR 2.2.1.1.1 */
|
||||
#define RDP_NEG_RSP 0x02 /* MS-RDPBCGR 2.2.1.2.1 */
|
||||
#define RDP_NEG_FAILURE 0x03 /* MS-RDPBCGR 2.2.1.2.2 */
|
||||
#define RDP_CORRELATION_INFO 0x06 /* MS-RDPBCGR 2.2.1.1.2 */
|
||||
|
||||
/* Protocol types codes (2.2.1.1.1, 2.2.1.2.1) */
|
||||
#define PROTOCOL_RDP 0x00000000
|
||||
#define PROTOCOL_SSL 0x00000001
|
||||
#define PROTOCOL_HYBRID 0x00000002
|
||||
#define PROTOCOL_RDSTLS 0x00000004
|
||||
#define PROTOCOL_HYBRID_EX 0x00000008
|
||||
|
||||
/* Negotiation packet flags (2.2.1.2.1) */
|
||||
#define EXTENDED_CLIENT_DATA_SUPPORTED 0x01
|
||||
#define DYNVC_GFX_PROTOCOL_SUPPORTED 0x02
|
||||
#define NEGRSP_RESERVED 0x04
|
||||
#define RESTRICTED_ADMIN_MODE_SUPPORTED 0x08
|
||||
#define REDIRECTED_AUTHENTICATION_MODE_SUPPORTED 0x10
|
||||
|
||||
/* RDP Negotiation Failure Codes (2.2.1.2.2) */
|
||||
#define SSL_REQUIRED_BY_SERVER 0x00000001
|
||||
#define SSL_NOT_ALLOWED_BY_SERVER 0x00000002
|
||||
#define SSL_CERT_NOT_ON_SERVER 0x00000003
|
||||
#define INCONSISTENT_FLAGS 0x00000004
|
||||
#define HYBRID_REQUIRED_BY_SERVER 0x00000005
|
||||
#define SSL_WITH_USER_AUTH_REQUIRED_BY_SERVER 0x00000006
|
||||
|
||||
/* TS_UD_HEADER: type ((2.2.1.3.1) */
|
||||
/* TODO: to be renamed */
|
||||
#define SEC_TAG_CLI_INFO 0xc001 /* CS_CORE? */
|
||||
#define SEC_TAG_CLI_CRYPT 0xc002 /* CS_SECURITY? */
|
||||
#define SEC_TAG_CLI_CHANNELS 0xc003 /* CS_CHANNELS? */
|
||||
#define SEC_TAG_CLI_4 0xc004 /* CS_CLUSTER? */
|
||||
#define SEC_TAG_CLI_MONITOR 0xc005 /* CS_MONITOR */
|
||||
#define SEC_TAG_CLI_MONITOR_EX 0xc008 /* CS_MONITOR_EX */
|
||||
#define SEC_TAG_SRV_INFO 0x0c01 /* SC_CORE */
|
||||
#define SEC_TAG_SRV_CRYPT 0x0c02 /* SC_SECURITY */
|
||||
#define SEC_TAG_SRV_CHANNELS 0x0c03 /* SC_NET? */
|
||||
|
||||
|
||||
/* Client Core Data: colorDepth, postBeta2ColorDepth (2.2.1.3.2) */
|
||||
#define RNS_UD_COLOR_4BPP 0xCA00
|
||||
#define RNS_UD_COLOR_8BPP 0xCA01
|
||||
#define RNS_UD_COLOR_16BPP_555 0xCA02
|
||||
#define RNS_UD_COLOR_16BPP_565 0xCA03
|
||||
#define RNS_UD_COLOR_24BPP 0xCA04
|
||||
|
||||
/* Client Core Data: supportedColorDepths (2.2.1.3.2) */
|
||||
#define RNS_UD_24BPP_SUPPORT 0x0001
|
||||
#define RNS_UD_16BPP_SUPPORT 0x0002
|
||||
#define RNS_UD_15BPP_SUPPORT 0x0004
|
||||
#define RNS_UD_32BPP_SUPPORT 0x0008
|
||||
|
||||
/* Client Core Data: earlyCapabilityFlags (2.2.1.3.2) */
|
||||
#define RNS_UD_CS_WANT_32BPP_SESSION 0x0002
|
||||
#define RNS_UD_CS_SUPPORT_MONITOR_LAYOUT_PDU 0x0040
|
||||
#define RNS_UD_CS_SUPPORT_DYNVC_GFX_PROTOCOL 0x0100
|
||||
#define RNS_UD_CS_SUPPORT_SKIP_CHANNELJOIN 0x0800
|
||||
|
||||
/* Client Core Data: connectionType (2.2.1.3.2) */
|
||||
#define CONNECTION_TYPE_MODEM 0x01
|
||||
#define CONNECTION_TYPE_BROADBAND_LOW 0x02
|
||||
#define CONNECTION_TYPE_SATELLITE 0x03
|
||||
#define CONNECTION_TYPE_BROADBAND_HIGH 0x04
|
||||
#define CONNECTION_TYPE_WAN 0x05
|
||||
#define CONNECTION_TYPE_LAN 0x06
|
||||
#define CONNECTION_TYPE_AUTODETECT 0x07
|
||||
|
||||
/* TS_UD_CS_NET (2.2.1.3.4) */
|
||||
/* This isn't explicitly named in MS-RDPBCGR */
|
||||
#define MAX_STATIC_CHANNELS 31
|
||||
|
||||
/* Channel definition structure CHANNEL_DEF (2.2.1.3.4.1) */
|
||||
#define CHANNEL_NAME_LEN 7
|
||||
/* These names are also not explicitly defined in MS-RDPBCGR */
|
||||
#define CLIPRDR_SVC_CHANNEL_NAME "cliprdr"
|
||||
#define DRDYNVC_SVC_CHANNEL_NAME "drdynvc"
|
||||
#define RAIL_SVC_CHANNEL_NAME "rail"
|
||||
#define RDPSND_SVC_CHANNEL_NAME "rdpsnd"
|
||||
#define RDPDR_SVC_CHANNEL_NAME "rdpdr"
|
||||
|
||||
/* 2.2.1.3.6 Client Monitor Data */
|
||||
/* monitorCount (4 bytes): A 32-bit, unsigned integer. The number of display */
|
||||
/* monitor definitions in the monitorDefArray field (the maximum allowed is 16). */
|
||||
#define CLIENT_MONITOR_DATA_MAXIMUM_MONITORS 16
|
||||
|
||||
/* 2.2.1.3.6 Client Monitor Data */
|
||||
/* The maximum width of the virtual desktop resulting from the union of the monitors */
|
||||
/* contained in the monitorDefArray field MUST NOT exceed 32,766 pixels. Similarly, */
|
||||
/* the maximum height of the virtual desktop resulting from the union of the monitors */
|
||||
/* contained in the monitorDefArray field MUST NOT exceed 32,766 pixels. */
|
||||
/* The minimum permitted size of the virtual desktop is 200 x 200 pixels. */
|
||||
#define CLIENT_MONITOR_DATA_MINIMUM_VIRTUAL_DESKTOP_WIDTH 0xC8 // 200
|
||||
#define CLIENT_MONITOR_DATA_MINIMUM_VIRTUAL_DESKTOP_HEIGHT 0xC8 // 200
|
||||
#define CLIENT_MONITOR_DATA_MAXIMUM_VIRTUAL_DESKTOP_WIDTH 0x7FFE // 32766
|
||||
#define CLIENT_MONITOR_DATA_MAXIMUM_VIRTUAL_DESKTOP_HEIGHT 0x7FFE // 32766
|
||||
|
||||
/* 2.2.1.3.6.1 Monitor Definition (TS_MONITOR_DEF) */
|
||||
#define TS_MONITOR_PRIMARY 0x00000001
|
||||
|
||||
/* Options field */
|
||||
/* NOTE: XR_ prefixed to avoid conflict with FreeRDP */
|
||||
#define XR_CHANNEL_OPTION_INITIALIZED 0x80000000
|
||||
#define XR_CHANNEL_OPTION_ENCRYPT_RDP 0x40000000
|
||||
#define XR_CHANNEL_OPTION_ENCRYPT_SC 0x20000000
|
||||
#define XR_CHANNEL_OPTION_ENCRYPT_CS 0x10000000
|
||||
#define XR_CHANNEL_OPTION_PRI_HIGH 0x08000000
|
||||
#define XR_CHANNEL_OPTION_PRI_MED 0x04000000
|
||||
#define XR_CHANNEL_OPTION_PRI_LOW 0x02000000
|
||||
#define XR_CHANNEL_OPTION_COMPRESS_RDP 0x00800000
|
||||
#define XR_CHANNEL_OPTION_COMPRESS 0x00400000
|
||||
#define XR_CHANNEL_OPTION_SHOW_PROTOCOL 0x00200000
|
||||
#define REMOTE_CONTROL_PERSISTENT 0x00100000
|
||||
|
||||
/* Server earlyCapabilityFlags (2.2.1.4.2) */
|
||||
#define RNS_UD_SC_SKIP_CHANNELJOIN_SUPPORTED 0x00000008
|
||||
|
||||
/* Server Proprietary Certificate (2.2.1.4.3.1.1) */
|
||||
/* TODO: to be renamed */
|
||||
#define SEC_TAG_PUBKEY 0x0006 /* BB_RSA_KEY_BLOB */
|
||||
#define SEC_TAG_KEYSIG 0x0008 /* BB_SIGNATURE_KEY_BLOB */
|
||||
|
||||
/* Info Packet (TS_INFO_PACKET): flags (2.2.1.11.1.1) */
|
||||
/* TODO: to be renamed */
|
||||
#define RDP_LOGON_AUTO 0x0008
|
||||
#define RDP_LOGON_NORMAL 0x0033
|
||||
#define RDP_COMPRESSION 0x0080
|
||||
#define RDP_LOGON_BLOB 0x0100
|
||||
#define RDP_LOGON_LEAVE_AUDIO 0x2000
|
||||
#define RDP_LOGON_RAIL 0x8000
|
||||
|
||||
/* Extended Info Packet: clientAddress (2.2.1.11.1.1.1) */
|
||||
#define EXTENDED_INFO_MAX_CLIENT_ADDR_LENGTH 80
|
||||
|
||||
/* Extended Info Packet: performanceFlags (2.2.1.11.1.1.1) */
|
||||
/* TODO: to be renamed */
|
||||
#define RDP5_DISABLE_NOTHING 0x00
|
||||
#define RDP5_NO_WALLPAPER 0x01
|
||||
#define RDP5_NO_FULLWINDOWDRAG 0x02
|
||||
#define RDP5_NO_MENUANIMATIONS 0x04
|
||||
#define RDP5_NO_THEMING 0x08
|
||||
#define RDP5_NO_CURSOR_SHADOW 0x20
|
||||
#define RDP5_NO_CURSORSETTINGS 0x40 /* disables cursor blinking */
|
||||
|
||||
/* LICENSE_PREAMBLE (2.2.1.12.1.1) */
|
||||
#define ERROR_ALERT 0xff
|
||||
#define PREAMBLE_VERSION_3_0 0x03
|
||||
|
||||
/* LICENSE_BINARY_BLOB (2.2.1.12.1.2) */
|
||||
#define BB_ERROR_BLOB 0x0004
|
||||
|
||||
/* LICENSE_ERROR_MESSAGE (2.2.1.12.1.3) */
|
||||
#define STATUS_VALID_CLIENT 0x00000007
|
||||
#define ST_NO_TRANSITION 0x00000002
|
||||
|
||||
/* Maps to generalCapabilitySet in T.128 page 138 */
|
||||
|
||||
/* Capability Set: capabilitySetType (2.2.1.13.1.1.1) */
|
||||
#define CAPSTYPE_GENERAL 0x0001
|
||||
#define CAPSTYPE_GENERAL_LEN 0x18
|
||||
|
||||
#define CAPSTYPE_BITMAP 0x0002
|
||||
#define CAPSTYPE_BITMAP_LEN 0x1C
|
||||
|
||||
#define CAPSTYPE_ORDER 0x0003
|
||||
#define CAPSTYPE_ORDER_LEN 0x58
|
||||
#define ORDER_CAP_NEGOTIATE 2 /* NEGOTIATEORDERSUPPORT? not used */
|
||||
#define ORDER_CAP_NOSUPPORT 4 /* not used */
|
||||
|
||||
#define CAPSTYPE_BITMAPCACHE 0x0004
|
||||
#define CAPSTYPE_BITMAPCACHE_LEN 0x28
|
||||
|
||||
#define CAPSTYPE_CONTROL 0x0005
|
||||
#define CAPSTYPE_CONTROL_LEN 0x0C
|
||||
|
||||
#define CAPSTYPE_ACTIVATION 0x0007
|
||||
#define CAPSTYPE_ACTIVATION_LEN 0x0C
|
||||
|
||||
#define CAPSTYPE_POINTER 0x0008
|
||||
#define CAPSTYPE_POINTER_LEN 0x0a
|
||||
#define CAPSTYPE_POINTER_MONO_LEN 0x08
|
||||
|
||||
#define CAPSTYPE_SHARE 0x0009
|
||||
#define CAPSTYPE_SHARE_LEN 0x08
|
||||
|
||||
#define CAPSTYPE_COLORCACHE 0x000A
|
||||
#define CAPSTYPE_COLORCACHE_LEN 0x08
|
||||
|
||||
#define CAPSTYPE_SOUND 0x000C
|
||||
|
||||
#define CAPSTYPE_INPUT 0x000D
|
||||
#define CAPSTYPE_INPUT_LEN 0x58
|
||||
|
||||
#define CAPSTYPE_FONT 0x000E
|
||||
#define CAPSTYPE_FONT_LEN 0x04
|
||||
|
||||
#define CAPSTYPE_BRUSH 0x000F
|
||||
#define CAPSTYPE_BRUSH_LEN 0x08
|
||||
|
||||
#define CAPSTYPE_GLYPHCACHE 0x0010
|
||||
#define CAPSTYPE_OFFSCREENCACHE 0x0011
|
||||
|
||||
#define CAPSTYPE_BITMAPCACHE_HOSTSUPPORT 0x0012
|
||||
#define CAPSTYPE_BITMAPCACHE_HOSTSUPPORT_LEN 0x08
|
||||
|
||||
#define CAPSTYPE_BITMAPCACHE_REV2 0x0013
|
||||
#define CAPSTYPE_BITMAPCACHE_REV2_LEN 0x28
|
||||
#define BMPCACHE2_FLAG_PERSIST ((long)1<<31)
|
||||
|
||||
#define CAPSTYPE_VIRTUALCHANNEL 0x0014
|
||||
#define CAPSTYPE_VIRTUALCHANNEL_LEN 0x08
|
||||
|
||||
#define CAPSTYPE_DRAWNINGRIDCACHE 0x0015
|
||||
#define CAPSTYPE_DRAWGDIPLUS 0x0016
|
||||
#define CAPSTYPE_RAIL 0x0017
|
||||
#define CAPSTYPE_WINDOW 0x0018
|
||||
|
||||
#define CAPSSETTYPE_COMPDESK 0x0019
|
||||
#define CAPSSETTYPE_COMPDESK_LEN 0x06
|
||||
|
||||
#define CAPSSETTYPE_MULTIFRAGMENTUPDATE 0x001A
|
||||
#define CAPSSETTYPE_MULTIFRAGMENTUPDATE_LEN 0x08
|
||||
|
||||
#define CAPSETTYPE_LARGE_POINTER 0x001B
|
||||
#define CAPSETTYPE_LARGE_POINTER_LEN 0x06
|
||||
|
||||
#define CAPSETTYPE_SURFACE_COMMANDS 0x001C
|
||||
#define CAPSETTYPE_SURFACE_COMMANDS_LEN 0x0C
|
||||
|
||||
#define CAPSSETTYPE_BITMAP_CODECS 0x001D
|
||||
#define CAPSSETTYPE_BITMAP_CODECS_LEN 0x1C
|
||||
|
||||
#define CAPSTYPE_FRAME_ACKNOWLEDGE 0x001E
|
||||
#define CAPSTYPE_FRAME_ACKNOWLEDGE_LEN 0x08
|
||||
|
||||
/* Control PDU Data: action (2.2.1.15.1) */
|
||||
/* TODO: to be renamed */
|
||||
#define RDP_CTL_REQUEST_CONTROL 1 /* CTRLACTION_REQUEST_CONTROL */
|
||||
#define RDP_CTL_GRANT_CONTROL 2
|
||||
#define RDP_CTL_DETACH 3
|
||||
#define RDP_CTL_COOPERATE 4
|
||||
|
||||
/* RDP5 disconnect PDU */
|
||||
/* Set Error Info PDU Data: errorInfo (2.2.5.1.1) */
|
||||
/* TODO: to be renamed */
|
||||
#define exDiscReasonNoInfo 0x0000
|
||||
#define exDiscReasonAPIInitiatedDisconnect 0x0001
|
||||
#define exDiscReasonAPIInitiatedLogoff 0x0002
|
||||
#define exDiscReasonServerIdleTimeout 0x0003
|
||||
#define exDiscReasonServerLogonTimeout 0x0004
|
||||
#define exDiscReasonReplacedByOtherConnection 0x0005
|
||||
#define exDiscReasonOutOfMemory 0x0006
|
||||
#define exDiscReasonServerDeniedConnection 0x0007
|
||||
#define exDiscReasonServerDeniedConnectionFips 0x0008
|
||||
#define exDiscReasonLicenseInternal 0x0100
|
||||
#define exDiscReasonLicenseNoLicenseServer 0x0101
|
||||
#define exDiscReasonLicenseNoLicense 0x0102
|
||||
#define exDiscReasonLicenseErrClientMsg 0x0103
|
||||
#define exDiscReasonLicenseHwidDoesntMatchLicense 0x0104
|
||||
#define exDiscReasonLicenseErrClientLicense 0x0105
|
||||
#define exDiscReasonLicenseCantFinishProtocol 0x0106
|
||||
#define exDiscReasonLicenseClientEndedProtocol 0x0107
|
||||
#define exDiscReasonLicenseErrClientEncryption 0x0108
|
||||
#define exDiscReasonLicenseCantUpgradeLicense 0x0109
|
||||
#define exDiscReasonLicenseNoRemoteConnections 0x010a
|
||||
|
||||
/* Virtual channel PDU (2.2.6.1) */
|
||||
#define CHANNEL_CHUNK_LENGTH 1600
|
||||
|
||||
/* Channel PDU Header flags (2.2.6.1.1) */
|
||||
/* NOTE: XR_ prefixed to avoid conflict with FreeRDP */
|
||||
#define XR_CHANNEL_FLAG_FIRST 0x00000001
|
||||
#define XR_CHANNEL_FLAG_LAST 0x00000002
|
||||
#define XR_CHANNEL_FLAG_SHOW_PROTOCOL 0x00000010
|
||||
|
||||
/* General Capability Set: osMajorType (2.2.7.1.1) */
|
||||
#define OSMAJORTYPE_UNSPECIFIED 0x0000
|
||||
#define OSMAJORTYPE_WINDOWS 0x0001
|
||||
#define OSMAJORTYPE_OS2 0x0002
|
||||
#define OSMAJORTYPE_MACINTOSH 0x0003
|
||||
#define OSMAJORTYPE_UNIX 0x0004
|
||||
#define OSMAJORTYPE_IOS 0x0005
|
||||
#define OSMAJORTYPE_OSX 0x0006
|
||||
#define OSMAJORTYPE_ANDROID 0x0007
|
||||
#define OSMAJORTYPE_CHROME_OS 0x0008
|
||||
|
||||
/* General Capability Set: osMinorType (2.2.7.1.1) */
|
||||
#define OSMINORTYPE_UNSPECIFIED 0x0000
|
||||
#define OSMINORTYPE_WINDOWS_31X 0x0001
|
||||
#define OSMINORTYPE_WINDOWS_95 0x0002
|
||||
#define OSMINORTYPE_WINDOWS_NT 0x0003
|
||||
#define OSMINORTYPE_OS2_V21 0x0004
|
||||
#define OSMINORTYPE_POWER_PC 0x0005
|
||||
#define OSMINORTYPE_MACINTOSH 0x0006
|
||||
#define OSMINORTYPE_NATIVE_XSERVER 0x0007
|
||||
#define OSMINORTYPE_PSEUDO_XSERVER 0x0008
|
||||
#define OSMINORTYPE_WINDOWS_RT 0x0009
|
||||
|
||||
/* General Capability Set: protocolVersion (2.2.7.1.1) */
|
||||
#define TS_CAPS_PROTOCOLVERSION 0x0200
|
||||
|
||||
/* General Capability Set: extraFlags (2.2.7.1.1) */
|
||||
#define FASTPATH_OUTPUT_SUPPORTED 0x0001
|
||||
#define NO_BITMAP_COMPRESSION_HDR 0x0400
|
||||
#define LONG_CREDENTIALS_SUPPORTED 0x0004
|
||||
#define AUTORECONNECT_SUPPORTED 0x0008
|
||||
#define ENC_SALTED_CHECKSUM 0x0010
|
||||
|
||||
/* Order Capability Set: orderSupportExFlags (2.2.7.1.3) */
|
||||
/* NOTE: XR_ prefixed to avoid conflict with FreeRDP */
|
||||
#define XR_ORDERFLAGS_EX_CACHE_BITMAP_REV3_SUPPORT 0x0002
|
||||
#define XR_ORDERFLAGS_EX_ALTSEC_FRAME_MARKER_SUPPORT 0x0004
|
||||
|
||||
/* Order Capability Set: orderFlags (2.2.7.1.3) */
|
||||
#define NEGOTIATEORDERSUPPORT 0x0002
|
||||
#define ZEROBOUNDSDELTASUPPORT 0x0008
|
||||
#define COLORINDEXSUPPORT 0x0020
|
||||
#define SOLIDPATTERNBRUSHONLY 0x0040
|
||||
#define ORDERFLAGS_EXTRA_FLAGS 0x0080
|
||||
|
||||
/* Order Capability Set: orderSupport (2.2.7.1.3) */
|
||||
#define TS_NEG_DSTBLT_INDEX 0x00
|
||||
#define TS_NEG_PATBLT_INDEX 0x01
|
||||
#define TS_NEG_SCRBLT_INDEX 0x02
|
||||
#define TS_NEG_MEMBLT_INDEX 0x03
|
||||
#define TS_NEG_MEM3BLT_INDEX 0x04
|
||||
/* 0x05 */
|
||||
/* 0x06 */
|
||||
#define TS_NEG_DRAWNINEGRID_INDEX 0x07
|
||||
#define TS_NEG_LINETO_INDEX 0x08
|
||||
#define TS_NEG_MULTI_DRAWNINEGRID_INDEX 0x09
|
||||
/* 0x0A */
|
||||
#define TS_NEG_SAVEBITMAP_INDEX 0x0B
|
||||
/* 0x0C */
|
||||
/* 0x0D */
|
||||
/* 0x0E */
|
||||
#define TS_NEG_MULTIDSTBLT_INDEX 0x0F
|
||||
#define TS_NEG_MULTIPATBLT_INDEX 0x10
|
||||
#define TS_NEG_MULTISCRBLT_INDEX 0x11
|
||||
#define TS_NEG_MULTIOPAQUERECT_INDEX 0x12
|
||||
#define TS_NEG_FAST_INDEX_INDEX 0x13
|
||||
#define TS_NEG_POLYGON_SC_INDEX 0x14
|
||||
#define TS_NEG_POLYGON_CB_INDEX 0x15
|
||||
#define TS_NEG_POLYLINE_INDEX 0x16
|
||||
/* 0x17 */
|
||||
#define TS_NEG_FAST_GLYPH_INDEX 0x18
|
||||
#define TS_NEG_ELLIPSE_SC_INDEX 0x19
|
||||
#define TS_NEG_ELLIPSE_CB_INDEX 0x1A
|
||||
#define TS_NEG_INDEX_INDEX 0x1B
|
||||
/* 0x1C */
|
||||
/* 0x1D */
|
||||
/* 0x1E */
|
||||
/* 0x1F */
|
||||
|
||||
/* Input Capability Set: inputFlags (2.2.7.1.6) */
|
||||
#define INPUT_FLAG_SCANCODES 0x0001
|
||||
#define INPUT_FLAG_MOUSEX 0x0004
|
||||
#define INPUT_FLAG_FASTPATH_INPUT 0x0008
|
||||
#define INPUT_FLAG_UNICODE 0x0010
|
||||
#define INPUT_FLAG_FASTPATH_INPUT2 0x0020
|
||||
#define INPUT_FLAG_UNUSED1 0x0040
|
||||
#define INPUT_FLAG_UNUSED2 0x0080
|
||||
#define TS_INPUT_FLAG_MOUSE_HWHEEL 0x0100
|
||||
#define TS_INPUT_FLAG_QOE_TIMESTAMPS 0x0200
|
||||
|
||||
/* Glyph Cache Capability Set: GlyphSupportLevel (2.2.7.1.8) */
|
||||
#define GLYPH_SUPPORT_NONE 0x0000
|
||||
#define GLYPH_SUPPORT_PARTIAL 0x0001
|
||||
#define GLYPH_SUPPORT_FULL 0x0002
|
||||
#define GLYPH_SUPPORT_ENCODE 0x0003
|
||||
|
||||
/* Desktop Composition Capability Set: CompDeskSupportLevel (2.2.7.2.8) */
|
||||
#define COMPDESK_NOT_SUPPORTED 0x0000
|
||||
#define COMPDESK_SUPPORTED 0x0001
|
||||
|
||||
/* Surface Commands Capability Set: cmdFlags (2.2.7.2.9) */
|
||||
#define SURFCMDS_SETSURFACEBITS 0x00000002
|
||||
#define SURFCMDS_FRAMEMARKER 0x00000010
|
||||
#define SURFCMDS_STREAMSUFRACEBITS 0x00000040
|
||||
|
||||
/* Bitmap Codec: codecGUID (2.2.7.2.10.1.1) */
|
||||
|
||||
/* CODEC_GUID_NSCODEC CA8D1BB9-000F-154F-589F-AE2D1A87E2D6 */
|
||||
#define XR_CODEC_GUID_NSCODEC \
|
||||
"\xb9\x1b\x8d\xca\x0f\x00\x4f\x15\x58\x9f\xae\x2d\x1a\x87\xe2\xd6"
|
||||
|
||||
/* CODEC_GUID_REMOTEFX 76772F12-BD72-4463-AFB3-B73C9C6F7886 */
|
||||
#define XR_CODEC_GUID_REMOTEFX \
|
||||
"\x12\x2F\x77\x76\x72\xBD\x63\x44\xAF\xB3\xB7\x3C\x9C\x6F\x78\x86"
|
||||
|
||||
/* CODEC_GUID_IMAGE_REMOTEFX 2744CCD4-9D8A-4E74-803C-0ECBEEA19C54 */
|
||||
#define XR_CODEC_GUID_IMAGE_REMOTEFX \
|
||||
"\xD4\xCC\x44\x27\x8A\x9D\x74\x4E\x80\x3C\x0E\xCB\xEE\xA1\x9C\x54"
|
||||
|
||||
/* MFVideoFormat_H264 34363248-0000-0010-8000-00AA00389B71 */
|
||||
#define XR_CODEC_GUID_H264 \
|
||||
"\x48\x32\x36\x34\x00\x00\x10\x00\x80\x00\x00\xAA\x00\x38\x9B\x71"
|
||||
|
||||
/* CODEC_GUID_JPEG 1BAF4CE6-9EED-430C-869A-CB8B37B66237 */
|
||||
#define XR_CODEC_GUID_JPEG \
|
||||
"\xE6\x4C\xAF\x1B\xED\x9E\x0C\x43\x86\x9A\xCB\x8B\x37\xB6\x62\x37"
|
||||
|
||||
/* CODEC_GUID_PNG 0E0C858D-28E0-45DB-ADAA-0F83E57CC560 */
|
||||
#define XR_CODEC_GUID_PNG \
|
||||
"\x8D\x85\x0C\x0E\xE0\x28\xDB\x45\xAD\xAA\x0F\x83\xE5\x7C\xC5\x60"
|
||||
|
||||
/* CODEC_GUID_IGNORE 0C4351A6-3535-42AE-910C-CDFCE5760B58 */
|
||||
#define XR_CODEC_GUID_IGNORE \
|
||||
"\xA6\x51\x43\x0C\x35\x35\xAE\x42\x91\x0C\xCD\xFC\xE5\x76\x0B\x58"
|
||||
|
||||
/* PDU Types (2.2.8.1.1.1.1) */
|
||||
#define PDUTYPE_DEMANDACTIVEPDU 0x1
|
||||
#define PDUTYPE_CONFIRMACTIVEPDU 0x3
|
||||
#define PDUTYPE_DEACTIVATEALLPDU 0x6
|
||||
#define PDUTYPE_DATAPDU 0x7
|
||||
#define PDUTYPE_SERVER_REDIR_PKT 0xA
|
||||
|
||||
#define PDUTYPE_TO_STR(pdu_type) \
|
||||
((pdu_type) == PDUTYPE_DEMANDACTIVEPDU ? "PDUTYPE_DEMANDACTIVEPDU" : \
|
||||
(pdu_type) == PDUTYPE_CONFIRMACTIVEPDU ? "PDUTYPE_CONFIRMACTIVEPDU" : \
|
||||
(pdu_type) == PDUTYPE_DEACTIVATEALLPDU ? "PDUTYPE_DEACTIVATEALLPDU" : \
|
||||
(pdu_type) == PDUTYPE_DATAPDU ? "PDUTYPE_DATAPDU" : \
|
||||
(pdu_type) == PDUTYPE_SERVER_REDIR_PKT ? "PDUTYPE_SERVER_REDIR_PKT" : \
|
||||
"unknown" \
|
||||
)
|
||||
|
||||
/* Share Data Header: pduType2 (2.2.8.1.1.1.2) */
|
||||
/* TODO: to be renamed */
|
||||
#define RDP_DATA_PDU_UPDATE 2 /* PDUTYPE2_UPDATE */
|
||||
#define RDP_DATA_PDU_CONTROL 20
|
||||
#define RDP_DATA_PDU_POINTER 27
|
||||
#define RDP_DATA_PDU_INPUT 28
|
||||
#define RDP_DATA_PDU_SYNCHRONISE 31
|
||||
#define PDUTYPE2_REFRESH_RECT 33
|
||||
#define RDP_DATA_PDU_PLAY_SOUND 34
|
||||
#define PDUTYPE2_SUPPRESS_OUTPUT 35
|
||||
#define PDUTYPE2_SHUTDOWN_REQUEST 36
|
||||
#define PDUTYPE2_SHUTDOWN_DENIED 37
|
||||
#define RDP_DATA_PDU_LOGON 38
|
||||
#define RDP_DATA_PDU_FONT2 39
|
||||
#define RDP_DATA_PDU_DISCONNECT 47
|
||||
#define PDUTYPE2_MONITOR_LAYOUT_PDU 55
|
||||
|
||||
/* TS_SECURITY_HEADER: flags (2.2.8.1.1.2.1) */
|
||||
#define SEC_EXCHANGE_PKT 0x0001
|
||||
#define SEC_ENCRYPT 0x0008
|
||||
#define SEC_INFO_PKT 0x0040
|
||||
#define SEC_LICENSE_PKT 0x0080
|
||||
#define SEC_LICENSE_ENCRYPT_CS 0x0280
|
||||
|
||||
/* Slow-Path Input Event: messageType (2.2.8.1.1.3.1.1) */
|
||||
/* TODO: to be renamed */
|
||||
#define RDP_INPUT_SYNCHRONIZE 0
|
||||
#define RDP_INPUT_CODEPOINT 1
|
||||
#define RDP_INPUT_VIRTKEY 2
|
||||
#define RDP_INPUT_SCANCODE 4
|
||||
#define RDP_INPUT_UNICODE 5
|
||||
#define RDP_INPUT_MOUSE 0x8001
|
||||
#define RDP_INPUT_MOUSEX 0x8002
|
||||
|
||||
/* Keyboard Event: keyboardFlags (2.2.8.1.1.3.1.1.1) */
|
||||
#define KBDFLAGS_EXTENDED 0x0100
|
||||
#define KBDFLAGS_EXTENDED1 0x0200
|
||||
#define KBDFLAGS_DOWN 0x4000
|
||||
#define KBDFLAGS_RELEASE 0x8000
|
||||
|
||||
/* Mouse Event: pointerFlags (2.2.8.1.1.3.1.1.3) */
|
||||
#define PTRFLAGS_HWHEEL 0x0400
|
||||
#define PTRFLAGS_WHEEL 0x0200
|
||||
#define PTRFLAGS_WHEEL_NEGATIVE 0x0100
|
||||
#define WheelRotationMask 0x01FF
|
||||
#define PTRFLAGS_MOVE 0x0800
|
||||
#define PTRFLAGS_DOWN 0x8000
|
||||
#define PTRFLAGS_BUTTON1 0x1000
|
||||
#define PTRFLAGS_BUTTON2 0x2000
|
||||
#define PTRFLAGS_BUTTON3 0x4000
|
||||
|
||||
/* Extended Mouse Event: pointerFlags (2.2.8.1.1.3.1.1.4) */
|
||||
#define PTRXFLAGS_DOWN 0x8000
|
||||
#define PTRXFLAGS_BUTTON1 0x0001
|
||||
#define PTRXFLAGS_BUTTON2 0x0002
|
||||
|
||||
/* Synchronize Event: toggleFlags (2.2.8.1.1.3.1.1.5) */
|
||||
#define TS_SYNC_SCROLL_LOCK 0x0001
|
||||
#define TS_SYNC_NUM_LOCK 0x0002
|
||||
#define TS_SYNC_CAPS_LOCK 0x0004
|
||||
#define TS_SYNC_KANA_LOCK 0x0008
|
||||
|
||||
/* Client Fast-Path Input Event PDU 2.2.8.1.2 */
|
||||
#define FASTPATH_INPUT_ENCRYPTED 0x2
|
||||
|
||||
/* Fast-Path Input Event: eventCode (2.2.8.1.2.2) */
|
||||
#define FASTPATH_INPUT_EVENT_SCANCODE 0x0
|
||||
#define FASTPATH_INPUT_EVENT_MOUSE 0x1
|
||||
#define FASTPATH_INPUT_EVENT_MOUSEX 0x2
|
||||
#define FASTPATH_INPUT_EVENT_SYNC 0x3
|
||||
#define FASTPATH_INPUT_EVENT_UNICODE 0x4
|
||||
#define FASTPATH_INPUT_EVENT_QOE_TIMESTAMP 0x6
|
||||
|
||||
/* Fast-Path Keyboard Event: eventHeader (2.2.8.1.2.2.1) */
|
||||
#define FASTPATH_INPUT_KBDFLAGS_RELEASE 0x01
|
||||
#define FASTPATH_INPUT_KBDFLAGS_EXTENDED 0x02
|
||||
#define FASTPATH_INPUT_KBDFLAGS_EXTENDED1 0x04
|
||||
|
||||
/* Slow-Path Graphics Update: updateType (2.2.9.1.1.3.1) */
|
||||
/* TODO: to be renamed */
|
||||
#define RDP_UPDATE_ORDERS 0
|
||||
#define RDP_UPDATE_BITMAP 1
|
||||
#define RDP_UPDATE_PALETTE 2
|
||||
#define RDP_UPDATE_SYNCHRONIZE 3
|
||||
|
||||
#define GRAPHICS_UPDATE_TYPE_TO_STR(type) \
|
||||
((type) == RDP_UPDATE_ORDERS ? "RDP_UPDATE_ORDERS" : \
|
||||
(type) == RDP_UPDATE_BITMAP ? "RDP_UPDATE_BITMAP" : \
|
||||
(type) == RDP_UPDATE_PALETTE ? "RDP_UPDATE_PALETTE" : \
|
||||
(type) == RDP_UPDATE_SYNCHRONIZE ? "RDP_UPDATE_SYNCHRONIZE" : \
|
||||
"unknown" \
|
||||
)
|
||||
|
||||
/* Server Pointer Update PDU: messageType (2.2.9.1.1.4) */
|
||||
/* TODO: to be renamed */
|
||||
#define RDP_POINTER_SYSTEM 1 /* TS_PTRMSGTYPE_SYSTEM */
|
||||
#define RDP_POINTER_MOVE 3
|
||||
#define RDP_POINTER_COLOR 6
|
||||
#define RDP_POINTER_CACHED 7
|
||||
#define RDP_POINTER_POINTER 8
|
||||
|
||||
/* System Pointer Update: systemPointerType (2.2.9.1.1.4.3) */
|
||||
#define RDP_NULL_POINTER 0
|
||||
#define RDP_DEFAULT_POINTER 0x7F00
|
||||
|
||||
/* Server Fast-Path Update PDU: action (2.2.9.1.2) */
|
||||
#define FASTPATH_OUTPUT_ACTION_FASTPATH 0x0
|
||||
#define FASTPATH_OUTPUT_ACTION_X224 0x3
|
||||
|
||||
/* Server Fast-Path Update PDU: flags (2.2.9.1.2) */
|
||||
#define FASTPATH_OUTPUT_SECURE_CHECKSUM 0x1
|
||||
#define FASTPATH_OUTPUT_ENCRYPTED 0x2
|
||||
|
||||
/* Fast-Path Update: updateCode (2.2.9.1.2.1) */
|
||||
#define FASTPATH_UPDATETYPE_ORDERS 0x0
|
||||
#define FASTPATH_UPDATETYPE_BITMAP 0x1
|
||||
#define FASTPATH_UPDATETYPE_PALETTE 0x2
|
||||
#define FASTPATH_UPDATETYPE_SYNCHRONIZE 0x3
|
||||
#define FASTPATH_UPDATETYPE_SURFCMDS 0x4
|
||||
#define FASTPATH_UPDATETYPE_PTR_NULL 0x5
|
||||
#define FASTPATH_UPDATETYPE_PTR_DEFAULT 0x6
|
||||
#define FASTPATH_UPDATETYPE_PTR_POSITION 0x8
|
||||
#define FASTPATH_UPDATETYPE_COLOR 0x9
|
||||
#define FASTPATH_UPDATETYPE_CACHED 0xA
|
||||
#define FASTPATH_UPDATETYPE_POINTER 0xB
|
||||
|
||||
/* Fast-Path Update: fragmentation (2.2.9.1.2.1) */
|
||||
#define FASTPATH_FRAGMENT_SINGLE 0x0
|
||||
#define FASTPATH_FRAGMENT_LAST 0x1
|
||||
#define FASTPATH_FRAGMENT_FIRST 0x2
|
||||
#define FASTPATH_FRAGMENT_NEXT 0x3
|
||||
#define FASTPATH_OUTPUT_COMPRESSION_USED 0x2
|
||||
|
||||
/* Surface Command Type (2.2.9.1.2.1.10.1) */
|
||||
#define CMDTYPE_SET_SURFACE_BITS 0x0001
|
||||
#define CMDTYPE_FRAME_MARKER 0x0004
|
||||
#define CMDTYPE_STREAM_SURFACE_BITS 0x0006
|
||||
|
||||
/* Compression Flags (3.1.8.2.1) */
|
||||
/* TODO: to be renamed, not used anywhere */
|
||||
#define RDP_MPPC_COMPRESSED 0x20
|
||||
#define RDP_MPPC_RESET 0x40
|
||||
#define RDP_MPPC_FLUSH 0x80
|
||||
#define RDP_MPPC_DICT_SIZE 8192 /* RDP 4.0 | MS-RDPBCGR 3.1.8 */
|
||||
|
||||
/* largePointerSupprtFlags (2.2.7.2.7) */
|
||||
#define LARGE_POINTER_FLAG_96x96 0x00000001
|
||||
#define LARGE_POINTER_FLAG_384x384 0x00000002
|
||||
|
||||
#endif /* MS_RDPBCGR_H */
|
@ -1,90 +0,0 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* MS-RDPECLIP : Definitions from [MS-RDPECLIP]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* References to MS-RDPECLIP are currently correct for v220210407 of that
|
||||
* document
|
||||
*/
|
||||
|
||||
#if !defined(MS_RDPECLIP_H)
|
||||
#define MS_RDPECLIP_H
|
||||
|
||||
/* Clipboard PDU header message codes 2.2.1 */
|
||||
#define CB_MONITOR_READY 1
|
||||
#define CB_FORMAT_LIST 2
|
||||
#define CB_FORMAT_LIST_RESPONSE 3
|
||||
#define CB_FORMAT_DATA_REQUEST 4
|
||||
#define CB_FORMAT_DATA_RESPONSE 5
|
||||
#define CB_TEMP_DIRECTORY 6
|
||||
#define CB_CLIP_CAPS 7
|
||||
#define CB_FILECONTENTS_REQUEST 8
|
||||
#define CB_FILECONTENTS_RESPONSE 9
|
||||
#define CB_LOCK_CLIPDATA 10
|
||||
#define CB_UNLOCK_CLIPDATA 11
|
||||
|
||||
#define CB_PDUTYPE_TO_STR(pdu_type) \
|
||||
((pdu_type) == CB_MONITOR_READY ? "CB_MONITOR_READY" : \
|
||||
(pdu_type) == CB_FORMAT_LIST ? "CB_FORMAT_LIST" : \
|
||||
(pdu_type) == CB_FORMAT_LIST_RESPONSE ? "CB_FORMAT_LIST_RESPONSE" : \
|
||||
(pdu_type) == CB_FORMAT_DATA_REQUEST ? "CB_FORMAT_DATA_REQUEST" : \
|
||||
(pdu_type) == CB_FORMAT_DATA_RESPONSE ? "CB_FORMAT_DATA_RESPONSE" : \
|
||||
(pdu_type) == CB_TEMP_DIRECTORY ? "CB_TEMP_DIRECTORY" : \
|
||||
(pdu_type) == CB_CLIP_CAPS ? "CB_CLIP_CAPS" : \
|
||||
(pdu_type) == CB_FILECONTENTS_REQUEST ? "CB_FILECONTENTS_REQUEST" : \
|
||||
(pdu_type) == CB_FILECONTENTS_RESPONSE ? "CB_FILECONTENTS_RESPONSE" : \
|
||||
(pdu_type) == CB_LOCK_CLIPDATA ? "CB_LOCK_CLIPDATA" : \
|
||||
(pdu_type) == CB_UNLOCK_CLIPDATA ? "CB_UNLOCK_CLIPDATA" : \
|
||||
"unknown" \
|
||||
)
|
||||
|
||||
/* Clipboard PDU header message flags 2.2.1 */
|
||||
#define CB_RESPONSE_OK 0x0001
|
||||
#define CB_RESPONSE_FAIL 0x0002
|
||||
#define CB_ASCII_NAMES 0x0004
|
||||
|
||||
/* Capability set codes 2.2.2.1.1 */
|
||||
#define CB_CAPSTYPE_GENERAL 1
|
||||
#define CB_CAPS_VERSION_1 1
|
||||
#define CB_CAPS_VERSION_2 2
|
||||
|
||||
/* General capability set general flags 2.2.2.1.1.1 */
|
||||
#define CB_USE_LONG_FORMAT_NAMES 0x00000002
|
||||
#define CB_STREAM_FILECLIP_ENABLED 0x00000004
|
||||
#define CB_FILECLIP_NO_FILE_PATHS 0x00000008
|
||||
#define CB_CAN_LOCK_CLIPDATA 0x00000010
|
||||
|
||||
/* File contents request PDU 2.2.5.3 */
|
||||
/* Note that in the document these do not have a CB_ prefix */
|
||||
#define CB_FILECONTENTS_SIZE 0x00000001
|
||||
#define CB_FILECONTENTS_RANGE 0x00000002
|
||||
|
||||
/* File descriptor structure flags 2.2.5.2.3.1 */
|
||||
/* Note that in the document these do not have a CB_ prefix */
|
||||
#define CB_FD_ATTRIBUTES 0x00000004
|
||||
#define CB_FD_FILESIZE 0x00000040
|
||||
#define CB_FD_WRITESTIME 0x00000020
|
||||
#define CB_FD_PROGRESSUI 0x00004000
|
||||
|
||||
/* File descriptor structure file attributes 2.2.5.2.3.1 */
|
||||
/* Note that in the document these do not have a CB_ prefix */
|
||||
#define CB_FILE_ATTRIBUTE_READONLY 0x00000001
|
||||
#define CB_FILE_ATTRIBUTE_HIDDEN 0x00000002
|
||||
#define CB_FILE_ATTRIBUTE_SYSTEM 0x00000004
|
||||
#define CB_FILE_ATTRIBUTE_DIRECTORY 0x00000010
|
||||
#define CB_FILE_ATTRIBUTE_ARCHIVE 0x00000020
|
||||
#define CB_FILE_ATTRIBUTE_NORMAL 0x00000080
|
||||
|
||||
#endif /* MS_RDPECLIP_H */
|
@ -1,44 +0,0 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* MS-RDPEDISP : Definitions from [MS-RDPEDISP]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* References to MS-RDPEDISP are currently correct for v20201030 of that
|
||||
* document
|
||||
*/
|
||||
|
||||
#if !defined(MS_RDPEDISP_H)
|
||||
#define MS_RDPEDISP_H
|
||||
|
||||
/* Display Control Messages: Display Virtual Channel Extension (2.2.2) */
|
||||
#define DISPLAYCONTROL_PDU_TYPE_MONITOR_LAYOUT 0x00000002
|
||||
#define DISPLAYCONTROL_PDU_TYPE_CAPS 0x00000005
|
||||
|
||||
/* Display Control Monitor Layout (2.2.2.2.1) */
|
||||
#define DISPLAYCONTROL_MONITOR_PRIMARY 0x00000001
|
||||
#define CLIENT_MONITOR_DATA_MINIMUM_VIRTUAL_MONITOR_WIDTH 0xC8
|
||||
#define CLIENT_MONITOR_DATA_MINIMUM_VIRTUAL_MONITOR_HEIGHT 0xC8
|
||||
#define CLIENT_MONITOR_DATA_MAXIMUM_VIRTUAL_MONITOR_WIDTH 0x2000
|
||||
#define CLIENT_MONITOR_DATA_MAXIMUM_VIRTUAL_MONITOR_HEIGHT 0x2000
|
||||
|
||||
#define ORIENTATION_LANDSCAPE 0
|
||||
#define ORIENTATION_PORTRAIT 90
|
||||
#define ORIENTATION_LANDSCAPE_FLIPPED 180
|
||||
#define ORIENTATION_PORTRAIT_FLIPPED 270
|
||||
|
||||
/* Display Control Monitor Layout (2.2.2.2.1) */
|
||||
#define DISPLAYCONTROL_MONITOR_PRIMARY 0x00000001
|
||||
|
||||
#endif /* MS_RDPEDISP_H */
|
@ -1,128 +0,0 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* MS-RDPEFS : Definitions from [MS-RDPEFS]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* References to MS-RDPEFS are currently correct for v20180912 of that
|
||||
* document
|
||||
*/
|
||||
|
||||
#if !defined(MS_RDPEFS_H)
|
||||
#define MS_RDPEFS_H
|
||||
|
||||
/*
|
||||
* RDPDR_HEADER definitions (2.2.1.1)
|
||||
*/
|
||||
|
||||
/* device redirector core component; most of the packets in this protocol */
|
||||
/* are sent under this component ID */
|
||||
#define RDPDR_CTYP_CORE 0x4472
|
||||
|
||||
/* printing component. the packets that use this ID are typically about */
|
||||
/* printer cache management and identifying XPS printers */
|
||||
#define RDPDR_CTYP_PRN 0x5052
|
||||
|
||||
/* Server Announce Request, as specified in section 2.2.2.2 */
|
||||
#define PAKID_CORE_SERVER_ANNOUNCE 0x496E
|
||||
|
||||
/* Client Announce Reply and Server Client ID Confirm, as specified in */
|
||||
/* sections 2.2.2.3 and 2.2.2.6. */
|
||||
#define PAKID_CORE_CLIENTID_CONFIRM 0x4343
|
||||
|
||||
/* Client Name Request, as specified in section 2.2.2.4 */
|
||||
#define PAKID_CORE_CLIENT_NAME 0x434E
|
||||
|
||||
/* Client Device List Announce Request, as specified in section 2.2.2.9 */
|
||||
#define PAKID_CORE_DEVICELIST_ANNOUNCE 0x4441
|
||||
|
||||
/* Server Device Announce Response, as specified in section 2.2.2.1 */
|
||||
#define PAKID_CORE_DEVICE_REPLY 0x6472
|
||||
|
||||
/* Device I/O Request, as specified in section 2.2.1.4 */
|
||||
#define PAKID_CORE_DEVICE_IOREQUEST 0x4952
|
||||
|
||||
/* Device I/O Response, as specified in section 2.2.1.5 */
|
||||
#define PAKID_CORE_DEVICE_IOCOMPLETION 0x4943
|
||||
|
||||
/* Server Core Capability Request, as specified in section 2.2.2.7 */
|
||||
#define PAKID_CORE_SERVER_CAPABILITY 0x5350
|
||||
|
||||
/* Client Core Capability Response, as specified in section 2.2.2.8 */
|
||||
#define PAKID_CORE_CLIENT_CAPABILITY 0x4350
|
||||
|
||||
/* Client Drive Device List Remove, as specified in section 2.2.3.2 */
|
||||
#define PAKID_CORE_DEVICELIST_REMOVE 0x444D
|
||||
|
||||
/* Add Printer Cachedata, as specified in [MS-RDPEPC] section 2.2.2.3 */
|
||||
#define PAKID_PRN_CACHE_DATA 0x5043
|
||||
|
||||
/* Server User Logged On, as specified in section 2.2.2.5 */
|
||||
#define PAKID_CORE_USER_LOGGEDON 0x554C
|
||||
|
||||
/* Server Printer Set XPS Mode, as specified in [MS-RDPEPC] section 2.2.2.2 */
|
||||
#define PAKID_PRN_USING_XPS 0x5543
|
||||
|
||||
/*
|
||||
* Capability header definitions (2.2.1.2)
|
||||
*/
|
||||
|
||||
#define CAP_GENERAL_TYPE 0x0001 /* General cap set - GENERAL_CAPS_SET */
|
||||
#define CAP_PRINTER_TYPE 0x0002 /* Print cap set - PRINTER_CAPS_SET */
|
||||
#define CAP_PORT_TYPE 0x0003 /* Port cap set - PORT_CAPS_SET */
|
||||
#define CAP_DRIVE_TYPE 0x0004 /* Drive cap set - DRIVE_CAPS_SET */
|
||||
#define CAP_SMARTCARD_TYPE 0x0005 /* Smart card cap set - SMARTCARD_CAPS_SET */
|
||||
|
||||
/*
|
||||
* Device announce header (2.2.1.3)
|
||||
*/
|
||||
#define RDPDR_DTYP_SERIAL 0x0001
|
||||
#define RDPDR_DTYP_PARALLEL 0x0002
|
||||
#define RDPDR_DTYP_PRINT 0x0004
|
||||
#define RDPDR_DTYP_FILESYSTEM 0x0008
|
||||
#define RDPDR_DTYP_SMARTCARD 0x0020
|
||||
|
||||
/* Device I/O Request definitions (2.2.1.4) */
|
||||
/* MajorFunction */
|
||||
enum IRP_MJ
|
||||
{
|
||||
IRP_MJ_CREATE = 0x00000000,
|
||||
IRP_MJ_CLOSE = 0x00000002,
|
||||
IRP_MJ_READ = 0x00000003,
|
||||
IRP_MJ_WRITE = 0x00000004,
|
||||
IRP_MJ_DEVICE_CONTROL = 0x0000000E,
|
||||
IRP_MJ_QUERY_VOLUME_INFORMATION = 0x0000000A,
|
||||
IRP_MJ_SET_VOLUME_INFORMATION = 0x0000000B,
|
||||
IRP_MJ_QUERY_INFORMATION = 0x00000005,
|
||||
IRP_MJ_SET_INFORMATION = 0x00000006,
|
||||
IRP_MJ_DIRECTORY_CONTROL = 0x0000000C,
|
||||
IRP_MJ_LOCK_CONTROL = 0x00000011
|
||||
};
|
||||
|
||||
/* MinorFunction */
|
||||
/* Set to zero unless MajorFunction code == IRP_MJ_DIRECTORY_CONTROL */
|
||||
enum IRP_MN
|
||||
{
|
||||
IRP_MN_NONE = 0x00000000, /* Name not in MS docs */
|
||||
IRP_MN_QUERY_DIRECTORY = 0x00000001,
|
||||
IRP_MN_NOTIFY_CHANGE_DIRECTORY = 0x00000002
|
||||
};
|
||||
|
||||
/*
|
||||
* General Capability Set (2.2.2.7.1)
|
||||
*/
|
||||
/* extendedPDU fields */
|
||||
#define RDPDR_USER_LOGGEDON_PDU 0x00000004
|
||||
|
||||
#endif /* MS_RDPEFS_H */
|
@ -1,59 +0,0 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* MS-RDPEGDI : Definitions from [MS-RDPEGDI]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* References to MS-RDPEGDI are currently correct for v20180912 of that
|
||||
* document
|
||||
*/
|
||||
|
||||
#if !defined(MS_RDPEGDI_H)
|
||||
#define MS_RDPEGDI_H
|
||||
|
||||
/* Drawing Order: controlFlags (2.2.2.2.1, 2.2.2.2.1.1.2) */
|
||||
#define TS_STANDARD 0x01
|
||||
#define TS_SECONDARY 0x02
|
||||
#define TS_BOUNDS 0x04
|
||||
#define TS_TYPE_CHANGE 0x08
|
||||
#define TS_DELTA_COORDINATES 0x10
|
||||
#define TS_ZERO_BOUNDS_DELTAS 0x20
|
||||
#define TS_ZERO_FIELD_BYTE_BIT0 0x40
|
||||
#define TS_ZERO_FIELD_BYTE_BIT1 0x80
|
||||
|
||||
/* Drawing Order: orderType (2.2.2.2.1.1.2) */
|
||||
/* Should be renamed */
|
||||
#define RDP_ORDER_DESTBLT 0 /* TS_ENC_DSTBLT_ORDER */
|
||||
#define RDP_ORDER_PATBLT 1
|
||||
#define RDP_ORDER_SCREENBLT 2
|
||||
#define RDP_ORDER_LINE 9
|
||||
#define RDP_ORDER_RECT 10
|
||||
#define RDP_ORDER_DESKSAVE 11
|
||||
#define RDP_ORDER_MEMBLT 13
|
||||
#define RDP_ORDER_TRIBLT 14
|
||||
#define RDP_ORDER_POLYLINE 22
|
||||
#define RDP_ORDER_TEXT2 27
|
||||
#define RDP_ORDER_COMPOSITE 37 /* 0x25 - not defined in RDPEGDI */
|
||||
|
||||
/* Secondary Drawing Order Header: orderType (2.2.2.2.1.2.1.1) */
|
||||
#define TS_CACHE_BITMAP_UNCOMPRESSED 0x00
|
||||
#define TS_CACHE_COLOR_TABLE 0x01
|
||||
#define TS_CACHE_BITMAP_COMPRESSED 0x02
|
||||
#define TS_CACHE_GLYPH 0x03
|
||||
#define TS_CACHE_BITMAP_UNCOMPRESSED_REV2 0x04
|
||||
#define TS_CACHE_BITMAP_COMPRESSED_REV2 0x05
|
||||
#define TS_CACHE_BRUSH 0x07
|
||||
#define TS_CACHE_BITMAP_COMPRESSED_REV3 0x08
|
||||
|
||||
#endif /* MS_RDPEGDI_H */
|
@ -1,36 +0,0 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* MS-RDPELE : Definitions from [MS-RDPELE]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* References to MS-RDPELE are currently correct for v20180912 of that
|
||||
* document
|
||||
*/
|
||||
|
||||
#if !defined(MS_RDPELE_H)
|
||||
#define MS_RDPELE_H
|
||||
|
||||
/* LicensingMessage (MS-RDPELE 2.2.2) */
|
||||
/* TODO: to be renamed */
|
||||
#define LICENCE_TAG_DEMAND 0x01 /* LICENSE_REQUEST */
|
||||
#define LICENCE_TAG_AUTHREQ 0x02 /* PLATFORM_CHALLENGE */
|
||||
#define LICENCE_TAG_ISSUE 0x03 /* NEW_LICENSE */
|
||||
#define LICENCE_TAG_REISSUE 0x04 /* UPGRADE_LICENSE */
|
||||
#define LICENCE_TAG_PRESENT 0x12 /* LICENSE_INFO */
|
||||
#define LICENCE_TAG_REQUEST 0x13 /* NEW_LICENSE_REQUEST */
|
||||
#define LICENCE_TAG_AUTHRESP 0x15 /* PLATFORM_CHALLENGE_RESPONSE */
|
||||
#define LICENCE_TAG_RESULT 0xff
|
||||
|
||||
#endif /* MS_RDPELE_H */
|
@ -1,31 +0,0 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* MS-RDPERP : Definitions from [MS-RDPERP]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* References to MS-RDPERP are currently correct for v20190923 of that
|
||||
* document
|
||||
*/
|
||||
|
||||
#if !defined(MS_RDPERP_H)
|
||||
#define MS_RDPERP_H
|
||||
|
||||
/* Window List Capability Set: WndSupportLevel (2.2.1.1.2) */
|
||||
#define TS_WINDOW_LEVEL_NOT_SUPPORTED 0x00000000
|
||||
#define TS_WINDOW_LEVEL_SUPPORTED 0x00000001
|
||||
#define TS_WINDOW_LEVEL_SUPPORTED_EX 0x00000002
|
||||
|
||||
|
||||
#endif /* MS_RDPERP_H */
|
@ -1,79 +0,0 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* MS-SMB2 : Definitions from [MS-SMB2]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* References to MS-SMB2 are currently correct for v20190923 of that
|
||||
* document
|
||||
*/
|
||||
|
||||
#if !defined(MS_SMB2_H)
|
||||
#define MS_SMB2_H
|
||||
|
||||
/* SMB2 CREATE request values (section 2.2.13) */
|
||||
|
||||
/*
|
||||
* ShareAccess Mask. Currently, this is referred
|
||||
* to in MS-RDPEFS 2.2.1.4.1 as 'SharedAccess' rather than 'ShareAccess'.
|
||||
*/
|
||||
#define SA_FILE_SHARE_READ 0x00000001
|
||||
#define SA_FILE_SHARE_WRITE 0x00000002
|
||||
#define SA_FILE_SHARE_DELETE 0x00000004
|
||||
|
||||
/* CreateDisposition Mask */
|
||||
#define CD_FILE_SUPERSEDE 0x00000000
|
||||
#define CD_FILE_OPEN 0x00000001
|
||||
#define CD_FILE_CREATE 0x00000002
|
||||
#define CD_FILE_OPEN_IF 0x00000003
|
||||
#define CD_FILE_OVERWRITE 0x00000004
|
||||
#define CD_FILE_OVERWRITE_IF 0x00000005
|
||||
|
||||
/* CreateOptions Mask */
|
||||
enum CREATE_OPTIONS
|
||||
{
|
||||
CO_FILE_DIRECTORY_FILE = 0x00000001,
|
||||
CO_FILE_WRITE_THROUGH = 0x00000002,
|
||||
CO_FILE_SYNCHRONOUS_IO_NONALERT = 0x00000020,
|
||||
CO_FILE_DELETE_ON_CLOSE = 0x00001000
|
||||
};
|
||||
|
||||
/*
|
||||
* DesiredAccess Mask (section 2.2.13.1.1)
|
||||
*/
|
||||
|
||||
#define DA_FILE_READ_DATA 0x00000001
|
||||
#define DA_FILE_WRITE_DATA 0x00000002
|
||||
#define DA_FILE_APPEND_DATA 0x00000004
|
||||
#define DA_FILE_READ_EA 0x00000008 /* rd extended attributes */
|
||||
#define DA_FILE_WRITE_EA 0x00000010 /* wr extended attributes */
|
||||
#define DA_FILE_EXECUTE 0x00000020
|
||||
#define DA_FILE_READ_ATTRIBUTES 0x00000080
|
||||
#define DA_FILE_WRITE_ATTRIBUTES 0x00000100
|
||||
#define DA_DELETE 0x00010000
|
||||
#define DA_READ_CONTROL 0x00020000 /* rd security descriptor */
|
||||
#define DA_WRITE_DAC 0x00040000
|
||||
#define DA_WRITE_OWNER 0x00080000
|
||||
#define DA_SYNCHRONIZE 0x00100000
|
||||
#define DA_ACCESS_SYSTEM_SECURITY 0x01000000
|
||||
#define DA_MAXIMUM_ALLOWED 0x02000000
|
||||
#define DA_GENERIC_ALL 0x10000000
|
||||
#define DA_GENERIC_EXECUTE 0x20000000
|
||||
#define DA_GENERIC_WRITE 0x40000000
|
||||
#define DA_GENERIC_READ 0x80000000
|
||||
|
||||
#endif /* MS_SMB2_H */
|
||||
|
||||
|
||||
|
3931
common/os_calls.c
3931
common/os_calls.c
File diff suppressed because it is too large
Load Diff
@ -1,427 +1,275 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Jay Sorg 2004-2014
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* generic operating system calls
|
||||
*/
|
||||
/*
|
||||
Copyright (c) 2004-2012 Jay Sorg
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
generic operating system calls
|
||||
*/
|
||||
|
||||
#if !defined(OS_CALLS_H)
|
||||
#define OS_CALLS_H
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
#include "arch.h"
|
||||
|
||||
enum proc_exit_reason
|
||||
{
|
||||
E_PXR_STATUS_CODE = 0, ///< 'val' contains exit status
|
||||
E_PXR_SIGNAL, ///< 'val' contains a signal number
|
||||
E_PXR_UNEXPECTED
|
||||
};
|
||||
|
||||
struct proc_exit_status
|
||||
{
|
||||
enum proc_exit_reason reason;
|
||||
int val;
|
||||
};
|
||||
|
||||
struct list;
|
||||
|
||||
#define g_tcp_can_recv g_sck_can_recv
|
||||
#define g_tcp_can_send g_sck_can_send
|
||||
#define g_tcp_recv g_sck_recv
|
||||
#define g_tcp_send g_sck_send
|
||||
#define g_tcp_close g_sck_close
|
||||
#define g_tcp_last_error_would_block g_sck_last_error_would_block
|
||||
#define g_tcp_set_non_blocking g_sck_set_non_blocking
|
||||
#define g_tcp_local_socket g_sck_local_socket
|
||||
#define g_tcp_local_connect g_sck_local_connect
|
||||
#define g_tcp_listen g_sck_listen
|
||||
#define g_tcp_local_bind g_sck_local_bind
|
||||
#define g_tcp_select g_sck_select
|
||||
#define g_close_wait_obj g_delete_wait_obj
|
||||
|
||||
int g_rm_temp_dir(void);
|
||||
void g_init(const char *app_name);
|
||||
void g_deinit(void);
|
||||
void g_printf(const char *format, ...) printflike(1, 2);
|
||||
void g_sprintf(char *dest, const char *format, ...) \
|
||||
printflike(2, 3);
|
||||
int g_snprintf(char *dest, int len, const char *format, ...) \
|
||||
printflike(3, 4);
|
||||
void g_writeln(const char *format, ...) printflike(1, 2);
|
||||
void g_write(const char *format, ...) printflike(1, 2);
|
||||
void g_hexdump(const char *p, int len);
|
||||
int g_getchar(void);
|
||||
int g_tcp_set_no_delay(int sck);
|
||||
int g_tcp_set_keepalive(int sck);
|
||||
int g_tcp_socket(void);
|
||||
int g_sck_set_send_buffer_bytes(int sck, int bytes);
|
||||
int g_sck_get_send_buffer_bytes(int sck, int *bytes);
|
||||
int g_sck_set_recv_buffer_bytes(int sck, int bytes);
|
||||
int g_sck_get_recv_buffer_bytes(int sck, int *bytes);
|
||||
int g_sck_local_socket(void);
|
||||
int g_sck_local_socketpair(int sck[2]);
|
||||
int g_sck_vsock_socket(void);
|
||||
int g_sck_get_peer_cred(int sck, int *pid, int *uid, int *gid);
|
||||
void g_sck_close(int sck);
|
||||
int g_tcp_connect(int sck, const char *address, const char *port);
|
||||
int g_sck_local_connect(int sck, const char *port);
|
||||
int g_sck_set_non_blocking(int sck);
|
||||
int g_tcp_bind(int sck, const char *port);
|
||||
int g_sck_local_bind(int sck, const char *port);
|
||||
int g_sck_vsock_bind(int sck, const char *port);
|
||||
int g_sck_vsock_bind_address(int sck, const char *port, const char *address);
|
||||
int g_tcp_bind_address(int sck, const char *port, const char *address);
|
||||
int g_sck_listen(int sck);
|
||||
int g_sck_accept(int sck);
|
||||
int g_sck_recv(int sck, void *ptr, unsigned int len, int flags);
|
||||
int g_sck_send(int sck, const void *ptr, unsigned int len, int flags);
|
||||
/**
|
||||
* Receives data and file descriptors on a unix domain socket
|
||||
*
|
||||
* @param sck - Socket to receive data + file descriptors from
|
||||
* @param ptr - Pointer to buffer for incoming data
|
||||
* @param len - Length of data. Must be > 0
|
||||
* @param[out] fds - Array of file descriptors
|
||||
* @param [in] maxfd - Max number of elements in fds
|
||||
* @param[out] fdcount - Actual number of file descriptors received
|
||||
* @return Bytes received, or < 0 for error.
|
||||
*
|
||||
* If the result is > 0 but less than len, the file descriptors have
|
||||
* been received. Get the rest of the data with normal g_sck_recv() calls.
|
||||
*
|
||||
* fdcount may be more that maxfd. This indicates that more file descriptors
|
||||
* were received than there was space for. The excess file descriptors
|
||||
* are closed and discarded.
|
||||
*/
|
||||
int g_sck_recv_fd_set(int sck, void *ptr, unsigned int len,
|
||||
int fds[], unsigned int maxfd,
|
||||
unsigned int *fdcount);
|
||||
/**
|
||||
* Sends data and file descriptors on a unix domain socket
|
||||
*
|
||||
* @param sck - Socket to send data + file descriptors on
|
||||
* @param ptr - Data to send
|
||||
* @param len - Length of data. Must be > 0
|
||||
* @param fds - Array of file descriptors
|
||||
* @param fdcount - Number of file descriptors
|
||||
* @return Bytes sent, or < 0 for error.
|
||||
*
|
||||
* If the result is > 0 but less than len, the file descriptors have
|
||||
* been sent. Send the rest of the data with normal g_sck_send() calls.
|
||||
*/
|
||||
int g_sck_send_fd_set(int sck, const void *ptr, unsigned int len,
|
||||
int fds[], unsigned int fdcount);
|
||||
int g_sck_last_error_would_block(int sck);
|
||||
int g_sck_socket_ok(int sck);
|
||||
/**
|
||||
* Checks socket writeability with an optional wait
|
||||
*
|
||||
* @param sck - Socket to check
|
||||
* @param millis - Maximum milliseconds to wait for writeability to be true
|
||||
*
|
||||
* @note The wait time may not be reached in the event of an incoming signal
|
||||
* so do not use this call to impose a hard timeout */
|
||||
int g_sck_can_send(int sck, int millis);
|
||||
/**
|
||||
* Checks socket readability with an optional wait
|
||||
*
|
||||
* @param sck - Socket to check
|
||||
* @param millis - Maximum milliseconds to wait for readability to be true
|
||||
*
|
||||
* @note The wait time may not be reached in the event of an incoming signal
|
||||
* so do not use this call to impose a hard timeout */
|
||||
int g_sck_can_recv(int sck, int millis);
|
||||
int g_sck_select(int sck1, int sck2);
|
||||
|
||||
/**
|
||||
* Gets the IP address of a connected peer, if it has one
|
||||
* @param sck File descriptor for peer
|
||||
* @param ip buffer to write IP address to
|
||||
* @param bytes Size of ip buffer. Should be at least MAX_IP_ADDRSTRLEN
|
||||
* @param[out] portptr Optional variable to receive the port number
|
||||
* @return Pointer to IP for convenience
|
||||
*
|
||||
* If the peer has no IP address (for example, it is a Unix Domain Socket),
|
||||
* or the specified buffer is too small, the returned string is ""
|
||||
*/
|
||||
const char *
|
||||
g_sck_get_peer_ip_address(int sck,
|
||||
char *ip, unsigned int bytes,
|
||||
unsigned short *port);
|
||||
/**
|
||||
* Gets a description for a connected peer
|
||||
* @param sck File descriptor for peer
|
||||
* @param desc buffer to write description to
|
||||
* @param bytes Size of description buffer. Should be at least
|
||||
* MAX_PEER_DESCSTRLEN
|
||||
* @return Pointer to desc for convenience
|
||||
*
|
||||
* Unlike g_sck_get_peer_ip_address(), this will return a
|
||||
* description of some sort for any socket type.
|
||||
*/
|
||||
const char *
|
||||
g_sck_get_peer_description(int sck,
|
||||
char *desc, unsigned int bytes);
|
||||
/**
|
||||
* Sleep for the specified number of milli-seconds
|
||||
* @param msecs Milli-seconds
|
||||
*
|
||||
* If a signal is processed, it is possible that this call will
|
||||
* sleep for less than the specified number of milli-seconds. This
|
||||
* is platform-specific
|
||||
*/
|
||||
void g_sleep(int msecs);
|
||||
int g_pipe(int fd[2]);
|
||||
|
||||
tintptr g_create_wait_obj(const char *name);
|
||||
tintptr g_create_wait_obj_from_socket(tintptr socket, int write);
|
||||
void g_delete_wait_obj_from_socket(tintptr wait_obj);
|
||||
int g_set_wait_obj(tintptr obj);
|
||||
int g_reset_wait_obj(tintptr obj);
|
||||
int g_is_wait_obj_set(tintptr obj);
|
||||
int g_delete_wait_obj(tintptr obj);
|
||||
/**
|
||||
* Wait for the specified readable and writeable objs
|
||||
*
|
||||
* The wait finishes when at least one of the objects becomes
|
||||
* readable or writeable
|
||||
*
|
||||
* @param read_objs Array of read objects
|
||||
* @param rcount Number of elements in read_objs
|
||||
* @param write_objs Array of write objects
|
||||
* @param rcount Number of elements in write_objs
|
||||
* @param mstimeout Timeout in milliseconds. < 0 means an infinite timeout.
|
||||
*
|
||||
* @return 0 for success. The objects will need to be polled to
|
||||
* find out what is readable or writeable.
|
||||
*
|
||||
* An mstimeout of zero will return immediately, although
|
||||
* error conditions may be checked for.
|
||||
*/
|
||||
int g_obj_wait(tintptr *read_objs, int rcount, tintptr *write_objs,
|
||||
int wcount, int mstimeout);
|
||||
void g_random(char *data, int len);
|
||||
int g_abs(int i);
|
||||
int g_memcmp(const void *s1, const void *s2, int len);
|
||||
int g_file_open_rw(const char *file_name);
|
||||
int g_file_open_ex(const char *file_name, int aread, int awrite,
|
||||
int acreate, int atrunc);
|
||||
int g_file_open_ro(const char *file_name);
|
||||
int g_file_close(int fd);
|
||||
/**
|
||||
* Returns 1 if a file is open (i.e. the file descriptor is valid)
|
||||
* @param fd File descriptor
|
||||
* @return 1 for file open, 0 for not open
|
||||
*/
|
||||
int g_file_is_open(int fd);
|
||||
int g_file_read(int fd, char *ptr, int len);
|
||||
int g_file_write(int fd, const char *ptr, int len);
|
||||
int g_file_seek(int fd, int offset);
|
||||
int g_file_lock(int fd, int start, int len);
|
||||
int
|
||||
g_file_map(int fd, int aread, int awrite, size_t length, void **addr);
|
||||
int
|
||||
g_munmap(void *addr, size_t length);
|
||||
int g_file_duplicate_on(int fd, int target_fd);
|
||||
int g_file_get_cloexec(int fd);
|
||||
int g_file_set_cloexec(int fd, int status);
|
||||
/**
|
||||
* Get a list of open file descriptors
|
||||
*
|
||||
* @param min Min FD to consider
|
||||
* @param max Max FD to consider (+1), or -1 for no limit
|
||||
* @result Array of file descriptors, in ascending order.
|
||||
*
|
||||
* Call delete_list() on the result when you've finished with it.
|
||||
*/
|
||||
struct list *g_get_open_fds(int min, int max);
|
||||
int g_chmod_hex(const char *filename, int flags);
|
||||
int g_umask_hex(int flags);
|
||||
int g_chown(const char *name, int uid, int gid);
|
||||
int g_mkdir(const char *dirname);
|
||||
char *g_get_current_dir(char *dirname, int maxlen);
|
||||
int g_set_current_dir(const char *dirname);
|
||||
int g_file_exist(const char *filename);
|
||||
int g_file_readable(const char *filename);
|
||||
int g_directory_exist(const char *dirname);
|
||||
int g_executable_exist(const char *dirname);
|
||||
int g_create_dir(const char *dirname);
|
||||
int g_create_path(const char *path);
|
||||
int g_remove_dir(const char *dirname);
|
||||
int g_file_delete(const char *filename);
|
||||
int g_file_get_size(const char *filename);
|
||||
int g_file_get_device_number(const char *filename);
|
||||
int g_file_get_inode_num(const char *filename);
|
||||
long g_load_library(char *in);
|
||||
int g_free_library(long lib);
|
||||
void *g_get_proc_address(long lib, const char *name);
|
||||
int g_system(const char *aexec);
|
||||
char *g_get_strerror(void);
|
||||
int g_get_errno(void);
|
||||
int g_execvp(const char *p1, char *args[]);
|
||||
/**
|
||||
* Issues an execvp() call
|
||||
*
|
||||
* @param file Executable
|
||||
* @param argv Argument list for executable.
|
||||
*
|
||||
* argv does not need to be NULL terminated - the call takes care
|
||||
* of this.
|
||||
*
|
||||
* @return Only if an error has occurred - use g_get_errno() or equivalent
|
||||
*/
|
||||
int g_execvp_list(const char *file, struct list *argv);
|
||||
int g_execlp3(const char *a1, const char *a2, const char *a3);
|
||||
/**
|
||||
* Set an alarm using SIGALRM
|
||||
* @param func Signal handler, or NULL to cancel an alarm
|
||||
* @param secs Number of seconds until an alarm is raised
|
||||
* @return Number of seconds remaining before a previously requested
|
||||
* alarm is raised
|
||||
*/
|
||||
unsigned int g_set_alarm(void (*func)(int), unsigned int secs);
|
||||
/**
|
||||
* Set a handler up for SIGCHLD
|
||||
* @param func signal handler, or NULL to restore the default handler
|
||||
* The handler remains in place until explicitly replaced.
|
||||
*/
|
||||
void g_signal_child_stop(void (*func)(int));
|
||||
/**
|
||||
* Set a handler up for SIGSEGV
|
||||
* @param func signal handler, or NULL to restore the default handler
|
||||
* The handler can only be called once, at which point the
|
||||
* default handler is restored. This is to avoid infinite loops
|
||||
*/
|
||||
void g_signal_segfault(void (*func)(int));
|
||||
/**
|
||||
* Set a handler up for SIGHUP
|
||||
* @param func signal handler, or NULL to restore the default handler
|
||||
* The handler remains in place until explicitly replaced.
|
||||
*/
|
||||
void g_signal_hang_up(void (*func)(int));
|
||||
/**
|
||||
* Set a handler up for SIGINT
|
||||
* @param func signal handler, or NULL to restore the default handler
|
||||
* The handler remains in place until explicitly replaced.
|
||||
*/
|
||||
void g_signal_user_interrupt(void (*func)(int));
|
||||
/**
|
||||
* Set a handler up for SIGTERM
|
||||
* @param func signal handler, or NULL to restore the default handler
|
||||
* The handler remains in place until explicitly replaced.
|
||||
*/
|
||||
void g_signal_terminate(void (*func)(int));
|
||||
/**
|
||||
* Set a handler up for SIGPIPE
|
||||
* @param func signal handler, or NULL to restore the default handler
|
||||
* The handler remains in place until explicitly replaced.
|
||||
*/
|
||||
void g_signal_pipe(void (*func)(int));
|
||||
/**
|
||||
* Set a handler up for SIGUSR1
|
||||
* @param func signal handler, or NULL to restore the default handler
|
||||
* The handler remains in place until explicitly replaced.
|
||||
*/
|
||||
void g_signal_usr1(void (*func)(int));
|
||||
int g_fork(void);
|
||||
int g_setgid(int pid);
|
||||
int g_drop_privileges(const char *user, const char *group);
|
||||
int g_initgroups(const char *user);
|
||||
int g_getuid(void);
|
||||
int g_getgid(void);
|
||||
int g_setuid(int pid);
|
||||
int g_setsid(void);
|
||||
int g_getlogin(char *name, unsigned int len);
|
||||
int g_setlogin(const char *name);
|
||||
#ifdef HAVE_SETUSERCONTEXT
|
||||
/** Sets the login user context (BSD systems only)
|
||||
* @param uid UID of suer
|
||||
* @return 0 for success
|
||||
*/
|
||||
int g_set_allusercontext(int uid);
|
||||
#endif
|
||||
int g_waitchild(struct proc_exit_status *e);
|
||||
int g_waitpid(int pid);
|
||||
struct proc_exit_status g_waitpid_status(int pid);
|
||||
/*
|
||||
* Sets the process group ID of the indicated process to the specified value.
|
||||
* (POSIX.1)
|
||||
*
|
||||
* Errors are logged.
|
||||
*
|
||||
* May do nothing if process groups are not supported
|
||||
*/
|
||||
int g_setpgid(int pid, int pgid);
|
||||
void g_clearenv(void);
|
||||
int g_setenv(const char *name, const char *value, int rewrite);
|
||||
char *g_getenv(const char *name);
|
||||
int g_exit(int exit_code);
|
||||
int g_getpid(void);
|
||||
int g_sigterm(int pid);
|
||||
int g_sighup(int pid);
|
||||
/*
|
||||
* Is a particular PID active?
|
||||
* @param pid PID to check
|
||||
* Returns boolean
|
||||
*/
|
||||
int g_pid_is_active(int pid);
|
||||
int g_getuser_info_by_name(const char *username, int *uid, int *gid,
|
||||
char **shell, char **dir, char **gecos);
|
||||
int g_getuser_info_by_uid(int uid, char **username, int *gid,
|
||||
char **shell, char **dir, char **gecos);
|
||||
int g_getgroup_info(const char *groupname, int *gid);
|
||||
/**
|
||||
* Checks whether a user is in the specified group
|
||||
* @param username Name of user
|
||||
* @param gid GID of group
|
||||
* @param[out] ok Whether user is in group
|
||||
* @return Non-zero if a system error occurred. In this instance OK is not set
|
||||
*
|
||||
* Primary group of username is also checked
|
||||
*/
|
||||
int g_check_user_in_group(const char *username, int gid, int *ok);
|
||||
int g_time1(void);
|
||||
int g_time2(void);
|
||||
int g_time3(void);
|
||||
int g_save_to_bmp(const char *filename, char *data, int stride_bytes,
|
||||
int width, int height, int depth, int bits_per_pixel);
|
||||
void *g_shmat(int shmid);
|
||||
int g_shmdt(const void *shmaddr);
|
||||
int g_gethostname(char *name, int len);
|
||||
int g_mirror_memcpy(void *dst, const void *src, int len);
|
||||
int g_tcp4_socket(void);
|
||||
int g_tcp4_bind_address(int sck, const char *port, const char *address);
|
||||
int g_tcp6_socket(void);
|
||||
int g_tcp6_bind_address(int sck, const char *port, const char *address);
|
||||
int g_no_new_privs(void);
|
||||
void
|
||||
g_qsort(void *base, size_t nitems, size_t size,
|
||||
int (*compar)(const void *, const void *));
|
||||
|
||||
/* glib-style wrappers */
|
||||
#define g_new(struct_type, n_structs) \
|
||||
(struct_type *) malloc(sizeof(struct_type) * (n_structs))
|
||||
#define g_new0(struct_type, n_structs) \
|
||||
(struct_type *) calloc((n_structs), sizeof(struct_type))
|
||||
|
||||
/* remove these when no longer used */
|
||||
#define g_malloc(_size, _zero) (_zero ? calloc(1, _size) : malloc(_size))
|
||||
#define g_free free
|
||||
#define g_memset memset
|
||||
#define g_memcpy memcpy
|
||||
#define g_memmove memmove
|
||||
int APP_CC
|
||||
g_rm_temp_dir(void);
|
||||
int APP_CC
|
||||
g_mk_temp_dir(const char* app_name);
|
||||
void APP_CC
|
||||
g_init(const char* app_name);
|
||||
void APP_CC
|
||||
g_deinit(void);
|
||||
void* APP_CC
|
||||
g_malloc(int size, int zero);
|
||||
void APP_CC
|
||||
g_free(void* ptr);
|
||||
void DEFAULT_CC
|
||||
g_printf(const char *format, ...);
|
||||
void DEFAULT_CC
|
||||
g_sprintf(char* dest, const char* format, ...);
|
||||
int DEFAULT_CC
|
||||
g_snprintf(char* dest, int len, const char* format, ...);
|
||||
void DEFAULT_CC
|
||||
g_writeln(const char* format, ...);
|
||||
void DEFAULT_CC
|
||||
g_write(const char* format, ...);
|
||||
void APP_CC
|
||||
g_hexdump(char* p, int len);
|
||||
void APP_CC
|
||||
g_memset(void* ptr, int val, int size);
|
||||
void APP_CC
|
||||
g_memcpy(void* d_ptr, const void* s_ptr, int size);
|
||||
int APP_CC
|
||||
g_getchar(void);
|
||||
int APP_CC
|
||||
g_tcp_set_no_delay(int sck);
|
||||
int APP_CC
|
||||
g_tcp_set_keepalive(int sck);
|
||||
int APP_CC
|
||||
g_tcp_socket(void);
|
||||
int APP_CC
|
||||
g_tcp_local_socket(void);
|
||||
void APP_CC
|
||||
g_tcp_close(int sck);
|
||||
int APP_CC
|
||||
g_tcp_connect(int sck, const char* address, const char* port);
|
||||
int APP_CC
|
||||
g_tcp_local_connect(int sck, const char* port);
|
||||
int APP_CC
|
||||
g_tcp_force_send(int sck, char* data, int len);
|
||||
int APP_CC
|
||||
g_tcp_force_recv(int sck, char* data, int len);
|
||||
int APP_CC
|
||||
g_tcp_set_non_blocking(int sck);
|
||||
int APP_CC
|
||||
g_tcp_bind(int sck, char* port);
|
||||
int APP_CC
|
||||
g_tcp_local_bind(int sck, char* port);
|
||||
int APP_CC
|
||||
g_tcp_bind_address(int sck, char* port, const char* address);
|
||||
int APP_CC
|
||||
g_tcp_listen(int sck);
|
||||
int APP_CC
|
||||
g_tcp_accept(int sck);
|
||||
int APP_CC
|
||||
g_tcp_recv(int sck, void* ptr, int len, int flags);
|
||||
int APP_CC
|
||||
g_tcp_send(int sck, const void* ptr, int len, int flags);
|
||||
int APP_CC
|
||||
g_tcp_last_error_would_block(int sck);
|
||||
int APP_CC
|
||||
g_tcp_socket_ok(int sck);
|
||||
int APP_CC
|
||||
g_tcp_can_send(int sck, int millis);
|
||||
int APP_CC
|
||||
g_tcp_can_recv(int sck, int millis);
|
||||
int APP_CC
|
||||
g_tcp_select(int sck1, int sck2);
|
||||
void APP_CC
|
||||
g_write_ip_address(int rcv_sck, char* ip_address, int bytes);
|
||||
void APP_CC
|
||||
g_sleep(int msecs);
|
||||
tbus APP_CC
|
||||
g_create_wait_obj(char* name);
|
||||
tbus APP_CC
|
||||
g_create_wait_obj_from_socket(tbus socket, int write);
|
||||
void APP_CC
|
||||
g_delete_wait_obj_from_socket(tbus wait_obj);
|
||||
int APP_CC
|
||||
g_set_wait_obj(tbus obj);
|
||||
int APP_CC
|
||||
g_reset_wait_obj(tbus obj);
|
||||
int APP_CC
|
||||
g_is_wait_obj_set(tbus obj);
|
||||
int APP_CC
|
||||
g_delete_wait_obj(tbus obj);
|
||||
int APP_CC
|
||||
g_close_wait_obj(tbus obj);
|
||||
int APP_CC
|
||||
g_obj_wait(tbus* read_objs, int rcount, tbus* write_objs, int wcount,
|
||||
int mstimeout);
|
||||
void APP_CC
|
||||
g_random(char* data, int len);
|
||||
int APP_CC
|
||||
g_abs(int i);
|
||||
int APP_CC
|
||||
g_memcmp(const void* s1, const void* s2, int len);
|
||||
int APP_CC
|
||||
g_file_open(const char* file_name);
|
||||
int APP_CC
|
||||
g_file_close(int fd);
|
||||
int APP_CC
|
||||
g_file_read(int fd, char* ptr, int len);
|
||||
int APP_CC
|
||||
g_file_write(int fd, char* ptr, int len);
|
||||
int APP_CC
|
||||
g_file_seek(int fd, int offset);
|
||||
int APP_CC
|
||||
g_file_lock(int fd, int start, int len);
|
||||
int APP_CC
|
||||
g_chmod_hex(const char* filename, int flags);
|
||||
int APP_CC
|
||||
g_chown(const char* name, int uid, int gid);
|
||||
int APP_CC
|
||||
g_mkdir(const char* dirname);
|
||||
char* APP_CC
|
||||
g_get_current_dir(char* dirname, int maxlen);
|
||||
int APP_CC
|
||||
g_set_current_dir(char* dirname);
|
||||
int APP_CC
|
||||
g_file_exist(const char* filename);
|
||||
int APP_CC
|
||||
g_directory_exist(const char* dirname);
|
||||
int APP_CC
|
||||
g_create_dir(const char* dirname);
|
||||
int APP_CC
|
||||
g_create_path(const char* path);
|
||||
int APP_CC
|
||||
g_remove_dir(const char* dirname);
|
||||
int APP_CC
|
||||
g_file_delete(const char* filename);
|
||||
int APP_CC
|
||||
g_file_get_size(const char* filename);
|
||||
int APP_CC
|
||||
g_strlen(const char* text);
|
||||
char* APP_CC
|
||||
g_strcpy(char* dest, const char* src);
|
||||
char* APP_CC
|
||||
g_strncpy(char* dest, const char* src, int len);
|
||||
char* APP_CC
|
||||
g_strcat(char* dest, const char* src);
|
||||
char* APP_CC
|
||||
g_strdup(const char* in);
|
||||
char* APP_CC
|
||||
g_strndup(const char* in, const unsigned int maxlen);
|
||||
int APP_CC
|
||||
g_strcmp(const char* c1, const char* c2);
|
||||
int APP_CC
|
||||
g_strncmp(const char* c1, const char* c2, int len);
|
||||
int APP_CC
|
||||
g_strcasecmp(const char* c1, const char* c2);
|
||||
int APP_CC
|
||||
g_strncasecmp(const char* c1, const char* c2, int len);
|
||||
int APP_CC
|
||||
g_atoi(const char* str);
|
||||
int APP_CC
|
||||
g_htoi(char* str);
|
||||
int APP_CC
|
||||
g_pos(char* str, const char* to_find);
|
||||
int APP_CC
|
||||
g_mbstowcs(twchar* dest, const char* src, int n);
|
||||
int APP_CC
|
||||
g_wcstombs(char* dest, const twchar* src, int n);
|
||||
int APP_CC
|
||||
g_strtrim(char* str, int trim_flags);
|
||||
long APP_CC
|
||||
g_load_library(char* in);
|
||||
int APP_CC
|
||||
g_free_library(long lib);
|
||||
void* APP_CC
|
||||
g_get_proc_address(long lib, const char* name);
|
||||
int APP_CC
|
||||
g_system(char* aexec);
|
||||
char* APP_CC
|
||||
g_get_strerror(void);
|
||||
int APP_CC
|
||||
g_get_errno(void);
|
||||
int APP_CC
|
||||
g_execvp(const char* p1, char* args[]);
|
||||
int APP_CC
|
||||
g_execlp3(const char* a1, const char* a2, const char* a3);
|
||||
void APP_CC
|
||||
g_signal_child_stop(void (*func)(int));
|
||||
void APP_CC
|
||||
g_signal_hang_up(void (*func)(int));
|
||||
void APP_CC
|
||||
g_signal_user_interrupt(void (*func)(int));
|
||||
void APP_CC
|
||||
g_signal_kill(void (*func)(int));
|
||||
void APP_CC
|
||||
g_signal_terminate(void (*func)(int));
|
||||
void APP_CC
|
||||
g_signal_pipe(void (*func)(int));
|
||||
void APP_CC
|
||||
g_signal_usr1(void (*func)(int));
|
||||
int APP_CC
|
||||
g_fork(void);
|
||||
int APP_CC
|
||||
g_setgid(int pid);
|
||||
int APP_CC
|
||||
g_initgroups(const char* user, int gid);
|
||||
int APP_CC
|
||||
g_getuid(void);
|
||||
int APP_CC
|
||||
g_setuid(int pid);
|
||||
int APP_CC
|
||||
g_waitchild(void);
|
||||
int APP_CC
|
||||
g_waitpid(int pid);
|
||||
void APP_CC
|
||||
g_clearenv(void);
|
||||
int APP_CC
|
||||
g_setenv(const char* name, const char* value, int rewrite);
|
||||
char* APP_CC
|
||||
g_getenv(const char* name);
|
||||
int APP_CC
|
||||
g_exit(int exit_code);
|
||||
int APP_CC
|
||||
g_getpid(void);
|
||||
int APP_CC
|
||||
g_sigterm(int pid);
|
||||
int APP_CC
|
||||
g_getuser_info(const char* username, int* gid, int* uid, char** shell,
|
||||
char** dir, char** gecos);
|
||||
int APP_CC
|
||||
g_getgroup_info(const char* groupname, int* gid);
|
||||
int APP_CC
|
||||
g_check_user_in_group(const char* username, int gid, int* ok);
|
||||
int APP_CC
|
||||
g_time1(void);
|
||||
int APP_CC
|
||||
g_time2(void);
|
||||
int APP_CC
|
||||
g_time3(void);
|
||||
|
||||
#endif
|
||||
|
324
common/parse.c
324
common/parse.c
@ -1,324 +0,0 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) 2021 Matt Burt
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Enforce stream primitive checking
|
||||
*/
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include <config_ac.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "arch.h"
|
||||
#include "parse.h"
|
||||
#include "log.h"
|
||||
#include "string_calls.h"
|
||||
#include "unicode_defines.h"
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
#if defined(B_ENDIAN) || defined(NEED_ALIGN)
|
||||
#define out_uint16_le_unchecked(s, v) do \
|
||||
{ \
|
||||
*((s)->p) = (unsigned char)((v) >> 0); \
|
||||
(s)->p++; \
|
||||
*((s)->p) = (unsigned char)((v) >> 8); \
|
||||
(s)->p++; \
|
||||
} while (0)
|
||||
#else
|
||||
#define out_uint16_le_unchecked(s, v) do \
|
||||
{ \
|
||||
*((unsigned short*)((s)->p)) = (unsigned short)(v); \
|
||||
(s)->p += 2; \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
/******************************************************************************/
|
||||
#if defined(B_ENDIAN) || defined(NEED_ALIGN)
|
||||
#define in_uint16_le_unchecked(s, v) do \
|
||||
{ \
|
||||
(v) = (unsigned short) \
|
||||
( \
|
||||
(*((unsigned char*)((s)->p + 0)) << 0) | \
|
||||
(*((unsigned char*)((s)->p + 1)) << 8) \
|
||||
); \
|
||||
(s)->p += 2; \
|
||||
} while (0)
|
||||
#else
|
||||
#define in_uint16_le_unchecked(s, v) do \
|
||||
{ \
|
||||
(v) = *((unsigned short*)((s)->p)); \
|
||||
(s)->p += 2; \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
/******************************************************************************/
|
||||
void
|
||||
parser_stream_overflow_check(const struct stream *s, int n, int is_out,
|
||||
const char *file, int line)
|
||||
{
|
||||
/* Sanity checks */
|
||||
if (n < 0)
|
||||
{
|
||||
LOG(LOG_LEVEL_ALWAYS, "%s:%d "
|
||||
"stream primitive called with negative n=%d",
|
||||
file, line, n);
|
||||
abort();
|
||||
}
|
||||
|
||||
if (is_out)
|
||||
{
|
||||
/* Output overflow */
|
||||
if (!s_check_rem_out(s, n))
|
||||
{
|
||||
LOG(LOG_LEVEL_ALWAYS, "%s:%d Stream output buffer overflow. "
|
||||
"Size=%d, pos=%d, requested=%d", file, line,
|
||||
s->size, (int)(s->p - s->data), n);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Input overflow */
|
||||
if (!s_check_rem(s, n))
|
||||
{
|
||||
LOG(LOG_LEVEL_ALWAYS, "%s:%d Stream input buffer overflow. "
|
||||
"Max=%d, pos=%d, requested=%d", file, line,
|
||||
(int)(s->end - s->data), (int)(s->p - s->data), n);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
void
|
||||
out_utf8_as_utf16_le_proc(struct stream *s, const char *v,
|
||||
unsigned int vn,
|
||||
const char *file, int line)
|
||||
{
|
||||
// Expansion of S_CHECK_REM_OUT(s, <octet_count>) using passed-in
|
||||
// file and line
|
||||
#ifdef USE_DEVEL_STREAMCHECK
|
||||
int octet_cnt = utf8_as_utf16_word_count(v, vn) * 2;
|
||||
parser_stream_overflow_check(s, octet_cnt, 1, file, line);
|
||||
#endif
|
||||
|
||||
while (vn > 0)
|
||||
{
|
||||
char32_t c32 = utf8_get_next_char(&v, &vn);
|
||||
char16_t low;
|
||||
if (c32 < 0x10000)
|
||||
{
|
||||
low = (char16_t)c32;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Need a surrogate pair */
|
||||
low = LOW_SURROGATE_FROM_C32(c32);
|
||||
char16_t high = HIGH_SURROGATE_FROM_C32(c32);
|
||||
out_uint16_le_unchecked(s, high);
|
||||
}
|
||||
out_uint16_le_unchecked(s, low);
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/**
|
||||
* Gets the next Unicode character from a code stream
|
||||
* @param s Stream
|
||||
* @return Unicode character
|
||||
*
|
||||
* Non-characters and illegally coded characters are mapped to
|
||||
* UCS_REPLACEMENT_CHARACTER
|
||||
*
|
||||
* @pre Two bytes are assumed to be available on the stram on entry
|
||||
*/
|
||||
static char32_t
|
||||
get_c32_from_stream(struct stream *s)
|
||||
{
|
||||
char32_t c32 = UCS_REPLACEMENT_CHARACTER; // Assume failure
|
||||
char16_t w;
|
||||
|
||||
in_uint16_le_unchecked(s, w);
|
||||
|
||||
if (IS_HIGH_SURROGATE(w))
|
||||
{
|
||||
if (s_check_rem(s, 2))
|
||||
{
|
||||
char16_t low;
|
||||
in_uint16_le_unchecked(s, low);
|
||||
if (IS_LOW_SURROGATE(low))
|
||||
{
|
||||
/* Valid surrogate pair */
|
||||
char32_t v = C32_FROM_SURROGATE_PAIR(low, w);
|
||||
|
||||
/* Ignore some values which can be successfully encoded
|
||||
* in this way */
|
||||
if (!IS_PLANE_END_NON_CHARACTER(c32))
|
||||
{
|
||||
c32 = v;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Invalid low surrogate - pop character back */
|
||||
s->p -= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!IS_LOW_SURROGATE(w) &&
|
||||
!IS_PLANE_END_NON_CHARACTER(w) &&
|
||||
!IS_ARABIC_NON_CHARACTER(w))
|
||||
{
|
||||
/* Character from the Basic Multilingual Plane */
|
||||
c32 = (char32_t)w;
|
||||
}
|
||||
|
||||
return c32;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
unsigned int
|
||||
in_utf16_le_fixed_as_utf8_proc(struct stream *s, unsigned int n,
|
||||
char *v, unsigned int vn,
|
||||
const char *file, int line)
|
||||
{
|
||||
unsigned int rv = 0;
|
||||
char32_t c32;
|
||||
char u8str[MAXLEN_UTF8_CHAR];
|
||||
unsigned int u8len;
|
||||
char *saved_s_end = s->end;
|
||||
|
||||
// Expansion of S_CHECK_REM(s, n*2) using passed-in file and line
|
||||
#ifdef USE_DEVEL_STREAMCHECK
|
||||
parser_stream_overflow_check(s, n * 2, 0, file, line);
|
||||
#endif
|
||||
// Temporarily set the stream end pointer to allow us to use
|
||||
// s_check_rem() when reading in UTF-16 words
|
||||
if (s->end - s->p > (int)(n * 2))
|
||||
{
|
||||
s->end = s->p + (int)(n * 2);
|
||||
}
|
||||
|
||||
while (s_check_rem(s, 2))
|
||||
{
|
||||
c32 = get_c32_from_stream(s);
|
||||
|
||||
u8len = utf_char32_to_utf8(c32, u8str);
|
||||
if (u8len + 1 <= vn)
|
||||
{
|
||||
/* Room for this character and a terminator. Add the character */
|
||||
unsigned int i;
|
||||
for (i = 0 ; i < u8len ; ++i)
|
||||
{
|
||||
v[i] = u8str[i];
|
||||
}
|
||||
vn -= u8len;
|
||||
v += u8len;
|
||||
}
|
||||
else if (vn > 1)
|
||||
{
|
||||
/* We've skipped a character, but there's more than one byte
|
||||
* remaining in the output buffer. Mark the output buffer as
|
||||
* full so we don't get a smaller character being squeezed into
|
||||
* the remaining space */
|
||||
vn = 1;
|
||||
}
|
||||
|
||||
rv += u8len;
|
||||
}
|
||||
|
||||
// Restore stream to full length
|
||||
s->end = saved_s_end;
|
||||
|
||||
if (vn > 0)
|
||||
{
|
||||
*v = '\0';
|
||||
}
|
||||
++rv;
|
||||
return rv;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
unsigned int
|
||||
in_utf16_le_fixed_as_utf8_length(struct stream *s, unsigned int n)
|
||||
{
|
||||
char *saved_s_p = s->p;
|
||||
unsigned int rv = in_utf16_le_fixed_as_utf8(s, n, NULL, 0);
|
||||
s->p = saved_s_p;
|
||||
return rv;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
unsigned int
|
||||
in_utf16_le_terminated_as_utf8(struct stream *s,
|
||||
char *v, unsigned int vn)
|
||||
{
|
||||
unsigned int rv = 0;
|
||||
char32_t c32;
|
||||
char u8str[MAXLEN_UTF8_CHAR];
|
||||
unsigned int u8len;
|
||||
while (s_check_rem(s, 2))
|
||||
{
|
||||
c32 = get_c32_from_stream(s);
|
||||
if (c32 == 0)
|
||||
{
|
||||
break; // Terminator encountered
|
||||
}
|
||||
|
||||
u8len = utf_char32_to_utf8(c32, u8str);
|
||||
if (u8len + 1 <= vn)
|
||||
{
|
||||
/* Room for this character and a terminator. Add the character */
|
||||
unsigned int i;
|
||||
for (i = 0 ; i < u8len ; ++i)
|
||||
{
|
||||
v[i] = u8str[i];
|
||||
}
|
||||
vn -= u8len;
|
||||
v += u8len;
|
||||
}
|
||||
else if (vn > 1)
|
||||
{
|
||||
/* We've skipped a character, but there's more than one byte
|
||||
* remaining in the output buffer. Mark the output buffer as
|
||||
* full so we don't get a smaller character being squeezed into
|
||||
* the remaining space */
|
||||
vn = 1;
|
||||
}
|
||||
rv += u8len;
|
||||
}
|
||||
|
||||
if (vn > 0)
|
||||
{
|
||||
*v = '\0';
|
||||
}
|
||||
++rv;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
unsigned int
|
||||
in_utf16_le_terminated_as_utf8_length(struct stream *s)
|
||||
{
|
||||
char *saved_s_p = s->p;
|
||||
unsigned int rv = in_utf16_le_terminated_as_utf8(s, NULL, 0);
|
||||
s->p = saved_s_p;
|
||||
return rv;
|
||||
}
|
539
common/parse.h
539
common/parse.h
@ -1,39 +1,35 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Jay Sorg 2004-2014
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Parsing structs and macros
|
||||
*
|
||||
* based on parse.h from rdesktop
|
||||
* this is a super fast stream method, you bet
|
||||
* needed functions g_malloc, g_free, g_memset, g_memcpy
|
||||
*/
|
||||
/*
|
||||
Copyright (c) 2004-2010 Jay Sorg
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Parsing structs and macros
|
||||
|
||||
based on parse.h from rdesktop
|
||||
this is a super fast stream method, you bet
|
||||
needed functions g_malloc, g_free, g_memset, g_memcpy
|
||||
*/
|
||||
|
||||
#if !defined(PARSE_H)
|
||||
#define PARSE_H
|
||||
|
||||
#include "arch.h"
|
||||
#include "log.h"
|
||||
|
||||
/* Check the config_ac.h file is included so we know whether to enable the
|
||||
* development macros
|
||||
*/
|
||||
#ifndef CONFIG_AC_H
|
||||
# error config_ac.h not visible in parse.h
|
||||
#endif
|
||||
|
||||
#if defined(L_ENDIAN)
|
||||
#elif defined(B_ENDIAN)
|
||||
@ -44,209 +40,38 @@
|
||||
/* parser state */
|
||||
struct stream
|
||||
{
|
||||
char *p;
|
||||
char *end;
|
||||
char *data;
|
||||
char* p;
|
||||
char* end;
|
||||
char* data;
|
||||
int size;
|
||||
int pad0;
|
||||
/* offsets of various headers */
|
||||
char *iso_hdr;
|
||||
char *mcs_hdr;
|
||||
char *sec_hdr;
|
||||
char *rdp_hdr;
|
||||
char *channel_hdr;
|
||||
/* other */
|
||||
char *next_packet;
|
||||
struct stream *next;
|
||||
int *source;
|
||||
char* iso_hdr;
|
||||
char* mcs_hdr;
|
||||
char* sec_hdr;
|
||||
char* rdp_hdr;
|
||||
char* channel_hdr;
|
||||
char* next_packet;
|
||||
};
|
||||
|
||||
/** Check arguments to stream primitives
|
||||
*
|
||||
* This adds a function call overhead to every stream primitive and is
|
||||
* intended for development only
|
||||
*
|
||||
* @param s stream
|
||||
* @param n Bytes being requested for input/output
|
||||
* @param is_out (0=input, !0=output)
|
||||
* @param file __file__for caller
|
||||
* @param line __line__ for caller
|
||||
*
|
||||
* On any kind of violation a message is output and the program is
|
||||
* aborted.
|
||||
*/
|
||||
void
|
||||
parser_stream_overflow_check(const struct stream *s, int n, int is_out,
|
||||
const char *file, int line);
|
||||
|
||||
#ifdef USE_DEVEL_STREAMCHECK
|
||||
# define S_CHECK_REM(s,n) \
|
||||
parser_stream_overflow_check((s), (n), 0, __FILE__, __LINE__)
|
||||
# define S_CHECK_REM_OUT(s,n) \
|
||||
parser_stream_overflow_check((s), (n), 1, __FILE__, __LINE__)
|
||||
#else
|
||||
# define S_CHECK_REM(s,n)
|
||||
# define S_CHECK_REM_OUT(s,n)
|
||||
#endif
|
||||
|
||||
/******************************************************************************/
|
||||
/**
|
||||
* Copies a UTF-8 string to a stream as little-endian UTF-16
|
||||
*
|
||||
* @param s Stream
|
||||
* @param v UTF-8 string
|
||||
* @param vn Length of UTF-8 string.
|
||||
* @param file Caller location (from __FILE__)
|
||||
* @param line Caller location (from __LINE__)
|
||||
*
|
||||
* Caller is expected to check there is room for the result in s
|
||||
*/
|
||||
void
|
||||
out_utf8_as_utf16_le_proc(struct stream *s, const char *v,
|
||||
unsigned int vn,
|
||||
const char *file, int line);
|
||||
|
||||
#define out_utf8_as_utf16_le(s,v,vn) \
|
||||
out_utf8_as_utf16_le_proc((s), (v), (vn), __FILE__, __LINE__)
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/**
|
||||
* Copies a fixed-size little-endian UTF-16 string from a stream as UTF-8
|
||||
*
|
||||
* @param s Stream
|
||||
* @param n Number of 16-bit words to copy
|
||||
* @param v Pointer to result buffer
|
||||
* @param vn Max size of result buffer
|
||||
*
|
||||
* @return number of characters which would be written to v, INCLUDING
|
||||
* an additional terminator. This can be used to check for a buffer
|
||||
* overflow. A terminator is added whether or not the input
|
||||
* includes one.
|
||||
*
|
||||
* Output is unconditionally NULL-terminated.
|
||||
* Input is not checked for NULLs - these are copied verbatim
|
||||
*/
|
||||
unsigned int
|
||||
in_utf16_le_fixed_as_utf8_proc(struct stream *s, unsigned int n,
|
||||
char *v, unsigned int vn,
|
||||
const char *file, int line);
|
||||
|
||||
#define in_utf16_le_fixed_as_utf8(s,n,v,vn) \
|
||||
in_utf16_le_fixed_as_utf8_proc((s), (n), (v), (vn), __FILE__, __LINE__)
|
||||
|
||||
/******************************************************************************/
|
||||
/**
|
||||
* Returns the size of the buffer needed to store a fixed-size
|
||||
* little-endian UTF-16 string in a stream as a UTF-8 string
|
||||
*
|
||||
* @param s Stream
|
||||
* @param n Number of 16-bit words to consider
|
||||
* @return number of characters needed to store the UTF-8 string. This
|
||||
* includes a terminator, which is written whether the parsed
|
||||
* string includes one or not.
|
||||
* @post Stream position is not moved between start and end of this call
|
||||
*/
|
||||
unsigned int
|
||||
in_utf16_le_fixed_as_utf8_length(struct stream *s, unsigned int n);
|
||||
|
||||
/******************************************************************************/
|
||||
/**
|
||||
* Copies a terminated little-endian UTF-16 string from a stream as UTF-8
|
||||
*
|
||||
* @param s Stream
|
||||
* @param v Pointer to result buffer
|
||||
* @param vn Max size of result buffer
|
||||
*
|
||||
* @return number of characters which would be written to v, INCLUDING
|
||||
* the terminator. This can be used to check for a buffer overflow.
|
||||
*
|
||||
* Output is unconditionally NULL-terminated.
|
||||
* Input processing stops when a NULL is encountered, or the end of the buffer
|
||||
* is reached.
|
||||
*/
|
||||
unsigned int
|
||||
in_utf16_le_terminated_as_utf8(struct stream *s,
|
||||
char *v, unsigned int vn);
|
||||
|
||||
/******************************************************************************/
|
||||
/**
|
||||
* Returns the size of the buffer needed to store a terminated
|
||||
* little-endian UTF-16 string in a stream as a terminated UTF-8 string
|
||||
*
|
||||
* @param s Stream
|
||||
* @return number of characters needed to store the UTF-8 string,
|
||||
* including the terminator
|
||||
* @post Stream position is not moved between start and end of this call
|
||||
*
|
||||
* Input processing stops when a NULL is encountered, or the end of the buffer
|
||||
* is reached.
|
||||
*/
|
||||
unsigned int
|
||||
in_utf16_le_terminated_as_utf8_length(struct stream *s);
|
||||
#define s_check(s) ((s)->p <= (s)->end)
|
||||
|
||||
/******************************************************************************/
|
||||
#define s_check_rem(s, n) ((s)->p + (n) <= (s)->end)
|
||||
|
||||
/******************************************************************************/
|
||||
/**
|
||||
* @returns true if there are at least n bytes remaining in the stream,
|
||||
* else false and logs an error message
|
||||
*/
|
||||
#define s_check_rem_and_log(s, n, msg_prefix) \
|
||||
( s_check_rem((s), (n)) ? \
|
||||
1 : \
|
||||
LOG(LOG_LEVEL_ERROR, \
|
||||
"%s Not enough bytes in the stream: expected %d, remaining %d", \
|
||||
(msg_prefix), (n), s_rem(s)) \
|
||||
&& 0 )
|
||||
|
||||
/******************************************************************************/
|
||||
#define s_check_rem_out(s, n) ((s)->p + (n) <= (s)->data + (s)->size)
|
||||
|
||||
/******************************************************************************/
|
||||
/**
|
||||
* @returns true if there are at least n bytes remaining in the stream,
|
||||
* else false and logs an error message
|
||||
*/
|
||||
#define s_check_rem_out_and_log(s, n, msg_prefix) \
|
||||
( s_check_rem_out((s), (n)) ? \
|
||||
1 : \
|
||||
LOG(LOG_LEVEL_ERROR, \
|
||||
"%s Not enough bytes in the stream: expected %d, remaining %d", \
|
||||
(msg_prefix), (n), s_rem_out(s)) \
|
||||
&& 0 )
|
||||
|
||||
/******************************************************************************/
|
||||
#define s_check_end(s) ((s)->p == (s)->end)
|
||||
|
||||
/******************************************************************************/
|
||||
/**
|
||||
* @returns true if there are exactly 0 bytes remaining in the stream,
|
||||
* else false and logs an error message
|
||||
*/
|
||||
#define s_check_end_and_log(s, msg_prefix) \
|
||||
( s_check_end((s)) ? \
|
||||
1 : \
|
||||
LOG(LOG_LEVEL_ERROR, \
|
||||
"%s Expected to be at the end of the stream, " \
|
||||
"but there are %d bytes remaining", \
|
||||
(msg_prefix), s_rem(s)) \
|
||||
&& 0 )
|
||||
|
||||
/******************************************************************************/
|
||||
#define s_rem(s) ((int) ((s)->end - (s)->p))
|
||||
|
||||
/******************************************************************************/
|
||||
#define s_rem_out(s) ((int) ((s)->data + (s)->size - (s)->p))
|
||||
|
||||
/******************************************************************************/
|
||||
#define make_stream(s) \
|
||||
(s) = (struct stream*)g_malloc(sizeof(struct stream), 1)
|
||||
|
||||
/******************************************************************************/
|
||||
#define init_stream(s, v) do \
|
||||
{ \
|
||||
{ \
|
||||
if ((v) > (s)->size) \
|
||||
{ \
|
||||
g_free((s)->data); \
|
||||
@ -256,24 +81,24 @@ in_utf16_le_terminated_as_utf8_length(struct stream *s);
|
||||
(s)->p = (s)->data; \
|
||||
(s)->end = (s)->data; \
|
||||
(s)->next_packet = 0; \
|
||||
} while (0)
|
||||
} while (0)
|
||||
|
||||
/******************************************************************************/
|
||||
#define free_stream(s) do \
|
||||
{ \
|
||||
{ \
|
||||
if ((s) != 0) \
|
||||
{ \
|
||||
g_free((s)->data); \
|
||||
} \
|
||||
g_free((s)); \
|
||||
} while (0)
|
||||
} while (0)
|
||||
|
||||
/******************************************************************************/
|
||||
#define s_push_layer(s, h, n) do \
|
||||
{ \
|
||||
{ \
|
||||
(s)->h = (s)->p; \
|
||||
(s)->p += (n); \
|
||||
} while (0)
|
||||
} while (0)
|
||||
|
||||
/******************************************************************************/
|
||||
#define s_pop_layer(s, h) \
|
||||
@ -283,84 +108,72 @@ in_utf16_le_terminated_as_utf8_length(struct stream *s);
|
||||
#define s_mark_end(s) \
|
||||
(s)->end = (s)->p
|
||||
|
||||
/******************************************************************************/
|
||||
#define in_sint8(s, v) do \
|
||||
{ \
|
||||
S_CHECK_REM((s), 1); \
|
||||
{ \
|
||||
(v) = *((signed char*)((s)->p)); \
|
||||
(s)->p++; \
|
||||
} while (0)
|
||||
} while (0)
|
||||
|
||||
/******************************************************************************/
|
||||
#define in_uint8(s, v) do \
|
||||
{ \
|
||||
S_CHECK_REM((s), 1); \
|
||||
{ \
|
||||
(v) = *((unsigned char*)((s)->p)); \
|
||||
(s)->p++; \
|
||||
} while (0)
|
||||
/******************************************************************************/
|
||||
#define in_uint8_peek(s, v) do \
|
||||
{ \
|
||||
S_CHECK_REM((s), 1); \
|
||||
v = *s->p; \
|
||||
} while (0)
|
||||
} while (0)
|
||||
|
||||
/******************************************************************************/
|
||||
#if defined(B_ENDIAN) || defined(NEED_ALIGN)
|
||||
#define in_sint16_le(s, v) do \
|
||||
{ \
|
||||
S_CHECK_REM((s), 2); \
|
||||
{ \
|
||||
(v) = (signed short) \
|
||||
( \
|
||||
(*((unsigned char*)((s)->p + 0)) << 0) | \
|
||||
(*((unsigned char*)((s)->p + 1)) << 8) \
|
||||
); \
|
||||
(s)->p += 2; \
|
||||
} while (0)
|
||||
} while (0)
|
||||
#else
|
||||
#define in_sint16_le(s, v) do \
|
||||
{ \
|
||||
S_CHECK_REM((s), 2); \
|
||||
{ \
|
||||
(v) = *((signed short*)((s)->p)); \
|
||||
(s)->p += 2; \
|
||||
} while (0)
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
/******************************************************************************/
|
||||
#if defined(B_ENDIAN) || defined(NEED_ALIGN)
|
||||
#define in_uint16_le(s, v) do \
|
||||
{ \
|
||||
S_CHECK_REM((s), 2); \
|
||||
{ \
|
||||
(v) = (unsigned short) \
|
||||
( \
|
||||
(*((unsigned char*)((s)->p + 0)) << 0) | \
|
||||
(*((unsigned char*)((s)->p + 1)) << 8) \
|
||||
); \
|
||||
(s)->p += 2; \
|
||||
} while (0)
|
||||
} while (0)
|
||||
#else
|
||||
#define in_uint16_le(s, v) do \
|
||||
{ \
|
||||
S_CHECK_REM((s), 2); \
|
||||
{ \
|
||||
(v) = *((unsigned short*)((s)->p)); \
|
||||
(s)->p += 2; \
|
||||
} while (0)
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
/******************************************************************************/
|
||||
#define in_uint16_be(s, v) do \
|
||||
{ \
|
||||
S_CHECK_REM((s), 2); \
|
||||
{ \
|
||||
(v) = *((unsigned char*)((s)->p)); \
|
||||
(s)->p++; \
|
||||
(v) <<= 8; \
|
||||
(v) |= *((unsigned char*)((s)->p)); \
|
||||
(s)->p++; \
|
||||
} while (0)
|
||||
} while (0)
|
||||
|
||||
/******************************************************************************/
|
||||
#if defined(B_ENDIAN) || defined(NEED_ALIGN)
|
||||
#define in_uint32_le(s, v) do \
|
||||
{ \
|
||||
S_CHECK_REM((s), 4); \
|
||||
{ \
|
||||
(v) = (unsigned int) \
|
||||
( \
|
||||
(*((unsigned char*)((s)->p + 0)) << 0) | \
|
||||
@ -369,47 +182,18 @@ in_utf16_le_terminated_as_utf8_length(struct stream *s);
|
||||
(*((unsigned char*)((s)->p + 3)) << 24) \
|
||||
); \
|
||||
(s)->p += 4; \
|
||||
} while (0)
|
||||
} while (0)
|
||||
#else
|
||||
#define in_uint32_le(s, v) do \
|
||||
{ \
|
||||
S_CHECK_REM((s), 4); \
|
||||
{ \
|
||||
(v) = *((unsigned int*)((s)->p)); \
|
||||
(s)->p += 4; \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
/******************************************************************************/
|
||||
#if defined(B_ENDIAN) || defined(NEED_ALIGN)
|
||||
#define in_uint64_le(s, v) do \
|
||||
{ \
|
||||
S_CHECK_REM((s), 8); \
|
||||
(v) = (tui64) \
|
||||
( \
|
||||
(((tui64)(*((unsigned char*)((s)->p + 0)))) << 0) | \
|
||||
(((tui64)(*((unsigned char*)((s)->p + 1)))) << 8) | \
|
||||
(((tui64)(*((unsigned char*)((s)->p + 2)))) << 16) | \
|
||||
(((tui64)(*((unsigned char*)((s)->p + 3)))) << 24) | \
|
||||
(((tui64)(*((unsigned char*)((s)->p + 4)))) << 32) | \
|
||||
(((tui64)(*((unsigned char*)((s)->p + 5)))) << 40) | \
|
||||
(((tui64)(*((unsigned char*)((s)->p + 6)))) << 48) | \
|
||||
(((tui64)(*((unsigned char*)((s)->p + 7)))) << 56) \
|
||||
); \
|
||||
(s)->p += 8; \
|
||||
} while (0)
|
||||
#else
|
||||
#define in_uint64_le(s, v) do \
|
||||
{ \
|
||||
S_CHECK_REM((s), 8); \
|
||||
(v) = *((tui64*)((s)->p)); \
|
||||
(s)->p += 8; \
|
||||
} while (0)
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
/******************************************************************************/
|
||||
#define in_uint32_be(s, v) do \
|
||||
{ \
|
||||
S_CHECK_REM((s), 4); \
|
||||
{ \
|
||||
(v) = *((unsigned char*)((s)->p)); \
|
||||
(s)->p++; \
|
||||
(v) <<= 8; \
|
||||
@ -421,50 +205,45 @@ in_utf16_le_terminated_as_utf8_length(struct stream *s);
|
||||
(v) <<= 8; \
|
||||
(v) |= *((unsigned char*)((s)->p)); \
|
||||
(s)->p++; \
|
||||
} while (0)
|
||||
} while (0)
|
||||
|
||||
/******************************************************************************/
|
||||
#define out_uint8(s, v) do \
|
||||
{ \
|
||||
S_CHECK_REM_OUT((s), 1); \
|
||||
{ \
|
||||
*((s)->p) = (unsigned char)(v); \
|
||||
(s)->p++; \
|
||||
} while (0)
|
||||
} while (0)
|
||||
|
||||
/******************************************************************************/
|
||||
#if defined(B_ENDIAN) || defined(NEED_ALIGN)
|
||||
#define out_uint16_le(s, v) do \
|
||||
{ \
|
||||
S_CHECK_REM_OUT((s), 2); \
|
||||
{ \
|
||||
*((s)->p) = (unsigned char)((v) >> 0); \
|
||||
(s)->p++; \
|
||||
*((s)->p) = (unsigned char)((v) >> 8); \
|
||||
(s)->p++; \
|
||||
} while (0)
|
||||
} while (0)
|
||||
#else
|
||||
#define out_uint16_le(s, v) do \
|
||||
{ \
|
||||
S_CHECK_REM_OUT((s), 2); \
|
||||
{ \
|
||||
*((unsigned short*)((s)->p)) = (unsigned short)(v); \
|
||||
(s)->p += 2; \
|
||||
} while (0)
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
/******************************************************************************/
|
||||
#define out_uint16_be(s, v) do \
|
||||
{ \
|
||||
S_CHECK_REM_OUT((s), 2); \
|
||||
{ \
|
||||
*((s)->p) = (unsigned char)((v) >> 8); \
|
||||
(s)->p++; \
|
||||
*((s)->p) = (unsigned char)((v) >> 0); \
|
||||
(s)->p++; \
|
||||
} while (0)
|
||||
} while (0)
|
||||
|
||||
/******************************************************************************/
|
||||
#if defined(B_ENDIAN) || defined(NEED_ALIGN)
|
||||
#define out_uint32_le(s, v) do \
|
||||
{ \
|
||||
S_CHECK_REM_OUT((s), 4); \
|
||||
{ \
|
||||
*((s)->p) = (unsigned char)((v) >> 0); \
|
||||
(s)->p++; \
|
||||
*((s)->p) = (unsigned char)((v) >> 8); \
|
||||
@ -473,51 +252,18 @@ in_utf16_le_terminated_as_utf8_length(struct stream *s);
|
||||
(s)->p++; \
|
||||
*((s)->p) = (unsigned char)((v) >> 24); \
|
||||
(s)->p++; \
|
||||
} while (0)
|
||||
} while (0)
|
||||
#else
|
||||
#define out_uint32_le(s, v) do \
|
||||
{ \
|
||||
S_CHECK_REM_OUT((s), 4); \
|
||||
{ \
|
||||
*((unsigned int*)((s)->p)) = (v); \
|
||||
(s)->p += 4; \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
/******************************************************************************/
|
||||
#if defined(B_ENDIAN) || defined(NEED_ALIGN)
|
||||
#define out_uint64_le(s, v) do \
|
||||
{ \
|
||||
S_CHECK_REM_OUT((s), 8); \
|
||||
*((s)->p) = (unsigned char)((v) >> 0); \
|
||||
(s)->p++; \
|
||||
*((s)->p) = (unsigned char)((v) >> 8); \
|
||||
(s)->p++; \
|
||||
*((s)->p) = (unsigned char)((v) >> 16); \
|
||||
(s)->p++; \
|
||||
*((s)->p) = (unsigned char)((v) >> 24); \
|
||||
(s)->p++; \
|
||||
*((s)->p) = (unsigned char)((v) >> 32); \
|
||||
(s)->p++; \
|
||||
*((s)->p) = (unsigned char)((v) >> 40); \
|
||||
(s)->p++; \
|
||||
*((s)->p) = (unsigned char)((v) >> 48); \
|
||||
(s)->p++; \
|
||||
*((s)->p) = (unsigned char)((v) >> 56); \
|
||||
(s)->p++; \
|
||||
} while (0)
|
||||
#else
|
||||
#define out_uint64_le(s, v) do \
|
||||
{ \
|
||||
S_CHECK_REM_OUT((s), 8); \
|
||||
*((tui64*)((s)->p)) = (v); \
|
||||
(s)->p += 8; \
|
||||
} while (0)
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
/******************************************************************************/
|
||||
#define out_uint32_be(s, v) do \
|
||||
{ \
|
||||
S_CHECK_REM_OUT((s), 4); \
|
||||
{ \
|
||||
*((s)->p) = (unsigned char)((v) >> 24); \
|
||||
s->p++; \
|
||||
*((s)->p) = (unsigned char)((v) >> 16); \
|
||||
@ -526,38 +272,32 @@ in_utf16_le_terminated_as_utf8_length(struct stream *s);
|
||||
s->p++; \
|
||||
*((s)->p) = (unsigned char)(v); \
|
||||
(s)->p++; \
|
||||
} while (0)
|
||||
} while (0)
|
||||
|
||||
/******************************************************************************/
|
||||
#define in_uint8p(s, v, n) do \
|
||||
{ \
|
||||
S_CHECK_REM((s), (n)); \
|
||||
{ \
|
||||
(v) = (s)->p; \
|
||||
(s)->p += (n); \
|
||||
} while (0)
|
||||
} while (0)
|
||||
|
||||
/******************************************************************************/
|
||||
#define in_uint8a(s, v, n) do \
|
||||
{ \
|
||||
S_CHECK_REM((s), (n)); \
|
||||
{ \
|
||||
g_memcpy((v), (s)->p, (n)); \
|
||||
(s)->p += (n); \
|
||||
} while (0)
|
||||
} while (0)
|
||||
|
||||
/******************************************************************************/
|
||||
#define in_uint8s(s, n) do \
|
||||
{ \
|
||||
S_CHECK_REM((s), (n)); \
|
||||
(s)->p += (n); \
|
||||
} while (0);
|
||||
#define in_uint8s(s, n) \
|
||||
(s)->p += (n)
|
||||
|
||||
/******************************************************************************/
|
||||
#define out_uint8p(s, v, n) do \
|
||||
{ \
|
||||
S_CHECK_REM_OUT((s), (n)); \
|
||||
{ \
|
||||
g_memcpy((s)->p, (v), (n)); \
|
||||
(s)->p += (n); \
|
||||
} while (0)
|
||||
} while (0)
|
||||
|
||||
/******************************************************************************/
|
||||
#define out_uint8a(s, v, n) \
|
||||
@ -565,110 +305,9 @@ in_utf16_le_terminated_as_utf8_length(struct stream *s);
|
||||
|
||||
/******************************************************************************/
|
||||
#define out_uint8s(s, n) do \
|
||||
{ \
|
||||
S_CHECK_REM_OUT((s), (n)); \
|
||||
{ \
|
||||
g_memset((s)->p, 0, (n)); \
|
||||
(s)->p += (n); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* @brief allocate a new stream
|
||||
*
|
||||
* @param _s opaque handle to the new stream
|
||||
* @param _l length of new stream
|
||||
******************************************************************************/
|
||||
#define xstream_new(_s, _l) \
|
||||
do \
|
||||
{ \
|
||||
make_stream((_s)); \
|
||||
init_stream((_s), (_l)); \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* @brief release a previously allocated stream
|
||||
*
|
||||
* @param _s opaque handle returned by stream_new()
|
||||
*****************************************************************************/
|
||||
#define xstream_free(_s) free_stream(_s)
|
||||
|
||||
#define xstream_skip_u8(_s, _n) in_uint8s(_s, _n)
|
||||
|
||||
#define xstream_rd_u8(_s, _var) in_uint8(_s, _var)
|
||||
#define xstream_rd_u16_le(_s, _var) in_uint16_le(_s, _var)
|
||||
#define xstream_rd_u32_le(_s, _var) in_uint32_le(_s, _var)
|
||||
|
||||
#define xstream_rd_s8_le(_s, _var) in_sint8(_s, _var)
|
||||
#define xstream_rd_s16_le(_s, _var) in_sint16_le(_s, _var)
|
||||
#define xstream_rd_s32_le(_s, _var) TODO
|
||||
|
||||
#define xstream_wr_u8(_s, _var) out_uint8(_s, _var)
|
||||
#define xstream_wr_u16_le(_s, _var) out_uint16_le(_s, _var)
|
||||
#define xstream_wr_u32_le(_s, _var) out_uint32_le(_s, _var)
|
||||
|
||||
#define xstream_wr_s8(_s, _var) TODO
|
||||
#define xstream_wr_s16_le(_s, _var) TODO
|
||||
#define xstream_wr_s32_le(_s, _var) TODO
|
||||
|
||||
#define xstream_rd_u64_le(_s, _v) \
|
||||
do \
|
||||
{ \
|
||||
_v = \
|
||||
(tui64)(*((unsigned char *)_s->p)) | \
|
||||
(((tui64) (*(((unsigned char *)_s->p) + 1))) << 8) | \
|
||||
(((tui64) (*(((unsigned char *)_s->p) + 2))) << 16) | \
|
||||
(((tui64) (*(((unsigned char *)_s->p) + 3))) << 24) | \
|
||||
(((tui64) (*(((unsigned char *)_s->p) + 4))) << 32) | \
|
||||
(((tui64) (*(((unsigned char *)_s->p) + 5))) << 40) | \
|
||||
(((tui64) (*(((unsigned char *)_s->p) + 6))) << 48) | \
|
||||
(((tui64) (*(((unsigned char *)_s->p) + 7))) << 56); \
|
||||
_s->p += 8; \
|
||||
} while (0)
|
||||
|
||||
#define xstream_wr_u64_le(_s, _v) \
|
||||
do \
|
||||
{ \
|
||||
*(((unsigned char *) _s->p) + 0) = (unsigned char) ((_v >> 0) & 0xff); \
|
||||
*(((unsigned char *) _s->p) + 1) = (unsigned char) ((_v >> 8) & 0xff); \
|
||||
*(((unsigned char *) _s->p) + 2) = (unsigned char) ((_v >> 16) & 0xff); \
|
||||
*(((unsigned char *) _s->p) + 3) = (unsigned char) ((_v >> 24) & 0xff); \
|
||||
*(((unsigned char *) _s->p) + 4) = (unsigned char) ((_v >> 32) & 0xff); \
|
||||
*(((unsigned char *) _s->p) + 5) = (unsigned char) ((_v >> 40) & 0xff); \
|
||||
*(((unsigned char *) _s->p) + 6) = (unsigned char) ((_v >> 48) & 0xff); \
|
||||
*(((unsigned char *) _s->p) + 7) = (unsigned char) ((_v >> 56) & 0xff); \
|
||||
_s->p += 8; \
|
||||
} while (0)
|
||||
|
||||
/* copy data into stream */
|
||||
#define xstream_copyin(_s, _dest, _len) \
|
||||
do \
|
||||
{ \
|
||||
g_memcpy((_s)->p, (_dest), (_len)); \
|
||||
(_s)->p += (_len); \
|
||||
} while (0)
|
||||
|
||||
/* copy data out of stream */
|
||||
#define xstream_copyout(_dest, _s, _len) \
|
||||
do \
|
||||
{ \
|
||||
g_memcpy((_dest), (_s)->p, (_len)); \
|
||||
(_s)->p += (_len); \
|
||||
} while (0)
|
||||
|
||||
#define xstream_rd_string(_dest, _s, _len) \
|
||||
do \
|
||||
{ \
|
||||
g_memcpy((_dest), (_s)->p, (_len)); \
|
||||
(_s)->p += (_len); \
|
||||
} while (0)
|
||||
|
||||
#define xstream_wr_string(_s, _src, _len) \
|
||||
do \
|
||||
{ \
|
||||
g_memcpy((_s)->p, (_src), (_len)); \
|
||||
(_s)->p += (_len); \
|
||||
} while (0)
|
||||
|
||||
#define xstream_len(_s) (int) ((_s)->p - (_s)->data)
|
||||
#define xstream_seek(_s, _len) (_s)->p += (_len)
|
||||
} while (0)
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,75 +0,0 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Jay Sorg 2016
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* region, from pixman.h
|
||||
*/
|
||||
|
||||
#ifndef PIXMAN_PIXMAN_H__
|
||||
#define PIXMAN_PIXMAN_H__
|
||||
|
||||
typedef int pixman_bool_t;
|
||||
|
||||
struct pixman_region16_data
|
||||
{
|
||||
long size;
|
||||
long numRects;
|
||||
};
|
||||
|
||||
struct pixman_box16
|
||||
{
|
||||
signed short x1, y1, x2, y2;
|
||||
};
|
||||
|
||||
struct pixman_region16
|
||||
{
|
||||
struct pixman_box16 extents;
|
||||
struct pixman_region16_data *data;
|
||||
};
|
||||
|
||||
enum _pixman_region_overlap_t
|
||||
{
|
||||
PIXMAN_REGION_OUT,
|
||||
PIXMAN_REGION_IN,
|
||||
PIXMAN_REGION_PART
|
||||
};
|
||||
|
||||
typedef enum _pixman_region_overlap_t pixman_region_overlap_t;
|
||||
|
||||
typedef struct pixman_region16_data pixman_region16_data_t;
|
||||
typedef struct pixman_box16 pixman_box16_t;
|
||||
typedef struct pixman_region16 pixman_region16_t;
|
||||
|
||||
/* creation/destruction */
|
||||
void pixman_region_init (pixman_region16_t *region);
|
||||
void pixman_region_init_rect (pixman_region16_t *region, int x, int y,
|
||||
unsigned int width, unsigned int height);
|
||||
void pixman_region_fini (pixman_region16_t *region);
|
||||
pixman_bool_t pixman_region_union (pixman_region16_t *new_reg,
|
||||
pixman_region16_t *reg1,
|
||||
pixman_region16_t *reg2);
|
||||
pixman_bool_t pixman_region_subtract (pixman_region16_t *reg_d,
|
||||
pixman_region16_t *reg_m,
|
||||
pixman_region16_t *reg_s);
|
||||
pixman_bool_t pixman_region_intersect (pixman_region16_t *new_reg,
|
||||
pixman_region16_t *reg1,
|
||||
pixman_region16_t *reg2);
|
||||
pixman_box16_t *pixman_region_rectangles (pixman_region16_t *region,
|
||||
int *n_rects);
|
||||
pixman_bool_t pixman_region_not_empty (pixman_region16_t *region);
|
||||
pixman_box16_t *pixman_region_extents (pixman_region16_t *region);
|
||||
|
||||
#endif
|
@ -1,77 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2008 Red Hat, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software
|
||||
* and its documentation for any purpose is hereby granted without
|
||||
* fee, provided that the above copyright notice appear in all copies
|
||||
* and that both that copyright notice and this permission notice
|
||||
* appear in supporting documentation, and that the name of
|
||||
* Red Hat, Inc. not be used in advertising or publicity pertaining to
|
||||
* distribution of the software without specific, written prior
|
||||
* permission. Red Hat, Inc. makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as
|
||||
* is" without express or implied warranty.
|
||||
*
|
||||
* RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
|
||||
* INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
|
||||
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Author: Soren Sandmann <sandmann@redhat.com>
|
||||
*/
|
||||
|
||||
/* taken from pixman 0.34
|
||||
altered to compile without all of pixman */
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config_ac.h"
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#if defined(HAVE_STDINT_H)
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#include "pixman-region.h"
|
||||
|
||||
#if !defined(UINT32_MAX)
|
||||
#define UINT32_MAX (4294967295U)
|
||||
#endif
|
||||
#if !defined(INT16_MIN)
|
||||
#define INT16_MIN (-32767-1)
|
||||
#endif
|
||||
#if !defined(INT16_MAX)
|
||||
#define INT16_MAX (32767)
|
||||
#endif
|
||||
|
||||
#define PIXMAN_EXPORT
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
|
||||
#define MIN(x1, x2) ((x1) < (x2) ? (x1) : (x2))
|
||||
#define MAX(x1, x2) ((x1) > (x2) ? (x1) : (x2))
|
||||
|
||||
typedef pixman_box16_t box_type_t;
|
||||
typedef pixman_region16_data_t region_data_type_t;
|
||||
typedef pixman_region16_t region_type_t;
|
||||
typedef signed int overflow_int_t;
|
||||
|
||||
#define PREFIX(x) pixman_region##x
|
||||
|
||||
#define PIXMAN_REGION_MAX INT16_MAX
|
||||
#define PIXMAN_REGION_MIN INT16_MIN
|
||||
|
||||
#define FUNC "func"
|
||||
|
||||
#define critical_if_fail(expr)
|
||||
|
||||
static int _pixman_log_error(const char *func, const char *format, ...)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include "pixman-region.c"
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Jay Sorg 2012-2014
|
||||
* Copyright (C) Jay Sorg 2012
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -78,9 +78,9 @@ struct rail_icon_info
|
||||
int cmap_bytes;
|
||||
int mask_bytes;
|
||||
int data_bytes;
|
||||
char *mask;
|
||||
char *cmap;
|
||||
char *data;
|
||||
char* mask;
|
||||
char* cmap;
|
||||
char* data;
|
||||
};
|
||||
|
||||
struct rail_window_rect
|
||||
@ -95,8 +95,8 @@ struct rail_notify_icon_infotip
|
||||
{
|
||||
int timeout;
|
||||
int flags;
|
||||
char *text;
|
||||
char *title;
|
||||
char* text;
|
||||
char* title;
|
||||
};
|
||||
|
||||
struct rail_window_state_order
|
||||
@ -105,7 +105,7 @@ struct rail_window_state_order
|
||||
int style;
|
||||
int extended_style;
|
||||
int show_state;
|
||||
char *title_info;
|
||||
char* title_info;
|
||||
int client_offset_x;
|
||||
int client_offset_y;
|
||||
int client_area_width;
|
||||
@ -119,17 +119,17 @@ struct rail_window_state_order
|
||||
int window_width;
|
||||
int window_height;
|
||||
int num_window_rects;
|
||||
struct rail_window_rect *window_rects;
|
||||
struct rail_window_rect* window_rects;
|
||||
int visible_offset_x;
|
||||
int visible_offset_y;
|
||||
int num_visibility_rects;
|
||||
struct rail_window_rect *visibility_rects;
|
||||
struct rail_window_rect* visibility_rects;
|
||||
};
|
||||
|
||||
struct rail_notify_state_order
|
||||
{
|
||||
int version;
|
||||
char *tool_tip;
|
||||
char* tool_tip;
|
||||
struct rail_notify_icon_infotip infotip;
|
||||
int state;
|
||||
int icon_cache_entry;
|
||||
@ -141,7 +141,7 @@ struct rail_monitored_desktop_order
|
||||
{
|
||||
int active_window_id;
|
||||
int num_window_ids;
|
||||
int *window_ids;
|
||||
int* window_ids;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,488 +0,0 @@
|
||||
/**
|
||||
* Copyright (C) 2022 Matt Burt, all xrdp contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file common/scancode.c
|
||||
* @brief Scancode handling
|
||||
*/
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include <config_ac.h>
|
||||
#endif
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "scancode.h"
|
||||
|
||||
struct scancode_to_keycode
|
||||
{
|
||||
unsigned short scancode; // 0x1xx implies an extended key
|
||||
unsigned char keycode;
|
||||
};
|
||||
|
||||
#define ELEMENTS(x) (sizeof(x) / sizeof(x[0]))
|
||||
|
||||
// Sources:-
|
||||
// file:/usr/share/X11/xkb/keycodes/evdev
|
||||
// https://wiki.osdev.org/PS/2_Keyboard
|
||||
// https://www.kbdlayout.info/
|
||||
static const struct scancode_to_keycode
|
||||
evdev_scancode_to_keycode_map[] =
|
||||
{
|
||||
// Virtual XKB
|
||||
// Key (US) Symbol
|
||||
// -------- ------
|
||||
{ 0x001, 9 }, // VK_ESCAPE ESC
|
||||
{ 0x002, 10 }, // VK_1 AE01
|
||||
{ 0x003, 11 }, // VK_2 AE02
|
||||
{ 0x004, 12 }, // VK_3 AE03
|
||||
{ 0x005, 13 }, // VK_4 AE04
|
||||
{ 0x006, 14 }, // VK_5 AE05
|
||||
{ 0x007, 15 }, // VK_6 AE06
|
||||
{ 0x008, 16 }, // VK_7 AE07
|
||||
{ 0x009, 17 }, // VK_8 AE08
|
||||
{ 0x00a, 18 }, // VK_9 AE09
|
||||
{ 0x00b, 19 }, // VK_0 AE10
|
||||
{ 0x00c, 20 }, // VK_OEM_MINUS AE11
|
||||
{ 0x00d, 21 }, // VK_OEM_PLUS AE12
|
||||
{ 0x00e, 22 }, // VK_BACK BKSP
|
||||
{ 0x00f, 23 }, // VK_TAB TAB
|
||||
{ 0x010, 24 }, // VK_Q AD01
|
||||
{ 0x011, 25 }, // VK_W AD02
|
||||
{ 0x012, 26 }, // VK_E AD03
|
||||
{ 0x013, 27 }, // VK_R AD04
|
||||
{ 0x014, 28 }, // VK_T AD05
|
||||
{ 0x015, 29 }, // VK_Y AD06
|
||||
{ 0x016, 30 }, // VK_U AD07
|
||||
{ 0x017, 31 }, // VK_I AD08
|
||||
{ 0x018, 32 }, // VK_O AD09
|
||||
{ 0x019, 33 }, // VK_P AD10
|
||||
{ 0x01a, 34 }, // VK_OEM_4 AD11
|
||||
{ 0x01b, 35 }, // VK_OEM_6 AD12
|
||||
{ 0x01c, 36 }, // VK_RETURN RTRN
|
||||
{ 0x01d, 37 }, // VK_LCONTROL LCTL
|
||||
{ 0x01e, 38 }, // VK_A AC01
|
||||
{ 0x01f, 39 }, // VK_S AC02
|
||||
{ 0x020, 40 }, // VK_D AC03
|
||||
{ 0x021, 41 }, // VK_F AC04
|
||||
{ 0x022, 42 }, // VK_G AC05
|
||||
{ 0x023, 43 }, // VK_H AC06
|
||||
{ 0x024, 44 }, // VK_J AC07
|
||||
{ 0x025, 45 }, // VK_K AC08
|
||||
{ 0x026, 46 }, // VK_L AC09
|
||||
{ 0x027, 47 }, // VK_OEM_1 AC10
|
||||
{ 0x028, 48 }, // VK_OEM_7 AC11
|
||||
{ 0x029, 49 }, // VK_OEM_3 TLDE
|
||||
{ 0x02a, 50 }, // VK_LSHIFT LFSH
|
||||
{ 0x02b, 51 }, // VK_OEM_5 BKSL
|
||||
{ 0x02c, 52 }, // VK_Z AB01
|
||||
{ 0x02d, 53 }, // VK_X AB02
|
||||
{ 0x02e, 54 }, // VK_C AB03
|
||||
{ 0x02f, 55 }, // VK_V AB04
|
||||
{ 0x030, 56 }, // VK_B AB05
|
||||
{ 0x031, 57 }, // VK_N AB06
|
||||
{ 0x032, 58 }, // VK_M AB07
|
||||
{ 0x033, 59 }, // VK_OEM_COMMA AB08
|
||||
{ 0x034, 60 }, // VK_OEM_PERIOD AB09
|
||||
{ 0x035, 61 }, // VK_OEM_2 AB10
|
||||
{ 0x036, 62 }, // VK_RSHIFT RTSH
|
||||
{ 0x037, 63 }, // VK_MULTIPLY KPMU
|
||||
{ 0x038, 64 }, // VK_LMENU LALT
|
||||
{ 0x039, 65 }, // VK_SPACE SPCE
|
||||
{ 0x03a, 66 }, // VK_CAPITAL CAPS
|
||||
{ 0x03b, 67 }, // VK_F1 FK01
|
||||
{ 0x03c, 68 }, // VK_F2 FK02
|
||||
{ 0x03d, 69 }, // VK_F3 FK03
|
||||
{ 0x03e, 70 }, // VK_F4 FK04
|
||||
{ 0x03f, 71 }, // VK_F5 FK05
|
||||
{ 0x040, 72 }, // VK_F6 FK06
|
||||
{ 0x041, 73 }, // VK_F7 FK07
|
||||
{ 0x042, 74 }, // VK_F8 FK08
|
||||
{ 0x043, 75 }, // VK_F9 FK09
|
||||
{ 0x044, 76 }, // VK_F10 FK10
|
||||
{ 0x045, 77 }, // VK_NUMLOCK NMLK
|
||||
{ 0x046, 78 }, // VK_SCROLL SCLK
|
||||
{ 0x047, 79 }, // VK_HOME KP7
|
||||
{ 0x048, 80 }, // VK_UP KP8
|
||||
{ 0x049, 81 }, // VK_PRIOR KP9
|
||||
{ 0x04a, 82 }, // VK_SUBTRACT KPSU
|
||||
{ 0x04b, 83 }, // VK_LEFT KP4
|
||||
{ 0x04c, 84 }, // VK_CLEAR KP5
|
||||
{ 0x04d, 85 }, // VK_RIGHT KP6
|
||||
{ 0x04e, 86 }, // VK_ADD KPAD
|
||||
{ 0x04f, 87 }, // VK_END KP1
|
||||
{ 0x050, 88 }, // VK_DOWN KP2
|
||||
{ 0x051, 89 }, // VK_NEXT KP3
|
||||
{ 0x052, 90 }, // VK_INSERT KP0
|
||||
{ 0x053, 91 }, // VK_DELETE KPDL
|
||||
{ 0x056, 94 }, // VK_OEM_102 LSGT
|
||||
{ 0x057, 95 }, // VK_F11 FK11
|
||||
{ 0x058, 96 }, // VK_F12 FK12
|
||||
{ 0x070, 101 }, // - HKTG
|
||||
{ 0x073, 97 }, // VK_ABNT_C1 AB11
|
||||
{ 0x079, 100 }, // - HENK
|
||||
{ 0x07b, 102 }, // VK_OEM_PA1 MUHE
|
||||
{ 0x07d, 132 }, // - AE13
|
||||
{ 0x07e, 129 }, // VK_ABNT_C2 KPPT (Brazil ABNT2)
|
||||
{ 0x110, 173 }, // VK_MEDIA_PREV_TRACK I173 (KEY_PREVIOUSSONG)
|
||||
{ 0x119, 171 }, // VK_MEDIA_NEXT_TRACK I171 (KEY_NEXTSONG)
|
||||
{ 0x11c, 104 }, // VK_RETURN KPEN
|
||||
{ 0x11d, 105 }, // VK_RCONTROL RCTL
|
||||
{ 0x120, 121 }, // VK_VOLUME_MUTE MUTE
|
||||
{ 0x121, 148 }, // VK_LAUNCH_APP2 I148 (KEY_CALC)
|
||||
{ 0x122, 172 }, // VK_PLAY_PAUSE I172 (KEY_PLAYPAUSE)
|
||||
{ 0x124, 174 }, // VK_MEDIA_STOP I174 (KEY_STOPCD)
|
||||
{ 0x12e, 122 }, // VK_VOLUME_DOWN VOL-
|
||||
{ 0x130, 123 }, // VK_VOLUME_UP VOL+
|
||||
{ 0x132, 180 }, // VK_BROWSER_HOME I180 (KEY_HOMEPAGE)
|
||||
{ 0x135, 106 }, // VK_DIVIDE KPDV
|
||||
{ 0x137, 107 }, // VK_SNAPSHOT PRSC
|
||||
{ 0x138, 108 }, // VK_RMENU RALT
|
||||
{ 0x147, 110 }, // VK_HOME HOME
|
||||
{ 0x148, 111 }, // VK_UP UP
|
||||
{ 0x149, 112 }, // VK_PRIOR PGUP (KEY_COMPUTER)
|
||||
{ 0x14b, 113 }, // VK_LEFT LEFT
|
||||
{ 0x14d, 114 }, // VK_RIGHT RGHT
|
||||
{ 0x14f, 115 }, // VK_END END
|
||||
{ 0x150, 116 }, // VK_DOWN DOWN
|
||||
{ 0x151, 117 }, // VK_NEXT PGDN
|
||||
{ 0x152, 118 }, // VK_INSERT INS
|
||||
{ 0x153, 119 }, // VK_DELETE DELE
|
||||
{ 0x15b, 133 }, // VK_LWIN LWIN
|
||||
{ 0x15c, 134 }, // VK_RWIN RWIN
|
||||
{ 0x15d, 135 }, // VK_APPS COMP
|
||||
{ 0x165, 225 }, // VK_BROWSER_SEARCH I225 (KEY_SEARCH)
|
||||
{ 0x166, 164 }, // VK_BROWSER_FAVORITES I164 (KEY_BOOKMARKS)
|
||||
{ 0x16b, 165 }, // VK_LAUNCH_APP1 I165 (KEY_COMPUTER)
|
||||
{ 0x16c, 163 }, // VK_LAUNCH_MAIL I163 (KEY_MAIL)
|
||||
{ 0x21d, 127 } // VK_PAUSE PAUS (KEY_PAUSE)
|
||||
};
|
||||
|
||||
// Sources:-
|
||||
// file:/usr/share/X11/xkb/keycodes/xfree86
|
||||
// https://wiki.osdev.org/PS/2_Keyboard
|
||||
// https://www.kbdlayout.info/
|
||||
static const struct scancode_to_keycode
|
||||
base_scancode_to_keycode_map[] =
|
||||
{
|
||||
// Virtual XKB
|
||||
// Key (US) Symbol
|
||||
// -------- ------
|
||||
{ 0x001, 9 }, // VK_ESCAPE ESC
|
||||
{ 0x002, 10 }, // VK_1 AE01
|
||||
{ 0x003, 11 }, // VK_2 AE02
|
||||
{ 0x004, 12 }, // VK_3 AE03
|
||||
{ 0x005, 13 }, // VK_4 AE04
|
||||
{ 0x006, 14 }, // VK_5 AE05
|
||||
{ 0x007, 15 }, // VK_6 AE06
|
||||
{ 0x008, 16 }, // VK_7 AE07
|
||||
{ 0x009, 17 }, // VK_8 AE08
|
||||
{ 0x00a, 18 }, // VK_9 AE09
|
||||
{ 0x00b, 19 }, // VK_0 AE10
|
||||
{ 0x00c, 20 }, // VK_OEM_MINUS AE11
|
||||
{ 0x00d, 21 }, // VK_OEM_PLUS AE12
|
||||
{ 0x00e, 22 }, // VK_BACK BKSP
|
||||
{ 0x00f, 23 }, // VK_TAB TAB
|
||||
{ 0x010, 24 }, // VK_Q AD01
|
||||
{ 0x011, 25 }, // VK_W AD02
|
||||
{ 0x012, 26 }, // VK_E AD03
|
||||
{ 0x013, 27 }, // VK_R AD04
|
||||
{ 0x014, 28 }, // VK_T AD05
|
||||
{ 0x015, 29 }, // VK_Y AD06
|
||||
{ 0x016, 30 }, // VK_U AD07
|
||||
{ 0x017, 31 }, // VK_I AD08
|
||||
{ 0x018, 32 }, // VK_O AD09
|
||||
{ 0x019, 33 }, // VK_P AD10
|
||||
{ 0x01a, 34 }, // VK_OEM_4 AD11
|
||||
{ 0x01b, 35 }, // VK_OEM_6 AD12
|
||||
{ 0x01c, 36 }, // VK_RETURN RTRN
|
||||
{ 0x01d, 37 }, // VK_LCONTROL LCTL
|
||||
{ 0x01e, 38 }, // VK_A AC01
|
||||
{ 0x01f, 39 }, // VK_S AC02
|
||||
{ 0x020, 40 }, // VK_D AC03
|
||||
{ 0x021, 41 }, // VK_F AC04
|
||||
{ 0x022, 42 }, // VK_G AC05
|
||||
{ 0x023, 43 }, // VK_H AC06
|
||||
{ 0x024, 44 }, // VK_J AC07
|
||||
{ 0x025, 45 }, // VK_K AC08
|
||||
{ 0x026, 46 }, // VK_L AC09
|
||||
{ 0x027, 47 }, // VK_OEM_1 AC10
|
||||
{ 0x028, 48 }, // VK_OEM_7 AC11
|
||||
{ 0x029, 49 }, // VK_OEM_3 TLDE
|
||||
{ 0x02a, 50 }, // VK_LSHIFT LFSH
|
||||
{ 0x02b, 51 }, // VK_OEM_5 BKSL
|
||||
{ 0x02c, 52 }, // VK_Z AB01
|
||||
{ 0x02d, 53 }, // VK_X AB02
|
||||
{ 0x02e, 54 }, // VK_C AB03
|
||||
{ 0x02f, 55 }, // VK_V AB04
|
||||
{ 0x030, 56 }, // VK_B AB05
|
||||
{ 0x031, 57 }, // VK_N AB06
|
||||
{ 0x032, 58 }, // VK_M AB07
|
||||
{ 0x033, 59 }, // VK_OEM_COMMA AB08
|
||||
{ 0x034, 60 }, // VK_OEM_PERIOD AB09
|
||||
{ 0x035, 61 }, // VK_OEM_2 AB10
|
||||
{ 0x036, 62 }, // VK_RSHIFT RTSH
|
||||
{ 0x037, 63 }, // VK_MULTIPLY KPMU
|
||||
{ 0x038, 64 }, // VK_LMENU LALT
|
||||
{ 0x039, 65 }, // VK_SPACE SPCE
|
||||
{ 0x03a, 66 }, // VK_CAPITAL CAPS
|
||||
{ 0x03b, 67 }, // VK_F1 FK01
|
||||
{ 0x03c, 68 }, // VK_F2 FK02
|
||||
{ 0x03d, 69 }, // VK_F3 FK03
|
||||
{ 0x03e, 70 }, // VK_F4 FK04
|
||||
{ 0x03f, 71 }, // VK_F5 FK05
|
||||
{ 0x040, 72 }, // VK_F6 FK06
|
||||
{ 0x041, 73 }, // VK_F7 FK07
|
||||
{ 0x042, 74 }, // VK_F8 FK08
|
||||
{ 0x043, 75 }, // VK_F9 FK09
|
||||
{ 0x044, 76 }, // VK_F10 FK10
|
||||
{ 0x045, 77 }, // VK_NUMLOCK NMLK
|
||||
{ 0x046, 78 }, // VK_SCROLL SCLK
|
||||
{ 0x047, 79 }, // VK_HOME KP7
|
||||
{ 0x048, 80 }, // VK_UP KP8
|
||||
{ 0x049, 81 }, // VK_PRIOR KP9
|
||||
{ 0x04a, 82 }, // VK_SUBTRACT KPSU
|
||||
{ 0x04b, 83 }, // VK_LEFT KP4
|
||||
{ 0x04c, 84 }, // VK_CLEAR KP5
|
||||
{ 0x04d, 85 }, // VK_RIGHT KP6
|
||||
{ 0x04e, 86 }, // VK_ADD KPAD
|
||||
{ 0x04f, 87 }, // VK_END KP1
|
||||
{ 0x050, 88 }, // VK_DOWN KP2
|
||||
{ 0x051, 89 }, // VK_NEXT KP3
|
||||
{ 0x052, 90 }, // VK_INSERT KP0
|
||||
{ 0x053, 91 }, // VK_DELETE KPDL
|
||||
{ 0x056, 94 }, // VK_OEM_102 LSGT
|
||||
{ 0x057, 95 }, // VK_F11 FK11
|
||||
{ 0x058, 96 }, // VK_F12 FK12
|
||||
{ 0x070, 208 }, // - HKTG
|
||||
{ 0x073, 211 }, // VK_ABNT_C1 AB11
|
||||
{ 0x079, 129 }, // - XFER
|
||||
{ 0x07b, 131 }, // VK_OEM_PA1 NFER
|
||||
{ 0x07d, 133 }, // - AE13
|
||||
{ 0x07e, 134 }, // VK_ABNT_C2 KPPT (Brazil ABNT2)
|
||||
{ 0x11c, 108 }, // VK_RETURN KPEN
|
||||
{ 0x11d, 109 }, // VK_RCONTROL RCTL
|
||||
{ 0x120, 141 }, // VK_VOLUME_MUTE MUTE
|
||||
{ 0x12e, 142 }, // VK_VOLUME_DOWN VOL-
|
||||
{ 0x130, 143 }, // VK_VOLUME_UP VOL+
|
||||
{ 0x135, 112 }, // VK_DIVIDE KPDV
|
||||
{ 0x137, 121 }, // VK_SNAPSHOT PRSC
|
||||
{ 0x138, 113 }, // VK_RMENU RALT
|
||||
{ 0x147, 97 }, // VK_HOME HOME
|
||||
{ 0x148, 98 }, // VK_UP UP
|
||||
{ 0x149, 99 }, // VK_PRIOR PGUP (KEY_COMPUTER)
|
||||
{ 0x14b, 100 }, // VK_LEFT LEFT
|
||||
{ 0x14d, 102 }, // VK_RIGHT RGHT
|
||||
{ 0x14f, 103 }, // VK_END END
|
||||
{ 0x150, 104 }, // VK_DOWN DOWN
|
||||
{ 0x151, 105 }, // VK_NEXT PGDN
|
||||
{ 0x152, 106 }, // VK_INSERT INS
|
||||
{ 0x153, 107 }, // VK_DELETE DELE
|
||||
{ 0x15b, 115 }, // VK_LWIN LWIN
|
||||
{ 0x15c, 116 }, // VK_RWIN RWIN
|
||||
{ 0x15d, 117 }, // VK_APPS COMP
|
||||
{ 0x21d, 110 } // VK_PAUSE PAUS (KEY_PAUSE)
|
||||
};
|
||||
|
||||
struct map_settings
|
||||
{
|
||||
const struct scancode_to_keycode *map;
|
||||
const char *name;
|
||||
unsigned int size;
|
||||
};
|
||||
|
||||
enum settings_index
|
||||
{
|
||||
SI_EVDEV = 0,
|
||||
SI_BASE
|
||||
};
|
||||
|
||||
const struct map_settings global_settings[] =
|
||||
{
|
||||
{
|
||||
// SI_EVDEV
|
||||
.map = evdev_scancode_to_keycode_map,
|
||||
.name = "evdev",
|
||||
.size = ELEMENTS(evdev_scancode_to_keycode_map),
|
||||
},
|
||||
{
|
||||
// SI_BASE
|
||||
.map = base_scancode_to_keycode_map,
|
||||
.name = "base",
|
||||
.size = ELEMENTS(base_scancode_to_keycode_map)
|
||||
}
|
||||
};
|
||||
|
||||
// Default mapping set is "evdev"
|
||||
const struct map_settings *settings = &global_settings[SI_EVDEV];
|
||||
|
||||
/*****************************************************************************/
|
||||
int
|
||||
scancode_to_index(unsigned short scancode)
|
||||
{
|
||||
if (scancode <= 0x7f)
|
||||
{
|
||||
return scancode;
|
||||
}
|
||||
if (scancode <= 0xff)
|
||||
{
|
||||
// 0x80 - 0xff : Invalid code
|
||||
return -1;
|
||||
}
|
||||
if (scancode <= 0x177)
|
||||
{
|
||||
// 01x100 - 0x177 : Move bit 9 to bit 8
|
||||
return (scancode & 0x7f) | 0x80;
|
||||
}
|
||||
|
||||
if (scancode == SCANCODE_PAUSE_KEY)
|
||||
{
|
||||
return SCANCODE_INDEX_PAUSE_KEY;
|
||||
}
|
||||
|
||||
// This leaves the following which are all rejected
|
||||
// 0x178 - 0x17f (currently unused). These would map to indexes 0xf8
|
||||
// to 0xff which we are reserving for extended1 keys.
|
||||
// 0x180 - 0x1ff Illegal format
|
||||
// >0x200 Anything not mentioned explicitly above (e.g.
|
||||
// SCANCODE_PAUSE_KEY)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
unsigned short
|
||||
scancode_from_index(int index)
|
||||
{
|
||||
index &= 0xff;
|
||||
unsigned short result;
|
||||
if (index == SCANCODE_INDEX_PAUSE_KEY)
|
||||
{
|
||||
result = SCANCODE_PAUSE_KEY;
|
||||
}
|
||||
else if (index < 0x80)
|
||||
{
|
||||
result = index;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = (index & 0x7f) | 0x100;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
unsigned short
|
||||
scancode_to_x11_keycode(unsigned short scancode)
|
||||
{
|
||||
unsigned int min = 0;
|
||||
unsigned int max = settings->size;
|
||||
unsigned short rv = 0;
|
||||
|
||||
// Check scancode is in range of map
|
||||
if (scancode >= settings->map[min].scancode &&
|
||||
scancode <= settings->map[max - 1].scancode)
|
||||
{
|
||||
// Use a binary chop to locate the correct index
|
||||
// in logarithmic time.
|
||||
while (1)
|
||||
{
|
||||
unsigned int index = (min + max) / 2;
|
||||
if (scancode == settings->map[index].scancode)
|
||||
{
|
||||
rv = settings->map[index].keycode;
|
||||
break;
|
||||
}
|
||||
// Adjust min or max, checking for end
|
||||
// of iteration
|
||||
if (scancode < settings->map[index].scancode)
|
||||
{
|
||||
max = index;
|
||||
}
|
||||
else if (min == index)
|
||||
{
|
||||
// We've already checked this value
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
min = index;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
unsigned short
|
||||
scancode_get_next(unsigned int *iter)
|
||||
{
|
||||
unsigned short rv = 0;
|
||||
if (*iter < settings->size)
|
||||
{
|
||||
rv = settings->map[*iter].scancode;
|
||||
++(*iter);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int
|
||||
scancode_set_keycode_set(const char *kk_set)
|
||||
{
|
||||
int rv = 0;
|
||||
|
||||
if (kk_set == NULL)
|
||||
{
|
||||
rv = 1;
|
||||
}
|
||||
else if (strncmp(kk_set, "evdev", 5) == 0)
|
||||
{
|
||||
settings = &global_settings[SI_EVDEV];
|
||||
}
|
||||
else if (strncmp(kk_set, "base", 4) == 0)
|
||||
{
|
||||
settings = &global_settings[SI_BASE];
|
||||
}
|
||||
else if (strncmp(kk_set, "xfree86", 7) == 0)
|
||||
{
|
||||
settings = &global_settings[SI_BASE];
|
||||
}
|
||||
else
|
||||
{
|
||||
rv = 1;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
const char *
|
||||
scancode_get_keycode_set(void)
|
||||
{
|
||||
return settings->name;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
const char *
|
||||
scancode_get_xkb_rules(void)
|
||||
{
|
||||
// Currently supported keycods map directly to the same name for
|
||||
// the rules which use them.
|
||||
return settings->name;
|
||||
}
|
@ -1,169 +0,0 @@
|
||||
/**
|
||||
* Copyright (C) 2024 Matt Burt, all xrdp contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file common/scancode.h
|
||||
* @brief Scancode handling
|
||||
*
|
||||
* This module provides functionality for the following:-
|
||||
* 1) Mapping from TS_KEYBOARD_EVENT PDU values to an 'RDP scancode'
|
||||
* 2) Handling RDP scancodes
|
||||
* 3) Convert between RDP scancodes and X11 keycodes.
|
||||
*
|
||||
* The values received in TS_KEYBOARD_EVENT PDUs are largely the same as
|
||||
* Windows scancodes. These are indirectly documented in the Microsoft
|
||||
* "Keyboard Scan Code Specification", Rev 1.3a (March 16th 2000) and
|
||||
* are otherwise known as "Scan code set 1" scancodes. This document no
|
||||
* longer appears to be available directly from the Microsoft website.
|
||||
*
|
||||
* A TS_KEYBOARD_EVENT_PDU contains two important values:-
|
||||
* 1) key_code This is not unique. For example, left-shift and
|
||||
* right-shift share a key_code of 0x2a
|
||||
* 2) keyboard_flags Among other flags, contains KBDFLAGS_EXTENDED and
|
||||
* KBDFLAGS_EXTENDED1. These combine with the key_code
|
||||
* to allow a specific key to be determined.
|
||||
*
|
||||
* An 'RDP scancode' as defined by this module is a mapping of the
|
||||
* Windows key_code and keyboard_flags into a single value which
|
||||
* represents a unique key. For example:-
|
||||
* Left control : key_code=0x1d, KBDFLAGS_EXTENDED=0 scancode = 0x1d
|
||||
* Right control : key_code=0x1d, KBDFLAGS_EXTENDED=1 scancode = 0x11d
|
||||
*
|
||||
* This model of unique keys more closely maps what X11 does with its
|
||||
* own keycodes.
|
||||
*
|
||||
* X11 keycodes are the X11 equivalent of RDP scancodes. In general, these
|
||||
* are specific to an X server. In practice however, these are nowadays
|
||||
* handled by the XKB extension and only two sets are in common use:-
|
||||
* - evdev : Linux, FreeBSD and possibly others
|
||||
* - base : Everything else.
|
||||
*
|
||||
* This module presents a single source of truth for conversions between
|
||||
* RDP scancodes and X11 keycodes.
|
||||
*/
|
||||
|
||||
#if !defined(SCANCODE_H)
|
||||
#define SCANCODE_H
|
||||
|
||||
#include "xrdp_scancode_defs.h"
|
||||
|
||||
enum
|
||||
{
|
||||
/**
|
||||
* Scancodes for keys used in the code are defined in the global
|
||||
* file xrdp_scancode_defs.h
|
||||
*/
|
||||
|
||||
/**
|
||||
* Scancode indexes for some of the keys in xrdp_scancode_defs.h
|
||||
*/
|
||||
SCANCODE_INDEX_LSHIFT_KEY = SCANCODE_LSHIFT_KEY,
|
||||
SCANCODE_INDEX_RSHIFT_KEY = SCANCODE_RSHIFT_KEY,
|
||||
SCANCODE_INDEX_RALT_KEY = (SCANCODE_RALT_KEY & 0x7f) | 0x80,
|
||||
SCANCODE_INDEX_PAUSE_KEY = 0xf8,
|
||||
// 0xf9 - 0xff reserved for future extended1 mappings
|
||||
|
||||
/**
|
||||
* Maximum value returned by scancode_to_index()
|
||||
*/
|
||||
SCANCODE_MAX_INDEX = 255
|
||||
};
|
||||
|
||||
/**
|
||||
* Convert a scancode to an index
|
||||
* @param scancode scancode in the range 0x00 - 0x2ff
|
||||
* @return index in the range 0..SCANCODE_MAX_INDEX (inclusive) or -1
|
||||
*
|
||||
* This function converts a 10-bit scancode into an 8-bit array index,
|
||||
* independent of the currently loaded keymap
|
||||
*
|
||||
* This is possible as the scancodes from 0x80 - 0x2ff are sparsely allocated.
|
||||
*
|
||||
* For scancodes in the range 0x00 - 0x7f, the index is identical to the
|
||||
* scancode. This includes scancodes for all the keys affected by
|
||||
* numlock.
|
||||
*/
|
||||
int
|
||||
scancode_to_index(unsigned short scancode);
|
||||
|
||||
/**
|
||||
* Convert an index back to a scancode.
|
||||
* @param index in the range 0..SCANCODE_MAX_INDEX
|
||||
*
|
||||
* @result scancode which is mapped to the index value
|
||||
*
|
||||
* The result is always a valid scancode, even if the index is
|
||||
* not valid.
|
||||
*/
|
||||
unsigned short
|
||||
scancode_from_index(int index);
|
||||
|
||||
/**
|
||||
* Looks up an RDP scancode and converts to an x11 keycode
|
||||
*
|
||||
* @param scancode Scancode. Extended scancodes have bit 9 set
|
||||
* (i.e. are in 0x100 - 0x1ff). Extended1 scancodes
|
||||
* (currently just the pause key) are in the range 0x200-0x2ff
|
||||
* @return keycode, or 0 for no keycode
|
||||
*/
|
||||
unsigned short
|
||||
scancode_to_x11_keycode(unsigned short scancode);
|
||||
|
||||
/**
|
||||
* Gets the next valid scancode from the list of valid scancodes
|
||||
* @param iter Value (initialised to zero), used to iterate
|
||||
* over available scancodes.
|
||||
* @return Next valid scancode, or zero.
|
||||
*
|
||||
* The iterator is updated on a successful call. Use like this:-
|
||||
*
|
||||
* iter = 0;
|
||||
* while ((scancode = scancode_get_next(&iter)) != 0)
|
||||
* {
|
||||
* . . .
|
||||
* }
|
||||
*/
|
||||
unsigned short
|
||||
scancode_get_next(unsigned int *iter);
|
||||
|
||||
/**
|
||||
* Sets the keycode set used for the scancode translation
|
||||
*
|
||||
* @param kk_set "evdev", "base", or something more
|
||||
* complex (e.g. "evdev+aliases(qwerty)")
|
||||
* @result 0 for success
|
||||
*/
|
||||
int
|
||||
scancode_set_keycode_set(const char *kk_set);
|
||||
|
||||
/**
|
||||
* Gets the keycode set used for the scancode translation
|
||||
*
|
||||
* @result "evdev", or "base"
|
||||
*/
|
||||
const char *
|
||||
scancode_get_keycode_set(void);
|
||||
|
||||
/**
|
||||
* Gets the XKB rules set which can be used to access the currently
|
||||
* loaded keycode set
|
||||
*
|
||||
* @result "evdev", or "base"
|
||||
*/
|
||||
const char *
|
||||
scancode_get_xkb_rules(void);
|
||||
|
||||
#endif /* SCANCODE_H */
|
1523
common/ssl_calls.c
1523
common/ssl_calls.c
File diff suppressed because it is too large
Load Diff
@ -1,115 +1,65 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Jay Sorg 2004-2014
|
||||
* Copyright (C) Idan Freiberg 2013-2014
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
xrdp: A Remote Desktop Protocol server.
|
||||
Copyright (C) Jay Sorg 2004-2010
|
||||
|
||||
*/
|
||||
|
||||
#if !defined(SSL_CALLS_H)
|
||||
#define SSL_CALLS_H
|
||||
|
||||
#include "arch.h"
|
||||
|
||||
/* Incomplete types */
|
||||
struct ssl_tls;
|
||||
struct trans;
|
||||
|
||||
int
|
||||
ssl_init(void);
|
||||
int
|
||||
ssl_finish(void);
|
||||
void *
|
||||
void* APP_CC
|
||||
ssl_rc4_info_create(void);
|
||||
void
|
||||
ssl_rc4_info_delete(void *rc4_info);
|
||||
void
|
||||
ssl_rc4_set_key(void *rc4_info, const char *key, int len);
|
||||
void
|
||||
ssl_rc4_crypt(void *rc4_info, char *data, int len);
|
||||
void *
|
||||
void APP_CC
|
||||
ssl_rc4_info_delete(void* rc4_info);
|
||||
void APP_CC
|
||||
ssl_rc4_set_key(void* rc4_info, char* key, int len);
|
||||
void APP_CC
|
||||
ssl_rc4_crypt(void* rc4_info, char* data, int len);
|
||||
void* APP_CC
|
||||
ssl_sha1_info_create(void);
|
||||
void
|
||||
ssl_sha1_info_delete(void *sha1_info);
|
||||
void
|
||||
ssl_sha1_clear(void *sha1_info);
|
||||
void
|
||||
ssl_sha1_transform(void *sha1_info, const char *data, int len);
|
||||
void
|
||||
ssl_sha1_complete(void *sha1_info, char *data);
|
||||
void *
|
||||
void APP_CC
|
||||
ssl_sha1_info_delete(void* sha1_info);
|
||||
void APP_CC
|
||||
ssl_sha1_clear(void* sha1_info);
|
||||
void APP_CC
|
||||
ssl_sha1_transform(void* sha1_info, char* data, int len);
|
||||
void APP_CC
|
||||
ssl_sha1_complete(void* sha1_info, char* data);
|
||||
void* APP_CC
|
||||
ssl_md5_info_create(void);
|
||||
void
|
||||
ssl_md5_info_delete(void *md5_info);
|
||||
void
|
||||
ssl_md5_clear(void *md5_info);
|
||||
void
|
||||
ssl_md5_transform(void *md5_info, const char *data, int len);
|
||||
void
|
||||
ssl_md5_complete(void *md5_info, char *data);
|
||||
void *
|
||||
ssl_des3_encrypt_info_create(const char *key, const char *ivec);
|
||||
void *
|
||||
ssl_des3_decrypt_info_create(const char *key, const char *ivec);
|
||||
void
|
||||
ssl_des3_info_delete(void *des3);
|
||||
int
|
||||
ssl_des3_encrypt(void *des3, int length, const char *in_data, char *out_data);
|
||||
int
|
||||
ssl_des3_decrypt(void *des3, int length, const char *in_data, char *out_data);
|
||||
void *
|
||||
ssl_hmac_info_create(void);
|
||||
void
|
||||
ssl_hmac_info_delete(void *hmac);
|
||||
void
|
||||
ssl_hmac_sha1_init(void *hmac, const char *data, int len);
|
||||
void
|
||||
ssl_hmac_transform(void *hmac, const char *data, int len);
|
||||
void
|
||||
ssl_hmac_complete(void *hmac, char *data, int len);
|
||||
int
|
||||
ssl_mod_exp(char *out, int out_len, const char *in, int in_len,
|
||||
const char *mod, int mod_len, const char *exp, int exp_len);
|
||||
int
|
||||
ssl_gen_key_xrdp1(int key_size_in_bits, const char *exp, int exp_len,
|
||||
char *mod, int mod_len, char *pri, int pri_len);
|
||||
|
||||
/* xrdp_tls.c */
|
||||
struct ssl_tls *
|
||||
ssl_tls_create(struct trans *trans, const char *key, const char *cert);
|
||||
int
|
||||
ssl_tls_accept(struct ssl_tls *self, long ssl_protocols,
|
||||
const char *tls_ciphers);
|
||||
int
|
||||
ssl_tls_disconnect(struct ssl_tls *self);
|
||||
void
|
||||
ssl_tls_delete(struct ssl_tls *self);
|
||||
int
|
||||
ssl_tls_read(struct ssl_tls *tls, char *data, int length);
|
||||
int
|
||||
ssl_tls_write(struct ssl_tls *tls, const char *data, int length);
|
||||
int
|
||||
ssl_tls_can_recv(struct ssl_tls *tls, int sck, int millis);
|
||||
const char *
|
||||
ssl_get_version(const struct ssl_tls *ssl);
|
||||
const char *
|
||||
ssl_get_cipher_name(const struct ssl_tls *ssl);
|
||||
int
|
||||
ssl_get_protocols_from_string(const char *str, long *ssl_protocols);
|
||||
const char *
|
||||
get_openssl_version(void);
|
||||
tintptr
|
||||
ssl_get_rwo(const struct ssl_tls *ssl);
|
||||
void APP_CC
|
||||
ssl_md5_info_delete(void* md5_info);
|
||||
void APP_CC
|
||||
ssl_md5_clear(void* md5_info);
|
||||
void APP_CC
|
||||
ssl_md5_transform(void* md5_info, char* data, int len);
|
||||
void APP_CC
|
||||
ssl_md5_complete(void* md5_info, char* data);
|
||||
int APP_CC
|
||||
ssl_mod_exp(char* out, int out_len, char* in, int in_len,
|
||||
char* mod, int mod_len, char* exp, int exp_len);
|
||||
int APP_CC
|
||||
ssl_gen_key_xrdp1(int key_size_in_bits, char* exp, int exp_len,
|
||||
char* mod, int mod_len, char* pri, int pri_len);
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,406 +0,0 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Jay Sorg 2004-2020
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* generic string handling calls
|
||||
*/
|
||||
|
||||
#if !defined(STRING_CALLS_H)
|
||||
#define STRING_CALLS_H
|
||||
|
||||
#include "arch.h"
|
||||
|
||||
/**
|
||||
* Map a character to a string value
|
||||
*
|
||||
* This structure is used by g_format_info_string() to specify the
|
||||
* string which could be output for %'ch', where ch is a character
|
||||
*/
|
||||
struct info_string_tag
|
||||
{
|
||||
char ch;
|
||||
const char *val;
|
||||
};
|
||||
|
||||
#define INFO_STRING_END_OF_LIST { '\0', NULL }
|
||||
|
||||
/**
|
||||
* Map a bitmask to a string value
|
||||
*
|
||||
*
|
||||
* This structure is used by g_bitmask_to_str() to specify the
|
||||
* string for each bit in the bitmask
|
||||
*/
|
||||
struct bitmask_string
|
||||
{
|
||||
int mask;
|
||||
const char *str;
|
||||
};
|
||||
|
||||
#define BITMASK_STRING_END_OF_LIST { 0, NULL }
|
||||
|
||||
/**
|
||||
* Map a bitmask to a char value
|
||||
*
|
||||
*
|
||||
* This structure is used by g_bitmask_to_charstr() to specify the
|
||||
* char for each bit in the bitmask
|
||||
*/
|
||||
struct bitmask_char
|
||||
{
|
||||
int mask;
|
||||
char c;
|
||||
};
|
||||
|
||||
#define BITMASK_CHAR_END_OF_LIST { 0, '\0' }
|
||||
|
||||
enum
|
||||
{
|
||||
// See g_sig2text()
|
||||
// Must be able to hold "SIG#%d" for INT_MIN
|
||||
//
|
||||
// ((sizeof(int) * 5 + 1) / 2) provides a very slight overestimate of
|
||||
// the bytes requires to store a decimal expansion of 'int':-
|
||||
// sizeof INT_MAX display bytes ((sizeof(int) * 5 + 1)
|
||||
// (int) needed / 2)
|
||||
// ------ ------- ------------- ---------------------------
|
||||
// 1 127 3 3
|
||||
// 2 32767 5 5
|
||||
// 3 8388607 7 8
|
||||
// 4 2147483637 10 10
|
||||
// 8 9*(10**18) 19 20
|
||||
// 16 2*(10**38) 39 40
|
||||
// 32 6*(10**76) 77 80
|
||||
MAXSTRSIGLEN = (3 + 1 + 1 + ((sizeof(int) * 5 + 1) / 2) + 1)
|
||||
};
|
||||
|
||||
/*
|
||||
* Significant Universal Character Set (Unicode) characters
|
||||
*/
|
||||
enum
|
||||
{
|
||||
UCS_WHITE_SQUARE = 0x25a1,
|
||||
UCS_REPLACEMENT_CHARACTER = 0xfffd
|
||||
};
|
||||
|
||||
/**
|
||||
* Processes a format string for general info
|
||||
*
|
||||
* @param[out] dest Destination buffer
|
||||
* @param[in] len Length of buffer, including space for a terminator
|
||||
* @param[in] format Format string to process
|
||||
* @param[in] map Array of struct info_string_tag.
|
||||
*
|
||||
* Where a '%<ch>' is encountered in the format string, the map is scanned
|
||||
* and the corresponding string is copied instead of '%<ch>'.
|
||||
*
|
||||
* '%%' is always replaced with a single '%' in the output. %<ch> strings
|
||||
* not present in the map are ignored.
|
||||
*
|
||||
* The map is terminated with INFO_STRING_END_OF_LIST
|
||||
*
|
||||
* Caller can check for buffer truncation by comparing the result with
|
||||
* the buffer length (as in snprintf())
|
||||
*/
|
||||
unsigned int
|
||||
g_format_info_string(char *dest, unsigned int len,
|
||||
const char *format,
|
||||
const struct info_string_tag map[]);
|
||||
|
||||
|
||||
/**
|
||||
* Converts a boolean to a string for output
|
||||
*
|
||||
* @param[in] value Value to convert
|
||||
* @return String representation
|
||||
*/
|
||||
const char *
|
||||
g_bool2text(int value);
|
||||
|
||||
/**
|
||||
* Converts a string to a boolean value
|
||||
*
|
||||
* @param[in] s String to convert
|
||||
* @return machine representation
|
||||
*/
|
||||
int
|
||||
g_text2bool(const char *s);
|
||||
|
||||
/**
|
||||
* Joins an array of strings into a single string.
|
||||
*
|
||||
* Note: The joiner is placed between each source string. The joiner is not
|
||||
* placed after the last source string. If there is only one source string,
|
||||
* then the result string will be equal to the source string.
|
||||
*
|
||||
* Note: any content that is present in dest will be overwritten with the new
|
||||
* joined string.
|
||||
*
|
||||
* Note: If the destination array is not large enough to hold the entire
|
||||
* contents of the joined string, then the joined string will be truncated
|
||||
* to fit in the destination array.
|
||||
*
|
||||
* @param[out] dest The destination array to write the joined string into.
|
||||
* @param[in] dest_len The max number of characters to write to the destination
|
||||
* array including the terminating null. Must be > 0
|
||||
* @param[in] joiner The string to concatenate between each source string.
|
||||
* The joiner string may be NULL which is processed as a zero length string.
|
||||
* @param[in] src An array of strings to join. The array must be non-null.
|
||||
* Array items may be NULL and are processed as zero length strings.
|
||||
* @param[in] src_len The number of strings to join in the src array. Must be > 0
|
||||
* @return A pointer to the beginning of the joined string (ie. returns dest).
|
||||
*/
|
||||
char *
|
||||
g_strnjoin(char *dest, int dest_len, const char *joiner, const char *src[], int src_len);
|
||||
|
||||
/**
|
||||
* Converts a binary array into a hux dump suitable for displaying to a user.
|
||||
*
|
||||
* The format of the hex dump is:
|
||||
* 0000 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 ................
|
||||
* /\ /\ /\
|
||||
* | | |
|
||||
* | | ascii representation of bytes
|
||||
* | hex representation of bytes
|
||||
* offset from beginning of the byte array in hex
|
||||
*
|
||||
* Note: the ascii representation uses '.' for all non-printable
|
||||
* characters (eg. below 32 or above 127).
|
||||
*
|
||||
* Note: the string contains embedded new lines, but is not new line terminated.
|
||||
*
|
||||
* @param[in] src Value to convert
|
||||
* @param[in] len The number of bytes in src to convert
|
||||
* @return string containing the hex dump that must be free'd by the caller
|
||||
*/
|
||||
char *
|
||||
g_bytes_to_hexdump(const char *src, int len);
|
||||
|
||||
/**
|
||||
* Extracts the display number from an X11 display string
|
||||
*
|
||||
* @param Display string (i.e. g_getenv("DISPLAY"))
|
||||
*
|
||||
* @result <0 if the string could not be parsed, or >=0 for a display number
|
||||
*/
|
||||
int
|
||||
g_get_display_num_from_display(const char *display_text);
|
||||
|
||||
/**
|
||||
* Converts a bitmask into a string for output purposes
|
||||
*
|
||||
* Similar to g_bitmask_to_charstr(), but tokens are strings, separated
|
||||
* by delimiters.
|
||||
*
|
||||
* @param bitmask Bitmask to convert
|
||||
* @param bitdefs Definitions for strings for bits
|
||||
* @param delim Delimiter to use between strings
|
||||
* @param buff Output buff
|
||||
* @param bufflen Length of buff, including terminator '`\0'
|
||||
*
|
||||
* @return Total length excluding terminator which would be written, as
|
||||
* in snprintf(). Can be used to check for overflow
|
||||
*
|
||||
* @note Any undefined bits in the bitmask are appended to the output as
|
||||
* a hexadecimal constant.
|
||||
*/
|
||||
int
|
||||
g_bitmask_to_str(int bitmask, const struct bitmask_string bitdefs[],
|
||||
char delim, char *buff, int bufflen);
|
||||
|
||||
/***
|
||||
* Converts a string containing a series of tokens to a bitmask.
|
||||
*
|
||||
* Similar to g_charstr_to_bitmask(), but tokens are strings, separated
|
||||
* by delimiters.
|
||||
*
|
||||
* @param str Input string
|
||||
* @param bitdefs Array mapping tokens to bitmask values
|
||||
* @param delim Delimiter for tokens in str
|
||||
* @param[out] unrecognised Buffer for any unrecognised tokens
|
||||
* @param unrecognised_len Length of unrecognised including '\0';
|
||||
* @return bitmask value for recognised tokens
|
||||
*/
|
||||
int
|
||||
g_str_to_bitmask(const char *str, const struct bitmask_string bitdefs[],
|
||||
const char *delim, char *unrecognised,
|
||||
int unrecognised_len);
|
||||
|
||||
/**
|
||||
* Converts a bitmask into a string for output purposes
|
||||
*
|
||||
* Similar to g_bitmask_to_str(), but tokens are individual characters, and
|
||||
* there are no delimiters.
|
||||
*
|
||||
* @param bitmask Bitmask to convert
|
||||
* @param bitdefs Definitions for strings for bits
|
||||
* @param buff Output buff
|
||||
* @param bufflen Length of buff, including terminator '`\0'
|
||||
* @param[out] rest Any unused bits which weren't covered by bitdefs.
|
||||
* May be NULL.
|
||||
*
|
||||
* @return Total length excluding terminator which would be written, as
|
||||
* in snprintf(). Can be used to check for overflow
|
||||
*
|
||||
* @note Any undefined bits in the bitmask are appended to the output as
|
||||
* a hexadecimal constant.
|
||||
*/
|
||||
int
|
||||
g_bitmask_to_charstr(int bitmask, const struct bitmask_char bitdefs[],
|
||||
char *buff, int bufflen, int *rest);
|
||||
|
||||
/***
|
||||
* Converts a string containing a series of characters to a bitmask.
|
||||
*
|
||||
* Similar to g_str_to_bitmask(), but tokens are individual characters, and
|
||||
* there are no delimiters.
|
||||
*
|
||||
* @param str Input string
|
||||
* @param bitdefs Array mapping tokens to bitmask values
|
||||
* @param delim Delimiter for tokens in str
|
||||
* @param[out] unrecognised Buffer for any unrecognised tokens
|
||||
* @param unrecognised_len Length of unrecognised including '\0';
|
||||
* @return bitmask value for recognised tokens
|
||||
*/
|
||||
int
|
||||
g_charstr_to_bitmask(const char *str, const struct bitmask_char bitdefs[],
|
||||
char *unrecognised, int unrecognised_len);
|
||||
|
||||
int g_strlen(const char *text);
|
||||
char *g_strchr(const char *text, int c);
|
||||
char *g_strrchr(const char *text, int c);
|
||||
char *g_strnchr(const char *text, int c, int len);
|
||||
char *g_strcpy(char *dest, const char *src);
|
||||
char *g_strncpy(char *dest, const char *src, int len);
|
||||
char *g_strcat(char *dest, const char *src);
|
||||
char *g_strncat(char *dest, const char *src, int len);
|
||||
char *g_strdup(const char *in);
|
||||
char *g_strndup(const char *in, const unsigned int maxlen);
|
||||
int g_strcmp(const char *c1, const char *c2);
|
||||
int g_strncmp(const char *c1, const char *c2, int len);
|
||||
int g_strncmp_d(const char *c1, const char *c2, const char delim, int len);
|
||||
int g_strcasecmp(const char *c1, const char *c2);
|
||||
int g_strncasecmp(const char *c1, const char *c2, int len);
|
||||
int g_atoi(const char *str);
|
||||
|
||||
/**
|
||||
* Extends g_atoi(), Converts decimal and hexadecimal number String to integer
|
||||
*
|
||||
* Prefix hexadecimal numbers with '0x'
|
||||
*
|
||||
* @param str String to convert to an integer
|
||||
* @return int Integer expression of a string
|
||||
*/
|
||||
int g_atoix(const char *str);
|
||||
int g_htoi(char *str);
|
||||
int g_bytes_to_hexstr(const void *bytes, int num_bytes, char *out_str,
|
||||
int bytes_out_str);
|
||||
int g_pos(const char *str, const char *to_find);
|
||||
char *g_strstr(const char *haystack, const char *needle);
|
||||
|
||||
/** trim spaces and tabs, anything <= space
|
||||
*
|
||||
* @param str (assumed to be UTF-8)
|
||||
* @param trim_flags 1 trim left, 2 trim right, 3 trim both, 4 trim through
|
||||
* @return != 0 - trim_flags not recognised
|
||||
* this will always shorten the string or not change it */
|
||||
int g_strtrim(char *str, int trim_flags);
|
||||
|
||||
/**
|
||||
* Maps a signal number to a string, i.e. SIGHUP -> "SIGHUP"
|
||||
*
|
||||
* @param signum Signal number
|
||||
* @param sigstr buffer for result
|
||||
* @return sigstr, for convenience
|
||||
*
|
||||
* Buffer is assumed to be at least MAXSTRSIGLEN
|
||||
*
|
||||
* The string "SIG#<num>" is returned for unrecognised signums
|
||||
*/
|
||||
char *g_sig2text(int signum, char sigstr[]);
|
||||
|
||||
/**
|
||||
* Get the next Unicode character from a UTF-8 string
|
||||
*
|
||||
* @param utf8str_ref UTF 8 string [by reference]
|
||||
* @param len_ref Length of string [by reference] or NULL
|
||||
* @return Unicode character
|
||||
*
|
||||
* On return, utf8str and len are updated to point past the decoded character.
|
||||
* Unrecognised characters are mapped to UCS_REPLACEMENT_CHARACTER
|
||||
*
|
||||
* len is not needed if your utf8str has a terminator, or is known to
|
||||
* be well-formed.
|
||||
*/
|
||||
char32_t
|
||||
utf8_get_next_char(const char **utf8str_ref, unsigned int *len_ref);
|
||||
|
||||
/**
|
||||
* Convert a Unicode character to UTF-8
|
||||
* @param c32 Unicode character
|
||||
* @param u8str buffer containing at least MAXLEN_UTF8_CHAR bytes for result
|
||||
* @return Number of bytes written to u8str. Can be NULL if only the
|
||||
* length is needed.
|
||||
*
|
||||
* The bytes written to u8str are unterminated
|
||||
*/
|
||||
#define MAXLEN_UTF8_CHAR 4
|
||||
unsigned int
|
||||
utf_char32_to_utf8(char32_t c32, char *u8str);
|
||||
|
||||
/**
|
||||
* Returns the number of Unicode characters in a UTF-8 string
|
||||
* @param utf8str UTF-8 string
|
||||
* @result Number of Unicode characters in the string (terminator not included)
|
||||
*/
|
||||
unsigned int
|
||||
utf8_char_count(const char *utf8str);
|
||||
|
||||
/**
|
||||
* Returns the number of UTF-16 words required to store a UTF-8 string
|
||||
* @param utf8str UTF-8 string
|
||||
* @param len Length of UTF-8 string
|
||||
* @result number of words to store UTF-8 string as UTF-16.
|
||||
*/
|
||||
unsigned int
|
||||
utf8_as_utf16_word_count(const char *utf8str, unsigned int len);
|
||||
|
||||
/**
|
||||
* Add a Unicode character into a UTF-8 string
|
||||
* @param utf8str Pointer to UTF-8 string
|
||||
* @param len Length of buffer for UTF-8 string (includes NULL)
|
||||
* @param c32 character to add
|
||||
* @param index Where to add the codepoint
|
||||
* @return 1 for success, 0 if no character was inserted
|
||||
*
|
||||
* This routine has to parse the string as it goes, so can be slow.
|
||||
*/
|
||||
int
|
||||
utf8_add_char_at(char *utf8str, unsigned int len, char32_t c32,
|
||||
unsigned int index);
|
||||
|
||||
/**
|
||||
* Remove a Unicode character from a UTF-8 string
|
||||
* @param utf8str Pointer to UTF-8 string
|
||||
* @param index Where to remove the codepoint from (0-based)
|
||||
* @return Character removed, or 0 if no character was removed
|
||||
*
|
||||
* This routine has to parse the string as it goes, so can be slow.
|
||||
*/
|
||||
char32_t
|
||||
utf8_remove_char_at(char *utf8str, unsigned int index);
|
||||
|
||||
#endif
|
@ -1,33 +1,30 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Jay Sorg 2004-2014
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* thread calls
|
||||
*/
|
||||
/*
|
||||
Copyright (c) 2004-2010 Jay Sorg
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include <config_ac.h>
|
||||
#endif
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
thread calls
|
||||
|
||||
*/
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <windows.h>
|
||||
#elif defined(__APPLE__)
|
||||
#include <pthread.h>
|
||||
#include <dispatch/dispatch.h>
|
||||
#include <dispatch/time.h>
|
||||
#else
|
||||
#include <pthread.h>
|
||||
#include <semaphore.h>
|
||||
@ -40,8 +37,8 @@
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
#if defined(_WIN32)
|
||||
int
|
||||
tc_thread_create(unsigned long (__stdcall *start_routine)(void *), void *arg)
|
||||
int APP_CC
|
||||
tc_thread_create(unsigned long (__stdcall * start_routine)(void*), void* arg)
|
||||
{
|
||||
int rv = 0;
|
||||
DWORD thread_id = 0;
|
||||
@ -54,8 +51,8 @@ tc_thread_create(unsigned long (__stdcall *start_routine)(void *), void *arg)
|
||||
return rv;
|
||||
}
|
||||
#else
|
||||
int
|
||||
tc_thread_create(void *(* start_routine)(void *), void *arg)
|
||||
int APP_CC
|
||||
tc_thread_create(void* (* start_routine)(void *), void* arg)
|
||||
{
|
||||
int rv = 0;
|
||||
pthread_t thread = (pthread_t)0;
|
||||
@ -64,18 +61,15 @@ tc_thread_create(void *(* start_routine)(void *), void *arg)
|
||||
|
||||
/* pthread_create returns error */
|
||||
rv = pthread_create(&thread, 0, start_routine, arg);
|
||||
|
||||
if (!rv)
|
||||
{
|
||||
if (!rv) {
|
||||
rv = pthread_detach(thread);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
tbus
|
||||
tbus APP_CC
|
||||
tc_get_threadid(void)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
@ -87,7 +81,7 @@ tc_get_threadid(void)
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns boolean */
|
||||
int
|
||||
int APP_CC
|
||||
tc_threadid_equal(tbus tid1, tbus tid2)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
@ -98,71 +92,65 @@ tc_threadid_equal(tbus tid1, tbus tid2)
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
tbus
|
||||
tbus APP_CC
|
||||
tc_mutex_create(void)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
return (tbus)CreateMutex(0, 0, 0);
|
||||
#else
|
||||
pthread_mutex_t *lmutex;
|
||||
pthread_mutex_t* lmutex;
|
||||
|
||||
lmutex = (pthread_mutex_t *)g_malloc(sizeof(pthread_mutex_t), 0);
|
||||
lmutex = (pthread_mutex_t*)g_malloc(sizeof(pthread_mutex_t), 0);
|
||||
pthread_mutex_init(lmutex, 0);
|
||||
return (tbus)lmutex;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void
|
||||
void APP_CC
|
||||
tc_mutex_delete(tbus mutex)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
CloseHandle((HANDLE)mutex);
|
||||
#else
|
||||
pthread_mutex_t *lmutex;
|
||||
pthread_mutex_t* lmutex;
|
||||
|
||||
lmutex = (pthread_mutex_t *)mutex;
|
||||
if (lmutex != NULL)
|
||||
{
|
||||
lmutex = (pthread_mutex_t*)mutex;
|
||||
pthread_mutex_destroy(lmutex);
|
||||
g_free(lmutex);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int
|
||||
int APP_CC
|
||||
tc_mutex_lock(tbus mutex)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
WaitForSingleObject((HANDLE)mutex, INFINITE);
|
||||
return 0;
|
||||
#else
|
||||
pthread_mutex_lock((pthread_mutex_t *)mutex);
|
||||
pthread_mutex_lock((pthread_mutex_t*)mutex);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int
|
||||
int APP_CC
|
||||
tc_mutex_unlock(tbus mutex)
|
||||
{
|
||||
int rv = 0;
|
||||
#if defined(_WIN32)
|
||||
ReleaseMutex((HANDLE)mutex);
|
||||
#else
|
||||
|
||||
if (mutex != 0)
|
||||
{
|
||||
if (mutex != 0) {
|
||||
rv = pthread_mutex_unlock((pthread_mutex_t *)mutex);
|
||||
}
|
||||
|
||||
#endif
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
tbus
|
||||
tbus APP_CC
|
||||
tc_sem_create(int init_count)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
@ -170,11 +158,8 @@ tc_sem_create(int init_count)
|
||||
|
||||
sem = CreateSemaphore(0, init_count, init_count + 10, 0);
|
||||
return (tbus)sem;
|
||||
#elif defined(__APPLE__)
|
||||
dispatch_semaphore_t sem = dispatch_semaphore_create(init_count);
|
||||
return (tbus)sem;
|
||||
#else
|
||||
sem_t *sem = (sem_t *)NULL;
|
||||
sem_t * sem = (sem_t *)NULL;
|
||||
|
||||
sem = (sem_t *)g_malloc(sizeof(sem_t), 0);
|
||||
sem_init(sem, 0, init_count);
|
||||
@ -183,50 +168,42 @@ tc_sem_create(int init_count)
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void
|
||||
void APP_CC
|
||||
tc_sem_delete(tbus sem)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
CloseHandle((HANDLE)sem);
|
||||
#elif defined(__APPLE__)
|
||||
dispatch_release((dispatch_semaphore_t)sem);
|
||||
#else
|
||||
sem_t *lsem;
|
||||
sem_t* lsem;
|
||||
|
||||
lsem = (sem_t *)sem;
|
||||
lsem = (sem_t*)sem;
|
||||
sem_destroy(lsem);
|
||||
g_free(lsem);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int
|
||||
int APP_CC
|
||||
tc_sem_dec(tbus sem)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
WaitForSingleObject((HANDLE)sem, INFINITE);
|
||||
return 0;
|
||||
#elif defined(__APPLE__)
|
||||
dispatch_semaphore_wait((dispatch_semaphore_t)sem, DISPATCH_TIME_FOREVER);
|
||||
return 0;
|
||||
#else
|
||||
sem_wait((sem_t *)sem);
|
||||
sem_wait((sem_t*)sem);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int
|
||||
int APP_CC
|
||||
tc_sem_inc(tbus sem)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
ReleaseSemaphore((HANDLE)sem, 1, 0);
|
||||
return 0;
|
||||
#elif defined(__APPLE__)
|
||||
dispatch_semaphore_signal((dispatch_semaphore_t)sem);
|
||||
return 0;
|
||||
#else
|
||||
sem_post((sem_t *)sem);
|
||||
sem_post((sem_t*)sem);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
@ -1,49 +1,54 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Jay Sorg 2004-2014
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* thread calls
|
||||
*/
|
||||
/*
|
||||
Copyright (c) 2004-2010 Jay Sorg
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
thread calls
|
||||
|
||||
*/
|
||||
|
||||
#if !defined(THREAD_CALLS_H)
|
||||
#define THREAD_CALLS_H
|
||||
|
||||
#include "arch.h"
|
||||
|
||||
int
|
||||
tc_thread_create(THREAD_RV (THREAD_CC *start_routine)(void *), void *arg);
|
||||
tbus
|
||||
int APP_CC
|
||||
tc_thread_create(THREAD_RV (THREAD_CC * start_routine)(void*), void* arg);
|
||||
tbus APP_CC
|
||||
tc_get_threadid(void);
|
||||
int
|
||||
int APP_CC
|
||||
tc_threadid_equal(tbus tid1, tbus tid2);
|
||||
tbus
|
||||
tbus APP_CC
|
||||
tc_mutex_create(void);
|
||||
void
|
||||
void APP_CC
|
||||
tc_mutex_delete(tbus mutex);
|
||||
int
|
||||
int APP_CC
|
||||
tc_mutex_lock(tbus mutex);
|
||||
int
|
||||
int APP_CC
|
||||
tc_mutex_unlock(tbus mutex);
|
||||
tbus
|
||||
tbus APP_CC
|
||||
tc_sem_create(int init_count);
|
||||
void
|
||||
void APP_CC
|
||||
tc_sem_delete(tbus sem);
|
||||
int
|
||||
int APP_CC
|
||||
tc_sem_dec(tbus sem);
|
||||
int
|
||||
int APP_CC
|
||||
tc_sem_inc(tbus sem);
|
||||
|
||||
#endif
|
||||
|
894
common/trans.c
894
common/trans.c
File diff suppressed because it is too large
Load Diff
209
common/trans.h
209
common/trans.h
@ -1,22 +1,27 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Jay Sorg 2004-2014
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* generic transport
|
||||
*/
|
||||
/*
|
||||
Copyright (c) 2008-2010 Jay Sorg
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
generic transport
|
||||
|
||||
*/
|
||||
|
||||
#if !defined(TRANS_H)
|
||||
#define TRANS_H
|
||||
@ -24,11 +29,8 @@
|
||||
#include "arch.h"
|
||||
#include "parse.h"
|
||||
|
||||
#define TRANS_MODE_TCP 1 /* tcp6 if defined, else tcp4 */
|
||||
#define TRANS_MODE_TCP 1
|
||||
#define TRANS_MODE_UNIX 2
|
||||
#define TRANS_MODE_VSOCK 3
|
||||
#define TRANS_MODE_TCP4 4 /* tcp4 only */
|
||||
#define TRANS_MODE_TCP6 6 /* tcp6 only */
|
||||
|
||||
#define TRANS_TYPE_LISTENER 1
|
||||
#define TRANS_TYPE_SERVER 2
|
||||
@ -38,144 +40,51 @@
|
||||
#define TRANS_STATUS_UP 1
|
||||
|
||||
struct trans; /* forward declaration */
|
||||
struct xrdp_tls;
|
||||
|
||||
typedef int (*ttrans_data_in)(struct trans *self);
|
||||
typedef int (*ttrans_conn_in)(struct trans *self,
|
||||
struct trans *new_self);
|
||||
typedef int (*tis_term)(void);
|
||||
typedef int (*trans_recv_proc) (struct trans *self, char *ptr, int len);
|
||||
typedef int (*trans_send_proc) (struct trans *self, const char *data, int len);
|
||||
typedef int (*trans_can_recv_proc) (struct trans *self, int sck, int millis);
|
||||
|
||||
/* optional source info */
|
||||
|
||||
enum xrdp_source
|
||||
{
|
||||
XRDP_SOURCE_NONE = 0,
|
||||
XRDP_SOURCE_CLIENT,
|
||||
XRDP_SOURCE_SESMAN,
|
||||
XRDP_SOURCE_CHANSRV,
|
||||
XRDP_SOURCE_MOD,
|
||||
|
||||
XRDP_SOURCE_MAX_COUNT
|
||||
};
|
||||
|
||||
/*
|
||||
* @brief Provide flow control mechanism for (primarily) xrdp
|
||||
*
|
||||
* There is one of these data structures per-program.
|
||||
*
|
||||
* While input is being read from a 'struct trans' and processed, the
|
||||
* cur_source member is set to the my_source member from the transport.
|
||||
* During this processing, trans_write_copy() may be called to send output
|
||||
* on another struct trans. If this happens, and the output needs to be
|
||||
* buffered, trans_write_copy() can add the number of bytes generated by
|
||||
* the input trans to the source field for the cur_source. This allows us to
|
||||
* see how much output has been buffered for each input source.
|
||||
*
|
||||
* When the program assembles 'struct trans' objects to scan for input
|
||||
* (normally in trans_get_wait_objs()), it is able to see how much buffered
|
||||
* output is registered for each input. Inputs which have too much buffered
|
||||
* output owing are skipped, and not considered for input.
|
||||
*
|
||||
* This provides a simple means of providing back-pressure on an input
|
||||
* where the data it is providing is being processed and then sent out on
|
||||
* a much slower link.
|
||||
*/
|
||||
struct source_info
|
||||
{
|
||||
enum xrdp_source cur_source;
|
||||
int source[XRDP_SOURCE_MAX_COUNT];
|
||||
};
|
||||
typedef int (*ttrans_data_in)(struct trans* self);
|
||||
typedef int (*ttrans_conn_in)(struct trans* self, struct trans* new_self);
|
||||
|
||||
struct trans
|
||||
{
|
||||
tbus sck; /* socket handle */
|
||||
int mode; /* 1 tcp, 2 unix socket, 3 vsock */
|
||||
tbus sck;
|
||||
int mode; /* 1 tcp, 2 unix socket */
|
||||
int status;
|
||||
int type1; /* 1 listener 2 server 3 client */
|
||||
ttrans_data_in trans_data_in;
|
||||
ttrans_conn_in trans_conn_in;
|
||||
void *callback_data;
|
||||
unsigned int header_size;
|
||||
struct stream *in_s;
|
||||
struct stream *out_s;
|
||||
char *listen_filename;
|
||||
tis_term is_term; /* used to test for exit */
|
||||
struct stream *wait_s;
|
||||
int no_stream_init_on_data_in;
|
||||
int extra_flags; /* user defined */
|
||||
void *extra_data; /* user defined */
|
||||
void (*extra_destructor)(struct trans *); /* user defined */
|
||||
|
||||
struct ssl_tls *tls;
|
||||
const char *ssl_protocol; /* e.g. TLSv1, TLSv1.1, TLSv1.2, unknown */
|
||||
const char *cipher_name; /* e.g. AES256-GCM-SHA384 */
|
||||
trans_recv_proc trans_recv;
|
||||
trans_send_proc trans_send;
|
||||
trans_can_recv_proc trans_can_recv;
|
||||
struct source_info *si;
|
||||
enum xrdp_source my_source;
|
||||
void* callback_data;
|
||||
int header_size;
|
||||
struct stream* in_s;
|
||||
struct stream* out_s;
|
||||
char* listen_filename;
|
||||
};
|
||||
|
||||
struct trans *
|
||||
struct trans* APP_CC
|
||||
trans_create(int mode, int in_size, int out_size);
|
||||
void
|
||||
trans_delete(struct trans *self);
|
||||
void
|
||||
trans_delete_from_child(struct trans *self);
|
||||
int
|
||||
trans_get_wait_objs(struct trans *self, tbus *objs, int *count);
|
||||
int
|
||||
trans_get_wait_objs_rw(struct trans *self,
|
||||
tbus *robjs, int *rcount,
|
||||
tbus *wobjs, int *wcount, int *timeout);
|
||||
int
|
||||
trans_check_wait_objs(struct trans *self);
|
||||
int
|
||||
trans_force_read_s(struct trans *self, struct stream *in_s, int size);
|
||||
int
|
||||
trans_force_write_s(struct trans *self, struct stream *out_s);
|
||||
int
|
||||
trans_force_read(struct trans *self, int size);
|
||||
int
|
||||
trans_force_write(struct trans *self);
|
||||
int
|
||||
trans_write_copy(struct trans *self);
|
||||
int
|
||||
trans_write_copy_s(struct trans *self, struct stream *out_s);
|
||||
/**
|
||||
* Connect the transport to the specified destination
|
||||
*
|
||||
* @param self Transport
|
||||
* @param server Destination server (TCP transports only)
|
||||
* @param port TCP port, or UNIX socket to connect to
|
||||
* @param timeout in milli-seconds for the operation
|
||||
* @return 0 for success
|
||||
*
|
||||
* Multiple connection attempts may be made within the timeout period.
|
||||
*
|
||||
* If the operation is successful, 0 is returned and self->status will
|
||||
* be TRANS_STATUS_UP
|
||||
*/
|
||||
int
|
||||
trans_connect(struct trans *self, const char *server, const char *port,
|
||||
void APP_CC
|
||||
trans_delete(struct trans* self);
|
||||
int APP_CC
|
||||
trans_get_wait_objs(struct trans* self, tbus* objs, int* count);
|
||||
int APP_CC
|
||||
trans_check_wait_objs(struct trans* self);
|
||||
int APP_CC
|
||||
trans_force_read_s(struct trans* self, struct stream* in_s, int size);
|
||||
int APP_CC
|
||||
trans_force_write_s(struct trans* self, struct stream* out_s);
|
||||
int APP_CC
|
||||
trans_force_read(struct trans* self, int size);
|
||||
int APP_CC
|
||||
trans_force_write(struct trans* self);
|
||||
int APP_CC
|
||||
trans_connect(struct trans* self, const char* server, const char* port,
|
||||
int timeout);
|
||||
int
|
||||
trans_listen_address(struct trans *self, const char *port, const char *address);
|
||||
int
|
||||
trans_listen(struct trans *self, const char *port);
|
||||
struct stream *
|
||||
trans_get_in_s(struct trans *self);
|
||||
struct stream *
|
||||
trans_get_out_s(struct trans *self, int size);
|
||||
int
|
||||
trans_set_tls_mode(struct trans *self, const char *key, const char *cert,
|
||||
long ssl_protocols, const char *tls_ciphers);
|
||||
int
|
||||
trans_shutdown_tls_mode(struct trans *self);
|
||||
int
|
||||
trans_tcp_force_read_s(struct trans *self, struct stream *in_s, int size);
|
||||
int APP_CC
|
||||
trans_listen_address(struct trans* self, char* port, const char* address);
|
||||
int APP_CC
|
||||
trans_listen(struct trans* self, char* port);
|
||||
struct stream* APP_CC
|
||||
trans_get_in_s(struct trans* self);
|
||||
struct stream* APP_CC
|
||||
trans_get_out_s(struct trans* self, int size);
|
||||
|
||||
#endif
|
||||
|
@ -1,100 +0,0 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Jay Sorg 2004-2023
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/**
|
||||
* @file common/unicode_defines.h
|
||||
*
|
||||
* Defines used internally by the implementations of the Unicode routines
|
||||
*/
|
||||
|
||||
#if !defined(UNICODE_DEFINES_H)
|
||||
#define UNICODE_DEFINES_H
|
||||
|
||||
/**
|
||||
* Is this byte a valid UTF-8 continuation character?
|
||||
*/
|
||||
#define IS_VALID_CONTINUATION_CHAR(c) ((c) >= 0x80 && (c) < 0xc0)
|
||||
|
||||
/**
|
||||
* Is this character one of the end-of-plane non-characters?
|
||||
*
|
||||
* These are U+xFFFE and U+xFFFF for x in (0..10}
|
||||
*/
|
||||
#define IS_PLANE_END_NON_CHARACTER(c32) (((c32) & 0xfffe) == 0xfffe)
|
||||
|
||||
/**
|
||||
* Is this character one of the additional non-characters?
|
||||
*
|
||||
* 32 additional non-charactersare defined in the
|
||||
* "Arabic Presentation Forms-A" Unicode block */
|
||||
#define IS_ARABIC_NON_CHARACTER(c32) ((c32) >= 0xfdd0 && (c32) <= 0xfdef)
|
||||
|
||||
// Invalid characters, based on UTF-8 decoding range
|
||||
//
|
||||
// By 'invalid' we mean characters that should not be encoded or
|
||||
// decoded when switching between UTF-8 and UTF-32
|
||||
//
|
||||
// See "UTF-8 decoder capability and stress test" Markus Kuhn 2015-08-28
|
||||
#define INVALID_UNICODE_0_TO_7F(c) (0) // No invalid characters
|
||||
#define INVALID_UNICODE_80_TO_7FF(c) (0) // No invalid characters
|
||||
#define INVALID_UNICODE_800_TO_FFFF(c) \
|
||||
(((c) >= 0xd800 && (c) <= 0xdfff) || /* Surrogate pairs */ \
|
||||
IS_ARABIC_NON_CHARACTER(c) || \
|
||||
IS_PLANE_END_NON_CHARACTER(c))
|
||||
|
||||
#define INVALID_UNICODE_10000_TO_1FFFFF(c) \
|
||||
(IS_PLANE_END_NON_CHARACTER(c) || (c) > 0x10ffff)
|
||||
|
||||
// Returns true for all 'invalid' Unicode chars
|
||||
#define INVALID_UNICODE(c) \
|
||||
( \
|
||||
INVALID_UNICODE_0_TO_7F(c) || \
|
||||
INVALID_UNICODE_80_TO_7FF(c) || \
|
||||
INVALID_UNICODE_800_TO_FFFF(c) || \
|
||||
INVALID_UNICODE_10000_TO_1FFFFF(c) \
|
||||
)
|
||||
|
||||
/**
|
||||
* Is this character a UTF-16 high surrogate?
|
||||
*/
|
||||
#define IS_HIGH_SURROGATE(u16) (((u16) & 0xfc00) == 0xd800)
|
||||
|
||||
/**
|
||||
* Is this character a UTF-16 low surrogate?
|
||||
*/
|
||||
#define IS_LOW_SURROGATE(u16) (((u16) & 0xfc00) == 0xdc00)
|
||||
|
||||
/**
|
||||
* Extract the UTF-16 high surrogate from a character
|
||||
*/
|
||||
#define HIGH_SURROGATE_FROM_C32(c32) \
|
||||
(((((c32) - 0x10000) >> 10) & 0x3ff) | 0xd800)
|
||||
|
||||
/**
|
||||
* Extract the UTF-16 low surrogate from a character
|
||||
*/
|
||||
#define LOW_SURROGATE_FROM_C32(c32) (((c32) & 0x3ff) | 0xdc00)
|
||||
|
||||
/**
|
||||
* Reconstruct a character from a UTF-16 surrogate pair
|
||||
*
|
||||
* This macro cannot return values higher than 0x10ffff
|
||||
*/
|
||||
#define C32_FROM_SURROGATE_PAIR(low,high) \
|
||||
((char32_t)(((high) & 0x3ff) << 10) + ((low) & 0x3ff) + 0x10000)
|
||||
|
||||
#endif // UNICODE_DEFINES_H
|
@ -1,111 +1,37 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Jay Sorg 2004-2014
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* xrdp / xserver info / caps
|
||||
*/
|
||||
/*
|
||||
Copyright (c) 2012 Jay Sorg
|
||||
|
||||
#include "xrdp_constants.h"
|
||||
#include "ms-rdpbcgr.h"
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
xrdp / xserver info / caps
|
||||
|
||||
*/
|
||||
|
||||
#if !defined(XRDP_CLIENT_INFO_H)
|
||||
#define XRDP_CLIENT_INFO_H
|
||||
|
||||
/*
|
||||
* 2.2.1.3.6.1 Monitor Definition (TS_MONITOR_DEF)
|
||||
* 2.2.1.3.9.1 Monitor Attributes (TS_MONITOR_ATTRIBUTES)
|
||||
* 2.2.2.2.1 DISPLAYCONTROL_MONITOR_LAYOUT
|
||||
*/
|
||||
struct monitor_info
|
||||
{
|
||||
/* From 2.2.1.3.6.1 Monitor Definition (TS_MONITOR_DEF) */
|
||||
int left;
|
||||
int top;
|
||||
int right;
|
||||
int bottom;
|
||||
int flags;
|
||||
|
||||
/* From [MS-RDPEDISP] 2.2.2.2.1 DISPLAYCONTROL_MONITOR_LAYOUT, or
|
||||
* [MS-RDPBCGR] 2.2.1.3.9.1 (TS_MONITOR_ATTRIBUTES) */
|
||||
unsigned int physical_width;
|
||||
unsigned int physical_height;
|
||||
unsigned int orientation;
|
||||
unsigned int desktop_scale_factor;
|
||||
unsigned int device_scale_factor;
|
||||
|
||||
/* Derived setting */
|
||||
unsigned int is_primary;
|
||||
};
|
||||
|
||||
/* xrdp keyboard overrids */
|
||||
struct xrdp_keyboard_overrides
|
||||
{
|
||||
int type;
|
||||
int subtype;
|
||||
int layout;
|
||||
};
|
||||
|
||||
struct display_size_description
|
||||
{
|
||||
unsigned int monitorCount; /* 2.2.2.2 DISPLAYCONTROL_MONITOR_LAYOUT_PDU: number of monitors detected (max = 16) */
|
||||
struct monitor_info minfo[CLIENT_MONITOR_DATA_MAXIMUM_MONITORS]; /* client monitor data */
|
||||
struct monitor_info minfo_wm[CLIENT_MONITOR_DATA_MAXIMUM_MONITORS]; /* client monitor data, non-negative values */
|
||||
unsigned int session_width;
|
||||
unsigned int session_height;
|
||||
};
|
||||
|
||||
enum client_resize_mode
|
||||
{
|
||||
CRMODE_NONE,
|
||||
CRMODE_SINGLE_SCREEN,
|
||||
CRMODE_MULTI_SCREEN
|
||||
};
|
||||
|
||||
enum xrdp_capture_code
|
||||
{
|
||||
CC_SIMPLE = 0,
|
||||
CC_SUF_A16 = 1,
|
||||
CC_SUF_RFX = 2,
|
||||
CC_SUF_A2 = 3,
|
||||
CC_GFX_PRO = 4,
|
||||
CC_GFX_A2 = 5
|
||||
};
|
||||
|
||||
/**
|
||||
* Type describing Unicode input state
|
||||
*/
|
||||
enum unicode_input_state
|
||||
{
|
||||
UIS_UNSUPPORTED = 0, ///< Client does not support Unicode
|
||||
UIS_SUPPORTED, ///< Client supports Unicode, but it's not active
|
||||
UIS_ACTIVE ///< Unicode input is active
|
||||
};
|
||||
/**
|
||||
* Information about the xrdp client
|
||||
*
|
||||
* @note This structure is shared with xorgxrdp. If you change anything
|
||||
* above the 'private to xrdp below this line' comment, you MUST
|
||||
* bump the CLIENT_INFO_CURRENT_VERSION number so that the mismatch
|
||||
* can be detected.
|
||||
*/
|
||||
struct xrdp_client_info
|
||||
{
|
||||
int size; /* bytes for this structure */
|
||||
int version; /* Should be CLIENT_INFO_CURRENT_VERSION */
|
||||
int bpp;
|
||||
int width;
|
||||
int height;
|
||||
/* bitmap cache info */
|
||||
int cache1_entries;
|
||||
int cache1_size;
|
||||
@ -127,28 +53,27 @@ struct xrdp_client_info
|
||||
char hostname[32];
|
||||
int build;
|
||||
int keylayout;
|
||||
char username[INFO_CLIENT_MAX_CB_LEN];
|
||||
char password[INFO_CLIENT_MAX_CB_LEN];
|
||||
char domain[INFO_CLIENT_MAX_CB_LEN];
|
||||
char program[INFO_CLIENT_MAX_CB_LEN];
|
||||
char directory[INFO_CLIENT_MAX_CB_LEN];
|
||||
char username[256];
|
||||
char password[256];
|
||||
char domain[256];
|
||||
char program[256];
|
||||
char directory[256];
|
||||
int rdp_compression;
|
||||
int rdp_autologin;
|
||||
int crypt_level; /* 1, 2, 3 = low, medium, high */
|
||||
int channels_allowed; /* 0 = no channels 1 = channels */
|
||||
int channel_code; /* 0 = no channels 1 = channels */
|
||||
int sound_code; /* 1 = leave sound at server */
|
||||
int is_mce;
|
||||
int rdp5_performanceflags;
|
||||
int brush_cache_code; /* 0 = no cache 1 = 8x8 standard cache
|
||||
2 = arbitrary dimensions */
|
||||
|
||||
char client_ip[256];
|
||||
int max_bpp;
|
||||
int jpeg; /* non standard bitmap cache v2 cap */
|
||||
int offscreen_support_level;
|
||||
int offscreen_cache_size;
|
||||
int offscreen_cache_entries;
|
||||
int rfx;
|
||||
|
||||
/* CAPSETTYPE_RAIL */
|
||||
int rail_support_level;
|
||||
/* CAPSETTYPE_WINDOW */
|
||||
@ -166,114 +91,6 @@ struct xrdp_client_info
|
||||
int jpeg_prop_len;
|
||||
char jpeg_prop[64];
|
||||
int v3_codec_id;
|
||||
int rfx_min_pixel;
|
||||
char orders[32];
|
||||
int order_flags_ex;
|
||||
int use_bulk_comp;
|
||||
int pointer_flags; /* 0 color, 1 new, 2 no new */
|
||||
int use_fast_path;
|
||||
int require_credentials; /* when true, credentials *must* be passed on cmd line */
|
||||
|
||||
int security_layer; /* 0 = rdp, 1 = tls , 2 = hybrid */
|
||||
int multimon; /* 0 = deny , 1 = allow */
|
||||
struct display_size_description display_sizes;
|
||||
|
||||
int keyboard_type;
|
||||
int keyboard_subtype;
|
||||
|
||||
int png_codec_id;
|
||||
int png_prop_len;
|
||||
char png_prop[64];
|
||||
int vendor_flags[4];
|
||||
int mcs_connection_type;
|
||||
int mcs_early_capability_flags;
|
||||
|
||||
int max_fastpath_frag_bytes;
|
||||
int pad0; /* unused */
|
||||
int capture_format;
|
||||
|
||||
char certificate[1024];
|
||||
char key_file[1024];
|
||||
|
||||
/* X11 keyboard layout - inferred from keyboard type/subtype */
|
||||
char model[16];
|
||||
char layout[16];
|
||||
char variant[16];
|
||||
char options[256];
|
||||
char xkb_rules[32];
|
||||
// A few x11 keycodes are needed by the xup module
|
||||
int x11_keycode_caps_lock;
|
||||
int x11_keycode_num_lock;
|
||||
int x11_keycode_scroll_lock;
|
||||
|
||||
/* ==================================================================== */
|
||||
/* Private to xrdp below this line */
|
||||
/* ==================================================================== */
|
||||
|
||||
/* codec */
|
||||
int h264_codec_id;
|
||||
int h264_prop_len;
|
||||
char h264_prop[64];
|
||||
|
||||
int use_frame_acks;
|
||||
int max_unacknowledged_frame_count;
|
||||
|
||||
long ssl_protocols;
|
||||
char *tls_ciphers;
|
||||
|
||||
char client_ip[MAX_PEER_ADDRSTRLEN];
|
||||
char client_description[MAX_PEER_DESCSTRLEN];
|
||||
|
||||
int client_os_major;
|
||||
int client_os_minor;
|
||||
|
||||
int no_orders_supported;
|
||||
int use_cache_glyph_v2;
|
||||
int rail_enable;
|
||||
// Mask of reasons why output may be suppressed
|
||||
// (see enum suppress_output_reason)
|
||||
unsigned int suppress_output_mask;
|
||||
|
||||
int enable_token_login;
|
||||
char domain_user_separator[16];
|
||||
|
||||
/* xrdp.override_* values */
|
||||
struct xrdp_keyboard_overrides xrdp_keyboard_overrides;
|
||||
|
||||
/* These values are optionally send over as part of TS_UD_CS_CORE.
|
||||
* They can be used as a fallback for a single monitor session
|
||||
* if physical sizes are not available in the monitor-specific
|
||||
* data */
|
||||
unsigned int session_physical_width; /* in mm */
|
||||
unsigned int session_physical_height; /* in mm */
|
||||
|
||||
int large_pointer_support_flags;
|
||||
int gfx;
|
||||
|
||||
// Can we resize the desktop by using a Deactivation-Reactivation Sequence?
|
||||
enum client_resize_mode client_resize_mode;
|
||||
|
||||
enum unicode_input_state unicode_input_support;
|
||||
enum xrdp_capture_code capture_code;
|
||||
};
|
||||
|
||||
enum xrdp_encoder_flags
|
||||
{
|
||||
NONE = 0,
|
||||
ENCODE_COMPLETE = 1 << 0,
|
||||
GFX_PROGRESSIVE_RFX = 1 << 1,
|
||||
GFX_H264 = 1 << 2,
|
||||
KEY_FRAME_REQUESTED = 1 << 3
|
||||
};
|
||||
|
||||
/*
|
||||
* Return true if output is suppressed for a particular reason
|
||||
*/
|
||||
#define OUTPUT_SUPPRESSED_FOR_REASON(ci,reason) \
|
||||
(((ci)->suppress_output_mask & (unsigned int)reason) != 0)
|
||||
|
||||
/* yyyymmdd of last incompatible change to xrdp_client_info */
|
||||
/* also used for changes to all the xrdp installed headers */
|
||||
#define CLIENT_INFO_CURRENT_VERSION 20240805
|
||||
|
||||
#endif
|
||||
|
@ -3,7 +3,7 @@
|
||||
* Miscellaneous protocol constants
|
||||
*
|
||||
* Copyright (C) Matthew Chapman 1999-2008
|
||||
* Copyright (C) Jay Sorg 2004-2014
|
||||
* Copyright (C) Jay Sorg 2004-2012
|
||||
* Copyright (C) Kevin Zhou 2012
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -25,55 +25,13 @@
|
||||
/* TCP port for Remote Desktop Protocol */
|
||||
#define TCP_PORT_RDP 3389
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* xrdp constants
|
||||
*
|
||||
* Constants defined in publicly available Microsoft documents are not
|
||||
* stored here, but are stored in the include files ms-*.h, where the name
|
||||
* of the file is the name of the document defining the constant.
|
||||
*
|
||||
* So for example, NTSTATUS values found in [MS-ERREF] are found in
|
||||
* ms-erref.h
|
||||
******************************************************************************/
|
||||
|
||||
/**
|
||||
* Size of buffer including terminator for an IP address as returned
|
||||
* by g_sck_get_peer_ip_address(). See POSIX INET6_ADDRSTRLEN
|
||||
*/
|
||||
#define MAX_PEER_ADDRSTRLEN 46
|
||||
|
||||
/**
|
||||
* Size of buffer including terminator for a socket description, as
|
||||
* returned by g_sck_get_peer_description()
|
||||
* Currently the largest is an IPv6 address (INET6_ADDRSTRLEN), plus
|
||||
* []:<port> characters
|
||||
*/
|
||||
#define MAX_PEER_DESCSTRLEN (46 + 2 + 1 + 5)
|
||||
|
||||
#define INFO_CLIENT_NAME_BYTES 32
|
||||
|
||||
/**
|
||||
* Maximum length of a string including the mandatory null terminator
|
||||
* [MS-RDPBCGR] TS_INFO_PACKET(2.2.1.11.1.1)
|
||||
*/
|
||||
#define INFO_CLIENT_MAX_CB_LEN 512
|
||||
|
||||
#define XRDP_MAX_BITMAP_CACHE_ID 3
|
||||
#define XRDP_MAX_BITMAP_CACHE_IDX 2000
|
||||
#define XRDP_BITMAP_CACHE_ENTRIES 2048
|
||||
|
||||
/*
|
||||
* Constants come from ITU-T Recommendations
|
||||
*/
|
||||
|
||||
#define ISO_PDU_CR 0xE0 /* X.224 Connection Request */
|
||||
#define ISO_PDU_CC 0xD0 /* X.224 Connection Confirm */
|
||||
#define ISO_PDU_CR 0xE0 /* Connection Request */
|
||||
#define ISO_PDU_CC 0xD0 /* Connection Confirm */
|
||||
#define ISO_PDU_DR 0x80 /* Disconnect Request */
|
||||
#define ISO_PDU_DT 0xF0 /* Data */
|
||||
#define ISO_PDU_ER 0x70 /* Error */
|
||||
|
||||
/* MCS PDU codes (T.125) */
|
||||
/* MCS PDU codes */
|
||||
#define MCS_EDRQ 1 /* Erect Domain Request */
|
||||
#define MCS_DPUM 8 /* Disconnect Provider Ultimatum */
|
||||
#define MCS_AURQ 10 /* Attach User Request */
|
||||
@ -83,32 +41,8 @@
|
||||
#define MCS_SDRQ 25 /* Send Data Request */
|
||||
#define MCS_SDIN 26 /* Send Data Indication */
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Constants come from other Microsoft products
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/* Sound format constants - see also RFC 2361 and MS-RDPAI */
|
||||
#define WAVE_FORMAT_PCM 0x0001
|
||||
#define WAVE_FORMAT_ADPCM 0x0002
|
||||
#define WAVE_FORMAT_ALAW 0x0006
|
||||
#define WAVE_FORMAT_MULAW 0x0007
|
||||
#define WAVE_FORMAT_MPEGLAYER3 0x0055
|
||||
#define WAVE_FORMAT_OPUS 0x0069
|
||||
#define WAVE_FORMAT_AAC 0xA106
|
||||
|
||||
/* https://technet.microsoft.com/ja-jp/library/aa387685.aspx */
|
||||
#define SEC_RSA_MAGIC 0x31415352 /* RSA1 */
|
||||
|
||||
/* NTSTATUS Values (MS-ERREF 2.3.1) */
|
||||
/* used for RDPDR */
|
||||
/*
|
||||
* not yet sorted out
|
||||
*/
|
||||
|
||||
#define MCS_CONNECT_INITIAL 0x7f65 /* MCS BER: big endian, class=application (0x4000), constructed (0x2000), tag number > 30 (0x1f00), tag number=101 (0x0065) */
|
||||
#define MCS_CONNECT_RESPONSE 0x7f66 /* MCS BER: application 102 */
|
||||
#define MCS_CONNECT_INITIAL 0x7f65
|
||||
#define MCS_CONNECT_RESPONSE 0x7f66
|
||||
|
||||
#define BER_TAG_BOOLEAN 1
|
||||
#define BER_TAG_INTEGER 2
|
||||
@ -120,23 +54,112 @@
|
||||
#define MCS_USERCHANNEL_BASE 1001
|
||||
|
||||
/* RDP secure transport constants */
|
||||
/* not used anywhere */
|
||||
#define SEC_RANDOM_SIZE 32
|
||||
#define SEC_MODULUS_SIZE 64
|
||||
#define SEC_PADDING_SIZE 8
|
||||
#define SEC_EXPONENT_SIZE 4
|
||||
|
||||
#define SEC_CLIENT_RANDOM 0x0001
|
||||
#define SEC_ENCRYPT 0x0008
|
||||
#define SEC_LOGON_INFO 0x0040
|
||||
#define SEC_LICENCE_NEG 0x0080
|
||||
|
||||
#define SEC_TAG_SRV_INFO 0x0c01
|
||||
#define SEC_TAG_SRV_CRYPT 0x0c02
|
||||
#define SEC_TAG_SRV_CHANNELS 0x0c03
|
||||
|
||||
#define SEC_TAG_CLI_INFO 0xc001
|
||||
#define SEC_TAG_CLI_CRYPT 0xc002
|
||||
#define SEC_TAG_CLI_CHANNELS 0xc003
|
||||
#define SEC_TAG_CLI_4 0xc004
|
||||
|
||||
#define SEC_TAG_PUBKEY 0x0006
|
||||
#define SEC_TAG_KEYSIG 0x0008
|
||||
|
||||
#define SEC_RSA_MAGIC 0x31415352 /* RSA1 */
|
||||
|
||||
/* RDP licensing constants */
|
||||
#define LICENCE_TOKEN_SIZE 10
|
||||
#define LICENCE_HWID_SIZE 20
|
||||
#define LICENCE_SIGNATURE_SIZE 16
|
||||
|
||||
#define LICENCE_TAG_DEMAND 0x01
|
||||
#define LICENCE_TAG_AUTHREQ 0x02
|
||||
#define LICENCE_TAG_ISSUE 0x03
|
||||
#define LICENCE_TAG_REISSUE 0x04
|
||||
#define LICENCE_TAG_PRESENT 0x12
|
||||
#define LICENCE_TAG_REQUEST 0x13
|
||||
#define LICENCE_TAG_AUTHRESP 0x15
|
||||
#define LICENCE_TAG_RESULT 0xff
|
||||
|
||||
#define LICENCE_TAG_USER 0x000f
|
||||
#define LICENCE_TAG_HOST 0x0010
|
||||
|
||||
/* RDP PDU codes */
|
||||
#define RDP_PDU_DEMAND_ACTIVE 1
|
||||
#define RDP_PDU_CONFIRM_ACTIVE 3
|
||||
#define RDP_PDU_REDIRECT 4
|
||||
#define RDP_PDU_DEACTIVATE 6
|
||||
#define RDP_PDU_DATA 7
|
||||
|
||||
#define RDP_DATA_PDU_UPDATE 2
|
||||
#define RDP_DATA_PDU_CONTROL 20
|
||||
#define RDP_DATA_PDU_POINTER 27
|
||||
#define RDP_DATA_PDU_INPUT 28
|
||||
#define RDP_DATA_PDU_SYNCHRONISE 31
|
||||
#define RDP_DATA_PDU_PLAY_SOUND 34
|
||||
#define RDP_DATA_PDU_LOGON 38
|
||||
#define RDP_DATA_PDU_FONT2 39
|
||||
#define RDP_DATA_PDU_DISCONNECT 47
|
||||
|
||||
#define RDP_CTL_REQUEST_CONTROL 1
|
||||
#define RDP_CTL_GRANT_CONTROL 2
|
||||
#define RDP_CTL_DETACH 3
|
||||
#define RDP_CTL_COOPERATE 4
|
||||
|
||||
#define RDP_UPDATE_ORDERS 0
|
||||
#define RDP_UPDATE_BITMAP 1
|
||||
#define RDP_UPDATE_PALETTE 2
|
||||
#define RDP_UPDATE_SYNCHRONIZE 3
|
||||
|
||||
#define RDP_POINTER_SYSTEM 1
|
||||
#define RDP_POINTER_MOVE 3
|
||||
#define RDP_POINTER_COLOR 6
|
||||
#define RDP_POINTER_CACHED 7
|
||||
|
||||
#define RDP_NULL_POINTER 0
|
||||
#define RDP_DEFAULT_POINTER 0x7F00
|
||||
|
||||
#define RDP_INPUT_SYNCHRONIZE 0
|
||||
#define RDP_INPUT_CODEPOINT 1
|
||||
#define RDP_INPUT_VIRTKEY 2
|
||||
#define RDP_INPUT_SCANCODE 4
|
||||
#define RDP_INPUT_MOUSE 0x8001
|
||||
|
||||
/* Device flags */
|
||||
#define KBD_FLAG_RIGHT 0x0001
|
||||
#define KBD_FLAG_EXT 0x0100
|
||||
#define KBD_FLAG_QUIET 0x1000
|
||||
#define KBD_FLAG_DOWN 0x4000
|
||||
#define KBD_FLAG_UP 0x8000
|
||||
|
||||
/* These are for synchronization; not for keystrokes */
|
||||
#define KBD_FLAG_SCROLL 0x0001
|
||||
#define KBD_FLAG_NUMLOCK 0x0002
|
||||
#define KBD_FLAG_CAPITAL 0x0004
|
||||
|
||||
/* See T.128 */
|
||||
/* not used anywhere */
|
||||
#define RDP_KEYPRESS 0
|
||||
#define RDP_KEYRELEASE (KBD_FLAG_DOWN | KBD_FLAG_UP)
|
||||
|
||||
#define MOUSE_FLAG_MOVE 0x0800
|
||||
#define MOUSE_FLAG_BUTTON1 0x1000
|
||||
#define MOUSE_FLAG_BUTTON2 0x2000
|
||||
#define MOUSE_FLAG_BUTTON3 0x4000
|
||||
#define MOUSE_FLAG_BUTTON4 0x0280
|
||||
#define MOUSE_FLAG_BUTTON5 0x0380
|
||||
#define MOUSE_FLAG_DOWN 0x8000
|
||||
|
||||
/* Raster operation masks */
|
||||
#define ROP2_S(rop3) (rop3 & 0xf)
|
||||
#define ROP2_P(rop3) ((rop3 & 0x3) | ((rop3 & 0x30) >> 2))
|
||||
@ -162,8 +185,83 @@
|
||||
#define PDU_FLAG_FIRST 0x01
|
||||
#define PDU_FLAG_LAST 0x02
|
||||
|
||||
/* Maps to generalCapabilitySet in T.128 page 138 */
|
||||
|
||||
/* RDP capabilities */
|
||||
#define RDP_CAPSET_GENERAL 1
|
||||
#define RDP_CAPLEN_GENERAL 0x18
|
||||
#define OS_MAJOR_TYPE_UNIX 4
|
||||
#define OS_MINOR_TYPE_XSERVER 7
|
||||
|
||||
#define RDP_CAPSET_BITMAP 2
|
||||
#define RDP_CAPLEN_BITMAP 0x1C
|
||||
|
||||
#define RDP_CAPSET_ORDER 3
|
||||
#define RDP_CAPLEN_ORDER 0x58
|
||||
#define ORDER_CAP_NEGOTIATE 2
|
||||
#define ORDER_CAP_NOSUPPORT 4
|
||||
|
||||
#define RDP_CAPSET_BMPCACHE 4
|
||||
#define RDP_CAPLEN_BMPCACHE 0x28
|
||||
|
||||
#define RDP_CAPSET_CONTROL 5
|
||||
#define RDP_CAPLEN_CONTROL 0x0C
|
||||
|
||||
#define RDP_CAPSET_ACTIVATE 7
|
||||
#define RDP_CAPLEN_ACTIVATE 0x0C
|
||||
|
||||
#define RDP_CAPSET_POINTER 8
|
||||
#define RDP_CAPLEN_POINTER 0x0a
|
||||
#define RDP_CAPLEN_POINTER_MONO 0x08
|
||||
|
||||
#define RDP_CAPSET_SHARE 9
|
||||
#define RDP_CAPLEN_SHARE 0x08
|
||||
|
||||
#define RDP_CAPSET_COLCACHE 10
|
||||
#define RDP_CAPLEN_COLCACHE 0x08
|
||||
|
||||
#define RDP_CAPSET_INPUT 13
|
||||
#define RDP_CAPLEN_INPUT 0x58
|
||||
|
||||
#define RDP_CAPSET_FONT 14
|
||||
#define RDP_CAPLEN_FONT 0x04
|
||||
|
||||
#define RDP_CAPSET_BRUSHCACHE 15
|
||||
#define RDP_CAPLEN_BRUSHCACHE 0x08
|
||||
|
||||
#define RDP_CAPSET_BITMAP_OFFSCREEN 18
|
||||
#define RDP_CAPLEN_BITMAP_OFFSCREEN 0x08
|
||||
|
||||
#define RDP_CAPSET_BMPCACHE2 19
|
||||
#define RDP_CAPLEN_BMPCACHE2 0x28
|
||||
#define BMPCACHE2_FLAG_PERSIST ((long)1<<31)
|
||||
|
||||
#define RDP_CAPSET_VIRCHAN 20
|
||||
#define RDP_CAPLEN_VIRCHAN 0x08
|
||||
|
||||
#define RDP_SOURCE "MSTSC"
|
||||
|
||||
/* Logon flags */
|
||||
#define RDP_LOGON_AUTO 0x0008
|
||||
#define RDP_LOGON_NORMAL 0x0033
|
||||
#define RDP_COMPRESSION 0x0080
|
||||
#define RDP_LOGON_BLOB 0x0100
|
||||
#define RDP_LOGON_LEAVE_AUDIO 0x2000
|
||||
|
||||
#define RDP5_DISABLE_NOTHING 0x00
|
||||
#define RDP5_NO_WALLPAPER 0x01
|
||||
#define RDP5_NO_FULLWINDOWDRAG 0x02
|
||||
#define RDP5_NO_MENUANIMATIONS 0x04
|
||||
#define RDP5_NO_THEMING 0x08
|
||||
#define RDP5_NO_CURSOR_SHADOW 0x20
|
||||
#define RDP5_NO_CURSORSETTINGS 0x40 /* disables cursor blinking */
|
||||
|
||||
/* compression types */
|
||||
#define RDP_MPPC_COMPRESSED 0x20
|
||||
#define RDP_MPPC_RESET 0x40
|
||||
#define RDP_MPPC_FLUSH 0x80
|
||||
#define RDP_MPPC_DICT_SIZE 8192
|
||||
|
||||
/* Keymap flags */
|
||||
#define MapRightShiftMask (1 << 0)
|
||||
#define MapLeftShiftMask (1 << 1)
|
||||
@ -224,8 +322,113 @@
|
||||
#define CF_GDIOBJFIRST 768
|
||||
#define CF_GDIOBJLAST 1023
|
||||
|
||||
/* Sound format constants */
|
||||
#define WAVE_FORMAT_PCM 1
|
||||
#define WAVE_FORMAT_ADPCM 2
|
||||
#define WAVE_FORMAT_ALAW 6
|
||||
#define WAVE_FORMAT_MULAW 7
|
||||
|
||||
/* Virtual channel options */
|
||||
#define XR_CHANNEL_OPTION_SHOW_PROTOCOL 0x00200000
|
||||
#define XR_CHANNEL_OPTION_COMPRESS 0x00400000
|
||||
#define XR_CHANNEL_OPTION_COMPRESS_RDP 0x00800000
|
||||
#define XR_CHANNEL_OPTION_PRI_LOW 0x02000000
|
||||
#define XR_CHANNEL_OPTION_PRI_MED 0x04000000
|
||||
#define XR_CHANNEL_OPTION_PRI_HIGH 0x08000000
|
||||
#define XR_CHANNEL_OPTION_ENCRYPT_CS 0x10000000
|
||||
#define XR_CHANNEL_OPTION_ENCRYPT_SC 0x20000000
|
||||
#define XR_CHANNEL_OPTION_ENCRYPT_RDP 0x40000000
|
||||
#define XR_CHANNEL_OPTION_INITIALIZED 0x80000000
|
||||
|
||||
/* NT status codes for RDPDR */
|
||||
#define STATUS_SUCCESS 0x00000000
|
||||
#define STATUS_PENDING 0x00000103
|
||||
|
||||
#define STATUS_NO_MORE_FILES 0x80000006
|
||||
#define STATUS_DEVICE_PAPER_EMPTY 0x8000000e
|
||||
#define STATUS_DEVICE_POWERED_OFF 0x8000000f
|
||||
#define STATUS_DEVICE_OFF_LINE 0x80000010
|
||||
#define STATUS_DEVICE_BUSY 0x80000011
|
||||
|
||||
#define STATUS_INVALID_HANDLE 0xc0000008
|
||||
#define STATUS_INVALID_PARAMETER 0xc000000d
|
||||
#define STATUS_NO_SUCH_FILE 0xc000000f
|
||||
#define STATUS_INVALID_DEVICE_REQUEST 0xc0000010
|
||||
#define STATUS_ACCESS_DENIED 0xc0000022
|
||||
#define STATUS_OBJECT_NAME_COLLISION 0xc0000035
|
||||
#define STATUS_DISK_FULL 0xc000007f
|
||||
#define STATUS_FILE_IS_A_DIRECTORY 0xc00000ba
|
||||
#define STATUS_NOT_SUPPORTED 0xc00000bb
|
||||
#define STATUS_TIMEOUT 0xc0000102
|
||||
#define STATUS_CANCELLED 0xc0000120
|
||||
|
||||
/* RDPDR constants */
|
||||
#define RDPDR_MAX_DEVICES 0x10
|
||||
#define DEVICE_TYPE_SERIAL 0x01
|
||||
#define DEVICE_TYPE_PARALLEL 0x02
|
||||
#define DEVICE_TYPE_PRINTER 0x04
|
||||
#define DEVICE_TYPE_DISK 0x08
|
||||
#define DEVICE_TYPE_SCARD 0x20
|
||||
|
||||
#define FILE_DIRECTORY_FILE 0x00000001
|
||||
#define FILE_NON_DIRECTORY_FILE 0x00000040
|
||||
#define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000
|
||||
|
||||
/* RDP5 disconnect PDU */
|
||||
#define exDiscReasonNoInfo 0x0000
|
||||
#define exDiscReasonAPIInitiatedDisconnect 0x0001
|
||||
#define exDiscReasonAPIInitiatedLogoff 0x0002
|
||||
#define exDiscReasonServerIdleTimeout 0x0003
|
||||
#define exDiscReasonServerLogonTimeout 0x0004
|
||||
#define exDiscReasonReplacedByOtherConnection 0x0005
|
||||
#define exDiscReasonOutOfMemory 0x0006
|
||||
#define exDiscReasonServerDeniedConnection 0x0007
|
||||
#define exDiscReasonServerDeniedConnectionFips 0x0008
|
||||
#define exDiscReasonLicenseInternal 0x0100
|
||||
#define exDiscReasonLicenseNoLicenseServer 0x0101
|
||||
#define exDiscReasonLicenseNoLicense 0x0102
|
||||
#define exDiscReasonLicenseErrClientMsg 0x0103
|
||||
#define exDiscReasonLicenseHwidDoesntMatchLicense 0x0104
|
||||
#define exDiscReasonLicenseErrClientLicense 0x0105
|
||||
#define exDiscReasonLicenseCantFinishProtocol 0x0106
|
||||
#define exDiscReasonLicenseClientEndedProtocol 0x0107
|
||||
#define exDiscReasonLicenseErrClientEncryption 0x0108
|
||||
#define exDiscReasonLicenseCantUpgradeLicense 0x0109
|
||||
#define exDiscReasonLicenseNoRemoteConnections 0x010a
|
||||
|
||||
#define RDP_ORDER_STANDARD 0x01
|
||||
#define RDP_ORDER_SECONDARY 0x02
|
||||
#define RDP_ORDER_BOUNDS 0x04
|
||||
#define RDP_ORDER_CHANGE 0x08
|
||||
#define RDP_ORDER_DELTA 0x10
|
||||
#define RDP_ORDER_LASTBOUNDS 0x20
|
||||
#define RDP_ORDER_SMALL 0x40
|
||||
#define RDP_ORDER_TINY 0x80
|
||||
|
||||
#define RDP_ORDER_DESTBLT 0
|
||||
#define RDP_ORDER_PATBLT 1
|
||||
#define RDP_ORDER_SCREENBLT 2
|
||||
#define RDP_ORDER_LINE 9
|
||||
#define RDP_ORDER_RECT 10
|
||||
#define RDP_ORDER_DESKSAVE 11
|
||||
#define RDP_ORDER_MEMBLT 13
|
||||
#define RDP_ORDER_TRIBLT 14
|
||||
#define RDP_ORDER_POLYLINE 22
|
||||
#define RDP_ORDER_TEXT2 27
|
||||
|
||||
#define RDP_ORDER_RAW_BMPCACHE 0
|
||||
#define RDP_ORDER_COLCACHE 1
|
||||
#define RDP_ORDER_BMPCACHE 2
|
||||
#define RDP_ORDER_FONTCACHE 3
|
||||
#define RDP_ORDER_RAW_BMPCACHE2 4
|
||||
#define RDP_ORDER_BMPCACHE2 5
|
||||
#define RDP_ORDER_BRUSHCACHE 7
|
||||
#define RDP_ORDER_BMPCACHE3 8
|
||||
|
||||
/* orderSupportExFlags (2 bytes): A 16-bit, unsigned integer.
|
||||
Extended order support flags. */
|
||||
#define XR_ORDERFLAGS_EX_CACHE_BITMAP_REV3_SUPPORT 0x0002
|
||||
#define XR_ORDERFLAGS_EX_ALTSEC_FRAME_MARKER_SUPPORT 0x0004
|
||||
|
||||
/* drawable types */
|
||||
#define WND_TYPE_BITMAP 0
|
||||
@ -244,17 +447,10 @@
|
||||
#define BUTTON_STATE_UP 0
|
||||
#define BUTTON_STATE_DOWN 1
|
||||
|
||||
/* touch gestures */
|
||||
#define TOUCH_TWO_FINGERS_DOWN 0
|
||||
#define TOUCH_TWO_FINGERS_UP 1
|
||||
#define TOUCH_TWO_FINGERS_LEFT 2
|
||||
#define TOUCH_TWO_FINGERS_RIGHT 3
|
||||
|
||||
/* messages */
|
||||
#define WM_PAINT 3
|
||||
#define WM_KEYDOWN 15
|
||||
#define WM_KEYUP 16
|
||||
#define WM_KEYBRD_SYNC 17
|
||||
#define WM_MOUSEMOVE 100
|
||||
#define WM_LBUTTONUP 101
|
||||
#define WM_LBUTTONDOWN 102
|
||||
@ -266,69 +462,103 @@
|
||||
#define WM_BUTTON4DOWN 108
|
||||
#define WM_BUTTON5UP 109
|
||||
#define WM_BUTTON5DOWN 110
|
||||
#define WM_BUTTON6UP 111
|
||||
#define WM_BUTTON6DOWN 112
|
||||
#define WM_BUTTON7UP 113
|
||||
#define WM_BUTTON7DOWN 114
|
||||
#define WM_BUTTON8UP 115
|
||||
#define WM_BUTTON8DOWN 116
|
||||
#define WM_BUTTON9UP 117
|
||||
#define WM_BUTTON9DOWN 118
|
||||
|
||||
#define WM_TOUCH_VSCROLL 140
|
||||
#define WM_TOUCH_HSCROLL 141
|
||||
|
||||
#define WM_INVALIDATE 200
|
||||
#define WM_CHANNEL_DATA 201
|
||||
|
||||
#define CB_ITEMCHANGE 300
|
||||
|
||||
#define OSMAJORTYPE_UNSPECIFIED 0x0000
|
||||
#define OSMAJORTYPE_WINDOWS 0x0001
|
||||
#define OSMAJORTYPE_OS2 0x0002
|
||||
#define OSMAJORTYPE_MACINTOSH 0x0003
|
||||
#define OSMAJORTYPE_UNIX 0x0004
|
||||
|
||||
#define OSMINORTYPE_UNSPECIFIED 0x0000
|
||||
#define OSMINORTYPE_WINDOWS_31X 0x0001
|
||||
#define TS_OSMINORTYPE_WINDOWS_95 0x0002
|
||||
#define TS_OSMINORTYPE_WINDOWS_NT 0x0003
|
||||
#define TS_OSMINORTYPE_OS2_V21 0x0004
|
||||
|
||||
#define TS_OSMINORTYPE_POWER_PC 0x0005
|
||||
#define TS_OSMINORTYPE_MACINTOSH 0x0006
|
||||
#define TS_OSMINORTYPE_NATIVE_XSERVER 0x0007
|
||||
#define TS_OSMINORTYPE_PSEUDO_XSERVER 0x0008
|
||||
|
||||
#define TS_CAPS_PROTOCOLVERSION 0x0200
|
||||
#define FASTPATH_OUTPUT_SUPPORTED 0x0001
|
||||
#define NO_BITMAP_COMPRESSION_HDR 0x0400
|
||||
#define LONG_CREDENTIALS_SUPPORTED 0x0004
|
||||
#define AUTORECONNECT_SUPPORTED 0x0008
|
||||
#define ENC_SALTED_CHEKSUM 0x0010
|
||||
#define NEGOTIATEORDERSUPPORT 0x0002
|
||||
#define ZEROBOUNDSDELTASUPPORT 0x0008
|
||||
#define COLORINDEXSUPPORT 0x0020
|
||||
#define SOLIDPATTERNBRUSHONLY 0x0040
|
||||
#define ORDERFLAGS_EXTRA_FLAGS 0x0080
|
||||
|
||||
#define INPUT_FLAG_SCANCODES 0x0001
|
||||
#define INPUT_FLAG_MOUSEX 0x0004
|
||||
#define INPUT_FLAG_FASTPATH_INPUT 0x0008
|
||||
#define INPUT_FLAG_UNICODE 0x0010
|
||||
#define INPUT_FLAG_FASTPATH_INPUT2 0x0020
|
||||
|
||||
#define COMPDESK_NOT_SUPPORTED 0x0000
|
||||
#define COMPDESK_SUPPORTED 0x0001
|
||||
|
||||
#define SURCMDS_SETSURFACEBITS 0x00000002
|
||||
#define SURCMDS_FRAMEMARKER 0x00000010
|
||||
#define SURCMDS_STREAMSUFRACEBITS 0x00000040
|
||||
|
||||
/* CODEC_GUID_NSCODEC 0xCA8D1BB9000F154F589FAE2D1A87E2D6 */
|
||||
#define XR_CODEC_GUID_NSCODEC \
|
||||
"\xb9\x1b\x8d\xca\x0f\x00\x4f\x15\x58\x9f\xae\x2d\x1a\x87\xe2\xd6"
|
||||
|
||||
/* CODEC_GUID_REMOTEFX 0x76772F12BD724463AFB3B73C9C6F7886 */
|
||||
#define XR_CODEC_GUID_REMOTEFX \
|
||||
"\x12\x2F\x77\x76\x72\xBD\x63\x44\xAF\xB3\xB7\x3C\x9C\x6F\x78\x86"
|
||||
|
||||
/* CODEC_GUID_JPEG 0x430C9EED1BAF4CE6869ACB8B37B66237*/
|
||||
#define XR_CODEC_GUID_JPEG \
|
||||
"\xE6\x4C\xAF\x1B\xED\x9E\x0C\x43\x86\x9A\xCB\x8B\x37\xB6\x62\x37"
|
||||
|
||||
#define RDP_CAPSET_SURFCMDS 0x1c
|
||||
#define RDP_CAPLEN_SURFCMDS 0x0c
|
||||
#define RDP_CAPSET_BMPCODECS 0x1d
|
||||
#define RDP_CAPLEN_BMPCODECS 0x1c
|
||||
#define RDP_CAPSET_COMPDESK 0x19
|
||||
#define RDP_CAPLEN_COMPDESK 0x06
|
||||
#define RDP_CAPSET_LPOINTER 0x27
|
||||
#define RDP_CAPLEN_LPOINTER 0x06
|
||||
|
||||
#define FASTPATH_OUTPUT_ACTION_FASTPATH 0x0
|
||||
#define FASTPATH_OUTPUT_ACTION_X224 0x3
|
||||
|
||||
#define FASTPATH_OUTPUT_SECURE_CHECKSUM 0x1
|
||||
#define FASTPATH_OUTPUT_ENCRYPTED 0x2
|
||||
|
||||
#define FASTPATH_UPDATETYPE_ORDERS 0x0
|
||||
#define FASTPATH_UPDATETYPE_BITMAP 0x1
|
||||
#define FASTPATH_UPDATETYPE_PALETTE 0x2
|
||||
#define FASTPATH_UPDATETYPE_SYNCHRONIZE 0x3
|
||||
#define FASTPATH_UPDATETYPE_SURFCMDS 0x4
|
||||
#define FASTPATH_UPDATETYPE_PTR_NULL 0x5
|
||||
#define FASTPATH_UPDATETYPE_PTR_DEFAULT 0x6
|
||||
#define FASTPATH_UPDATETYPE_PTR_POSITION 0x8
|
||||
#define FASTPATH_UPDATETYPE_COLOR 0x9
|
||||
#define FASTPATH_UPDATETYPE_CACHED 0xA
|
||||
#define FASTPATH_UPDATETYPE_POINTER 0xB
|
||||
|
||||
#define FASTPATH_FRAGMENT_SINGLE 0x0
|
||||
#define FASTPATH_FRAGMENT_LAST 0x1
|
||||
#define FASTPATH_FRAGMENT_FIRST 0x2
|
||||
#define FASTPATH_FRAGMENT_NEXT 0x3
|
||||
|
||||
#define FASTPATH_MAX_PACKET_SIZE 0x3fff
|
||||
|
||||
// Since we're not guaranteed to have pixman, copy these directives.
|
||||
#define XRDP_PIXMAN_TYPE_ARGB 2
|
||||
#define XRDP_PIXMAN_TYPE_ABGR 3
|
||||
#define XRDP_PIXMAN_FORMAT(bpp,type,a,r,g,b) (((bpp) << 24) | \
|
||||
((type) << 16) | \
|
||||
((a) << 12) | \
|
||||
((r) << 8) | \
|
||||
((g) << 4) | \
|
||||
((b)))
|
||||
#define CMDTYPE_SET_SURFACE_BITS 0x0001
|
||||
#define CMDTYPE_FRAME_MARKER 0x0004
|
||||
#define CMDTYPE_STREAM_SURFACE_BITS 0x0006
|
||||
|
||||
#define XRDP_a8b8g8r8 \
|
||||
XRDP_PIXMAN_FORMAT(32, XRDP_PIXMAN_TYPE_ABGR, 8, 8, 8, 8)
|
||||
|
||||
#define XRDP_a8r8g8b8 \
|
||||
XRDP_PIXMAN_FORMAT(32, XRDP_PIXMAN_TYPE_ARGB, 8, 8, 8, 8)
|
||||
|
||||
#define XRDP_r5g6b5 \
|
||||
XRDP_PIXMAN_FORMAT(16, XRDP_PIXMAN_TYPE_ARGB, 0, 5, 6, 5)
|
||||
|
||||
#define XRDP_a1r5g5b5 \
|
||||
XRDP_PIXMAN_FORMAT(16, XRDP_PIXMAN_TYPE_ARGB, 1, 5, 5, 5)
|
||||
|
||||
#define XRDP_r3g3b2 \
|
||||
XRDP_PIXMAN_FORMAT(8, XRDP_PIXMAN_TYPE_ARGB, 0, 3, 3, 2)
|
||||
|
||||
// The last used constant in pixman is 63, so use 64+
|
||||
#define XRDP_nv12 \
|
||||
XRDP_PIXMAN_FORMAT(12, 64, 0, 0, 0, 0)
|
||||
|
||||
#define XRDP_i420 \
|
||||
XRDP_PIXMAN_FORMAT(12, 65, 0, 0, 0, 0)
|
||||
|
||||
#define XRDP_nv12_709fr \
|
||||
XRDP_PIXMAN_FORMAT(12, 66, 0, 0, 0, 0)
|
||||
|
||||
#define XRDP_yuv444_709fr \
|
||||
XRDP_PIXMAN_FORMAT(32, 67, 0, 0, 0, 0)
|
||||
|
||||
// https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpegfx/8131c1bc-1af8-4907-a05a-f72f4581160f
|
||||
#define XRDP_yuv444_v1_stream_709fr \
|
||||
XRDP_PIXMAN_FORMAT(32, 68, 0, 0, 0, 0)
|
||||
|
||||
// https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpegfx/781406c3-5e24-4f2b-b6ff-42b76bf64f6d
|
||||
#define XRDP_yuv444_v2_stream_709fr \
|
||||
XRDP_PIXMAN_FORMAT(32, 69, 0, 0, 0, 0)
|
||||
#define XRDP_MAX_BITMAP_CACHE_ID 3
|
||||
#define XRDP_MAX_BITMAP_CACHE_IDX 2000
|
||||
|
||||
#endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Jay Sorg 2012-2014
|
||||
* Copyright (C) Jay Sorg 2012
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -78,9 +78,9 @@ struct rail_icon_info
|
||||
int cmap_bytes;
|
||||
int mask_bytes;
|
||||
int data_bytes;
|
||||
char *mask;
|
||||
char *cmap;
|
||||
char *data;
|
||||
char* mask;
|
||||
char* cmap;
|
||||
char* data;
|
||||
};
|
||||
|
||||
struct rail_window_rect
|
||||
@ -95,8 +95,8 @@ struct rail_notify_icon_infotip
|
||||
{
|
||||
int timeout;
|
||||
int flags;
|
||||
char *text;
|
||||
char *title;
|
||||
char* text;
|
||||
char* title;
|
||||
};
|
||||
|
||||
struct rail_window_state_order
|
||||
@ -105,7 +105,7 @@ struct rail_window_state_order
|
||||
int style;
|
||||
int extended_style;
|
||||
int show_state;
|
||||
char *title_info;
|
||||
char* title_info;
|
||||
int client_offset_x;
|
||||
int client_offset_y;
|
||||
int client_area_width;
|
||||
@ -119,17 +119,17 @@ struct rail_window_state_order
|
||||
int window_width;
|
||||
int window_height;
|
||||
int num_window_rects;
|
||||
struct rail_window_rect *window_rects;
|
||||
struct rail_window_rect* window_rects;
|
||||
int visible_offset_x;
|
||||
int visible_offset_y;
|
||||
int num_visibility_rects;
|
||||
struct rail_window_rect *visibility_rects;
|
||||
struct rail_window_rect* visibility_rects;
|
||||
};
|
||||
|
||||
struct rail_notify_state_order
|
||||
{
|
||||
int version;
|
||||
char *tool_tip;
|
||||
char* tool_tip;
|
||||
struct rail_notify_icon_infotip infotip;
|
||||
int state;
|
||||
int icon_cache_entry;
|
||||
@ -141,7 +141,7 @@ struct rail_monitored_desktop_order
|
||||
{
|
||||
int active_window_id;
|
||||
int num_window_ids;
|
||||
int *window_ids;
|
||||
int* window_ids;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,88 +0,0 @@
|
||||
/**
|
||||
* Copyright (C) 2024 Matt Burt, all xrdp contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file common/xrdp_scancode_defs.h
|
||||
* @brief Scancode global definitions, shared with xorgxrdp
|
||||
*/
|
||||
|
||||
#if !defined(XRDP_SCANCODE_DEFS_H)
|
||||
#define XRDP_SCANCODE_DEFS_H
|
||||
|
||||
enum
|
||||
{
|
||||
/**
|
||||
* Scancodes for keys received from the RDP client
|
||||
*/
|
||||
SCANCODE_LSHIFT_KEY = 0x2a,
|
||||
SCANCODE_RSHIFT_KEY = 0x36,
|
||||
SCANCODE_LCTRL_KEY = 0x1d,
|
||||
SCANCODE_RCTRL_KEY = 0x11d,
|
||||
SCANCODE_CAPS_KEY = 0x3a,
|
||||
SCANCODE_NUMLOCK_KEY = 0x45,
|
||||
SCANCODE_SCROLL_KEY = 0x46, // Scroll lock
|
||||
SCANCODE_LALT_KEY = 0x38,
|
||||
SCANCODE_RALT_KEY = 0x138,
|
||||
SCANCODE_LWIN_KEY = 0x15b,
|
||||
SCANCODE_RWIN_KEY = 0x15c,
|
||||
SCANCODE_MENU_KEY = 0x15d,
|
||||
|
||||
SCANCODE_ESC_KEY = 0x01,
|
||||
SCANCODE_BACKSPACE_KEY = 0x0e,
|
||||
SCANCODE_ENTER_KEY = 0x1c,
|
||||
SCANCODE_TAB_KEY = 0x0f,
|
||||
SCANCODE_PAUSE_KEY = 0x21d,
|
||||
|
||||
SCANCODE_KP_ENTER_KEY = 0x11c,
|
||||
SCANCODE_KP_DEL_KEY = 0x53,
|
||||
SCANCODE_KP_1_KEY = 0x4f,
|
||||
SCANCODE_KP_2_KEY = 0x50,
|
||||
SCANCODE_KP_4_KEY = 0x4b,
|
||||
SCANCODE_KP_6_KEY = 0x4d,
|
||||
SCANCODE_KP_7_KEY = 0x47,
|
||||
SCANCODE_KP_8_KEY = 0x48,
|
||||
|
||||
SCANCODE_LEFT_ARROW_KEY = 0x14b,
|
||||
SCANCODE_RIGHT_ARROW_KEY = 0x14d,
|
||||
SCANCODE_UP_ARROW_KEY = 0x148,
|
||||
SCANCODE_DOWN_ARROW_KEY = 0x150,
|
||||
|
||||
SCANCODE_HOME_KEY = 0x147,
|
||||
SCANCODE_DEL_KEY = 0x153,
|
||||
SCANCODE_END_KEY = 0x14f,
|
||||
|
||||
/**
|
||||
* Keys affected by numlock
|
||||
* (this is not the whole keypad)
|
||||
*/
|
||||
SCANCODE_MIN_NUMLOCK = SCANCODE_KP_7_KEY,
|
||||
SCANCODE_MAX_NUMLOCK = SCANCODE_KP_DEL_KEY
|
||||
};
|
||||
|
||||
// Convert key_code and flags values received from a TS_KEYBOARD_EVENT
|
||||
// into a value suitable for use by this module
|
||||
#define SCANCODE_FROM_KBD_EVENT(key_code,keyboard_flags) \
|
||||
(((key_code) & 0x7f) | ((keyboard_flags) & 0x300))
|
||||
|
||||
// Convert a scancode used by this module back into a
|
||||
// TS_KEYBOARD_EVENT keyCode value
|
||||
#define SCANCODE_TO_KBD_EVENT_KEY_CODE(scancode) ((scancode) & 0x7f)
|
||||
|
||||
// Convert a scancode used by this module back into a
|
||||
// TS_KEYBOARD_EVENT keyboardFlags value
|
||||
#define SCANCODE_TO_KBD_EVENT_KBD_FLAGS(scancode) ((scancode) & 0x300)
|
||||
|
||||
#endif /* XRDP_SCANCODE_DEFS_H */
|
@ -1,64 +0,0 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Jay Sorg 2004-2014
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* names of UNIX sockets for inter-process communication
|
||||
*/
|
||||
|
||||
#if !defined(XRDP_SOCKETS_H)
|
||||
#define XRDP_SOCKETS_H
|
||||
|
||||
/* XRDP_SOCKET_ROOT_PATH must be defined to include this file */
|
||||
#ifdef __cppcheck__
|
||||
/* avoid syntax errors */
|
||||
# define XRDP_SOCKET_ROOT_PATH "/dummy"
|
||||
#elif !defined(XRDP_SOCKET_ROOT_PATH)
|
||||
# error "XRDP_SOCKET_ROOT_PATH must be defined"
|
||||
#endif
|
||||
|
||||
/* Buffer size for code for fullpath declarations
|
||||
*
|
||||
* This needs to fit in the sun_path field of a sockaddr_un. POSIX
|
||||
* does not define this size, so the value below is the lower of
|
||||
* the FreeBSD/OpenBSD/NetBSD(104) and Linux(108) values */
|
||||
#define XRDP_SOCKETS_MAXPATH 104
|
||||
|
||||
/* The socketdir is rooted at XRDP_SOCKET_ROOT_PATH. User-specific
|
||||
* sockets live in a user-specific sub-directory of this called
|
||||
* XRDP_SOCKET_PATH. The sub-directory is the UID of the user */
|
||||
#define XRDP_SOCKET_PATH XRDP_SOCKET_ROOT_PATH "/%d"
|
||||
|
||||
/* Sockets in XRDP_SOCKET_ROOT_PATH */
|
||||
#define SCP_LISTEN_PORT_BASE_STR "sesman.socket"
|
||||
|
||||
/* names of socket files within XRDP_SOCKET_PATH, qualified by
|
||||
* display number */
|
||||
#define XRDP_CHANSRV_BASE_STR "xrdp_chansrv_socket_%d"
|
||||
#define CHANSRV_PORT_OUT_BASE_STR "xrdp_chansrv_audio_out_socket_%d"
|
||||
#define CHANSRV_PORT_IN_BASE_STR "xrdp_chansrv_audio_in_socket_%d"
|
||||
#define CHANSRV_API_BASE_STR "xrdpapi_%d"
|
||||
#define XRDP_X11RDP_BASE_STR "xrdp_display_%d"
|
||||
#define XRDP_DISCONNECT_BASE_STR "xrdp_disconnect_display_%d"
|
||||
|
||||
/* fullpath declarations */
|
||||
#define XRDP_CHANSRV_STR XRDP_SOCKET_PATH "/" XRDP_CHANSRV_BASE_STR
|
||||
#define CHANSRV_PORT_OUT_STR XRDP_SOCKET_PATH "/" CHANSRV_PORT_OUT_BASE_STR
|
||||
#define CHANSRV_PORT_IN_STR XRDP_SOCKET_PATH "/" CHANSRV_PORT_IN_BASE_STR
|
||||
#define CHANSRV_API_STR XRDP_SOCKET_PATH "/" CHANSRV_API_BASE_STR
|
||||
#define XRDP_X11RDP_STR XRDP_SOCKET_PATH "/" XRDP_X11RDP_BASE_STR
|
||||
#define XRDP_DISCONNECT_STR XRDP_SOCKET_PATH "/" XRDP_DISCONNECT_BASE_STR
|
||||
|
||||
#endif
|
740
configure.ac
740
configure.ac
@ -1,713 +1,123 @@
|
||||
# Process this file with autoconf to produce a configure script
|
||||
|
||||
AC_PREREQ([2.69])
|
||||
AC_INIT([xrdp], [0.10.80], [xrdp-devel@googlegroups.com])
|
||||
AC_DEFINE([VERSION_YEAR], 2024, [Copyright year])
|
||||
AC_CONFIG_HEADERS(config_ac.h:config_ac-h.in)
|
||||
AM_INIT_AUTOMAKE([1.7.2 foreign])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
AC_USE_SYSTEM_EXTENSIONS
|
||||
AC_PREREQ(2.59)
|
||||
AC_INIT([xrdp], [0.6.0], [xrdp-devel@lists.sourceforge.net])
|
||||
AM_CONFIG_HEADER(config_ac.h:config_ac-h.in)
|
||||
AM_INIT_AUTOMAKE([1.6 foreign])
|
||||
AC_PROG_CC
|
||||
AC_PROG_CXX
|
||||
LT_INIT
|
||||
|
||||
PKG_PROG_PKG_CONFIG
|
||||
if test "x$PKG_CONFIG" = "x"; then
|
||||
AC_MSG_ERROR([please install pkg-config])
|
||||
fi
|
||||
|
||||
AC_CONFIG_SUBDIRS([libpainter librfxcodec])
|
||||
|
||||
# Use silent rules by default if supported by Automake
|
||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
||||
|
||||
case $host_os in
|
||||
*linux*)
|
||||
linux=yes
|
||||
;;
|
||||
*kfreebsd*)
|
||||
linux=yes # only used in instfiles/ so that’s ok for us for now
|
||||
;;
|
||||
*freebsd*)
|
||||
freebsd=yes
|
||||
;;
|
||||
*netbsd*)
|
||||
netbsd=yes
|
||||
;;
|
||||
*openbsd*)
|
||||
openbsd=yes
|
||||
;;
|
||||
*darwin*)
|
||||
macos=yes
|
||||
;;
|
||||
esac
|
||||
|
||||
AM_CONDITIONAL(LINUX, [test "x$linux" = xyes])
|
||||
AM_CONDITIONAL(FREEBSD, [test "x$freebsd" = xyes])
|
||||
AM_CONDITIONAL(OPENBSD, [test "x$openbsd" = xyes])
|
||||
AM_CONDITIONAL(NETBSD, [test "x$netbsd" = xyes])
|
||||
AM_CONDITIONAL(MACOS, [test "x$macos" = xyes])
|
||||
|
||||
AC_CHECK_SIZEOF([int])
|
||||
AC_CHECK_SIZEOF([long])
|
||||
AC_CHECK_SIZEOF([void *])
|
||||
|
||||
# runstatedir not available for autoconf <= 2.69
|
||||
if test "x$runstatedir" = "x" ; then
|
||||
runstatedir='${localstatedir}/run'
|
||||
fi
|
||||
|
||||
AC_ARG_WITH([socketdir],
|
||||
[AS_HELP_STRING([--with-socketdir=DIR],
|
||||
[Use directory for UNIX sockets for XRDP sessions (default: RUNSTATEDIR/xrdp)])],
|
||||
[], [with_socketdir="$runstatedir/xrdp"])
|
||||
AC_SUBST([socketdir], [$with_socketdir])
|
||||
|
||||
AC_C_CONST
|
||||
AC_PROG_LIBTOOL
|
||||
AC_ARG_WITH([systemdsystemunitdir],
|
||||
AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files, no to disable]),
|
||||
[], [
|
||||
if test "x$linux" = xyes; then
|
||||
with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
|
||||
fi
|
||||
])
|
||||
|
||||
AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
|
||||
[], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
|
||||
if test "x$with_systemdsystemunitdir" != xno; then
|
||||
AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
|
||||
fi
|
||||
AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
|
||||
|
||||
AC_ARG_ENABLE(tests,
|
||||
AS_HELP_STRING([--enable-tests],
|
||||
[Ensure dependencies for the tests are installed]),
|
||||
[ensure_tests_deps=yes], [])
|
||||
AC_ARG_ENABLE(pam, AS_HELP_STRING([--enable-pam],
|
||||
[Build PAM support (default: yes)]),
|
||||
[], [enable_pam=yes])
|
||||
AM_CONDITIONAL(SESMAN_NOPAM, [test x$enable_pam != xyes])
|
||||
AC_ARG_ENABLE(vsock, AS_HELP_STRING([--enable-vsock],
|
||||
[Build AF_VSOCK support (default: no)]),
|
||||
[], [enable_vsock=no])
|
||||
AC_ARG_ENABLE(ipv6, AS_HELP_STRING([--enable-ipv6],
|
||||
[Build IPv6 support (default: no, experimental)]),
|
||||
[], [enable_ipv6=no])
|
||||
AC_ARG_ENABLE(ipv6only, AS_HELP_STRING([--enable-ipv6only],
|
||||
[Build IPv6-only (default: no)]),
|
||||
[], [enable_ipv6only=no])
|
||||
AC_ARG_ENABLE(nopam, AS_HELP_STRING([--enable-nopam],
|
||||
[Build no PAM support (default: no)]),
|
||||
[nopam=true], [nopam=false])
|
||||
AM_CONDITIONAL(SESMAN_NOPAM, [test x$nopam = xtrue])
|
||||
AC_ARG_ENABLE(kerberos, AS_HELP_STRING([--enable-kerberos],
|
||||
[Build kerberos support (prefer --enable-pam if available) (default: no)]),
|
||||
[], [enable_kerberos=no])
|
||||
AC_ARG_ENABLE(bsd, AS_HELP_STRING([--enable-bsd],
|
||||
[Build BSD auth support (default: no)]),
|
||||
[bsd=true], [bsd=false])
|
||||
AM_CONDITIONAL(SESMAN_BSD, [test x$bsd = xtrue])
|
||||
AM_CONDITIONAL(SESMAN_KERBEROS, [test x$enable_kerberos = xyes])
|
||||
[Build kerberos support (default: no)]),
|
||||
[kerberos=true], [kerberos=false])
|
||||
AM_CONDITIONAL(SESMAN_KERBEROS, [test x$kerberos = xtrue])
|
||||
AC_ARG_ENABLE(pamuserpass, AS_HELP_STRING([--enable-pamuserpass],
|
||||
[Build PAM userpass support (default: no)]),
|
||||
[], [enable_pamuserpass=no])
|
||||
AM_CONDITIONAL(SESMAN_PAMUSERPASS, [test x$enable_pamuserpass = xyes])
|
||||
AC_ARG_ENABLE(pam-config, AS_HELP_STRING([--enable-pam-config=CONF],
|
||||
[Select PAM config to install: arch, debian, redhat, suse, freebsd, macos, unix
|
||||
(default: autodetect)]))
|
||||
|
||||
# Development options. devel_all is first as this provides a default for
|
||||
# the others
|
||||
AC_ARG_ENABLE(devel_all, AS_HELP_STRING([--enable-devel-all],
|
||||
[Enable all development options (default: no)]),
|
||||
[devel_all=$enableval], [devel_all=no])
|
||||
AC_ARG_ENABLE(devel_debug, AS_HELP_STRING([--enable-devel-debug],
|
||||
[Build exes with no optimisation and debugging symbols (default: no)]),
|
||||
[devel_debug=$enableval], [devel_debug=$devel_all])
|
||||
AM_CONDITIONAL(DEVEL_DEBUG, [test x$devel_debug = xyes ])
|
||||
AC_ARG_ENABLE(devel_logging, AS_HELP_STRING([--enable-devel-logging],
|
||||
[Enable development logging (default: no)]),
|
||||
[devel_logging=$enableval], [devel_logging=$devel_all])
|
||||
AC_ARG_ENABLE(devel_streamcheck, AS_HELP_STRING([--enable-devel-streamcheck],
|
||||
[Add range-check/abort to stream primitives (default: no)]),
|
||||
[devel_streamcheck=$enableval], [devel_streamcheck=$devel_all])
|
||||
|
||||
AC_ARG_ENABLE(neutrinordp, AS_HELP_STRING([--enable-neutrinordp],
|
||||
[Build neutrinordp module (default: no)]),
|
||||
[], [enable_neutrinordp=no])
|
||||
AM_CONDITIONAL(XRDP_NEUTRINORDP, [test x$enable_neutrinordp = xyes])
|
||||
|
||||
AC_ARG_ENABLE(ulalaca, AS_HELP_STRING([--enable-ulalaca],
|
||||
[Build ulalaca module (experimental) (default: no)]),
|
||||
[], [enable_ulalaca=no])
|
||||
AM_CONDITIONAL(XRDP_ULALACA, [test x$enable_ulalaca = xyes])
|
||||
|
||||
[Build pam userpass support (default: no)]),
|
||||
[pamuserpass=true], [pamuserpass=false])
|
||||
AM_CONDITIONAL(SESMAN_PAMUSERPASS, [test x$pamuserpass = xtrue])
|
||||
AC_ARG_ENABLE(xrdpdebug, AS_HELP_STRING([--enable-xrdpdebug],
|
||||
[Build debug (default: no)]),
|
||||
[xrdpdebug=true], [xrdpdebug=false])
|
||||
AM_CONDITIONAL(XRDP_DEBUG, [test x$xrdpdebug = xtrue])
|
||||
AC_ARG_ENABLE(freerdp1, AS_HELP_STRING([--enable-freerdp1],
|
||||
[Build freerdp1 module (default: no)]),
|
||||
[freerdp1=true], [freerdp1=false])
|
||||
AM_CONDITIONAL(XRDP_FREERDP1, [test x$freerdp1 = xtrue])
|
||||
AC_ARG_ENABLE(jpeg, AS_HELP_STRING([--enable-jpeg],
|
||||
[Build jpeg module (default: no)]),
|
||||
[], [enable_jpeg=no])
|
||||
AM_CONDITIONAL(XRDP_JPEG, [test x$enable_jpeg = xyes])
|
||||
AC_ARG_ENABLE(tjpeg, AS_HELP_STRING([--enable-tjpeg],
|
||||
[Build turbo jpeg module (default: no)]),
|
||||
[], [enable_tjpeg=no])
|
||||
AM_CONDITIONAL(XRDP_TJPEG, [test x$enable_tjpeg = xyes])
|
||||
AC_ARG_ENABLE(fuse, AS_HELP_STRING([--enable-fuse],
|
||||
[Build fuse(clipboard file / drive redir) (default: no)]),
|
||||
[], [enable_fuse=no])
|
||||
AM_CONDITIONAL(XRDP_FUSE, [test x$enable_fuse = xyes])
|
||||
AC_ARG_ENABLE(xrdpvr, AS_HELP_STRING([--enable-xrdpvr],
|
||||
[Build xrdpvr module (default: no)]),
|
||||
[], [enable_xrdpvr=no])
|
||||
AM_CONDITIONAL(XRDP_XRDPVR, [test x$enable_xrdpvr = xyes])
|
||||
AC_ARG_ENABLE(fdkaac, AS_HELP_STRING([--enable-fdkaac],
|
||||
[Build aac(audio codec) (default: no)]),
|
||||
[], [enable_fdkaac=no])
|
||||
AM_CONDITIONAL(XRDP_FDK_AAC, [test x$enable_fdkaac = xyes])
|
||||
AC_ARG_ENABLE(opus, AS_HELP_STRING([--enable-opus],
|
||||
[Build opus(audio codec) (default: no)]),
|
||||
[], [enable_opus=no])
|
||||
AM_CONDITIONAL(XRDP_OPUS, [test x$enable_opus = xyes])
|
||||
AC_ARG_ENABLE(mp3lame, AS_HELP_STRING([--enable-mp3lame],
|
||||
[Build lame mp3(audio codec) (default: no)]),
|
||||
[], [enable_mp3lame=no])
|
||||
AM_CONDITIONAL(XRDP_MP3LAME, [test x$enable_mp3lame = xyes])
|
||||
AC_ARG_ENABLE(ibus, AS_HELP_STRING([--enable-ibus],
|
||||
[Allow unicode input via IBus) (default: no)]),
|
||||
[], [enable_ibus=no])
|
||||
AM_CONDITIONAL(XRDP_IBUS, [test x$enable_ibus = xyes])
|
||||
AC_ARG_ENABLE(pixman, AS_HELP_STRING([--enable-pixman],
|
||||
[Use pixman library (default: no)]),
|
||||
[], [enable_pixman=no])
|
||||
AM_CONDITIONAL(XRDP_PIXMAN, [test x$enable_pixman = xyes])
|
||||
AC_ARG_ENABLE(x264, AS_HELP_STRING([--enable-x264],
|
||||
[Use x264 library (default: no)]),
|
||||
[], [enable_x264=no])
|
||||
AM_CONDITIONAL(XRDP_X264, [test x$enable_x264 = xyes])
|
||||
AC_ARG_ENABLE(painter, AS_HELP_STRING([--disable-painter],
|
||||
[Do not use included painter library (default: no)]),
|
||||
[], [enable_painter=yes])
|
||||
AM_CONDITIONAL(XRDP_PAINTER, [test x$enable_painter = xyes])
|
||||
[jpeg=true], [jpeg=false])
|
||||
AM_CONDITIONAL(XRDP_JPEG, [test x$jpeg = xtrue])
|
||||
AC_ARG_ENABLE(simplesound, AS_HELP_STRING([--enable-simplesound],
|
||||
[Build simple pulse audio interface (default: no)]),
|
||||
[simplesound=true], [simplesound=false])
|
||||
AM_CONDITIONAL(XRDP_SIMPLESOUND, [test x$simplesound = xtrue])
|
||||
|
||||
AC_ARG_ENABLE(rfxcodec, AS_HELP_STRING([--disable-rfxcodec],
|
||||
[Do not use included librfxcodec library (default: no)]),
|
||||
[], [enable_rfxcodec=yes])
|
||||
AM_CONDITIONAL(XRDP_RFXCODEC, [test x$enable_rfxcodec = xyes])
|
||||
|
||||
AC_ARG_ENABLE(rdpsndaudin, AS_HELP_STRING([--enable-rdpsndaudin],
|
||||
[Use rdpsnd audio in (default: no)]),
|
||||
[], [enable_rdpsndaudin=no])
|
||||
AM_CONDITIONAL(XRDP_RDPSNDAUDIN, [test x$enable_rdpsndaudin = xyes])
|
||||
|
||||
AC_ARG_ENABLE(utmp, AS_HELP_STRING([--enable-utmp],
|
||||
[Update utmp (default: no)]),
|
||||
[], [enable_utmp=no])
|
||||
AM_CONDITIONAL(XRDP_UTMP, [test x$enable_utmp = xyes])
|
||||
|
||||
AC_ARG_WITH(imlib2, AS_HELP_STRING([--with-imlib2=ARG], [imlib2 library to use for non-BMP backgrounds (ARG=yes/no/<abs-path>)]),,)
|
||||
|
||||
AC_ARG_WITH(freetype2, AS_HELP_STRING([--with-freetype2=ARG], [freetype2 library to use for rendering fonts (ARG=yes/no/<abs-path>)]),,)
|
||||
|
||||
# Obsolete options
|
||||
AC_ARG_ENABLE(xrdpdebug, AS_HELP_STRING([--enable-xrdpdebug],
|
||||
[This option is no longer supported - use --enable-devel-all]))
|
||||
|
||||
if test "x$enable_xrdpdebug" != x; then
|
||||
AC_MSG_ERROR([--enable-xrdpdebug must be replaced with one or more --enable-devel-* options])
|
||||
fi
|
||||
|
||||
# configure compiler options and CFLAGS
|
||||
AX_GCC_FUNC_ATTRIBUTE([format])
|
||||
AX_TYPE_SOCKLEN_T
|
||||
AX_CFLAGS_WARN_ALL
|
||||
AX_APPEND_COMPILE_FLAGS([-Wwrite-strings])
|
||||
AX_APPEND_COMPILE_FLAGS([-Wmissing-prototypes], ,[-Werror])
|
||||
|
||||
AM_COND_IF([LINUX],
|
||||
[AX_APPEND_COMPILE_FLAGS([-Werror])]) # bsd has warnings that have not been fixed yet
|
||||
|
||||
AM_COND_IF([DEVEL_DEBUG],
|
||||
[AX_APPEND_COMPILE_FLAGS([-g -O0])],
|
||||
[AX_APPEND_COMPILE_FLAGS([-O2])])
|
||||
|
||||
# Function setusercontext() is in BSD -lutil but N/A on Solaris or GNU systems
|
||||
AC_SEARCH_LIBS([setusercontext], [util])
|
||||
|
||||
# Define HAVE_XXXXX macros for some system functions
|
||||
AC_CHECK_FUNCS([setusercontext getgrouplist clearenv])
|
||||
|
||||
# The type used by getgrouplist() is the same type used by getgroups()
|
||||
AC_TYPE_GETGROUPS
|
||||
|
||||
# Don't fail without working nasm if rfxcodec is not enabled
|
||||
if test "x$enable_rfxcodec" != xyes; then
|
||||
with_simd=no
|
||||
export with_simd
|
||||
fi
|
||||
|
||||
# Check if -ldl is needed to use dlopen()
|
||||
DLOPEN_LIBS=
|
||||
AC_CHECK_FUNC(dlopen, [],
|
||||
[AC_CHECK_LIB(dl, dlopen, [DLOPEN_LIBS=-ldl])])
|
||||
AC_SUBST(DLOPEN_LIBS)
|
||||
AM_CONDITIONAL(GOT_PREFIX, test "x${prefix}" != "xNONE"])
|
||||
|
||||
# checking for openssl
|
||||
PKG_CHECK_MODULES([OPENSSL], [openssl >= 0.9.8], [],
|
||||
[AC_MSG_ERROR([please install libssl-dev or openssl-devel])])
|
||||
|
||||
# look for openssl binary
|
||||
OPENSSL_BIN=`$PKG_CONFIG --variable=exec_prefix openssl`/bin
|
||||
AC_PATH_PROGS([OPENSSL], [openssl], [:], [$OPENSSL_BIN:$PATH])
|
||||
|
||||
# checking for PAM variation
|
||||
# Linux-PAM is used in Linux systems
|
||||
# OpenPAM is used by FreeBSD, NetBSD, DragonFly BSD and OS X
|
||||
# OpenBSD uses BSD Authentication rather than both PAMs
|
||||
AC_CHECK_HEADER([security/_pam_types.h],
|
||||
[AC_DEFINE([HAVE__PAM_TYPES_H], 1, [Using Linux-PAM], [])])
|
||||
AC_CHECK_HEADER([security/pam_constants.h],
|
||||
[AC_DEFINE([HAVE_PAM_CONSTANTS_H], 1, [Using OpenPAM], [])])
|
||||
|
||||
# Find imlib2
|
||||
case "$with_imlib2" in
|
||||
'' | no) AC_MSG_NOTICE([imlib2 will not be supported])
|
||||
use_imlib2=no
|
||||
;;
|
||||
yes)
|
||||
PKG_CHECK_MODULES([IMLIB2], [imlib2 >= 1.4.5],
|
||||
[use_imlib2=yes],
|
||||
[AC_MSG_ERROR([please install libimlib2-dev or imlib2-devel])])
|
||||
;;
|
||||
/*) AC_MSG_CHECKING([for imlib2 in $with_imlib2])
|
||||
if test -d $with_imlib2/lib; then
|
||||
IMLIB2_LIBS="-L$with_imlib2/lib -lImlib2"
|
||||
elif test -d $with_imlib2/lib64; then
|
||||
IMLIB2_LIBS="-L$with_imlib2/lib64 -lImlib2"
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([Can't find libImlib2 in $with_imlib2])
|
||||
fi
|
||||
|
||||
if test -f $with_imlib2/include/Imlib2.h; then
|
||||
IMLIB2_CFLAGS="-I $with_imlib2/include"
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([Can't find $with_imlib2/include/Imlib2.h])
|
||||
fi
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_SUBST([IMLIB2_LIBS])
|
||||
AC_SUBST([IMLIB2_CFLAGS])
|
||||
use_imlib2=yes
|
||||
;;
|
||||
*) AC_MSG_ERROR([--with-imlib2 needs yes/no or absolute path])
|
||||
esac
|
||||
|
||||
if test x$use_imlib2 = xyes; then
|
||||
AC_DEFINE([USE_IMLIB2],1, [Compile with imlib2 support])
|
||||
fi
|
||||
|
||||
# Find freetype2
|
||||
#
|
||||
# The modversion used by pkgcheck does not correspond to the
|
||||
# freetype2 release. See docs/VERSIONS.TXT in the freetype2
|
||||
# source for a table of correspondences. If you change one
|
||||
# of the below defines, change both.
|
||||
m4_define([FT2_REQUIRED_VERSION], [2_8_0])
|
||||
m4_define([FT2_REQUIRED_MODVERSION], [20.0.14])
|
||||
case "$with_freetype2" in
|
||||
'' | no) AC_MSG_NOTICE([freetype2 will not be supported])
|
||||
use_freetype2=no
|
||||
;;
|
||||
yes)
|
||||
PKG_CHECK_MODULES([FREETYPE2], [freetype2 >= FT2_REQUIRED_MODVERSION],
|
||||
[use_freetype2=yes],
|
||||
[AC_MSG_ERROR([please install version FT2_REQUIRED_VERSION or later of libfreetype6-dev or freetype-devel])])
|
||||
;;
|
||||
/*) AC_MSG_CHECKING([for freetype2 in $with_freetype2])
|
||||
if test -d $with_freetype2/lib; then
|
||||
FREETYPE2_LIBS="-L$with_freetype2/lib -llibfreetype"
|
||||
elif test -d $with_freetype2/lib64; then
|
||||
FREETYPE2_LIBS="-L$with_freetype2/lib64 -llibfreetype"
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([Can't find libfreetype in $with_freetype2])
|
||||
fi
|
||||
|
||||
if test -f $with_freetype2/include/freetype2/ft2build.h; then
|
||||
FREETYPE2_CFLAGS="-I $with_freetype2/include/freetype2"
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_ERROR([Can't find $with_freetype2/include/freetype2/ft2build.h])
|
||||
fi
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_SUBST([FREETYPE2_LIBS])
|
||||
AC_SUBST([FREETYPE2_CFLAGS])
|
||||
use_freetype2=yes
|
||||
;;
|
||||
*) AC_MSG_ERROR([--with-freetype2 needs yes/no or absolute path])
|
||||
esac
|
||||
AM_CONDITIONAL([USE_FREETYPE2], [test "x$use_freetype2" = xyes])
|
||||
|
||||
# Check only one auth mechanism is specified, and give it a name
|
||||
auth_cnt=0
|
||||
auth_mech="Builtin"
|
||||
AUTHMOD_OBJ=verify_user.lo
|
||||
AUTHMOD_LIB=-lcrypt
|
||||
if test x$enable_pam = xyes
|
||||
then
|
||||
auth_cnt=`expr $auth_cnt + 1`
|
||||
auth_mech="PAM"
|
||||
AUTHMOD_OBJ=verify_user_pam.lo
|
||||
AUTHMOD_LIB=-lpam
|
||||
fi
|
||||
if test x$bsd = xtrue
|
||||
then
|
||||
auth_cnt=`expr $auth_cnt + 1`
|
||||
auth_mech="BSD"
|
||||
AUTHMOD_OBJ=verify_user_bsd.lo
|
||||
AUTHMOD_LIB=
|
||||
fi
|
||||
if test x$enable_kerberos = xyes
|
||||
then
|
||||
auth_cnt=`expr $auth_cnt + 1`
|
||||
auth_mech="Kerberos"
|
||||
AUTHMOD_OBJ=verify_user_kerberos.lo
|
||||
AUTHMOD_LIB=-lkrb5
|
||||
fi
|
||||
if test x$enable_pamuserpass = xyes
|
||||
then
|
||||
auth_cnt=`expr $auth_cnt + 1`
|
||||
auth_mech="PAM userpass"
|
||||
AUTHMOD_OBJ=verify_user_pam_userpass.lo
|
||||
AUTHMOD_LIB="-lpam -lpam_userpass"
|
||||
fi
|
||||
|
||||
if test $auth_cnt -gt 1
|
||||
then
|
||||
AC_MSG_ERROR([--enable-pam, --enable-bsd, --enable-pamuserpass and --enable-kerberos are mutually exclusive])
|
||||
fi
|
||||
|
||||
AC_SUBST([AUTHMOD_OBJ])
|
||||
AC_SUBST([AUTHMOD_LIB])
|
||||
AC_CHECK_HEADER([openssl/rc4.h], [],
|
||||
[AC_MSG_ERROR([please install libssl-dev or openssl-devel])],
|
||||
[#include <stdlib.h>])
|
||||
|
||||
# checking if pam should be autodetected.
|
||||
if test "x$enable_pam" = "xyes"
|
||||
if test -z "$enable_nopam"
|
||||
then
|
||||
if test -z "$enable_bsd"
|
||||
if test -z "$enable_kerberos"
|
||||
then
|
||||
AC_CHECK_HEADER([security/pam_appl.h], [],
|
||||
[AC_MSG_ERROR([please install libpam0g-dev or pam-devel])])
|
||||
fi
|
||||
if test "x$enable_pam_config" = "x"; then
|
||||
PAM_RULES="auto"
|
||||
else
|
||||
pam_config_file="$srcdir/instfiles/pam.d/xrdp-sesman.$enable_pam_config"
|
||||
if test -f "$pam_config_file"; then
|
||||
PAM_RULES="$enable_pam_config"
|
||||
else
|
||||
AC_MSG_ERROR([PAM file "$pam_config_file" is not available])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(PAM_RULES)
|
||||
|
||||
# Add define for development options to config_ac.h
|
||||
AC_DEFINE([CONFIG_AC_H],1, [Allow sources to check config_ac.h is included])
|
||||
if test x$devel_logging = xyes
|
||||
then
|
||||
AC_DEFINE([USE_DEVEL_LOGGING],1,[Enable development logging])
|
||||
fi
|
||||
|
||||
if test x$devel_streamcheck = xyes
|
||||
then
|
||||
AC_DEFINE([USE_DEVEL_STREAMCHECK],1,[Enable development stream checking])
|
||||
fi
|
||||
|
||||
if test "x$enable_vsock" = "xyes"
|
||||
then
|
||||
enable_vsock=yes
|
||||
if test "x$freebsd" = "xyes"
|
||||
then
|
||||
# Determine if we have AF_HYPERV defined (FreeBSD 13+)
|
||||
AC_CHECK_DECL([AF_HYPERV], [AC_DEFINE([XRDP_ENABLE_VSOCK], 1, [Enable AF_HYPERV])], [], [#include <sys/socket.h>])
|
||||
else
|
||||
AC_CHECK_HEADERS([linux/socket.h linux/vm_sockets.h],
|
||||
[AC_DEFINE([XRDP_ENABLE_VSOCK], 1, [Enable AF_VSOCK])],
|
||||
[],
|
||||
[#include <sys/socket.h>])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$enable_ipv6only" = "xyes"
|
||||
then
|
||||
enable_ipv6=yes
|
||||
AC_DEFINE([XRDP_ENABLE_IPV6ONLY],1,[Enable IPv6 only])
|
||||
fi
|
||||
|
||||
if test "x$enable_ipv6" = "xyes"
|
||||
then
|
||||
AC_DEFINE([XRDP_ENABLE_IPV6],1,[Enable IPv6])
|
||||
fi
|
||||
|
||||
AS_IF( [test "x$enable_neutrinordp" = "xyes"] , [PKG_CHECK_MODULES(FREERDP, freerdp >= 1.0.0)] )
|
||||
AS_IF( [test "x$enable_freerdp1" = "xyes"] , [PKG_CHECK_MODULES(FREERDP, freerdp >= 1.0.0)] )
|
||||
|
||||
# checking for libjpeg
|
||||
if test "x$enable_jpeg" = "xyes"
|
||||
if ! test -z "$enable_jpeg"
|
||||
then
|
||||
AC_CHECK_HEADER([jpeglib.h], [],
|
||||
[AC_MSG_ERROR([please install libjpeg-dev or libjpeg-devel])])
|
||||
fi
|
||||
|
||||
# checking for fuse
|
||||
if test "x$enable_fuse" = "xyes"
|
||||
# checking for libpulse libpulse-simple
|
||||
if ! test -z "$enable_simplesound"
|
||||
then
|
||||
PKG_CHECK_MODULES([FUSE], [fuse3 >= 3.1.0], [],
|
||||
[AC_MSG_ERROR([please install libfuse3-dev or fuse3-devel])])
|
||||
AC_CHECK_HEADER([pulse/simple.h], [],
|
||||
[AC_MSG_ERROR([please install libpulse-dev or libpulse-devel])])
|
||||
fi
|
||||
|
||||
# checking for fdk aac
|
||||
if test "x$enable_fdkaac" = "xyes"
|
||||
then
|
||||
PKG_CHECK_MODULES([FDKAAC], [fdk-aac >= 0.1.0], [],
|
||||
[AC_MSG_ERROR([please install libfdk-aac-dev or fdk-aac-devel])])
|
||||
fi
|
||||
|
||||
# checking for opus
|
||||
if test "x$enable_opus" = "xyes"
|
||||
then
|
||||
AC_CHECK_HEADER([opus/opus.h], [],
|
||||
[AC_MSG_ERROR([please install libopus-dev or opus-devel])])
|
||||
fi
|
||||
|
||||
# checking for lame mp3
|
||||
if test "x$enable_mp3lame" = "xyes"
|
||||
then
|
||||
AC_CHECK_HEADER([lame/lame.h], [],
|
||||
[AC_MSG_ERROR([please install libmp3lame-dev or lamemp3-devel])])
|
||||
fi
|
||||
|
||||
# checking for ibus includes
|
||||
if test "x$enable_ibus" = "xyes"
|
||||
then
|
||||
PKG_CHECK_MODULES([IBUS], [ibus-1.0 >= 1.5], [],
|
||||
[AC_MSG_ERROR([please install libibus-1.0-dev or ibus-devel])])
|
||||
|
||||
# ibus uses dbus which depends on glib
|
||||
PKG_CHECK_MODULES([GLIB2], [glib-2.0 >= 2.56], [],
|
||||
[AC_MSG_ERROR([please install libglib2.0-dev or glib2.0-devel])])
|
||||
fi
|
||||
|
||||
AS_IF( [test "x$enable_pixman" = "xyes"] , [PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.1.0)] )
|
||||
|
||||
AS_IF( [test "x$enable_x264" = "xyes"] , [PKG_CHECK_MODULES(XRDP_X264, x264 >= 0.3.0)] )
|
||||
|
||||
# checking for TurboJPEG
|
||||
if test "x$enable_tjpeg" = "xyes"
|
||||
then
|
||||
if test ! -z "$TURBOJPEG_PATH"
|
||||
then
|
||||
# env var TURBOJPEG_PATH has been defined, use that
|
||||
AC_CHECK_HEADER([$TURBOJPEG_PATH/include/turbojpeg.h], [],
|
||||
[AC_MSG_ERROR([could not find TurboJPEG in dir specified by env variable TURBOJPEG_PATH ($TURBOJPEG_PATH)])])
|
||||
|
||||
AC_SUBST(TurboJpegIncDir, ["-I$TURBOJPEG_PATH/include"])
|
||||
AC_SUBST(TurboJpegLibDir, ["-L$TURBOJPEG_PATH/lib -Wl,-rpath -Wl,$TURBOJPEG_PATH/lib"])
|
||||
elif test -e /opt/libjpeg-turbo/lib64
|
||||
then
|
||||
# TurboJPEG has been installed to /opt on a 64 bit m/c
|
||||
AC_SUBST(TurboJpegIncDir, ["-I/opt/libjpeg-turbo/include"])
|
||||
AC_SUBST(TurboJpegLibDir, ["-L/opt/libjpeg-turbo/lib64 -Wl,-rpath -Wl,/opt/libjpeg-turbo/lib64"])
|
||||
elif test -e /opt/libjpeg-turbo/lib32
|
||||
then
|
||||
# TurboJPEG has been installed to /opt on a 32 bit m/c
|
||||
AC_SUBST(TurboJpegIncDir, ["-I/opt/libjpeg-turbo/include"])
|
||||
AC_SUBST(TurboJpegLibDir, ["-L/opt/libjpeg-turbo/lib32 -Wl,-rpath -Wl,/opt/libjpeg-turbo/lib32"])
|
||||
else
|
||||
# check in default location
|
||||
AC_CHECK_HEADER([/usr/include/turbojpeg.h], [],
|
||||
[AC_MSG_ERROR([please install TurboJPEG ])])
|
||||
AC_SUBST(TurboJpegIncDir, [""])
|
||||
AC_SUBST(TurboJpegLibDir, [""])
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_PATH_XTRA
|
||||
if test "x$no_x" == "xyes"; then
|
||||
AC_MSG_ERROR([please install libx11-dev or libX11-devel])
|
||||
fi
|
||||
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $X_CFLAGS"
|
||||
|
||||
# checking for Xfixes
|
||||
# checking for Xlib, Xfixes
|
||||
AC_CHECK_HEADER([X11/Xlib.h], [],
|
||||
[AC_MSG_ERROR([please install libx11-dev or libX11-devel])])
|
||||
AC_CHECK_HEADER([X11/extensions/Xfixes.h], [],
|
||||
[AC_MSG_ERROR([please install libxfixes-dev or libXfixes-devel])],
|
||||
[AC_MSG_ERROR([please install libx11-dev and libxfixes-dev or libXfixes-devel])],
|
||||
[#include <X11/Xlib.h>])
|
||||
|
||||
# checking for Xrandr
|
||||
AC_CHECK_HEADER([X11/extensions/Xrandr.h], [],
|
||||
[AC_MSG_ERROR([please install libxrandr-dev or libXrandr-devel])],
|
||||
[#include <X11/Xlib.h>])
|
||||
|
||||
# checking for XKB
|
||||
AC_CHECK_HEADER([X11/extensions/XKBrules.h], [],
|
||||
[AC_MSG_ERROR([please install libxkbfile-dev or libxkbfile-devel])],
|
||||
[#include <X11/Xlib.h>
|
||||
#include <X11/XKBlib.h>
|
||||
#include <stdio.h>])
|
||||
|
||||
if test "x$enable_utmp" = "xyes"
|
||||
then
|
||||
AC_CHECK_HEADERS(utmp.h utmpx.h)
|
||||
|
||||
# Test for non-standard extensions in struct utmpx
|
||||
AXRDP_CHECK_UTMPX_MEMBER_EXISTS([ut_host], [HAVE_UTMPX_UT_HOST])
|
||||
AXRDP_CHECK_UTMPX_MEMBER_EXISTS([ut_exit], [HAVE_UTMPX_UT_EXIT])
|
||||
libdir="${libdir}/xrdp";
|
||||
if test "x${prefix}" = "xNONE" ; then
|
||||
sysconfdir="/etc";
|
||||
localstatedir="/var";
|
||||
fi
|
||||
|
||||
CFLAGS="$save_CFLAGS"
|
||||
|
||||
# perform unit tests if libcheck and libmocka found
|
||||
perform_unit_tests=yes; # Assume packages will be found
|
||||
if test "x$ensure_tests_deps" == "xyes"; then
|
||||
PKG_CHECK_MODULES([CHECK], [check >= 0.10.0],
|
||||
[],
|
||||
[AC_MSG_ERROR([please install check, the unit test framework])])
|
||||
# Check if cmocka is available - needed for unit testing
|
||||
PKG_CHECK_MODULES([CMOCKA], [cmocka],
|
||||
[],
|
||||
[AC_MSG_ERROR([please install cmocka, the mocking framework])])
|
||||
else
|
||||
PKG_CHECK_MODULES([CHECK], [check >= 0.10.0],
|
||||
[],
|
||||
[perform_unit_tests=no])
|
||||
PKG_CHECK_MODULES([CMOCKA], [cmocka],
|
||||
[],
|
||||
[perform_unit_tests=no])
|
||||
fi
|
||||
|
||||
if test "x$perform_unit_tests" == "xyes"; then
|
||||
AC_MSG_NOTICE([libcheck found, unit tests will be performed])
|
||||
else
|
||||
AC_MSG_NOTICE([libcheck not found, unit tests will be skipped])
|
||||
fi
|
||||
# -- end perform unit tests
|
||||
|
||||
AC_SUBST([moduledir], '${libdir}/xrdp')
|
||||
|
||||
AC_ARG_ENABLE([strict-locations],
|
||||
[AS_HELP_STRING([--enable-strict-locations],
|
||||
[Use standard Autoconf install directories unless overridden
|
||||
(default: use /etc and /var)])],
|
||||
[], [enable_strict_locations=no])
|
||||
|
||||
if test "x$enable_strict_locations" != "xyes"; then
|
||||
sysconfdir="/etc";
|
||||
localstatedir="/var";
|
||||
fi
|
||||
|
||||
AC_ARG_WITH([pamconfdir],
|
||||
[AS_HELP_STRING([--with-pamconfdir=DIR],
|
||||
[Use directory for pam.d config (default: /etc/pam.d)])],
|
||||
[], [with_pamconfdir="$sysconfdir/pam.d"])
|
||||
AC_SUBST([pamconfdir], [$with_pamconfdir])
|
||||
|
||||
PKG_INSTALLDIR
|
||||
|
||||
AC_CHECK_HEADERS([sys/prctl.h uchar.h])
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
AC_CONFIG_FILES([Makefile
|
||||
common/Makefile
|
||||
vnc/Makefile
|
||||
rdp/Makefile
|
||||
libxrdp/Makefile
|
||||
xup/Makefile
|
||||
mc/Makefile
|
||||
freerdp1/Makefile
|
||||
xrdp/Makefile
|
||||
sesman/Makefile
|
||||
sesman/libscp/Makefile
|
||||
sesman/tools/Makefile
|
||||
sesman/sessvc/Makefile
|
||||
sesman/chansrv/Makefile
|
||||
keygen/Makefile
|
||||
docs/Makefile
|
||||
docs/man/Makefile
|
||||
fontutils/Makefile
|
||||
genkeymap/Makefile
|
||||
instfiles/default/Makefile
|
||||
instfiles/init.d/Makefile
|
||||
instfiles/Makefile
|
||||
instfiles/pam.d/Makefile
|
||||
instfiles/pulse/Makefile
|
||||
instfiles/rc.d/Makefile
|
||||
keygen/Makefile
|
||||
waitforx/Makefile
|
||||
libipm/Makefile
|
||||
libxrdp/Makefile
|
||||
Makefile
|
||||
mc/Makefile
|
||||
neutrinordp/Makefile
|
||||
ulalaca/Makefile
|
||||
pkgconfig/Makefile
|
||||
pkgconfig/xrdp.pc
|
||||
pkgconfig/xrdp-uninstalled.pc
|
||||
sesman/libsesman/Makefile
|
||||
sesman/chansrv/Makefile
|
||||
sesman/Makefile
|
||||
sesman/sesexec/Makefile
|
||||
sesman/tools/Makefile
|
||||
tests/Makefile
|
||||
tests/common/Makefile
|
||||
tests/libipm/Makefile
|
||||
tests/libxrdp/Makefile
|
||||
tests/memtest/Makefile
|
||||
tests/xrdp/Makefile
|
||||
tools/Makefile
|
||||
tools/devel/Makefile
|
||||
tools/devel/tcp_proxy/Makefile
|
||||
tools/chkpriv/Makefile
|
||||
vnc/Makefile
|
||||
genkeymap/Makefile
|
||||
xrdpapi/Makefile
|
||||
xrdp/Makefile
|
||||
xrdpvr/Makefile
|
||||
xup/Makefile
|
||||
third_party/Makefile
|
||||
third_party/tomlc99/Makefile
|
||||
])
|
||||
|
||||
AC_REQUIRE_AUX_FILE([tap-driver.sh])
|
||||
# fontdump/Makefile
|
||||
# xrdp/cursors/Makefile
|
||||
# Xserver/hw/rdp/Makefile
|
||||
AC_OUTPUT
|
||||
|
||||
echo ""
|
||||
echo "xrdp will be compiled with:"
|
||||
echo ""
|
||||
echo " mp3lame $enable_mp3lame"
|
||||
echo " opus $enable_opus"
|
||||
echo " fdkaac $enable_fdkaac"
|
||||
echo " jpeg $enable_jpeg"
|
||||
echo " turbo jpeg $enable_tjpeg"
|
||||
echo " rfxcodec $enable_rfxcodec"
|
||||
echo " x264 $enable_x264"
|
||||
echo " painter $enable_painter"
|
||||
echo " pixman $enable_pixman"
|
||||
echo " fuse $enable_fuse"
|
||||
echo " ipv6 $enable_ipv6"
|
||||
echo " ipv6only $enable_ipv6only"
|
||||
echo " vsock $enable_vsock"
|
||||
echo " ibus $enable_ibus"
|
||||
echo " auth mechanism $auth_mech"
|
||||
echo " rdpsndaudin $enable_rdpsndaudin"
|
||||
echo " utmp support $enable_utmp"
|
||||
if test x$enable_utmp = xyes; then
|
||||
echo " utmpx.ut_host $ac_cv_utmpx_has_ut_host"
|
||||
echo " utmpx.ut_exit $ac_cv_utmpx_has_ut_exit"
|
||||
fi
|
||||
|
||||
echo
|
||||
echo " with imlib2 $use_imlib2"
|
||||
echo " with freetype2 $use_freetype2"
|
||||
|
||||
echo
|
||||
echo " development logging $devel_logging"
|
||||
echo " development streamcheck $devel_streamcheck"
|
||||
echo ""
|
||||
echo " strict_locations $enable_strict_locations"
|
||||
echo " prefix $prefix"
|
||||
echo " exec_prefix $exec_prefix"
|
||||
echo " libdir $libdir"
|
||||
echo " bindir $bindir"
|
||||
echo " sysconfdir $sysconfdir"
|
||||
echo " pamconfdir $pamconfdir"
|
||||
echo " localstatedir $localstatedir"
|
||||
echo " runstatedir $runstatedir"
|
||||
echo " socketdir $socketdir"
|
||||
echo ""
|
||||
echo " unit tests performable $perform_unit_tests"
|
||||
echo ""
|
||||
echo " CFLAGS = $CFLAGS"
|
||||
echo " LDFLAGS = $LDFLAGS"
|
||||
|
||||
# xrdp_configure_options.h will be written to the build directory, not the source directory
|
||||
echo '#define XRDP_CONFIGURE_OPTIONS \' > ./xrdp_configure_options.h
|
||||
./config.status --config | xargs -n 1 | sed -e 's/^/" /' -e 's/$/\\n" \\/' >> ./xrdp_configure_options.h
|
||||
echo '""' >> ./xrdp_configure_options.h
|
||||
# example of how to check for a struct in a header
|
||||
#AC_CHECK_MEMBER([struct in6_addr.s6_addr],
|
||||
# [],
|
||||
# [AC_DEFINE(NO_ARPA_INET_H_IP6, 1, [for IPv6])],
|
||||
# [#include <arpa/inet.h>])
|
||||
|
35
design.txt
Normal file
35
design.txt
Normal file
@ -0,0 +1,35 @@
|
||||
|
||||
This document is intended to explain xrdp server design.
|
||||
|
||||
Many connections, all capable of running different modules
|
||||
one connection could be using a vnc connection
|
||||
one could be running a custom app made for xrdp
|
||||
one could be running a X11 session
|
||||
clients control the screen size and color depth
|
||||
|
||||
all controlled by a configuration file.
|
||||
|
||||
you can create a lib or use a lib with your executable that talks
|
||||
to xrdp server.
|
||||
|
||||
------ ----------
|
||||
-xrdp---linked-------mylib.so- session 1
|
||||
------ ----------
|
||||
|
|
||||
| -------------------------
|
||||
|----unix socket--myapp linked to libxrdp- session 2
|
||||
| -------------------------
|
||||
|
|
||||
| -----------
|
||||
|----linked-------mylib2.so- session 3
|
||||
-----------
|
||||
|
||||
Any of the above sessions can repeat or have different session
|
||||
numbers or not even be used.
|
||||
If a session is disconnected, all that changes is the rdp connection
|
||||
is lost, the session remains.
|
||||
|
||||
For X11, start the XServer after the user is
|
||||
authenticated. First check for the next available X11 display,
|
||||
create a user session, start the XServer and set the DISPLAY enviromenet
|
||||
variable.
|
1
docs/man/.gitignore
vendored
1
docs/man/.gitignore
vendored
@ -1 +0,0 @@
|
||||
*.[1-8]
|
@ -1,40 +1,14 @@
|
||||
man_MANS = \
|
||||
xrdp-dis.1 \
|
||||
EXTRA_DIST = sesman.ini.5 xrdp.ini.5 xrdp.8 xrdp-sesman.8 xrdp-sesrun.8
|
||||
|
||||
xrdpman5dir=$(mandir)/man5
|
||||
|
||||
xrdpman5_DATA = \
|
||||
sesman.ini.5 \
|
||||
xrdp.ini.5 \
|
||||
xrdp-km.toml.5 \
|
||||
xrdp.ini.5
|
||||
|
||||
xrdpman8dir=$(mandir)/man8
|
||||
|
||||
xrdpman8_DATA = \
|
||||
xrdp.8 \
|
||||
xrdp-chansrv.8 \
|
||||
xrdp-genkeymap.8 \
|
||||
xrdp-keygen.8 \
|
||||
xrdp-sesadmin.8 \
|
||||
xrdp-sesman.8 \
|
||||
xrdp-sesrun.8 \
|
||||
xrdp-dumpfv1.8
|
||||
|
||||
EXTRA_DIST = xrdp-mkfv1.8.in $(man_MANS:=.in)
|
||||
|
||||
if USE_FREETYPE2
|
||||
man_MANS += xrdp-mkfv1.8
|
||||
endif
|
||||
|
||||
SUBST_VARS = sed \
|
||||
-e 's|@PACKAGE_VERSION[@]|$(PACKAGE_VERSION)|g' \
|
||||
-e 's|@bindir[@]|$(bindir)|g' \
|
||||
-e 's|@sbindir[@]|$(sbindir)|g' \
|
||||
-e 's|@localstatedir[@]|$(localstatedir)|g' \
|
||||
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
|
||||
-e 's|@socketdir[@]|$(socketdir)|g' \
|
||||
-e 's|@xrdpconfdir[@]|$(sysconfdir)/xrdp|g' \
|
||||
-e 's|@xrdpdatadir[@]|$(datadir)/xrdp|g' \
|
||||
-e 's|@xrdphomeurl[@]|http://www.xrdp.org/|g'
|
||||
|
||||
subst_verbose = $(subst_verbose_@AM_V@)
|
||||
subst_verbose_ = $(subst_verbose_@AM_DEFAULT_V@)
|
||||
subst_verbose_0 = @echo " SUBST $@";
|
||||
|
||||
SUFFIXES = .in
|
||||
.in:
|
||||
$(subst_verbose)$(SUBST_VARS) $< > $@
|
||||
|
||||
CLEANFILES = $(man_MANS)
|
||||
xrdp-sesrun.8
|
||||
|
224
docs/man/sesman.ini.5
Normal file
224
docs/man/sesman.ini.5
Normal file
@ -0,0 +1,224 @@
|
||||
.\"
|
||||
.TH "sesman.ini" "5" "0.1.0" "xrdp team" ""
|
||||
.SH "NAME"
|
||||
.LP
|
||||
\fBsesman.ini\fR \- Configuration file for \fBsesman\fR(8)
|
||||
.SH "DESCRIPTION"
|
||||
.LP
|
||||
This is the man page for \fBsesman.ini\fR, \fBsesman\fR(8) configuration file.
|
||||
It is composed by a number of sections, each one composed by a section name, enclosed by square brackets, folowed by a list of \fI<parameter>\fR=\fI<value>\fR lines.
|
||||
|
||||
\fBsesman.ini\fR supports the following sections:
|
||||
|
||||
.TP
|
||||
\fB[Globals]\fR \- sesman global configuration section,
|
||||
|
||||
.TP
|
||||
\fB[Logging]\fR \- logging subsystem parameters
|
||||
|
||||
.TP
|
||||
\fB[Security]\fR \- Access control parameters
|
||||
|
||||
.TP
|
||||
\fB[Sessions]\fR \- Session management parameters
|
||||
|
||||
.LP
|
||||
All options and values (except for file names and paths) are case insensitive, and are described in detail below.
|
||||
|
||||
.LP
|
||||
For any of the following parameter, if it's specified more than one time the last entry encountered will be used.
|
||||
|
||||
\fBNOTE\fR: if any of these options is specified outside its section, it will be \fIignored\fR.
|
||||
.SH "GLOBALS"
|
||||
.LP
|
||||
|
||||
.TP
|
||||
The options to be specified in the \fB[globals]\fR section are the following:
|
||||
.br
|
||||
|
||||
.TP
|
||||
\fBListenAddress\fR=\fIip address\fR
|
||||
Specifies sesman listening address. Default is 0.0.0.0 (all interfaces)
|
||||
.br
|
||||
|
||||
.TP
|
||||
\fBListenPort\fR=\fIport number\fR
|
||||
Specifies sesman listening port. Default is 3350
|
||||
.br
|
||||
|
||||
.TP
|
||||
\fBEnableUserWindowManager\fR=\fI[0|1]\fR
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR this option enables user specific window manager, that is, anyone can define it's own script executed by sesman when starting a new session, specified by \fBUserWindowManager\fR
|
||||
.br
|
||||
|
||||
.TP
|
||||
\fBUserWindowManager\fR=\fIstartwm.sh\fR
|
||||
This option specifies the script run by sesman when starting a session and per\-user window manager is enabled.
|
||||
.br
|
||||
The path is relative to user's HOME directory
|
||||
.br
|
||||
|
||||
.TP
|
||||
\fBDefaultWindowManager\fR=\fI${SESMAN_BIN_DIR}/startwm.sh\fR
|
||||
This contains full path to the default window manager startup script used by sesman to start a session
|
||||
.SH "LOGGING"
|
||||
.LP
|
||||
|
||||
.TP
|
||||
The following parameters can be used in the \fB[logging]\fR section:
|
||||
.br
|
||||
|
||||
.TP
|
||||
\fBLogFile\fR=\fI${SESMAN_LOG_DIR}/sesman.log\fR
|
||||
This options contains the path to logfile. It can be either absolute or relative, and the default is \fI${SESMAN_LOG_DIR}/sesman.log\fR
|
||||
.br
|
||||
|
||||
.TP
|
||||
\fBLogLevel\fR=\fIlevel\fR
|
||||
This option can have one of the following values:
|
||||
|
||||
\fBCORE\fR or \fB0\fR \- Log only core messages. these messages are _always_ logged, regardless the logging level selected.
|
||||
|
||||
\fBERROR\fR or \fB1\fR \- Log only error messages
|
||||
|
||||
\fBWARNING\fR, \fBWARN\fR or \fB2\fR \- Logs warnings and error messages
|
||||
|
||||
\fBINFO\fR or \fB3\fR \- Logs errors, warnings and informational messages
|
||||
|
||||
\fBDEBUG\fR or \fB4\fR \- Log everything. If \fBsesman\fR is compiled in debug mode, this options will output many more low\-level message, useful for developers
|
||||
.br
|
||||
|
||||
.TP
|
||||
\fBEnableSyslog\fR=\fI[0|1]\fR
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR this option enables logging to syslog. Otherwise syslog is disabled.
|
||||
.br
|
||||
|
||||
.TP
|
||||
\fBSyslogLevel\fR=\fIlevel\fR
|
||||
This option sets the logging level for syslog. It can have the same values of \fBLogLevel\fR. If \fBSyslogLevel\fR is greater than \fBLogLevel\fR, its value is lowered to that of \fBLogLevel\fR.
|
||||
.SH "SESSIONS"
|
||||
.LP
|
||||
|
||||
.TP
|
||||
The following parameters can be used in the \fB[Sessions]\fR section:
|
||||
.br
|
||||
|
||||
.TP
|
||||
\fBX11DisplayOffset\fR=\fI<number>\fR
|
||||
Specifies the first X display number available for sesman(8). This prevents sesman from interfering with real X11 servers. The default is 10.
|
||||
.br
|
||||
|
||||
.TP
|
||||
\fBMaxSessions\fR=\fI<number>\fR
|
||||
Sets the maximum number of simultaneous session on terminal server.
|
||||
.br
|
||||
If unset or set to \fI0\fR, unlimited session are allowed.
|
||||
.br
|
||||
|
||||
.TP
|
||||
\fBKillDisconnected\fR=\fI[0|1]\fR
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR, every session will be killed when the user disconnects.
|
||||
.br
|
||||
\fI\-this option is currently ignored!\-\fR
|
||||
.br
|
||||
|
||||
.TP
|
||||
\fBIdleTimeLimit\fR=\fI<number>\fR
|
||||
Sets the the time limit before an idle session is disconnected.
|
||||
.br
|
||||
If set to \fI0\fR, automatic disconnection is disabled.
|
||||
.br
|
||||
\fI\-this option is currently ignored!\-\fR
|
||||
.br
|
||||
|
||||
.TP
|
||||
\fBDisconnectedTimeLimit\fR=\fI<number>\fR
|
||||
Sets the the time limit before a disconnected session is killed.
|
||||
.br
|
||||
If set to \fI0\fR, automatic killing is disabled.
|
||||
.br
|
||||
\fI\-this option is currently ignored!\-\fR
|
||||
.br
|
||||
.SH "SECURITY"
|
||||
.LP
|
||||
|
||||
.TP
|
||||
The following parameters can be used in the \fB[Sessions]\fR section:
|
||||
.br
|
||||
|
||||
.TP
|
||||
\fBAllowRootLogin\fR=\fI[0|1]\fR
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR enables root login on the terminal server
|
||||
.br
|
||||
|
||||
.TP
|
||||
\fBMaxLoginRetry\fR=\fI[0|1]\fR
|
||||
The number of login attempts that are allowed on terminal server. If set to \fI0\fR, unlimited attempts are allowed. The default value for this field is \fI3\fR.
|
||||
.br
|
||||
|
||||
.TP
|
||||
\fBTerminalServerUsers\fR=\fItsusers\fR
|
||||
Only the users belonging to the group \fItsusers\fR are allowed to login on terminal server.
|
||||
.br
|
||||
If unset or set to an invalid or non\-existent group, login for all users is enabled.
|
||||
.br
|
||||
|
||||
.TP
|
||||
\fBTerminalServerAdmins\fR=\fItsadmins\fR
|
||||
Sets the group which a user shall belong to have session management rights.
|
||||
.br
|
||||
\fI\-this option is currently ignored!\-\fR
|
||||
.br
|
||||
.SH "EXAMPLES"
|
||||
.LP
|
||||
This is an example \fBsesman.ini\fR:
|
||||
|
||||
[Globals]
|
||||
.br
|
||||
ListenAddress=127.0.0.1
|
||||
.br
|
||||
ListenPort=3350
|
||||
.br
|
||||
EnableUserWindowManager=1
|
||||
.br
|
||||
UserWindowManager=startwm.sh
|
||||
.br
|
||||
DefaultWindowManager=startwm.sh
|
||||
|
||||
[Logging]
|
||||
.br
|
||||
LogFile=/usr/local/xrdp/sesman.log
|
||||
.br
|
||||
LogLevel=DEBUG
|
||||
.br
|
||||
EnableSyslog=0
|
||||
.br
|
||||
SyslogLevel=DEBUG
|
||||
|
||||
[Sessions]
|
||||
.br
|
||||
MaxSessions=10
|
||||
.br
|
||||
KillDisconnected=0
|
||||
.br
|
||||
IdleTimeLimit=0
|
||||
.br
|
||||
DisconnectedTimeLimit=0
|
||||
|
||||
[Security]
|
||||
.br
|
||||
AllowRootLogin=1
|
||||
.br
|
||||
MaxLoginRetry=3
|
||||
.br
|
||||
TerminalServerUsers=tsusers
|
||||
.br
|
||||
TerminalServerAdmins=tsadmins
|
||||
.SH "FILES"
|
||||
.LP
|
||||
${SESMAN_CFG_DIR}/sesman.ini
|
||||
.SH "SEE ALSO"
|
||||
.LP
|
||||
sesman(8) sesrun(8) xrdp(8) xrdp.ini(5)
|
||||
|
||||
for more info on \fBxrdp\fR see http://xrdp.sf.net
|
@ -1,427 +0,0 @@
|
||||
.\"
|
||||
.TH "sesman.ini" "5" "@PACKAGE_VERSION@" "xrdp team" ""
|
||||
.SH "NAME"
|
||||
\fBsesman.ini\fR \- Configuration file for \fBxrdp-sesman\fR(8)
|
||||
|
||||
.SH "DESCRIPTION"
|
||||
\fBsesman.ini\fR consists of several sections. Each section starts with
|
||||
the section name in square brackets, followed by a list of
|
||||
\fIparameter\fR=\fIvalue\fR lines. Following sections are recognized:
|
||||
|
||||
.TP
|
||||
\fB[Globals]\fR
|
||||
Global configuration
|
||||
|
||||
.TP
|
||||
\fB[Logging]\fR
|
||||
Logging subsystem
|
||||
|
||||
.TP
|
||||
\fB[Sessions]\fR
|
||||
Session management
|
||||
|
||||
.TP
|
||||
\fB[Security]\fR
|
||||
Access control
|
||||
|
||||
.TP
|
||||
\fB[Chansrv]\fR
|
||||
Settings for xrdp-chansrv(8)
|
||||
|
||||
.TP
|
||||
\fB[ChansrvLogging]\fR
|
||||
Logging settings for xrdp-chansrv(8)
|
||||
|
||||
.TP
|
||||
\fB[SessionVariables]\fR
|
||||
Environment variables for the session
|
||||
|
||||
.LP
|
||||
All parameters and values (except for file names and paths) are case
|
||||
insensitive, and are described in detail below. If any parameter is
|
||||
specified more than once, the last entry will be used. Options specified
|
||||
outside their proper section will be \fIignored\fR.
|
||||
|
||||
.SH "GLOBALS"
|
||||
Following parameters can be used in the \fB[Globals]\fR section.
|
||||
|
||||
.TP
|
||||
\fBListenPort\fR=\fIpath-to-socket\fR
|
||||
UNIX domain socket for xrdp-sesman(8) to listen on.
|
||||
.PP
|
||||
.RS
|
||||
The default value of this setting is 'sesman.socket'.
|
||||
.PP
|
||||
An absolute path can be specified by starting this parameter with a '/'.
|
||||
In this instance, the system administrator is responsible for ensuring
|
||||
the socket can only be created by a suitably privileged process.
|
||||
.PP
|
||||
If the parameter does not start with a '/', a name within
|
||||
@socketdir@ is used.
|
||||
.RE
|
||||
|
||||
.TP
|
||||
\fBEnableUserWindowManager\fR=\fI[true|false]\fR
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR, this option enables user
|
||||
specific startup script. That is, xrdp-sesman will execute the script
|
||||
specified by \fBUserWindowManager\fR if it exists.
|
||||
|
||||
.TP
|
||||
\fBUserWindowManager\fR=\fIfilename\fR
|
||||
Path of the startup script relative to the user's home directory. If
|
||||
present and enabled by \fBEnableUserWindowManager\fR, that script is
|
||||
executed instead of \fBDefaultWindowManager\fR.
|
||||
|
||||
.TP
|
||||
\fBDefaultWindowManager\fR=\fIfilename\fR
|
||||
Full path or relative path of the default startup script used by xrdp-sesman
|
||||
to start a session. If the path is not a full path, it will be resolved as
|
||||
relative path to \fI@xrdpconfdir@\fR. If not specified, defaults to
|
||||
\fI@xrdpconfdir@/startwm.sh\fR.
|
||||
|
||||
.TP
|
||||
\fBReconnectScript\fR=\fIfilename\fR
|
||||
Full path or relative path if the script which executed when users reconnects
|
||||
to the existing session. If the path is not a full path, it will be resolved as
|
||||
relative path to \fI@xrdpconfdir@\fR. If not specified, defaults to
|
||||
\fI@xrdpconfdir@/reconnectwm.sh\fR.
|
||||
|
||||
.SH "LOGGING"
|
||||
Following parameters can be used in the \fB[Logging]\fR and \fB[ChansrvLogging]\fR
|
||||
sections.
|
||||
|
||||
.TP
|
||||
\fBLogFile\fR=\fIfilename\fR
|
||||
Log file path. It can be either absolute or relative. If not specified,
|
||||
defaults to \fI./sesman.log\fR. If set to \fB<stdout>\fR, log will go to
|
||||
stdout. Use for debugging only\fR
|
||||
|
||||
It is ignored in the [ChansrvLogging] section
|
||||
since the channel server creates one log file per display and instead uses the
|
||||
following log file naming convention \fIxrdp-chansrv.${DISPLAY}.log\fR
|
||||
|
||||
.TP
|
||||
\fBLogLevel\fR=\fIlevel\fR
|
||||
This option can have one of the following values:
|
||||
|
||||
\fBCORE\fR or \fB0\fR \- Log only core messages. Those messages are
|
||||
logged \fIregardless\fR of the selected logging level.
|
||||
|
||||
\fBERROR\fR or \fB1\fR \- Log only error messages.
|
||||
|
||||
\fBWARNING\fR, \fBWARN\fR or \fB2\fR \- Logs warnings and error messages.
|
||||
|
||||
\fBINFO\fR or \fB3\fR \- Log errors, warnings and informational messages.
|
||||
|
||||
\fBDEBUG\fR or \fB4\fR \- Log everything. If xrdp-sesman is compiled in
|
||||
debug mode, this options will output many more low\-level messages.
|
||||
|
||||
.TP
|
||||
\fBEnableSyslog\fR=\fI[true|false]\fR
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR, this option enables logging to
|
||||
syslog.
|
||||
|
||||
.TP
|
||||
\fBSyslogLevel\fR=\fIlevel\fR
|
||||
Logging level for syslog. It can have the same values as \fBLogLevel\fR.
|
||||
Defaults to \fBDEBUG\fR.
|
||||
|
||||
.TP
|
||||
\fBEnableConsole\fR=\fI[true|false]\fR
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR, this option enables logging to
|
||||
the console (ie. stdout).
|
||||
|
||||
.TP
|
||||
\fBConsoleLevel\fR=\fIlevel\fR
|
||||
Logging level for the console. It can have the same values as \fBLogLevel\fR.
|
||||
Defaults to \fBDEBUG\fR.
|
||||
|
||||
.TP
|
||||
\fBEnableProcessId\fR=\fI[true|false]\fR
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR, this option enables logging the
|
||||
process id in all log messages. Defaults to \fBfalse\fR.
|
||||
|
||||
.SH "SESSIONS"
|
||||
Following parameters can be used in the \fB[Sessions]\fR section.
|
||||
|
||||
.TP
|
||||
\fBX11DisplayOffset\fR=\fInumber\fR
|
||||
The first X display number available for xrdp-sesman. This prevents
|
||||
xrdp-sesman from interfering with real X11 servers. If not specified,
|
||||
defaults to \fI10\fR.
|
||||
|
||||
.TP
|
||||
\fBMaxSessions\fR=\fInumber\fR
|
||||
Sets the maximum number of simultaneous sessions. If not set or set to
|
||||
\fI0\fR, unlimited session are allowed.
|
||||
|
||||
.TP
|
||||
\fBMaxDisplayNumber\fR=\fInumber\fR
|
||||
Sets the maximum number which can be assigned to an X11 $DISPLAY. The
|
||||
default is compatible with IANA TCP port allocations. If you are not
|
||||
allowing TCP connections to your X servers you may safely increase this
|
||||
number.
|
||||
|
||||
.TP
|
||||
\fBKillDisconnected\fR=\fI[true|false]\fR
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR, every session will be killed
|
||||
within \fBDisconnectedTimeLimit\fR seconds after the user disconnects.
|
||||
This setting currently only works with xorgxrdp sessions.
|
||||
|
||||
.TP
|
||||
\fBDisconnectedTimeLimit\fR=\fInumber\fR
|
||||
Sets the time limit for \fBKillDisconnected\fR to a value greater than 60.
|
||||
Values less than 60 are to be overridden with 60.
|
||||
This setting currently only works with xorgxrdp sessions.
|
||||
|
||||
.TP
|
||||
\fBIdleTimeLimit\fR=\fInumber\fR
|
||||
Sets the time limit (in seconds) before an idle session is disconnected.
|
||||
Idle means no keyboard inputs and no mouse moves/clicks here.
|
||||
If set to \fI0\fR, idle sessions will never be disconnected by timeout.
|
||||
This works only with xorgxrdp sessions. Moreover, xorgxrdp must be v0.2.9 or later.
|
||||
|
||||
.TP
|
||||
\fBPolicy\fR=\fI[Default|Separate|{UBDI}]\fR
|
||||
Session allocation policy. Used to decide when to allocate a
|
||||
new session. Set to one of the following values:
|
||||
.br
|
||||
|
||||
.RS
|
||||
.HP 12
|
||||
\fBDefault\fR - Currently the same as "UB" for all session types
|
||||
.HP 12
|
||||
\fBSeparate\fR - All sessions are separate. Sessions can never be rejoined,
|
||||
and will need to be cleaned up manually, or automatically by setting other
|
||||
sesman options.
|
||||
.P
|
||||
Alternatively combine one-or-more of the following options
|
||||
.HP 4
|
||||
\fBU\fR - Sessions are separated per user
|
||||
.HP 4
|
||||
\fBB\fR - Sessions are separated by bits-per-pixel
|
||||
.HP 4
|
||||
\fBD\fR - Sessions are separated by initial display size
|
||||
.HP 4
|
||||
\fBI\fR - Sessions are separated by IP address
|
||||
.RE
|
||||
|
||||
.IP
|
||||
Note that the \fBU\fR and \fBB\fR criteria cannot be turned
|
||||
off. \fBDisplaySize\fR refers to the initial geometry of a connection,
|
||||
as actual display sizes can change dynamically.
|
||||
|
||||
.SH "SECURITY"
|
||||
Following parameters can be used in the \fB[Security]\fR section.
|
||||
|
||||
.TP
|
||||
\fBAllowRootLogin\fR=\fI[true|false]\fR
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR, enables root login on the
|
||||
terminal server.
|
||||
|
||||
.TP
|
||||
\fBMaxLoginRetry\fR=\fInumber\fR
|
||||
The number of login attempts that are allowed on terminal server. If set
|
||||
to \fI0\fR, unlimited attempts are allowed. If not specified, defaults to
|
||||
\fI3\fR.
|
||||
|
||||
.TP
|
||||
\fBTerminalServerUsers\fR=\fIgroup\fR
|
||||
Only the users belonging to the specified group are allowed to login on
|
||||
terminal server. If unset or set to an invalid or non\-existent group,
|
||||
login for all users is enabled.
|
||||
|
||||
.TP
|
||||
\fBTerminalServerAdmins\fR=\fIgroup\fR
|
||||
\fIThis option is currently ignored!\fR Only members of this group can
|
||||
have session management rights.
|
||||
|
||||
.TP
|
||||
\fBRestrictOutboundClipboard\fR=\fI[all|none|text|file|image]\fR
|
||||
If set to \fBall\fR, will restrict the clipboard
|
||||
outbound from the server, to prevent data copied inside the xrdp session
|
||||
to be pasted in the client. Default value is \fBnone\fR.
|
||||
In addition, you can control text/file/image transfer restrictions
|
||||
respectively. It also accepts comma separated list such as text,file,image.
|
||||
.br
|
||||
|
||||
.br
|
||||
\fBnone\fR - No restriction about copying inbound clipboard data.
|
||||
.br
|
||||
\fBall\fR - Restrict to copy inbound clipboard data.
|
||||
.br
|
||||
\fBtext\fR - Restrict to copy only inbound text clipboard data.
|
||||
.br
|
||||
\fBfile\fR - Restrict to copy only inbound file clipboard data.
|
||||
.br
|
||||
\fBimage\fR - Restrict to copy only inbound image clipboard data.
|
||||
.br
|
||||
|
||||
To keep compatibility, the following aliases are also available.
|
||||
.br
|
||||
\fBtrue\fR - an alias of \fBall\fR.
|
||||
.br
|
||||
\fBfalse\fR - an alias of \fBnone\fR.
|
||||
.br
|
||||
\fByes\fR - an alias of \fBall\fR.
|
||||
|
||||
.TP
|
||||
\fBRestrictInboundClipboard\fR=\fI[none|all|text|file|image]\fR
|
||||
If set to \fBall\fR, will restrict the clipboard
|
||||
inbound from the client, to prevent data copied inside the client
|
||||
to be pasted in the xrdp session. Default value is \fBnone\fR.
|
||||
In addition, you can control text/file/image transfer restrictions
|
||||
respectively. It also accepts comma separated list such as text,file,image.
|
||||
.br
|
||||
|
||||
.br
|
||||
\fBnone\fR - No restriction about copying inbound clipboard data.
|
||||
.br
|
||||
\fBall\fR - Restrict to copy inbound clipboard data.
|
||||
.br
|
||||
\fBtext\fR - Restrict to copy only inbound text clipboard data.
|
||||
.br
|
||||
\fBfile\fR - Restrict to copy only inbound file clipboard data.
|
||||
.br
|
||||
\fBimage\fR - Restrict to copy only inbound image clipboard data.
|
||||
.br
|
||||
|
||||
To keep compatibility, the following aliases are also available.
|
||||
.br
|
||||
\fBtrue\fR - an alias of \fBall\fR.
|
||||
.br
|
||||
\fBfalse\fR - an alias of \fBnone\fR.
|
||||
.br
|
||||
\fByes\fR - an alias of \fBall\fR.
|
||||
|
||||
.TP
|
||||
\fBAlwaysGroupCheck\fR=\fI[true|false]\fR
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR, require group membership even
|
||||
if the group specified in \fBTerminalServerUsers\fR doesn't exist.
|
||||
|
||||
.TP
|
||||
\fBAllowAlternateShell\fR=\fI[true|false]\fR
|
||||
If set to \fB0\fR, \fBfalse\fR or \fBno\fR, prevent usage of alternate shells by users.
|
||||
|
||||
.TP
|
||||
\fBXorgNoNewPrivileges\fR=\fI[true|false]\fR
|
||||
Only applicable on Linux. If set to \fB0\fR, \fBfalse\fR or \fBno\fR, do
|
||||
not use the kernel's \fIno_new_privs\fR restriction when invoking the Xorg
|
||||
X11 server. The use of \fIno_new_privs\fR is intended to prevent issues due
|
||||
to a setuid Xorg executable. However, if a kernel security module (such as
|
||||
AppArmor) is used to confine xrdp, \fIno_new_privs\fR may interfere with
|
||||
transitions between confinement domains.
|
||||
|
||||
.TP
|
||||
\fBSessionSockdirGroup\fR=\fIgroup\fR
|
||||
Sets the group owner of the directories containing session sockets. This
|
||||
MUST be the same as runtime_group in xrdp.ini, or xrdp will not
|
||||
be able to connect to any sessions.
|
||||
|
||||
.SH "X11 SERVER"
|
||||
Following parameters can be used in the \fB[Xvnc]\fR and
|
||||
\fB[Xorg]\fR sections.
|
||||
|
||||
.TP
|
||||
\fBparam\fR=\fIstring\fR
|
||||
Multiple \fIparam\fR lines are supported. This first line specifies the
|
||||
path to the X11 server executable. Following lines specify command line
|
||||
arguments passed to the X11 server.
|
||||
|
||||
.SH "CHANSRV"
|
||||
Following parameters can be used in the \fB[Chansrv]\fR section.
|
||||
|
||||
.TP
|
||||
\fBFuseMountName\fR=\fIstring\fR
|
||||
Directory for drive redirection.
|
||||
Created if it doesn't exist. If not specified, defaults to \fIxrdp_client\fR.
|
||||
If first character is not a '/', this is relative to $HOME.
|
||||
.P
|
||||
.RS
|
||||
The following substitutions are made in this string:-
|
||||
%U - Username
|
||||
%u - Numeric UID
|
||||
%d - Numeric display number (ex 10)
|
||||
%D - Display environment variable (ex :10.0)
|
||||
%% - Percent character
|
||||
.HP 3
|
||||
1) The directory path permissions MUST be configured correctly by
|
||||
the system administrator or the system itself - xrdp-chansrv will not
|
||||
do this for you (although it will create the final directories owned by
|
||||
the user).
|
||||
.HP 3
|
||||
2) The desktop may not automatically display a link for the redirected
|
||||
drive. To fix this, consult the docs for your chosen desktop.
|
||||
.RE
|
||||
|
||||
.TP
|
||||
\fBFuseDirectIO\fR=\fI[false|true]\fR
|
||||
Defaults to \fIfalse\fR. Set to \fItrue\fR to disable page caching in
|
||||
FUSE when opening files on a redirected drive. Direct I/O can impact
|
||||
the performance of file operations.
|
||||
|
||||
.TP
|
||||
\fBFileUmask\fR=\fImode\fR
|
||||
Additional umask to apply to files in the \fBFuseMountName\fR directory.
|
||||
The default value of 077 prevents other users on the system from reading
|
||||
files on your redirected drives. This may not be appropriate for all
|
||||
environments, and so you can change this value to allow other users to
|
||||
access your remote files if required.
|
||||
|
||||
.TP
|
||||
\fBEnableFuseMount\fR=\fI[true|false]\fR
|
||||
Defaults to \fItrue\fR.
|
||||
Set to \fIfalse\fR to disable xrdp-chansrv's use of the FUSE system
|
||||
feature, even if it has been built with this feature enabled.
|
||||
.P
|
||||
.RS
|
||||
Setting this value to \fIfalse\fR will disable the following application
|
||||
features:-
|
||||
.P
|
||||
- drive redirection
|
||||
.P
|
||||
- copying-and-pasting of files
|
||||
.RE
|
||||
.TP
|
||||
\fBUseNautilus3FlistFormat\fR=\fI[false|true]\fR
|
||||
Defaults to \fIfalse\fR.
|
||||
Set to \fItrue\fR to make file copy-paste compatible with Nautilus from
|
||||
GNOME 3 versions later than 3.29.92. Do not use this for any other reason.
|
||||
|
||||
This setting will be removed in a later version of xrdp, when GNOME 3 is
|
||||
no longer supported.
|
||||
|
||||
.TP
|
||||
\fBSoundNumSilentFramesAAC\fR=\fInumber\fR
|
||||
Sets the \fInumber\fR of silent frames which are sent to client before close
|
||||
message is sent, when AAC is selected. If set to 0, no silent frame is sent.
|
||||
If not specified, defaults to \fI4\fR.
|
||||
|
||||
.TP
|
||||
\fBSoundNumSilentFramesMP3\fR=\fInumber\fR
|
||||
Sets the \fInumber\fR of silent frames which are sent to client before close
|
||||
message is sent, when MP3 is selected. If set to 0, no silent frame is sent.
|
||||
If not specified, defaults to \fI2\fR.
|
||||
|
||||
.TP
|
||||
\fBSoundMsecDoNotSend\fR=\fInumber\fR
|
||||
Sets the duration(msec). Sound data is not send to client during \fInumber\fR
|
||||
millisecond(s) after close message is sent, when AAC/MP3 is selected.
|
||||
If set to 0, all the data is sent. If not specified, defaults to \fI1000\fR.
|
||||
|
||||
.SH "SESSIONS VARIABLES"
|
||||
All entries in the \fB[SessionVariables]\fR section are set as
|
||||
environment variables in the user's session.
|
||||
|
||||
.SH "FILES"
|
||||
@sysconfdir@/xrdp/sesman.ini
|
||||
|
||||
.SH "SEE ALSO"
|
||||
.BR xrdp-sesman (8),
|
||||
.BR xrdp-sesrun (8),
|
||||
.BR xrdp (8),
|
||||
.BR xrdp.ini (5)
|
||||
|
||||
For more info on \fBxrdp\fR see
|
||||
.UR @xrdphomeurl@
|
||||
.UE
|
@ -1,62 +0,0 @@
|
||||
.TH "xrdp\-chansrv" "8" "@PACKAGE_VERSION@" "xrdp team" ""
|
||||
.SH "NAME"
|
||||
\fBxrdp\-chansrv\fR \- \fBxrdp\fR channel server
|
||||
|
||||
.SH "SYNTAX"
|
||||
.B xrdp\-chansrv
|
||||
|
||||
.SH "DESCRIPTION"
|
||||
\fBxrdp\-chansrv\fR is the \fBxrdp\fR(8) channel server, which manages the Remote Desktop Protocol (RDP) sub-channels.
|
||||
.PP
|
||||
This program is only forked internally by \fBxrdp\-sesman\fP(8).
|
||||
.PP
|
||||
Currently \fBxrdp\-chansrv\fP knows about the following channels:
|
||||
.RS 8
|
||||
.TP
|
||||
.B cliprdr
|
||||
Clipboard Redirection
|
||||
.TP
|
||||
.B rdpsnd
|
||||
Remote Desktop Protocol Sound
|
||||
.TP
|
||||
.B rdpdr
|
||||
Remote Desktop Protocol Device Redirection
|
||||
.TP
|
||||
.B rail
|
||||
Remote Applications Integrated Locally
|
||||
.TP
|
||||
.B drdynvc
|
||||
Dynamic Virtual Channel
|
||||
.RE
|
||||
|
||||
.SH ENVIRONMENT
|
||||
.TP
|
||||
.I CHANSRV_LOG_PATH
|
||||
Path to the location where the log file is stored. If not specified,
|
||||
$\fBXDG_DATA_HOME/xrdp\fP or \fB$HOME/.local/share/xrdp\fP is used instead.
|
||||
.TP
|
||||
.I DISPLAY
|
||||
X11 display number. Must be specified.
|
||||
|
||||
.SH FILES
|
||||
.TP
|
||||
.I @sysconfdir@/xrdp/sesman.ini
|
||||
Contains some settings for this program.
|
||||
.TP
|
||||
.I @socketdir@/xrdp_chansrv_socket_*
|
||||
UNIX socket used by external programs to implement channels.
|
||||
.TP
|
||||
.I @socketdir@/xrdp_api_*
|
||||
UNIX socket used by \fBxrdp\-chansrv\fP to communicate with \fBxrdp\-sesman\fP.
|
||||
.TP
|
||||
.I xrdp-chansrv.%s.log
|
||||
Log file used by \fBxrdp\-chansrv\fP(8). \fB%s\fP is display number. See the
|
||||
description of \fBCHANSRV_LOG_PATH\fP above for the file's location.
|
||||
|
||||
.SH "SEE ALSO"
|
||||
.BR xrdp\-sesman (8),
|
||||
.BR sesman.ini (5).
|
||||
|
||||
For more info on \fBxrdp\fR see
|
||||
.UR @xrdphomeurl@
|
||||
.UE
|
@ -1,27 +0,0 @@
|
||||
.TH "xrdp-dis" "1" "@PACKAGE_VERSION@" "xrdp team"
|
||||
.SH NAME
|
||||
xrdp\-dis \- xrdp disconnect utility
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B xrdp\-dis
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
\fBxrdp\-dis\fP is run with no parameters to disconnect your xrdp session.
|
||||
|
||||
.SH ENVIRONMENT
|
||||
.TP
|
||||
.B DISPLAY
|
||||
to get the default host and display number.
|
||||
|
||||
.SH FILES
|
||||
.TP
|
||||
.I @socketdir@/xrdp_disconnect_display_*
|
||||
UNIX socket used to communicate the disconnect request to xorgxrdp.
|
||||
|
||||
.SH KNOWN ISSUES
|
||||
.TP
|
||||
This utility doesn't support disconnecting Xvnc sessions so far.
|
||||
|
||||
.SH SEE ALSO
|
||||
.BR xrdp (8).
|
@ -1,58 +0,0 @@
|
||||
.TH "xrdp-dumpfv1" "8" "@PACKAGE_VERSION@" "xrdp team"
|
||||
.SH NAME
|
||||
xrdp\-dumpfv1 \- Display content of .fv1 font files
|
||||
|
||||
.SH SYNOPSIS
|
||||
\fBxrdp-dumpfv1\fR [ options ] fv1_file
|
||||
|
||||
.SH DESCRIPTION
|
||||
\fBxrdp\-dumpfv1\fP can be used to display the contents of an fv1 file.
|
||||
|
||||
.SH OPTIONS
|
||||
A summary of options is included below.
|
||||
|
||||
One of \fB\-i\fR, \fB\-t\fR, or \fB\-c\fR must be specified.
|
||||
.TP
|
||||
\fB\-i\fR
|
||||
Displays general information about the fv1 file.
|
||||
|
||||
.TP
|
||||
\fB\-t\fR
|
||||
Displays a CSV table of all the glyphs in the font. This table can be
|
||||
imported into a spreadsheet program for further manipulation.
|
||||
|
||||
.TP
|
||||
\fB\-c\fR <character>
|
||||
Displays detailed information about a particular glyph in the font,
|
||||
including a representation of the bitmap for the glyph.
|
||||
|
||||
Specify the character using one of the following strings:
|
||||
|
||||
\fBU+<hex>\fR - Unicode character, e.g. \fBU+25\fR for a percentage symbol (%).
|
||||
|
||||
\fB@<char>\fR - Unicode character, e.g. \fB@%\fR for a percentage symbol.
|
||||
|
||||
\fBnumber\fR - Unicode value as an integer, e.g. \fB37\fR for a
|
||||
percentage symbol
|
||||
|
||||
Note that the row numbers shown in the font data are relative to the
|
||||
natural font baseline. If comparing two fonts, be aware that when the
|
||||
glyph is drawn, the row number may be affected by the global descender
|
||||
value for the font (displayed with \fB\-i\fR).
|
||||
|
||||
.SH "EXAMPLES"
|
||||
.TP
|
||||
\fBxrdp\-dumpfv1 -i @xrdpdatadir@/sans-10.fv1\fR
|
||||
Displays global information about the sans 10 font file distributed with xrdp.
|
||||
|
||||
.TP
|
||||
\fBxrdp\-dumpfv1 -c @'*' @xrdpdatadir@/sans-10.fv1\fR
|
||||
Displays information about the asterisk symbol in the sans 10 font file distributed with xrdp.
|
||||
|
||||
.SH SEE ALSO
|
||||
.BR xrdp\-mkfv1(8).
|
||||
|
||||
More info on \fBxrdp\fR can be found on the
|
||||
.UR @xrdphomeurl@
|
||||
xrdp homepage
|
||||
.UE
|
@ -1,76 +0,0 @@
|
||||
.TH "xrdp\-genkeymap" "8" "@PACKAGE_VERSION@" "xrdp team" ""
|
||||
.de URL
|
||||
. \\$2 \(laURL: \\$1 \(ra\\$3
|
||||
..
|
||||
.if \n[.g] .mso www.tmac
|
||||
|
||||
.SH "NAME"
|
||||
\fBxrdp\-genkeymap\fR \- key map generator for XRDP
|
||||
|
||||
.SH "SYNTAX"
|
||||
.B xrdp\-genkeymap
|
||||
.I [ options ] file
|
||||
|
||||
.SH "DESCRIPTION"
|
||||
\fBxrdp\-genkeymap\fR extracts the current key map from the X server
|
||||
X session to generate a mapping from Remote Desktop Protocol (RDP)
|
||||
scan codes to X keysyms and Unicode code points.
|
||||
|
||||
Before running this utility, make sure the keymap is correct, by issuing
|
||||
the correct \fIsetxkbmap\fP command(s).
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B -k 'keycode_set'
|
||||
Inform \fBxrdp\-genkeymap\fR of the keycode set in operation (evdev or
|
||||
base), so that the correct scan code to keycode mapping table is selected
|
||||
to generate the keymap.
|
||||
|
||||
If you omit this option, the XKB extension is asked to provide the
|
||||
name of the keycode set.
|
||||
|
||||
.TP
|
||||
.B -c 'comment'
|
||||
Adds a comment to the top of the generated file.
|
||||
|
||||
This option may be repeated more than once to add multiple comments to
|
||||
the top of the file.
|
||||
.TP
|
||||
.B outfile
|
||||
The key map information is stored in the file named \fIoutfile\fP.
|
||||
|
||||
.SH "FILES"
|
||||
.TP
|
||||
.I @sysconfdir@/xrdp/km-XXXXXXXX.toml
|
||||
Files containing the keyboard mapping for country and language \fIXXXXXXXX\fP.
|
||||
\fIXXXXXXXX\fP is a 8 digit hexadecimal number, representing the \fIinput
|
||||
locale identifier\fP.
|
||||
|
||||
The input locale identifier is passed from the RDP client when it connects.
|
||||
.RE
|
||||
|
||||
.SH "AUTHORS"
|
||||
Jay Sorg <jsorg71@users.sourceforge.net>
|
||||
.br
|
||||
Simone Fedele <ilsimo@users.sourceforge.net>
|
||||
|
||||
.SH "SEE ALSO"
|
||||
.BR xrdp (8),
|
||||
.BR xrdp-km.toml (5),
|
||||
.BR setxkbmap (1),
|
||||
.BR unicode (7)
|
||||
|
||||
.PP
|
||||
Input locale identifiers on the
|
||||
.UR https://go.microsoft.com/fwlink/?LinkId=202824
|
||||
Microsoft website
|
||||
.UE
|
||||
.PP
|
||||
Description of Keyboard Input mapping on the
|
||||
.UR https://github.com/FreeRDP/FreeRDP/wiki/Keyboard
|
||||
FreeRDP wiki
|
||||
.UE
|
||||
.PP
|
||||
For more info on \fBxrdp\fR see
|
||||
.UR @xrdphomeurl@
|
||||
.UE
|
@ -1,44 +0,0 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.\"-
|
||||
.\" Copyright © 2007, 2008 Vincent Bernat <bernat@debian.org>
|
||||
.\" License: GPL-2+
|
||||
.\"-
|
||||
.TH xrdp\-keygen 8 "@PACKAGE_VERSION@" "xrdp team"
|
||||
.SH NAME
|
||||
xrdp\-keygen \- xrdp RSA key generation utility
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B xrdp\-keygen xrdp
|
||||
< \fIoutfile\fP | \fBauto\fP >
|
||||
.br
|
||||
.B xrdp\-keygen test
|
||||
|
||||
.SH DESCRIPTION
|
||||
\fBxrdp\-keygen\fP generates the file
|
||||
.I @sysconfdir@/xrdp/rsakeys.ini
|
||||
which contains the RSA key pair used to perform authentication to
|
||||
remote clients. The public key is self-signed.
|
||||
|
||||
.SH OPTIONS
|
||||
This program takes one of the following options:
|
||||
.TP
|
||||
\fBxrdp\fP \fIoutfile\fP
|
||||
Generate a new key pair.
|
||||
The key data is stored in the file named \fIoutfile\fP.
|
||||
.br
|
||||
If \fBauto\fP is used as \fIoutfile\fP, the default file \fI@sysconfdir@/xrdp/rsakeys.ini\fP gets created if it does not yet exists.
|
||||
.TP
|
||||
.B test
|
||||
Generate a test key pair and print information to standard output.
|
||||
|
||||
.SH FILES
|
||||
.TP
|
||||
.I @sysconfdir@/xrdp/rsakeys.ini
|
||||
RSA public and private key pair used to identify this XRDP server.
|
||||
|
||||
.SH SEE ALSO
|
||||
.BR xrdp (8),
|
||||
.BR xrdp\-sesman (8).
|
||||
|
||||
.SH AUTHOR
|
||||
This manual page was originally written by Vincent Bernat <bernat@luffy.cx>.
|
@ -1,129 +0,0 @@
|
||||
.\"
|
||||
.TH "xrdp-km.toml" "5" "@PACKAGE_VERSION@" "xrdp team" ""
|
||||
.SH "NAME"
|
||||
\fBxrdp-km.toml\fR \- \fBxrdp\fP key mapping file
|
||||
|
||||
.SH "DESCRIPTION"
|
||||
Key mapping files are located at \fB@sysconfdir@/xrdp/km-XXXXXXXX.toml\fP
|
||||
where \fBXXXXXXXX\fP is the input locale identifier sent by the RDP client.
|
||||
|
||||
The key mapping files are used to translate RDP scan codes into one of
|
||||
the following forms:-
|
||||
.TP
|
||||
.B X11 KeySyms
|
||||
These are used when \fBxrdp\fP connects to a VNC server.
|
||||
.TP
|
||||
.B Unicode characters
|
||||
These are used on the \fBxrdp\fP login screen.
|
||||
.RE
|
||||
.PP
|
||||
Each keymap file consists of several sections. Each section starts with
|
||||
the section name in square brackets, followed by a list of
|
||||
\fIparameter\fR=\fIvalue\fR lines.
|
||||
|
||||
.SH "SECTIONS"
|
||||
The following sections are recognized:
|
||||
.TP
|
||||
\fB[Globals]\fR
|
||||
Global configuration
|
||||
|
||||
.TP
|
||||
\fB[noshift]\fR
|
||||
Key mappings if no modifier keys (i.e. shift, alt gr, caps lock) are down.
|
||||
.TP
|
||||
\fB[shift]\fR
|
||||
Key mappings if the shift key is down.
|
||||
.TP
|
||||
\fB[altgr]\fR
|
||||
Key mappings if the alt gr key is down.
|
||||
.TP
|
||||
\fB[shiftaltgr]\fR
|
||||
Key mappings if the shift and alt gr keys are down.
|
||||
.TP
|
||||
\fB[capslock]\fR
|
||||
Key mappings if the caps lock key is down.
|
||||
.TP
|
||||
\fB[shiftcapslock]\fR
|
||||
Key mappings if the caps lock and shift keys are down.
|
||||
.TP
|
||||
\fB[shiftcapslockaltgr]\fR
|
||||
Key mappings if the shift, caps lock and alt gr keys are down.
|
||||
.TP
|
||||
\fB[numlock]\fR
|
||||
Key mappings if the numlock key is down.
|
||||
|
||||
.LP
|
||||
All parameters and values are case
|
||||
insensitive, and are described in detail below. If any parameter is
|
||||
specified more than once, the last entry will be used. Options specified
|
||||
outside their proper section will be \fIignored\fR.
|
||||
|
||||
.SH "GLOBALS Section"
|
||||
Following parameters can be used in the \fB[Globals]\fR section.
|
||||
|
||||
.TP
|
||||
\fBVersion\fR=\fInumber\fR
|
||||
Version of the file format in use.
|
||||
Can be used to check for file format mis-matches when a file is loaded.
|
||||
.RE
|
||||
|
||||
.SH "Keymap Sections"
|
||||
All other sections contain lines formatted in one of the following
|
||||
ways:-
|
||||
|
||||
.TP
|
||||
<scancode>=<KeySym>
|
||||
.TP
|
||||
<scancode>=<KeySymNum>:<unicode-char>
|
||||
.RE
|
||||
|
||||
Each line may also be followed by a comment (preceded by '#') which
|
||||
contains more information about the key, for example a KeySym string.
|
||||
|
||||
.TP
|
||||
.B scancode
|
||||
A \fBscancode\fP is an RDP scancode received from the client. These
|
||||
correspond to Windows "Scan Code Set 1" scan codes, and can be displayed
|
||||
in Windows by using an appropriate utility.
|
||||
|
||||
The \fBscancode\fP is in one of these two forms:-
|
||||
|
||||
.RS 8
|
||||
.TP
|
||||
.B <hex-digit><hex-digit>
|
||||
Standard scancodes. For example, '1C' refers to the enter key.
|
||||
These are 'key down' scancodes, and so are always between 00 and 7F.
|
||||
.TP
|
||||
.B E0_<hex-digit><hex-digit>
|
||||
Extended scancodes. For example, 'E0_1C' refers to the enter key on the numeric keypad.
|
||||
.RE
|
||||
|
||||
.TP
|
||||
.B KeySymNum
|
||||
A decimal number representing an X11 KeySym
|
||||
|
||||
.TP
|
||||
.B unicode-char
|
||||
A string of the format \fBU+XXXX\fP \fBU+XXXXX\fP,, \fBU+XXXXX\fP,
|
||||
where \fBX\fP is a hexadecimal digit.
|
||||
.RE
|
||||
|
||||
.SH "Limitations"
|
||||
This file format has the following limitations.
|
||||
.IP \(bu
|
||||
Not all combinations of shift keys are stored in the file. For example,
|
||||
at present there is no section for shift and numlock combined.
|
||||
.IP \(bu
|
||||
Modifier keys, other than the ones supported above, are not supported.
|
||||
|
||||
.SH "SEE ALSO"
|
||||
.BR xrdp-genkeymap (8)
|
||||
|
||||
.PP
|
||||
Scancode mappings for most keyboards at
|
||||
.UR https://kbdlayout.info
|
||||
.UE
|
||||
|
||||
For more info on \fBxrdp\fR see
|
||||
.UR @xrdphomeurl@
|
||||
.UE
|
@ -1,81 +0,0 @@
|
||||
.TH "xrdp-mkfv1" "8" "@PACKAGE_VERSION@" "xrdp team"
|
||||
.SH NAME
|
||||
xrdp\-mkfv1 \- Create .fv1 font files from other font files
|
||||
|
||||
.SH SYNOPSIS
|
||||
\fBxrdp-mkfv1\fR [ options ] font_file fv1_file
|
||||
|
||||
.SH DESCRIPTION
|
||||
\fBxrdp\-mkfv1\fP can be used to convert a font file such as a TrueType
|
||||
font to a fv1 file.
|
||||
|
||||
.SH OPTIONS
|
||||
A summary of options is included below.
|
||||
|
||||
.TP
|
||||
\fB\-n\fR <font_name>
|
||||
Give the font a name, which is stored in the font header.
|
||||
|
||||
The default is to use the font family name from the source font.
|
||||
|
||||
.TP
|
||||
\fB\-p\fR <number>
|
||||
Set the point size of the font. A fixed DPI value of 96 is used for
|
||||
converting this value into a pixel size.
|
||||
|
||||
The default value for this option is '10'.
|
||||
|
||||
.TP
|
||||
\fB\-m\fR <glyph>
|
||||
Set the limit on the glyphs stored in the font file. The argument is the last
|
||||
glyph stored in the font file.
|
||||
|
||||
Specify the glyph using one of the following strings:
|
||||
|
||||
\fBU+<hex>\fR - Unicode character, e.g. \fBU+25\fR for a percentage symbol (%).
|
||||
|
||||
\fB@<char>\fR - Unicode character, e.g. \fB@%\fR for a percentage symbol.
|
||||
|
||||
\fBnumber\fR - Unicode value as an integer, e.g. \fB37\fR for a
|
||||
percentage symbol
|
||||
|
||||
The default value for this option is 'U+4DFF'.
|
||||
|
||||
.TP
|
||||
\fB\-C\fR
|
||||
When used with the "DejaVu Sans" font at a point-size of 10, a small
|
||||
number of glyphs are assigned a different x-offset than they have
|
||||
when the original Windows font generation program is used.
|
||||
|
||||
This switch can be used to preserve the original x-offsets for glyphs in
|
||||
the range U+0020 - U+00FF when a 10 point DajaVu Sans font is generated.
|
||||
|
||||
Use one of the following arguments to this option:-
|
||||
|
||||
\fBauto\fR - Automatic mode. Offsets are preserved if a "DajaVu Sans" 10-point font is converted.
|
||||
|
||||
\fBon / true / yes\fR - Preserve offsets if automatic font detection does not work.
|
||||
|
||||
\fBoff / false / no\fR - Do not tamper with the offsets generated by the program.
|
||||
|
||||
The default value of this switch is \fRauto\fR.
|
||||
|
||||
To see the effects of this switch, set the \fBMKFV1_LOG_LEVEL\fR environment
|
||||
variable to \fBinfo\fR before running the program.
|
||||
|
||||
.SH "EXAMPLES"
|
||||
.TP
|
||||
\fBxrdp-mkfv1 -p18 /path/to/DejaVuSans.ttf ./sans-18.fv1\fR
|
||||
Generate an 18-point Deja Sans font.
|
||||
|
||||
.TP
|
||||
\fBxrdp-mkfv1 -C off -p10 /path/to/DejaVuSans.ttf ./sans-10.fv1\fR
|
||||
Generate a 10-point DajaVu Sans font using natural offsets.
|
||||
|
||||
.SH SEE ALSO
|
||||
.BR xrdp\-dumpfv1(8).
|
||||
|
||||
More info on \fBxrdp\fR can be found on the
|
||||
.UR @xrdphomeurl@
|
||||
xrdp homepage
|
||||
.UE
|
@ -1,56 +0,0 @@
|
||||
.TH "xrdp-sesadmin" "8" "@PACKAGE_VERSION@" "xrdp team"
|
||||
.SH NAME
|
||||
xrdp\-sesadmin \- console XRDP sessions administration tool
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B xrdp\-sesadmin
|
||||
.RI [ options ]
|
||||
.BI -c= command
|
||||
|
||||
.SH DESCRIPTION
|
||||
This manual page documents briefly the
|
||||
.B xrdp\-sesadmin
|
||||
command.
|
||||
.PP
|
||||
\fBxrdp\-sesadmin\fP is a console program to administer running XRDP sessions.
|
||||
|
||||
.SH OPTIONS
|
||||
A summary of options is included below.
|
||||
.TP
|
||||
.BI \-u= username
|
||||
Retained for compatibility, but ignored.
|
||||
|
||||
.TP
|
||||
.BI \-p= password
|
||||
Retained for compatibility, but ignored.
|
||||
|
||||
.TP
|
||||
.BI \-i= port
|
||||
The sesman \fIUNIX domain socket\fP to connect to.
|
||||
Defaults to \fBsesman.socket\fP.
|
||||
If no path is specified for the socket, a default of @socketdir@ is used.
|
||||
|
||||
.TP
|
||||
.BI \-c= command
|
||||
Specifies the \fIcommand\fP to execute on the server.
|
||||
Valid commands are:
|
||||
.RS 4
|
||||
.TP
|
||||
.B list
|
||||
List active sessions for the current user.
|
||||
.TP
|
||||
.BI kill: sid
|
||||
Kills the session specified the given \fIsession id\fP.
|
||||
(not yet implemented).
|
||||
.RE
|
||||
|
||||
.SH FILES
|
||||
xrdp\-sesadmin.log
|
||||
|
||||
.SH SEE ALSO
|
||||
.BR xrdp (8).
|
||||
|
||||
More info on \fBxrdp\fR can be found on the
|
||||
.UR @xrdphomeurl@
|
||||
xrdp homepage
|
||||
.UE
|
44
docs/man/xrdp-sesman.8
Normal file
44
docs/man/xrdp-sesman.8
Normal file
@ -0,0 +1,44 @@
|
||||
.TH "sesman" "8" "0.1.0" "xrdp team" ""
|
||||
.SH "NAME"
|
||||
.LP
|
||||
\fBsesman\fR \- \fBxrdp\fR(8) session manager
|
||||
.SH "SYNTAX"
|
||||
.LP
|
||||
sesman [ \-\-nodaemon | \-\-kill | \-\-help ]
|
||||
.SH "DESCRIPTION"
|
||||
.LP
|
||||
\fBsesman\fR is \fBxrdp\fR(8) session manager.
|
||||
.br
|
||||
It manages user sessions by authenticating the user and starting the appropriate Xserver
|
||||
.SH "OPTIONS"
|
||||
.LP
|
||||
.TP
|
||||
\fB\-n\fR, \fB\-\-nodaemon\fR
|
||||
Starts \fBsesman\fR in foreground instead of starting it as a daemon.
|
||||
.TP
|
||||
\fB\-k\fR, \fB\-\-kill\fR
|
||||
Kills running \fBsesman\fR daemon.
|
||||
.TP
|
||||
\fB\-h\fR, \fB\-\-help\fR
|
||||
Output help information and exit.
|
||||
.SH "FILES"
|
||||
.LP
|
||||
${SESMAN_BIN_DIR}/sesman
|
||||
.br
|
||||
${SESMAN_BIN_DIR}/sesrun
|
||||
.br
|
||||
${SESMAN_CFG_DIR}/sesman.ini
|
||||
.br
|
||||
${SESMAN_LOG_DIR}/sesman.log
|
||||
.br
|
||||
${SESMAN_PID_DIR}/sesman.pid
|
||||
.SH "AUTHORS"
|
||||
.LP
|
||||
Jay Sorg <jsorg71@users.sourceforge.net>
|
||||
.br
|
||||
Simone Fedele <ilsimo@users.sourceforge.net>
|
||||
.SH "SEE ALSO"
|
||||
.LP
|
||||
sesman.ini(5) sesrun(8) xrdp(8) xrdp.ini(5)
|
||||
|
||||
for more info on \fBxrdp\fR see http://xrdp.sf.net
|
@ -1,88 +0,0 @@
|
||||
.TH "xrdp\-sesman" "8" "@PACKAGE_VERSION@" "xrdp team" ""
|
||||
.SH "NAME"
|
||||
xrdp\-sesman \- \fBxrdp\fR(8) session manager
|
||||
|
||||
.SH "SYNTAX"
|
||||
.B xrdp\-sesman
|
||||
\-\-kill
|
||||
.br
|
||||
.B xrdp\-sesman
|
||||
\-\-reload
|
||||
.br
|
||||
.B xrdp\-sesman
|
||||
\-\-help
|
||||
.br
|
||||
.B xrdp\-sesman
|
||||
\-\-version
|
||||
.br
|
||||
.B xrdp\-sesman
|
||||
[\-\-nodaemon] [\-\-dump\-config] [\-\-config /path/to/sesman.ini]
|
||||
|
||||
.SH "DESCRIPTION"
|
||||
\fBxrdp\-sesman\fR is \fBxrdp\fR(8) session manager.
|
||||
.br
|
||||
It manages user sessions by authenticating the user and starting the appropriate Xserver.
|
||||
|
||||
.SH "OPTIONS"
|
||||
.TP
|
||||
\fB\-k\fR, \fB\-\-kill\fR
|
||||
Kills running \fBxrdp\-sesman\fR daemon.
|
||||
.TP
|
||||
\fB\-r\fR, \fB\-\-reload\fR
|
||||
Reloads running \fBxrdp\-sesman\fR daemon.
|
||||
.TP
|
||||
\fB\-h\fR, \fB\-\-help\fR
|
||||
Output help information and exit.
|
||||
.TP
|
||||
\fB\-v\fR, \fB\-\-version\fR
|
||||
Output version information and exit.
|
||||
.TP
|
||||
\fB\-n\fR, \fB\-\-nodaemon\fR
|
||||
Starts \fBxrdp\-sesman\fR in foreground instead of starting it as a daemon.
|
||||
.TP
|
||||
\fB\-\-dump\-config\fR
|
||||
Print the configuration on stdout before starting the daemon.
|
||||
The default is not to do this.
|
||||
.TP
|
||||
\fB\-c\fR, \fB\-\-config\fR
|
||||
Specify a path to a different \fIsesman.ini\fR file. This option is intended
|
||||
to be used primarily for testing or for unusual configurations.
|
||||
.P
|
||||
.RS
|
||||
If you use this option, be aware that you will have to have a
|
||||
\fB@sysconfdir@/xrdp/sesman.ini\fR in place too, as a few elements of
|
||||
the system (notably \fBxrdp(8)\fR and \fBxrdp\-chansrv(8)\fR) will want
|
||||
to read it.
|
||||
.RE
|
||||
.SH "SIGNALS"
|
||||
.TP
|
||||
\fBSIGHUP\fR
|
||||
Causes \fBxrdp\-sesman\fR to reload its configuration. Needed if you're
|
||||
not running \fBxrdp\-sesman\fR as a daemon.
|
||||
.SH "FILES"
|
||||
@sbindir@/xrdp\-sesman
|
||||
.br
|
||||
@bindir@/xrdp\-sesrun
|
||||
.br
|
||||
@sysconfdir@/xrdp/sesman.ini
|
||||
.br
|
||||
@localstatedir@/log/xrdp\-sesman.log
|
||||
.br
|
||||
@localstatedir@/run/xrdp\-sesman.pid
|
||||
.br
|
||||
@socketdir@/sesman.socket
|
||||
|
||||
.SH "AUTHORS"
|
||||
Jay Sorg <jsorg71@users.sourceforge.net>
|
||||
.br
|
||||
Simone Fedele <ilsimo@users.sourceforge.net>
|
||||
|
||||
.SH "SEE ALSO"
|
||||
.BR sesman.ini (5),
|
||||
.BR xrdp\-sesrun (8),
|
||||
.BR xrdp (8),
|
||||
.BR xrdp.ini (5)
|
||||
|
||||
for more info on \fBxrdp\fR see
|
||||
.UR @xrdphomeurl@
|
||||
.UE
|
47
docs/man/xrdp-sesrun.8
Normal file
47
docs/man/xrdp-sesrun.8
Normal file
@ -0,0 +1,47 @@
|
||||
.TH "sesrun" "8" "0.1.0" "xrdp team" ""
|
||||
.SH "NAME"
|
||||
.LP
|
||||
\fBsesrun\fR \- \fBsesman\fR(8) session launcher
|
||||
.SH "SYNTAX"
|
||||
.LP
|
||||
sesrun <server> <username> <password> <width> <height> <bpp>
|
||||
.SH "DESCRIPTION"
|
||||
.LP
|
||||
\fBsesrun\fR starts a session using \fBsesman\fR(8).
|
||||
.br
|
||||
This is a tool useful for testing, it simply behaves like xrdp when some user logs in a new session and authenticates, thus starting a new session.
|
||||
.SH "OPTIONS"
|
||||
.LP
|
||||
.TP
|
||||
<server>
|
||||
Server on which sesman is running
|
||||
.TP
|
||||
<username>
|
||||
user name of the session being started
|
||||
.TP
|
||||
<password>
|
||||
user password
|
||||
.TP
|
||||
<width>
|
||||
Screen width
|
||||
.TP
|
||||
<height>
|
||||
Screen height
|
||||
.TP
|
||||
<bpp>
|
||||
Session color depth
|
||||
.SH "FILES"
|
||||
.LP
|
||||
${SESMAN_BIN_DIR}/sesman
|
||||
.br
|
||||
${SESMAN_BIN_DIR}/sesrun
|
||||
.SH "AUTHORS"
|
||||
.LP
|
||||
Jay Sorg <jsorg71@users.sourceforge.net>
|
||||
.br
|
||||
Simone Fedele <ilsimo@users.sourceforge.net>
|
||||
.SH "SEE ALSO"
|
||||
.LP
|
||||
sesman(8) sesman.ini(5) xrdp(8) xrdp.ini(5)
|
||||
|
||||
for more info on \fBxrdp\fR see http://xrdp.sf.net
|
@ -1,108 +0,0 @@
|
||||
.TH "xrdp\-sesrun" "8" "@PACKAGE_VERSION@" "xrdp team" ""
|
||||
.SH "NAME"
|
||||
\fBxrdp\-sesrun\fR \- \fBxrdp\-sesman\fR(8) session launcher
|
||||
|
||||
.SH "SYNTAX"
|
||||
.B xrdp\-sesrun
|
||||
.I --help
|
||||
.br
|
||||
|
||||
.B xrdp\-sesrun
|
||||
.I [ options ] [ username ]
|
||||
|
||||
.SH "DESCRIPTION"
|
||||
\fBxrdp\-sesrun\fR starts a session using \fBxrdp\-sesman\fR(8).
|
||||
.br
|
||||
This is a tool useful for testing. It simply behaves like xrdp when some
|
||||
user logs in a new session and authenticates, thus starting a new session.
|
||||
|
||||
Default values for the options are set at compile-time. Run the utility with
|
||||
the '--help' option to see what the defaults are for your installation.
|
||||
|
||||
If no username is used, the current username is used, and no password
|
||||
needs to be provided. In this instance, it is important that any necessary
|
||||
authentication tokens for a GUI session (e.g. a Kerberos ticket) have
|
||||
already been acquired.
|
||||
|
||||
If a username is provided, a password must also be provided. In this instance
|
||||
the utility prompts for a password if neither \fB-p\fR or \fB-F\fR is used.
|
||||
|
||||
.SH "OPTIONS"
|
||||
.TP
|
||||
.B -g <width>x<height>
|
||||
Set session geometry.
|
||||
.br
|
||||
Note that most configurations will resize the session on connection, so this
|
||||
option may not do what you expect.
|
||||
.TP
|
||||
.B -b <bits-per-pixel>
|
||||
Set session bits-per-pixel (colour depth). Some session types (i.e. Xorg)
|
||||
will ignore this setting.
|
||||
.TP
|
||||
.B -t <session-type>
|
||||
Session type - one of Xorg or Xvnc. Alternatively, for testing
|
||||
only, use the numeric session code.
|
||||
.TP
|
||||
.B -D <directory>
|
||||
Directory to run the new session in. Defaults to $HOME for the specified user.
|
||||
.TP
|
||||
.B -S <shell>
|
||||
Specify an alternate shell to run, instead of the default window manager.
|
||||
.TP
|
||||
.B -p <password>
|
||||
Password for user. USE FOR TESTING ONLY - the password will be visible
|
||||
in the output of the \fBps\fR command.
|
||||
.TP
|
||||
.B -F <file-descriptor>
|
||||
Specify a file descriptor (normally 0) to read the password in from. This
|
||||
is a secure way to pass the password in to the utility.
|
||||
.TP
|
||||
.B -c <sesman-ini>
|
||||
Specify a different sesman.ini file. This file is used to find out how to
|
||||
connect to \fBxrdp\-sesman\fR.
|
||||
|
||||
.SH "ENVIRONMENT"
|
||||
.TP
|
||||
.I SESRUN_LOG_LEVEL
|
||||
Override the default logging level. One of "error", "warn", "info",
|
||||
"debug", "trace" or a number 1-5.
|
||||
|
||||
.SH "EXAMPLES"
|
||||
.TP
|
||||
.B
|
||||
xrdp-sesrun
|
||||
Create a default session for the current user.
|
||||
.TP
|
||||
.B
|
||||
xrdp-sesrun -F 0 user1 <passwd.txt
|
||||
Create a default session for user \fBuser1\fR with a password from
|
||||
a file
|
||||
.TP
|
||||
.B
|
||||
xrdp-sesrun -t Xvnc -S /usr/bin/xterm user1
|
||||
Create an extremely minimal Xvnc session for user \fBuser1\fR. This
|
||||
could be useful for debugging why the standard session is not starting
|
||||
properly. Note you would need to install the \fBxterm\fR utility
|
||||
first. The \fBgnome\-terminal\fR utility probably won't work here.
|
||||
|
||||
.SH "FILES"
|
||||
@sbindir@/xrdp\-sesman
|
||||
.br
|
||||
@bindir@/xrdp\-sesrun
|
||||
.br
|
||||
@sysconfdir@/xrdp/sesman.ini
|
||||
|
||||
.SH "AUTHORS"
|
||||
Jay Sorg <jsorg71@users.sourceforge.net>
|
||||
.br
|
||||
Simone Fedele <ilsimo@users.sourceforge.net>
|
||||
|
||||
.SH "SEE ALSO"
|
||||
.BR xrdp\-sesman (8),
|
||||
.BR sesman.ini (5),
|
||||
.BR xrdp (8),
|
||||
.BR xrdp.ini (5)
|
||||
|
||||
For more info on \fBxrdp\fR see
|
||||
.UR @xrdphomeurl@
|
||||
.UE
|
44
docs/man/xrdp.8
Normal file
44
docs/man/xrdp.8
Normal file
@ -0,0 +1,44 @@
|
||||
.TH "xrdp" "8" "0.1.0" "xrdp team" ""
|
||||
.SH "NAME"
|
||||
.LP
|
||||
\fBxrdp\fR \- a Remote Desktop Protocol (RDP) server
|
||||
.SH "SYNTAX"
|
||||
.LP
|
||||
xrdp [ \-\-nodaemon | \-\-kill | \-\-help ]
|
||||
.SH "DESCRIPTION"
|
||||
.LP
|
||||
\fBxrdp\fR is a Remote Desktop Protocol (RDP) Server.
|
||||
.br
|
||||
Unlike Windows NT/2000/2003 server, \fBxrdp\fR will not display a Windows desktop but an X window desktop to the user.
|
||||
|
||||
It can also be used as a VNC\->RDP bridge.
|
||||
.SH "OPTIONS"
|
||||
.LP
|
||||
.TP
|
||||
\fB\-n\fR, \fB\-\-nodaemon\fR
|
||||
Starts \fBxrdp\fR in foreground instead of starting it as a daemon.
|
||||
.TP
|
||||
\fB\-k\fR, \fB\-\-kill\fR
|
||||
Kills running \fBxrdp\fR daemon.
|
||||
.TP
|
||||
\fB\-h\fR, \fB\-\-help\fR
|
||||
Output help information and exit.
|
||||
.SH "FILES"
|
||||
.LP
|
||||
${XRDP_BIN_DIR}/xrdp
|
||||
.br
|
||||
${XRDP_CFG_DIR}/xrdp.ini
|
||||
.br
|
||||
${XRDP_LOG_DIR}/xrdp.log
|
||||
.br
|
||||
${XRDP_PID_DIR}/xrdp.pid
|
||||
.SH "AUTHORS"
|
||||
.LP
|
||||
Jay Sorg <jsorg71@users.sourceforge.net>
|
||||
.br
|
||||
Simone Fedele <ilsimo@users.sourceforge.net>
|
||||
.SH "SEE ALSO"
|
||||
.LP
|
||||
xrdp.ini(5) sesman(8) sesman.ini(5) sesrun(8)
|
||||
|
||||
for more info on \fBxrdp\fR see http://xrdp.sf.net
|
@ -1,79 +0,0 @@
|
||||
.TH "xrdp" "8" "@PACKAGE_VERSION@" "xrdp team" ""
|
||||
.SH "NAME"
|
||||
\fBxrdp\fR \- a Remote Desktop Protocol (RDP) server
|
||||
|
||||
.SH "SYNTAX"
|
||||
.B xrdp
|
||||
\-\-kill
|
||||
.br
|
||||
.B xrdp
|
||||
\-\-help
|
||||
.br
|
||||
.B xrdp
|
||||
\-\-version
|
||||
.br
|
||||
.B xrdp
|
||||
[\-\-nodaemon] [\-\-port port] [\-\-fork] [\-\-dump\-config] [\-\-config /path/to/xrdp.ini]
|
||||
|
||||
.SH "DESCRIPTION"
|
||||
\fBxrdp\fR is a Remote Desktop Protocol (RDP) Server.
|
||||
.br
|
||||
Unlike Windows NT/2000/2003 server, \fBxrdp\fR will not display a Windows desktop but an X window desktop to the user.
|
||||
|
||||
It can also be used as a VNC\->RDP bridge.
|
||||
|
||||
.SH "OPTIONS"
|
||||
.TP
|
||||
\fB\-k\fR, \fB\-\-kill\fR
|
||||
Kill running \fBxrdp\fR daemon.
|
||||
.TP
|
||||
\fB\-h\fR, \fB\-\-help\fR
|
||||
Output help information and exit.
|
||||
.TP
|
||||
\fB\-v\fR, \fB\-\-version\fR
|
||||
Output version information and exit.
|
||||
.TP
|
||||
\fB\-n\fR, \fB\-\-nodaemon\fR
|
||||
Start \fBxrdp\fR in foreground instead of starting it as a daemon.
|
||||
.TP
|
||||
\fB\-p\fR, \fB\-\-port\fR
|
||||
Specify TCP port to listen to. This overrides \fIport\fR setting in
|
||||
\fIxrdp.ini\fR file.
|
||||
.TP
|
||||
\fB\-f\fR, \fB\-\-fork\fR
|
||||
Fork a new process on a new connection. If not enabled, use a new thread
|
||||
for every connection. This overrides \fIfork\fR setting in
|
||||
\fIxrdp.ini\fR file.
|
||||
.TP
|
||||
\fB\-\-dump\-config\fR
|
||||
Print the configuration on stdout before starting the daemon.
|
||||
The default is not to do this.
|
||||
.TP
|
||||
\fB\-c\fR, \fB\-\-config\fR
|
||||
Specify a path to a different \fIxrdp.ini\fR file. This option is intended
|
||||
to be used primarily for testing or for unusual configurations.
|
||||
|
||||
|
||||
.SH "FILES"
|
||||
@sbindir@/xrdp
|
||||
.br
|
||||
@sysconfdir@/xrdp/xrdp.ini
|
||||
.br
|
||||
@localstatedir@/log/xrdp.log
|
||||
.br
|
||||
@localstatedir@/run/xrdp.pid
|
||||
|
||||
.SH "AUTHORS"
|
||||
Jay Sorg <jsorg71@users.sourceforge.net>
|
||||
.br
|
||||
Simone Fedele <ilsimo@users.sourceforge.net>
|
||||
|
||||
.SH "SEE ALSO"
|
||||
.BR xrdp.ini (5),
|
||||
.BR sesman (8),
|
||||
.BR sesman.ini (5),
|
||||
.BR sesrun (8)
|
||||
|
||||
for more info on \fBxrdp\fR see
|
||||
.UR @xrdphomeurl@
|
||||
.UE
|
99
docs/man/xrdp.ini.5
Normal file
99
docs/man/xrdp.ini.5
Normal file
@ -0,0 +1,99 @@
|
||||
.\"
|
||||
.TH "xrdp.ini" "5" "0.1.0" "xrdp team" ""
|
||||
.SH "NAME"
|
||||
.LP
|
||||
\fBxrdp.ini\fR \- Configuration file for \fBxrdp\fR(8)
|
||||
.SH "DESCRIPTION"
|
||||
.LP
|
||||
This is the man page for \fBxrdp.ini\fR, \fBxrdp\fR(8) configuration file.
|
||||
It is composed by a number of sections, each one composed by a section name, enclosed by square brackets, folowed by a list of \fI<parameter>\fR=\fI<value>\fR lines.
|
||||
|
||||
\fBxrdp.ini\fR is contains a \fB[Globals]\fR section, which sets some global configuration settings for \fBxrdp\fR(8), and one or more "connection" sections which contain the info on which services \fBxrdp\fR(8) can connect to.
|
||||
|
||||
.LP
|
||||
All options and values (except for file names and paths) are case insensitive, and are described in detail below.
|
||||
.SH "GLOBALS"
|
||||
.LP
|
||||
|
||||
.TP
|
||||
The options to be specified in the \fB[Globals]\fR section are the following:
|
||||
.br
|
||||
|
||||
.TP
|
||||
\fBbitmap_cache\fR=\fI[0|1]\fR
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR this option enables bitmap caching in \fBxrdp\fR(8)
|
||||
.br
|
||||
|
||||
.TP
|
||||
\fBbitmap_compression\fR=\fI[0|1]\fR
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR this option enables bitmap compression in \fBxrdp\fR(8)
|
||||
.SH "CONNECTIONS"
|
||||
.LP
|
||||
|
||||
|
||||
.TP
|
||||
A connection section is made of a section name, enclosed in square brackets, and the following entries:
|
||||
.br
|
||||
|
||||
.TP
|
||||
\fBname\fR=\fI<session name>\fR
|
||||
The name displayed in \fBxrdp\fR(8) login window's combo box.
|
||||
.br
|
||||
|
||||
.TP
|
||||
\fBlib\fR=\fI../vnc/libvnc.so\fR
|
||||
Sets the library to be used with this connection.
|
||||
.br
|
||||
|
||||
.TP
|
||||
\fBusername\fR=\fI<username>\fR|\fIask\fR
|
||||
Specifies the username used for authenticating in the connection.
|
||||
If set to \fIask\fR, user name should be provided in the login window.
|
||||
.br
|
||||
|
||||
.TP
|
||||
\fBpassword\fR=\fI<password>\fR|\fIask\fR
|
||||
Specifies the password used for authenticating in the connection.
|
||||
If set to \fIask\fR, password should be provided in the login window.
|
||||
.br
|
||||
|
||||
.TP
|
||||
\fBip\fR=\fI127.0.0.1\fR
|
||||
Specifies the ip address of the host to connect to.
|
||||
.br
|
||||
|
||||
.TP
|
||||
\fBport\fR=\fI<number>\fR|\fI\-1\fR
|
||||
Specifies the port number to connect to. If set to \fI\-1\fR, the default port for the specified library is used.
|
||||
.SH "EXAMPLES"
|
||||
.LP
|
||||
This is an example \fBxrdp.ini\fR:
|
||||
|
||||
[Globals]
|
||||
.br
|
||||
bitmap_cache=yes
|
||||
.br
|
||||
bitmap_compression=yes
|
||||
|
||||
|
||||
[vnc1]
|
||||
.br
|
||||
name=sesman
|
||||
.br
|
||||
lib=../vnc/libvnc.so
|
||||
.br
|
||||
username=ask
|
||||
.br
|
||||
password=ask
|
||||
.br
|
||||
ip=127.0.0.1
|
||||
.br
|
||||
port=\-1
|
||||
.SH "FILES"
|
||||
.LP
|
||||
${XRDP_CFG_DIR}/xrdp.ini
|
||||
.SH "SEE ALSO"
|
||||
.LP
|
||||
xrdp(8) sesman(8) sesrun(8) sesman.ini(5)
|
||||
|
||||
for more info on \fBxrdp\fR see http://xrdp.sf.net
|
@ -1,439 +0,0 @@
|
||||
.TH "xrdp.ini" "5" "@PACKAGE_VERSION@" "xrdp team" ""
|
||||
.SH "NAME"
|
||||
\fBxrdp.ini\fR \- Configuration file for \fBxrdp\fR(8)
|
||||
|
||||
.SH "DESCRIPTION"
|
||||
This is the man page for \fBxrdp.ini\fR, \fBxrdp\fR(8) configuration file.
|
||||
It is composed by a number of sections, each one composed by a section name, enclosed by square brackets, followed by a list of \fI<parameter>\fR=\fI<value>\fR lines.
|
||||
|
||||
\fBxrdp.ini\fR supports the following sections:
|
||||
|
||||
.TP
|
||||
\fB[Globals]\fP \- sets some global configuration settings for \fBxrdp\fR(8).
|
||||
|
||||
.TP
|
||||
\fB[Logging]\fP \- logging subsystem parameters
|
||||
|
||||
.TP
|
||||
\fB[Channels]\fP \- channel subsystem parameters
|
||||
|
||||
.LP
|
||||
All options and values (except for file names and paths) are case insensitive, and are described in detail below.
|
||||
|
||||
.SH "GLOBALS"
|
||||
The options to be specified in the \fB[Globals]\fR section are the following:
|
||||
|
||||
.TP
|
||||
\fBautorun\fP=\fIsession_name\fP
|
||||
Section name for automatic login. If set and the client supplies valid
|
||||
username and password, the user will be logged in automatically using the
|
||||
connection specified by \fIsession_name\fP.
|
||||
|
||||
If \fIsession_name\fP is empty, the \fBLOGIN DOMAIN\fR from the client
|
||||
with be used to select the section. If no domain name is supplied, the
|
||||
first suitable section will be used for automatic login.
|
||||
|
||||
.TP
|
||||
\fBbitmap_cache\fR=\fI[true|false]\fR
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR this option enables bitmap caching in \fBxrdp\fR(8).
|
||||
|
||||
.TP
|
||||
\fBbitmap_compression\fR=\fI[true|false]\fR
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR this option enables bitmap compression in \fBxrdp\fR(8).
|
||||
|
||||
.TP
|
||||
\fBbulk_compression\fP=\fI[true|false]\fP
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR this option enables compression of bulk data in \fBxrdp\fR(8).
|
||||
|
||||
.TP
|
||||
\fBcertificate\fP=\fI/path/to/certificate\fP
|
||||
.TP
|
||||
\fBkey_file\fP=\fI/path/to/private_key\fP
|
||||
Set location of TLS certificate and private key. They must be written in PEM format.
|
||||
If not specified, defaults to \fB@sysconfdir@/xrdp/cert.pem\fP, \fB@sysconfdir@/xrdp/key.pem\fP.
|
||||
|
||||
This parameter is effective only if \fBsecurity_layer\fP is set to \fBtls\fP or \fBnegotiate\fP.
|
||||
|
||||
.TP
|
||||
\fBchannel_code\fP=\fI[true|false]\fP
|
||||
If set to \fB0\fR, \fBfalse\fR or \fBno\fR this option disables all channels \fBxrdp\fR(8).
|
||||
See section \fBCHANNELS\fP below for more fine grained options.
|
||||
|
||||
.TP
|
||||
\fBcrypt_level\fP=\fI[low|medium|high|fips]\fP
|
||||
.\" <http://blogs.msdn.com/b/openspecification/archive/2011/12/08/encryption-negotiation-in-rdp-connection.aspx>
|
||||
Regulate encryption level of Standard RDP Security.
|
||||
This parameter is effective only if \fBsecurity_layer\fP is set to \fBrdp\fP or \fBnegotiate\fP.
|
||||
|
||||
Encryption in Standard RDP Security is controlled by two settings: \fIEncryption Level\fP
|
||||
and \fIEncryption Method\fP. The only supported \fIEncryption Method\fP are \fB40BIT_ENCRYPTION\fP
|
||||
and \fB128BIT_ENCRYPTION\fP. \fB56BIT_ENCRYPTION\fP is not supported.
|
||||
This option controls the \fIEncryption Level\fP:
|
||||
.RS 8
|
||||
.TP
|
||||
.B low
|
||||
All data sent from the client to the server is protected by encryption based on
|
||||
the maximum key strength supported by the client.
|
||||
.I This is the only level that the traffic sent by the server to client is not encrypted.
|
||||
.TP
|
||||
.B medium
|
||||
All data sent between the client and the server is protected by encryption based on
|
||||
the maximum key strength supported by the client (client compatible).
|
||||
.TP
|
||||
.B high
|
||||
All data sent between the client and the server is protected by encryption based on
|
||||
the server's maximum key strength (sever compatible).
|
||||
.TP
|
||||
.B fips
|
||||
All data sent between the client and server is protected using Federal Information
|
||||
Processing Standard 140-1 validated encryption methods.
|
||||
.I This level is required for Windows clients (mstsc.exe) if the client's group policy
|
||||
.I enforces FIPS-compliance mode.
|
||||
.RE
|
||||
|
||||
.TP
|
||||
\fBfork\fP=\fI[true|false]\fP
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR for each incoming connection \fBxrdp\fR(8) forks a sub-process instead of using threads.
|
||||
|
||||
.TP
|
||||
\fBhidelogwindow\fP=\fI[true|false]\fP
|
||||
If set to \fB1\fP, \fBtrue\fP or \fByes\fP, \fBxrdp\fP will not show a window for log messages.
|
||||
If not specified, defaults to \fBfalse\fP.
|
||||
|
||||
.TP
|
||||
\fBmax_bpp\fP=\fI[8|15|16|24|32]\fP
|
||||
Limit the color depth by specifying the maximum number of bits per pixel.
|
||||
If not specified or set to \fB0\fP, unlimited.
|
||||
|
||||
.TP
|
||||
\fBpamerrortxt\fP=\fIerror_text\fP
|
||||
Specify additional text displayed to user if authentication fails. The maximum length is \fB256\fP.
|
||||
|
||||
The use of 'pam' in the name of this option is historic
|
||||
|
||||
.TP
|
||||
\fBport\fP=\fIport\fP
|
||||
Specify TCP port and interface to listen on for incoming connections.
|
||||
Specifying only the port means that xrdp will listen on all interfaces.
|
||||
The default port for RDP is \fB3389\fP.
|
||||
Multiple address:port instances must be separated by spaces or commas. Check the .ini file for examples.
|
||||
Specifying interfaces requires said interfaces to be UP before xrdp starts.
|
||||
|
||||
.TP
|
||||
\fBruntime_user\fP=\fIusername\fP
|
||||
.TP
|
||||
\fBruntime_group\fP=\fIgroupname\fP
|
||||
User name and group to run the xrdp daemon under.
|
||||
|
||||
After xrdp starts, it sets its UID and GID to values derived from these
|
||||
settings, so that it's running without system privilege.
|
||||
|
||||
The \fBruntime_group\fP MUST be set to the same value as
|
||||
\fBSessionSockdirGroup\fP in \fBsesman.ini\fP if you want to run sessions.
|
||||
|
||||
A suitable user and group can be added with a command like this (Linux):-
|
||||
|
||||
useradd xrdp -d / -c 'xrdp daemon' -s /usr/sbin/nologin
|
||||
|
||||
In order to establish secure connections, the xrdp daemon needs permission
|
||||
to access sensitive cryptographic files. After changing either or both
|
||||
of these values, check that xrdp has access to required files by running
|
||||
this script:-
|
||||
|
||||
@xrdpdatadir@/xrdp-chkpriv
|
||||
|
||||
.TP
|
||||
\fBenable_token_login\fP=\fI[true|false]\fP
|
||||
If set to \fB1\fP, \fBtrue\fP or \fByes\fP, \fBxrdp\fP will scan the user name provided by the
|
||||
client for the ASCII field separator character (0x1F). It will then copy over what is after the
|
||||
separator as the password supplied by the user and treats it as autologon. If not specified,
|
||||
defaults to \fBfalse\fP.
|
||||
|
||||
.TP
|
||||
\fBdomain_user_separator\fP=\fBseparator\fP
|
||||
If specified the domain name supplied by the client is appended to the username separated
|
||||
by \fBseparator\fP.
|
||||
|
||||
.TP
|
||||
\fBrequire_credentials\fP=\fI[true|false]\fP
|
||||
If set to \fB1\fP, \fBtrue\fP or \fByes\fP, \fBxrdp\fP requires clients
|
||||
to include username and password initial connection phase. In other
|
||||
words, xrdp doesn't allow clients to show login screen if set to true.
|
||||
It follows that an incorrect password will cause the login to immediately
|
||||
fail without displaying the login screen. If not specified, defaults
|
||||
to \fBfalse\fP.
|
||||
|
||||
.TP
|
||||
\fBsecurity_layer\fP=\fI[tls|rdp|negotiate]\fP
|
||||
Regulate security methods. If not specified, defaults to \fBnegotiate\fP.
|
||||
.RS 8
|
||||
.TP
|
||||
.B tls
|
||||
Enhanced RDP Security is used. All security operations (encryption, decryption, data integrity
|
||||
verification, and server authentication) are implemented by TLS.
|
||||
|
||||
.TP
|
||||
.B rdp
|
||||
Standard RDP Security, which is not safe from man-in-the-middle attack, is used. The encryption level
|
||||
of Standard RDP Security is controlled by \fBcrypt_level\fP.
|
||||
|
||||
.TP
|
||||
.B negotiate
|
||||
Negotiate these security methods with clients.
|
||||
.RE
|
||||
|
||||
.TP
|
||||
\fBssl_protocols\fP=\fI[SSLv3] [TLSv1] [TLSv1.1] [TLSv1.2] [TLSv1.3]\fP
|
||||
Enables the specified SSL/TLS protocols. Each value should be separated by comma.
|
||||
SSLv2 is always disabled. At least one protocol should be given to accept TLS connections.
|
||||
This parameter is effective only if \fBsecurity_layer\fP is set to \fBtls\fP or \fBnegotiate\fP.
|
||||
|
||||
.TP
|
||||
\fBtcp_keepalive\fP=\fI[true|false]\fP
|
||||
Regulate if the listening socket uses socket option \fBSO_KEEPALIVE\fP.
|
||||
If set to \fB1\fP, \fBtrue\fP or \fByes\fP and the network connection disappears
|
||||
without closing messages, the connection will be closed.
|
||||
|
||||
.TP
|
||||
\fBtcp_nodelay\fP=\fI[true|false]\fP
|
||||
Regulate if the listening socket uses socket option \fBTCP_NODELAY\fP.
|
||||
If set to \fB1\fP, \fBtrue\fP or \fByes\fP, no buffering will be performed in the TCP stack.
|
||||
|
||||
.TP
|
||||
\fBtcp_send_buffer_bytes\fP=\fIbuffer_size\fP
|
||||
.TP
|
||||
\fBtcp_recv_buffer_bytes\fP=\fIbuffer_size\fP
|
||||
Specify send/recv buffer sizes in bytes. The default value depends on
|
||||
the operating system. It is recommended not to set these on systems with
|
||||
dynamic TCP buffer sizing
|
||||
|
||||
.TP
|
||||
\fBtls_ciphers\fP=\fIcipher_suite\fP
|
||||
Specifies TLS cipher suite. The format of this parameter is equivalent
|
||||
to which \fBopenssl\fP(1) ciphers subcommand accepts.
|
||||
|
||||
(ex. $ openssl ciphers 'HIGH:!ADH:!SHA1')
|
||||
|
||||
This parameter is effective only if \fBsecurity_layer\fP is set to \fBtls\fP or \fBnegotiate\fP.
|
||||
|
||||
.TP
|
||||
\fBuse_fastpath\fP=\fI[input|output|both|none]\fP
|
||||
If not specified, defaults to \fBnone\fP.
|
||||
|
||||
.TP
|
||||
\fBblack\fP=\fI000000\fP
|
||||
.TP
|
||||
\fBgrey\fP=\fIc0c0c0\fP
|
||||
.TP
|
||||
\fBdark_grey\fP=\fI808080\fP
|
||||
.TP
|
||||
\fBblue\fP=\fI0000ff\fP
|
||||
.TP
|
||||
\fBdark_blue\fP=\fI00007f\fP
|
||||
.TP
|
||||
\fBwhite\fP=\fIffffff\fP
|
||||
.TP
|
||||
\fBred\fP=\fIff0000\fP
|
||||
.TP
|
||||
\fBgreen\fP=\fI00ff00\fP
|
||||
.TP
|
||||
\fBbackground\fP=\fI000000\fP
|
||||
These options override the colors used internally by \fBxrdp\fP(8) to draw the login and log windows.
|
||||
Colors are defined using a hexadecimal (hex) notation for the combination of Red, Green, and Blue color values (RGB).
|
||||
The lowest value that can be given to one of the light sources is 0 (hex 00).
|
||||
The highest value is 255 (hex FF).
|
||||
.TP
|
||||
\fBfv1_select\fP=\fI130:sans-18.fv1,0:sans-10.fv1\fP
|
||||
Selects a default fv1 font.
|
||||
This parameter is a comma-separated list of DPI:name pairs. The list
|
||||
is scanned from left-to-right. The font used is the first font whose DPI
|
||||
value is less-than-or-equal to the vertical DPI of the monitor used for
|
||||
the login screen.
|
||||
.TP
|
||||
\fBdefault_dpi\fP=\fI96\fP
|
||||
Default DPI used for a monitor if the client does not send physical
|
||||
size information.
|
||||
|
||||
|
||||
.SH "LOGGING"
|
||||
The following parameters can be used in the \fB[Logging]\fR section:
|
||||
|
||||
.TP
|
||||
\fBLogFile\fR=\fI@localstatedir@/log/xrdp.log\fR
|
||||
This options contains the path to logfile. It can be either absolute or relative. If set to \fB<stdout>\fR, log will go to stdout. Use for debugging only\fR
|
||||
|
||||
.TP
|
||||
\fBLogLevel\fR=\fIlevel\fR
|
||||
This option can have one of the following values:
|
||||
|
||||
\fBCORE\fR or \fB0\fR \- Log only core messages. these messages are _always_ logged, regardless the logging level selected.
|
||||
|
||||
\fBERROR\fR or \fB1\fR \- Log only error messages
|
||||
|
||||
\fBWARNING\fR, \fBWARN\fR or \fB2\fR \- Logs warnings and error messages
|
||||
|
||||
\fBINFO\fR or \fB3\fR \- Logs errors, warnings and informational messages
|
||||
|
||||
\fBDEBUG\fR or \fB4\fR \- Log everything. If \fBxrdp-sesman\fR is compiled in debug mode, this options will output many more low\-level message, useful for developers
|
||||
|
||||
.TP
|
||||
\fBEnableSyslog\fR=\fI[true|false]\fR
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR this option enables logging to syslog. Otherwise syslog is disabled.
|
||||
|
||||
.TP
|
||||
\fBSyslogLevel\fR=\fIlevel\fR
|
||||
This option sets the logging level for syslog. It can have the same values of \fBLogLevel\fR. If \fBSyslogLevel\fR is greater than \fBLogLevel\fR, its value is lowered to that of \fBLogLevel\fR.
|
||||
|
||||
.TP
|
||||
\fBEnableConsole\fR=\fI[true|false]\fR
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR, this option enables logging to the console (ie. stdout).
|
||||
|
||||
.TP
|
||||
\fBConsoleLevel\fR=\fIlevel\fR
|
||||
Logging level for the console. It can have the same values as \fBLogLevel\fR. Defaults to \fBDEBUG\fR.
|
||||
|
||||
.TP
|
||||
\fBEnableProcessId\fR=\fI[true|false]\fR
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR, this option enables logging the process id in all log messages. Defaults to \fBfalse\fR.
|
||||
|
||||
.SH "CHANNELS"
|
||||
The Remote Desktop Protocol supports several channels, which are used to transfer additional data like sound, clipboard data and others.
|
||||
Channel names not listed here will be blocked by \fBxrdp\fP.
|
||||
Not all channels are supported in all cases, so setting a value to \fItrue\fP is a prerequisite, but does not force its use.
|
||||
.br
|
||||
Channels can also be enabled or disabled on a per connection basis by prefixing each setting with \fBchannel.\fP in the channel section.
|
||||
|
||||
.TP
|
||||
\fBrdpdr\fP=\fI[true|false]\fP
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR using the RDP channel for device redirection is allowed.
|
||||
|
||||
.TP
|
||||
\fBrdpsnd\fP=\fI[true|false]\fP
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR using the RDP channel for sound is allowed.
|
||||
|
||||
.TP
|
||||
\fBdrdynvc\fP=\fI[true|false]\fP
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR using the RDP channel to initiate additional dynamic virtual channels is allowed.
|
||||
|
||||
.TP
|
||||
\fBcliprdr\fP=\fI[true|false]\fP
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR using the RDP channel for clipboard redirection is allowed.
|
||||
|
||||
.TP
|
||||
\fBrail\fP=\fI[true|false]\fP
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR using the RDP channel for remote applications integrated locally (RAIL) is allowed.
|
||||
|
||||
.TP
|
||||
\fBxrdpvr\fP=\fI[true|false]\fP
|
||||
If set to \fB1\fR, \fBtrue\fR or \fByes\fR using the RDP channel for XRDP Video streaming is allowed.
|
||||
|
||||
.SH "CONNECTIONS"
|
||||
A connection section is made of a section name, enclosed in square brackets, and the following entries:
|
||||
|
||||
.TP
|
||||
\fBname\fR=\fI<session name>\fR
|
||||
The name displayed in \fBxrdp\fR(8) login window's combo box.
|
||||
|
||||
.TP
|
||||
\fBlib\fR=\fI../vnc/libvnc.so\fR
|
||||
Sets the library to be used with this connection.
|
||||
|
||||
.TP
|
||||
\fBusername\fR=\fI<username>\fR|\fI{base64}<base64-encoded-username>\fR|\fIask\fR
|
||||
Specifies the username used for authenticating in the connection.
|
||||
If set to \fIask\fR, user name should be provided in the login window.
|
||||
|
||||
If the username includes comment out symbols such as '#', or ';', the username can be
|
||||
provided in base64 form prefixing "{base64}".
|
||||
|
||||
.TP
|
||||
\fBpassword\fR=\fI<password>\fR|\fI{base64}<base64-encoded-password>\fR|\fIask\fR
|
||||
Specifies the password used for authenticating in the connection.
|
||||
If set to \fIask\fR, password should be provided in the login window.
|
||||
|
||||
This parameter can be provided in base64 form as well as username. See also examples below.
|
||||
|
||||
.TP
|
||||
\fBip\fR=\fI127.0.0.1\fR
|
||||
Specifies the ip address of the host to connect to.
|
||||
|
||||
.TP
|
||||
\fBport\fR=\fI<number>\fR|\fI\-1\fR
|
||||
Specifies the port number to connect to. If set to \fI\-1\fR, the default port for the specified library is used.
|
||||
|
||||
.TP
|
||||
\fBxserverbpp\fR=\fI<number>\fR
|
||||
Specifies color depth of the backend X server. The default is the color
|
||||
depth of the client. Only Xvnc uses that setting. Xorg runs at
|
||||
\fI24\fR bpp.
|
||||
|
||||
.TP
|
||||
\fBdisabled_encodings_mask\fR=\fI<number>\fR
|
||||
Set this bitmask to a non-zero value to prevent \fBxrdp\fR(8) requesting
|
||||
some features from the Xvnc server. You should only need to set this
|
||||
to a non-zero value to work around bugs in your Xvnc server. The bit
|
||||
values supported for a particular release of \fBxrdp\fR(8) are documented in
|
||||
\fBxrdp.ini\fR.
|
||||
|
||||
.TP
|
||||
\fBcode\fR=\fI<number>\fR|\fI0\fR
|
||||
Specifies the session type. The default, \fI0\fR, is Xvnc,
|
||||
and \fI20\fR is Xorg with xorgxrdp modules.
|
||||
|
||||
.TP
|
||||
\fBchansrvport\fR=\fBDISPLAY(\fR\fIn\fR\fB)\fR|\fBDISPLAY(\fR\fIn,u\fR\fB)\fR||\fI/path/to/domain-socket\fR
|
||||
Asks xrdp to connect to a manually started \fBxrdp-chansrv\fR instance.
|
||||
This can be useful if you wish to use to use xrdp to connect to a VNC session
|
||||
which has been started other than by \fBxrdp-sesman\fR, as you can then make
|
||||
use of \fBxrdp\-chansrv\fR facilities in the VNC session.
|
||||
|
||||
Either the first or second form of this setting is recommended. Replace
|
||||
\fIn\fR with the X11 display number of the session, and (if applicable)
|
||||
\fIu\fR with the numeric ID of the session. The second form is only
|
||||
required if \fBxrdp\fR is unable to determine the session uid from the
|
||||
other values in the connection block.
|
||||
|
||||
.TP
|
||||
\fBkeycode_set\fR=\fI<string>\fR
|
||||
[Xorg only] Asks for the specified keycode set to be used by the X server.
|
||||
Normally "evdev" or "base". The default should be correct for your system.
|
||||
|
||||
.SH "EXAMPLES"
|
||||
This is an example \fBxrdp.ini\fR:
|
||||
|
||||
.nf
|
||||
[Globals]
|
||||
bitmap_cache=true
|
||||
bitmap_compression=true
|
||||
|
||||
[Xorg]
|
||||
name=Xorg
|
||||
lib=libxup.so
|
||||
username=ask
|
||||
password=ask
|
||||
ip=127.0.0.1
|
||||
port=-1
|
||||
code=20
|
||||
|
||||
[vnc-any]
|
||||
name=vnc-any
|
||||
lib=libvnc.so
|
||||
ip=ask
|
||||
port=ask5900
|
||||
username=na
|
||||
password={base64}cGFzc3dvcmQhCg==
|
||||
.fi
|
||||
|
||||
.SH "FILES"
|
||||
@sysconfdir@/xrdp/xrdp.ini
|
||||
|
||||
.SH "SEE ALSO"
|
||||
.BR xrdp (8),
|
||||
.BR xrdp\-chansrv (8),
|
||||
.BR xrdp\-sesman (8),
|
||||
.BR xrdp\-sesrun (8),
|
||||
.BR sesman.ini (5)
|
||||
|
||||
For more info on \fBxrdp\fR see
|
||||
.UR @xrdphomeurl@
|
||||
.UE
|
24
faq-compile.txt
Normal file
24
faq-compile.txt
Normal file
@ -0,0 +1,24 @@
|
||||
Compile FAQ
|
||||
|
||||
Q. I get error: security/pam_appl.h: File or directory doesn't exist
|
||||
What is wrong?
|
||||
|
||||
A. You need to install pam development package.
|
||||
For Debian / Ubuntu this package is called libpam0g-dev.
|
||||
For Red Hat / Suse this package is called pam-devel.
|
||||
|
||||
Q. I get error :
|
||||
|
||||
A. You need to install opensll development package.
|
||||
For Debian / Ubuntu this package is called libssl-dev.
|
||||
For Red Hat / Suze this package is called openssl-devel.
|
||||
|
||||
Q.
|
||||
|
||||
A.i
|
||||
Red Hat
|
||||
libX11-devel
|
||||
libXfixes-devel
|
||||
Debian
|
||||
libx11-dev
|
||||
libxfixes-dev
|
16
faq-general.txt
Normal file
16
faq-general.txt
Normal file
@ -0,0 +1,16 @@
|
||||
General FAQ
|
||||
|
||||
Q. What is RDP?
|
||||
|
||||
A. RDP stands for Remote Desktop Protocol. Its the protocol used by Windows
|
||||
terminal servers to talk to the terminal server clients.
|
||||
|
||||
Q. What is xrdp?
|
||||
|
||||
A. xrdp, usually spell lower case, is as open source implementation of the RDP
|
||||
protocol.
|
||||
|
||||
Q. I can't get it to compile in Ubuntu. What can I do?
|
||||
|
||||
A. See faq-compile.txt.
|
||||
|
63
file-loc.txt
Normal file
63
file-loc.txt
Normal file
@ -0,0 +1,63 @@
|
||||
|
||||
default build will install the following
|
||||
|
||||
/usr/local/lib/xrdp/
|
||||
libcommon.so
|
||||
libmc.so
|
||||
librdp.so
|
||||
libscp.so
|
||||
libvnc.so
|
||||
libxrdp.so
|
||||
libxup.so
|
||||
|
||||
/usr/local/bin/
|
||||
xrdp-genkeymap
|
||||
xrdp-keygen
|
||||
xrdp-sesadmin
|
||||
xrdp-sesrun
|
||||
xrdp-sestest
|
||||
|
||||
/usr/local/sbin/
|
||||
xrdp
|
||||
xrdp-sesman
|
||||
xrdp-sessvc
|
||||
xrdp-chansrv
|
||||
|
||||
/etc/xrdp/
|
||||
km-xxxx.ini
|
||||
sesman.ini
|
||||
rsakeys.ini
|
||||
startwm.sh
|
||||
xrdp.ini
|
||||
xrdp.sh
|
||||
|
||||
/etc/pam.d/
|
||||
xrdp-sesman
|
||||
|
||||
/usr/local/share/man/man5
|
||||
sesman.ini.5
|
||||
xrdp.ini.5
|
||||
|
||||
/usr/local/share/man/man8
|
||||
xrdp.8
|
||||
xrdp-sesman.8
|
||||
xrdp-sesrun.8
|
||||
|
||||
/usr/local/share/xrdp
|
||||
ad256.bmp
|
||||
cursor0.cur
|
||||
cursor1.cur
|
||||
sans-10.fv1
|
||||
xrdp256.bmp
|
||||
|
||||
when running, the following are created and written to
|
||||
|
||||
/var/run/
|
||||
xrdp.pid
|
||||
sesman.pid
|
||||
|
||||
/var/log/
|
||||
xrdp-sesman.log
|
||||
|
||||
/tmp
|
||||
xrdp*
|
0
fontutils/windows/Makefile → fontdump/Makefile
Normal file → Executable file
0
fontutils/windows/Makefile → fontdump/Makefile
Normal file → Executable file
458
fontdump/fontdump.c
Executable file
458
fontdump/fontdump.c
Executable file
@ -0,0 +1,458 @@
|
||||
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "os_calls.h"
|
||||
#include "arch.h"
|
||||
|
||||
static HINSTANCE g_instance = 0;
|
||||
static HWND g_wnd = 0;
|
||||
static HWND g_lb = 0;
|
||||
static HWND g_exit_button = 0;
|
||||
static HWND g_go_button = 0;
|
||||
static HWND g_font_list = 0;
|
||||
static char g_font_name[512] = "";
|
||||
static int g_font_size = 10;
|
||||
static HFONT g_font = 0;
|
||||
static int g_running = 0;
|
||||
|
||||
#define FONT_DATASIZE(_w, _h) (((_h * ((_w + 7) / 8)) + 3) & ~3)
|
||||
|
||||
/*****************************************************************************/
|
||||
int
|
||||
check_messages(void)
|
||||
{
|
||||
MSG msg;
|
||||
|
||||
while (PeekMessage(&msg, 0, 0, 0, PM_NOREMOVE))
|
||||
{
|
||||
GetMessage(&msg, NULL, 0, 0);
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
static int
|
||||
msg(char* msg1, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char text1[512];
|
||||
|
||||
va_start(ap, msg1);
|
||||
vsnprintf(text1, 511, msg1, ap);
|
||||
SendMessageA(g_lb, LB_ADDSTRING, 0, (LPARAM)text1);
|
||||
va_end(ap);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
static int
|
||||
show_last_error(void)
|
||||
{
|
||||
LPVOID lpMsgBuf;
|
||||
|
||||
FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
NULL, GetLastError(),
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
(LPSTR)&lpMsgBuf, 0, NULL);
|
||||
msg("GetLastError - %s", lpMsgBuf);
|
||||
LocalFree(lpMsgBuf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
static int
|
||||
font_dump(void)
|
||||
{
|
||||
HDC dc;
|
||||
HDC dc1;
|
||||
RECT rect;
|
||||
HBRUSH brush;
|
||||
HGDIOBJ saved;
|
||||
HBITMAP bitmap;
|
||||
BITMAPINFO bi;
|
||||
char* bits;
|
||||
ABC abc;
|
||||
SIZE sz;
|
||||
char filename[256];
|
||||
TCHAR text[256];
|
||||
char zero1;
|
||||
char* bmtext;
|
||||
int bmtextindex;
|
||||
int fd;
|
||||
int x1;
|
||||
int strlen1;
|
||||
int index1;
|
||||
int index2;
|
||||
int len;
|
||||
int pixel;
|
||||
int red;
|
||||
int green;
|
||||
int blue;
|
||||
int width;
|
||||
int height;
|
||||
int roller;
|
||||
int outlen;
|
||||
tui8 b1;
|
||||
short x2;
|
||||
|
||||
if (g_running)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
g_running = 1;
|
||||
msg("starting");
|
||||
g_font_name[0] = 0;
|
||||
SendMessageA(g_font_list, WM_GETTEXT, 255, (LPARAM)g_font_name);
|
||||
if (g_strlen(g_font_name) == 0)
|
||||
{
|
||||
msg("error font not set");
|
||||
g_running = 0;
|
||||
return 1;
|
||||
}
|
||||
dc = GetDC(g_wnd);
|
||||
height = -MulDiv(g_font_size, GetDeviceCaps(dc, LOGPIXELSY), 72);
|
||||
g_font = CreateFontA(height, 0, 0, 0, FW_DONTCARE, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, g_font_name);
|
||||
ReleaseDC(g_wnd, dc);
|
||||
if (g_font == 0)
|
||||
{
|
||||
msg("error - Font creation failed");
|
||||
}
|
||||
zero1 = 0;
|
||||
g_snprintf(filename, 255, "%s-%d.fv1", g_font_name, g_font_size);
|
||||
msg("creating file %s", filename);
|
||||
g_file_delete(filename);
|
||||
fd = g_file_open(filename);
|
||||
g_file_write(fd, "FNT1", 4);
|
||||
strlen1 = g_strlen(g_font_name);
|
||||
g_file_write(fd, g_font_name, strlen1);
|
||||
x1 = strlen1;
|
||||
while (x1 < 32)
|
||||
{
|
||||
g_file_write(fd, &zero1, 1);
|
||||
x1++;
|
||||
}
|
||||
x2 = g_font_size; /* font size */
|
||||
g_file_write(fd, (char*)&x2, 2);
|
||||
x2 = 1; /* style */
|
||||
g_file_write(fd, (char*)&x2, 2);
|
||||
/* pad */
|
||||
index1 = 0;
|
||||
while (index1 < 8)
|
||||
{
|
||||
g_file_write(fd, &zero1, 1);
|
||||
index1++;
|
||||
}
|
||||
for (x1 = 32; x1 < 0x4e00; x1++)
|
||||
{
|
||||
check_messages();
|
||||
dc = GetWindowDC(g_wnd);
|
||||
saved = SelectObject(dc, g_font);
|
||||
if (!GetCharABCWidths(dc, x1, x1, &abc))
|
||||
{
|
||||
show_last_error();
|
||||
}
|
||||
text[0] = (TCHAR)x1;
|
||||
text[1] = 0;
|
||||
if (!GetTextExtentPoint32(dc, text, 1, &sz))
|
||||
{
|
||||
show_last_error();
|
||||
}
|
||||
SelectObject(dc, saved);
|
||||
ReleaseDC(g_wnd, dc);
|
||||
if ((sz.cx > 0) && (sz.cy > 0))
|
||||
{
|
||||
dc = GetWindowDC(g_wnd);
|
||||
saved = SelectObject(dc, g_font);
|
||||
SetBkColor(dc, RGB(255, 255, 255));
|
||||
if (!ExtTextOut(dc, 50, 50, ETO_OPAQUE, 0, text, 1, 0))
|
||||
{
|
||||
show_last_error();
|
||||
}
|
||||
SelectObject(dc, saved);
|
||||
ReleaseDC(g_wnd, dc);
|
||||
Sleep(10);
|
||||
/* width */
|
||||
x2 = abc.abcB;
|
||||
g_file_write(fd, (char*)&x2, 2);
|
||||
/* height */
|
||||
x2 = sz.cy;
|
||||
g_file_write(fd, (char*)&x2, 2);
|
||||
/* baseline */
|
||||
x2 = -sz.cy;
|
||||
g_file_write(fd, (char*)&x2, 2);
|
||||
/* offset */
|
||||
x2 = abc.abcA;
|
||||
g_file_write(fd, (char*)&x2, 2);
|
||||
/* incby */
|
||||
x2 = sz.cx;
|
||||
g_file_write(fd, (char*)&x2, 2);
|
||||
/* pad */
|
||||
index1 = 0;
|
||||
while (index1 < 6)
|
||||
{
|
||||
g_file_write(fd, &zero1, 1);
|
||||
index1++;
|
||||
}
|
||||
dc = GetWindowDC(g_wnd);
|
||||
rect.left = 50 + abc.abcA;
|
||||
rect.top = 50;
|
||||
rect.right = rect.left + abc.abcB;
|
||||
rect.bottom = rect.top + sz.cy;
|
||||
memset(&bi, 0, sizeof(bi));
|
||||
width = (abc.abcB + 7) & (~7);
|
||||
height = sz.cy;
|
||||
bi.bmiHeader.biSize = sizeof(bi.bmiHeader);
|
||||
bi.bmiHeader.biWidth = width;
|
||||
bi.bmiHeader.biHeight = height;
|
||||
bi.bmiHeader.biPlanes = 1;
|
||||
bi.bmiHeader.biBitCount = 32;
|
||||
bitmap = CreateDIBSection(dc, &bi, DIB_RGB_COLORS, (void*)&bits, 0, 0);
|
||||
if (bitmap == 0)
|
||||
{
|
||||
msg("error - CreateDIBSection failed");
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(bits, 0, width * height * 4);
|
||||
dc1 = CreateCompatibleDC(dc);
|
||||
SelectObject(dc1, bitmap);
|
||||
if (!BitBlt(dc1, 0, 0, width, height, dc, rect.left, rect.top, SRCCOPY))
|
||||
{
|
||||
show_last_error();
|
||||
}
|
||||
bmtext = (char*)g_malloc(width * height + 16, 1);
|
||||
bmtextindex = 0;
|
||||
for (index1 = (height - 1); index1 >= 0; index1--)
|
||||
{
|
||||
for (index2 = 0; index2 < width; index2++)
|
||||
{
|
||||
pixel = ((int*)bits)[index1 * width + index2];
|
||||
red = (pixel >> 16) & 0xff;
|
||||
green = (pixel >> 8) & 0xff;
|
||||
blue = (pixel >> 0) & 0xff;
|
||||
if (red == 0 && green == 0 && blue == 0)
|
||||
{
|
||||
bmtext[bmtextindex] = '1';
|
||||
bmtextindex++;
|
||||
}
|
||||
else
|
||||
{
|
||||
bmtext[bmtextindex] = '0';
|
||||
bmtextindex++;
|
||||
}
|
||||
}
|
||||
}
|
||||
outlen = 0;
|
||||
b1 = 0;
|
||||
roller = 0;
|
||||
len = g_strlen(bmtext);
|
||||
for (index2 = 0; index2 < len; index2++)
|
||||
{
|
||||
if (bmtext[index2] == '1')
|
||||
{
|
||||
switch (roller)
|
||||
{
|
||||
case 0: b1 = b1 | 0x80; break;
|
||||
case 1: b1 = b1 | 0x40; break;
|
||||
case 2: b1 = b1 | 0x20; break;
|
||||
case 3: b1 = b1 | 0x10; break;
|
||||
case 4: b1 = b1 | 0x08; break;
|
||||
case 5: b1 = b1 | 0x04; break;
|
||||
case 6: b1 = b1 | 0x02; break;
|
||||
case 7: b1 = b1 | 0x01; break;
|
||||
}
|
||||
}
|
||||
roller++;
|
||||
if (roller == 8)
|
||||
{
|
||||
roller = 0;
|
||||
g_file_write(fd, &b1, 1);
|
||||
outlen++;
|
||||
b1 = 0;
|
||||
}
|
||||
}
|
||||
while ((outlen % 4) != 0)
|
||||
{
|
||||
g_file_write(fd, &zero1, 1);
|
||||
outlen++;
|
||||
}
|
||||
free(bmtext);
|
||||
DeleteDC(dc1);
|
||||
DeleteObject(bitmap);
|
||||
}
|
||||
if (sz.cx != (long)(abc.abcA + abc.abcB + abc.abcC))
|
||||
{
|
||||
msg("error - width not right 1");
|
||||
}
|
||||
brush = CreateSolidBrush(RGB(255, 255, 255));
|
||||
FillRect(dc, &rect, brush);
|
||||
DeleteObject(brush);
|
||||
ReleaseDC(g_wnd, dc);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* write out a blank glyph here */
|
||||
/* width */
|
||||
x2 = 1;
|
||||
g_file_write(fd, (char*)&x2, 2);
|
||||
/* height */
|
||||
x2 = 1;
|
||||
g_file_write(fd, (char*)&x2, 2);
|
||||
/* baseline */
|
||||
x2 = 0;
|
||||
g_file_write(fd, (char*)&x2, 2);
|
||||
/* offset */
|
||||
x2 = 0;
|
||||
g_file_write(fd, (char*)&x2, 2);
|
||||
/* incby */
|
||||
x2 = 1;
|
||||
g_file_write(fd, (char*)&x2, 2);
|
||||
/* pad */
|
||||
index1 = 0;
|
||||
while (index1 < 6)
|
||||
{
|
||||
g_file_write(fd, &zero1, 1);
|
||||
index1++;
|
||||
}
|
||||
/* blank bitmap */
|
||||
index1 = 0;
|
||||
while (index1 < 4)
|
||||
{
|
||||
g_file_write(fd, &zero1, 1);
|
||||
index1++;
|
||||
}
|
||||
}
|
||||
}
|
||||
g_file_close(fd);
|
||||
msg("done");
|
||||
g_running = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
static LRESULT CALLBACK
|
||||
wnd_proc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
HBRUSH brush;
|
||||
RECT rect;
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WM_PAINT:
|
||||
BeginPaint(hWnd, &ps);
|
||||
brush = CreateSolidBrush(RGB(255, 255, 255));
|
||||
rect = ps.rcPaint;
|
||||
FillRect(ps.hdc, &rect, brush);
|
||||
DeleteObject(brush);
|
||||
EndPaint(hWnd, &ps);
|
||||
break;
|
||||
case WM_CLOSE:
|
||||
DestroyWindow(g_wnd);
|
||||
g_wnd = 0;
|
||||
break;
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
case WM_TIMER:
|
||||
KillTimer(g_wnd, 1);
|
||||
font_dump();
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
if ((HWND)lParam == g_exit_button)
|
||||
{
|
||||
PostMessage(g_wnd, WM_CLOSE, 0, 0);
|
||||
}
|
||||
else if ((HWND)lParam == g_go_button)
|
||||
{
|
||||
while (SendMessage(g_lb, LB_GETCOUNT, 0, 0) > 0)
|
||||
{
|
||||
SendMessage(g_lb, LB_DELETESTRING, 0, 0);
|
||||
}
|
||||
SetTimer(g_wnd, 1, 1000, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
static int
|
||||
create_window(void)
|
||||
{
|
||||
WNDCLASS wc;
|
||||
DWORD style;
|
||||
HDC dc;
|
||||
int height;
|
||||
int left;
|
||||
int top;
|
||||
|
||||
ZeroMemory(&wc, sizeof(wc));
|
||||
wc.lpfnWndProc = wnd_proc; /* points to window procedure */
|
||||
/* name of window class */
|
||||
wc.lpszClassName = _T("fontdump");
|
||||
wc.hCursor = LoadCursor(0, IDC_ARROW);
|
||||
/* Register the window class. */
|
||||
if (!RegisterClass(&wc))
|
||||
{
|
||||
return 0; /* Failed to register window class */
|
||||
}
|
||||
style = WS_OVERLAPPED | WS_CAPTION | WS_POPUP | WS_MINIMIZEBOX |
|
||||
WS_SYSMENU | WS_SIZEBOX | WS_MAXIMIZEBOX;
|
||||
left = GetSystemMetrics(SM_CXSCREEN) / 2 - 640 / 2;
|
||||
top = GetSystemMetrics(SM_CYSCREEN) / 2 - 480 / 2;
|
||||
g_wnd = CreateWindow(wc.lpszClassName, _T("fontdump"),
|
||||
style, left, top, 640, 480,
|
||||
(HWND) NULL, (HMENU) NULL, g_instance,
|
||||
(LPVOID) NULL);
|
||||
style = WS_CHILD | WS_VISIBLE | WS_BORDER;
|
||||
g_lb = CreateWindow(_T("LISTBOX"), _T("LISTBOX1"), style,
|
||||
200, 10, 400, 400, g_wnd, 0, g_instance, 0);
|
||||
style = WS_CHILD | WS_VISIBLE;
|
||||
g_exit_button = CreateWindow(_T("BUTTON"), _T("Exit"), style,
|
||||
540, 410, 75, 25, g_wnd, 0, g_instance, 0);
|
||||
g_go_button = CreateWindow(_T("BUTTON"), _T("Go"), style,
|
||||
440, 410, 75, 25, g_wnd, 0, g_instance, 0);
|
||||
style = WS_CHILD | WS_VISIBLE | CBS_DROPDOWN;
|
||||
g_font_list = CreateWindow(_T("COMBOBOX"), _T("COMBOBOX1"), style,
|
||||
50, 250, 125, 125, g_wnd, 0, g_instance, 0);
|
||||
ShowWindow(g_wnd, SW_SHOWNORMAL);
|
||||
PostMessage(g_wnd, WM_SETFONT, (WPARAM)g_font, 0);
|
||||
SendMessageA(g_font_list, CB_ADDSTRING, 0, (LPARAM)"Tahoma");
|
||||
SendMessageA(g_font_list, CB_ADDSTRING, 0, (LPARAM)"DejaVu Serif");
|
||||
SendMessageA(g_font_list, CB_ADDSTRING, 0, (LPARAM)"DejaVu Sans");
|
||||
SendMessageA(g_font_list, CB_ADDSTRING, 0, (LPARAM)"Arial");
|
||||
SendMessageA(g_font_list, CB_ADDSTRING, 0, (LPARAM)"Comic Sans MS");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
static int
|
||||
main_loop(void)
|
||||
{
|
||||
MSG msg;
|
||||
|
||||
while (GetMessage(&msg, NULL, 0, 0))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
return (int)(msg.wParam);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int WINAPI
|
||||
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||
LPSTR lpCmdLine, int nCmdShow)
|
||||
{
|
||||
g_instance = hInstance;
|
||||
create_window();
|
||||
return main_loop();
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
EXTRA_DIST = windows
|
||||
|
||||
# Some programs need freetype2 to build
|
||||
if USE_FREETYPE2
|
||||
MKFV1 = xrdp-mkfv1
|
||||
else
|
||||
MKFV1 =
|
||||
endif
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I$(top_builddir) \
|
||||
-I$(top_srcdir)/common \
|
||||
$(FREETYPE2_CFLAGS)
|
||||
|
||||
bin_PROGRAMS = \
|
||||
$(MKFV1) \
|
||||
xrdp-dumpfv1
|
||||
|
||||
xrdp_mkfv1_SOURCES = \
|
||||
mkfv1.c \
|
||||
fv1.c \
|
||||
fv1.h
|
||||
|
||||
xrdp_mkfv1_LDADD = \
|
||||
$(top_builddir)/common/libcommon.la \
|
||||
$(FREETYPE2_LIBS)
|
||||
|
||||
xrdp_dumpfv1_SOURCES = \
|
||||
dumpfv1.c \
|
||||
fv1.c \
|
||||
fv1.h
|
||||
|
||||
xrdp_dumpfv1_LDADD = \
|
||||
$(top_builddir)/common/libcommon.la
|
@ -1,87 +0,0 @@
|
||||
The fv1 font format has the following characteristics:-
|
||||
|
||||
1) Bitmap fonts (i.e. pixels are on or off)
|
||||
2) 96 DPI is assumed
|
||||
3) Glyphs from U+0020 up to a pre-defined limit are stored in the file.
|
||||
At the time of writing this limit is U+4DFF. To change the limit
|
||||
requires a change to xrdp/xrdp_types.h and (potentially)
|
||||
fontutils/mkfv1.c
|
||||
4) Font format is header, plus a variable data area for each glyph.
|
||||
|
||||
The intention (over time) is to build support for the freetype2 library
|
||||
directly into xrdp. This will allow for modern font features like
|
||||
anti-aliasing and kerning to be supported.
|
||||
|
||||
General Info
|
||||
------------
|
||||
All numeric values are 2 octets, and stored in twos-complement
|
||||
little-endian format.
|
||||
|
||||
Dimensions are all measured in pixels.
|
||||
|
||||
Font header
|
||||
-----------
|
||||
|
||||
signature 4 octets File signature - "FNT1"
|
||||
font~name 32 octets Null-terminated if less that 32 octets long
|
||||
point_size 2 octets Assumes 96 DPI.
|
||||
style 2 octets Unused. Set to 1.
|
||||
body_height 2 octets Line spacing for font.
|
||||
min_descender 2 octets The common lowest descender value in the font
|
||||
glyphs (A few glyphs may be lower than
|
||||
this). Used to calculate where the font baseline
|
||||
is in relation to the text box for the font.
|
||||
<padding> 4 octets Set to zero.
|
||||
|
||||
Older fonts, generated for xrdp v.0.9x and earlier, have zero values
|
||||
for the body_height and min_descender. For these fonts, the body height is
|
||||
calculated as (-baseline + 1) for the first glyph, and the glyphs are
|
||||
all offset so that a min_descender of 0 works OK.
|
||||
|
||||
Glyph data
|
||||
----------
|
||||
The header is followed by a number of glyphs representing U+0020 upwards. The
|
||||
glyphs have a variable size. The format of each glyph is as follows:-
|
||||
|
||||
width 2 octets Width of character data
|
||||
height 2 octets Height of character data
|
||||
baseline 2 octets Offset from font baseline to 1st row of glyph data
|
||||
offset 2 octets Space before glyph is drawn (can be -ve)
|
||||
inc_by 2 octets Total width of glyph + spacing. The width of
|
||||
a string is obtained by adding up all the inc_by
|
||||
fields for all the glyphs
|
||||
data <variable> Bitmap data.
|
||||
|
||||
Bitmap data is laid out in rows from top to bottom. Within each row the
|
||||
most significant bit of each octet is on the left. Row data is padded
|
||||
to the nearest octet (e.g. a 14 bit width would be padded by 2 bits to
|
||||
16 bits (2 octets). The total data is padded out with between 0 and 3
|
||||
octets to end on a 4-octet boundary.
|
||||
|
||||
Example glyph:-
|
||||
|
||||
Glyph : U+0067
|
||||
Width : 12
|
||||
Height : 18
|
||||
Baseline : -13
|
||||
Offset : 1
|
||||
Inc By : 15
|
||||
Data :
|
||||
-13: ...XXXXX..XX 1F 30
|
||||
-12: ..XXXXXXXXXX 3F F0
|
||||
-11: .XXX....XXXX 70 F0
|
||||
-10: XXX......XXX E0 70
|
||||
-9: XX........XX C0 30
|
||||
-8: XX........XX C0 30
|
||||
-7: XX........XX C0 30
|
||||
-6: XX........XX C0 30
|
||||
-5: XX........XX C0 30
|
||||
-4: XXX......XXX E0 70
|
||||
-3: .XXX....XXXX 70 F0
|
||||
-2: ..XXXXXXXXXX 3F F0
|
||||
-1: ...XXXXX..XX 1F 30
|
||||
+0: ..........XX 00 30
|
||||
+1: .........XXX 00 70
|
||||
+2: ..X.....XXX. 20 E0
|
||||
+3: ..XXXXXXXX.. 3F C0
|
||||
+4: ...XXXXXX... 1F 80
|
@ -1,413 +0,0 @@
|
||||
/**
|
||||
* xrdp: A Remote Desktop Protocol server.
|
||||
*
|
||||
* Copyright (C) Jay Sorg 2004-2022
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* fonts
|
||||
*/
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include <config_ac.h>
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "list.h"
|
||||
#include "os_calls.h"
|
||||
#include "parse.h"
|
||||
#include "string_calls.h"
|
||||
#include "fv1.h"
|
||||
|
||||
/**
|
||||
* What the program is doing
|
||||
*/
|
||||
enum program_mode
|
||||
{
|
||||
PM_UNSPECIFIED = 0,
|
||||
PM_INFO,
|
||||
PM_GLYPH_INFO_TABLE,
|
||||
PM_SHOW_CHAR
|
||||
};
|
||||
|
||||
/**
|
||||
* Parsed program arguments
|
||||
*/
|
||||
struct program_args
|
||||
{
|
||||
const char *font_file;
|
||||
enum program_mode mode;
|
||||
int ucode; /* Unicode character to display in 'c' mode */
|
||||
};
|
||||
|
||||
/**************************************************************************//**
|
||||
* Parses the program args
|
||||
*
|
||||
* @param argc Passed to main
|
||||
* @param @argv Passed to main
|
||||
* @param pa program_pargs structure for resulting values
|
||||
* @return !=0 for success
|
||||
*/
|
||||
static int
|
||||
parse_program_args(int argc, char *argv[], struct program_args *pa)
|
||||
{
|
||||
int params_ok = 1;
|
||||
int opt;
|
||||
|
||||
pa->font_file = NULL;
|
||||
pa->mode = PM_UNSPECIFIED;
|
||||
pa->ucode = 0;
|
||||
|
||||
while ((opt = getopt(argc, argv, "c:it")) != -1)
|
||||
{
|
||||
switch (opt)
|
||||
{
|
||||
case 'i':
|
||||
if (pa->mode == PM_UNSPECIFIED)
|
||||
{
|
||||
pa->mode = PM_INFO;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(LOG_LEVEL_ERROR, "Can't have two modes set");
|
||||
params_ok = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case 't':
|
||||
if (pa->mode == PM_UNSPECIFIED)
|
||||
{
|
||||
pa->mode = PM_GLYPH_INFO_TABLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(LOG_LEVEL_ERROR, "Can't have two modes set");
|
||||
params_ok = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
if (pa->mode == PM_UNSPECIFIED)
|
||||
{
|
||||
pa->mode = PM_SHOW_CHAR;
|
||||
if (toupper(optarg[0]) == 'U' && optarg[1] == '+')
|
||||
{
|
||||
char *hex = g_strdup(optarg);
|
||||
hex[0] = '0';
|
||||
hex[1] = 'x';
|
||||
pa->ucode = g_atoix(hex);
|
||||
g_free(hex);
|
||||
}
|
||||
else if (optarg[0] == '@')
|
||||
{
|
||||
pa->ucode = optarg[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
pa->ucode = g_atoix(optarg);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(LOG_LEVEL_ERROR, "Can't have two modes set");
|
||||
params_ok = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG(LOG_LEVEL_ERROR, "Unrecognised switch '%c'", (char)opt);
|
||||
params_ok = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (argc <= optind)
|
||||
{
|
||||
LOG(LOG_LEVEL_ERROR, "No font file specified");
|
||||
params_ok = 0;
|
||||
}
|
||||
else if ((argc - optind) > 1)
|
||||
{
|
||||
LOG(LOG_LEVEL_ERROR, "Unexpected arguments after font file");
|
||||
params_ok = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
pa->font_file = argv[optind];
|
||||
}
|
||||
|
||||
return params_ok;
|
||||
}
|
||||
|
||||
/**************************************************************************//**
|
||||
* Displays information about a font file
|
||||
*
|
||||
* @param fv1 loaded font file
|
||||
*/
|
||||
static void
|
||||
display_font_file_info(const struct fv1_file *fv1)
|
||||
{
|
||||
g_printf("Font name : %s\n", fv1->font_name);
|
||||
g_printf("Point size (%d DPI) : %d\n", FV1_DEVICE_DPI, fv1->point_size);
|
||||
g_printf("Style : %d\n", fv1->style);
|
||||
if (fv1->body_height == 0 && fv1->glyphs->count > 0)
|
||||
{
|
||||
const struct fv1_glyph *g =
|
||||
(const struct fv1_glyph *)fv1->glyphs->items[0];
|
||||
g_printf("Body height : %d (from 1st glyph)\n", -g->baseline + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_printf("Body height : %d\n", fv1->body_height);
|
||||
}
|
||||
g_printf("Descender : %d\n", fv1->min_descender);
|
||||
|
||||
if (fv1->glyphs->count == 0)
|
||||
{
|
||||
g_printf("\nFile contains no glyphs\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
g_printf("Min glyph index : U+%04X\n", FV1_MIN_CHAR);
|
||||
g_printf("Max glyph index : U+%04X\n", FV1_GLYPH_END(fv1) - 1);
|
||||
|
||||
/* Work out the statistics */
|
||||
unsigned short max_width = 0;
|
||||
int max_width_ucode = 0;
|
||||
unsigned short max_height = 0;
|
||||
int max_height_ucode = 0;
|
||||
short min_baseline = 0;
|
||||
int min_baseline_ucode = 0;
|
||||
short min_offset = 0;
|
||||
int min_offset_ucode = 0;
|
||||
short max_offset = 0;
|
||||
int max_offset_ucode = 0;
|
||||
unsigned short max_inc_by = 0;
|
||||
int max_inc_by_ucode = 0;
|
||||
|
||||
/* Derived quantities */
|
||||
short min_y_descender = SHRT_MAX;
|
||||
int min_y_descender_ucode = 0;
|
||||
int max_datasize = -1;
|
||||
int max_datasize_ucode = 0;
|
||||
|
||||
/* Loop and output macros */
|
||||
#define SET_MIN(ucode,field,val) \
|
||||
if ((field) < (val)) \
|
||||
{ \
|
||||
val = (field); \
|
||||
val##_ucode = (ucode); \
|
||||
}
|
||||
|
||||
#define SET_MAX(ucode,field,val) \
|
||||
if ((field) > (val)) \
|
||||
{ \
|
||||
val = (field); \
|
||||
val##_ucode = (ucode); \
|
||||
}
|
||||
|
||||
#define OUTPUT_INFO(string, val) \
|
||||
if (val##_ucode > 0) \
|
||||
{ \
|
||||
g_printf(string, val, val##_ucode); \
|
||||
}
|
||||
int u;
|
||||
for (u = FV1_MIN_CHAR ; u < FV1_GLYPH_END(fv1); ++u)
|
||||
{
|
||||
const struct fv1_glyph *g = FV1_GET_GLYPH(fv1, u);
|
||||
if (g != NULL)
|
||||
{
|
||||
short y_descender = - (g->baseline + g->height);
|
||||
int datasize = FONT_DATASIZE(g);
|
||||
|
||||
SET_MAX(u, g->width, max_width);
|
||||
SET_MAX(u, g->height, max_height);
|
||||
SET_MIN(u, g->baseline, min_baseline);
|
||||
SET_MIN(u, g->offset, min_offset);
|
||||
SET_MAX(u, g->offset, max_offset);
|
||||
SET_MAX(u, g->inc_by, max_inc_by);
|
||||
SET_MIN(u, y_descender, min_y_descender);
|
||||
SET_MAX(u, datasize, max_datasize);
|
||||
}
|
||||
}
|
||||
|
||||
OUTPUT_INFO("Max glyph width : %d (U+%04X)\n", max_width);
|
||||
OUTPUT_INFO("Max glyph height : %d (U+%04X)\n", max_height);
|
||||
OUTPUT_INFO("Min glyph y-baseline : %d (U+%04X)\n", min_baseline);
|
||||
OUTPUT_INFO("Min glyph y-descender : %d (U+%04X)\n", min_y_descender);
|
||||
OUTPUT_INFO("Min glyph x-offset : %d (U+%04X)\n", min_offset);
|
||||
OUTPUT_INFO("Max glyph x-offset : %d (U+%04X)\n", max_offset);
|
||||
OUTPUT_INFO("Max glyph x-inc_by : %d (U+%04X)\n", max_inc_by);
|
||||
OUTPUT_INFO("Max glyph datasize : %d (U+%04X)\n", max_datasize);
|
||||
|
||||
#undef SET_MIN
|
||||
#undef SET_MAX
|
||||
#undef OUTPUT_INFO
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************//**
|
||||
* Display info in a table about all the glyphs
|
||||
* @param fv1 font file
|
||||
*/
|
||||
static void
|
||||
display_glyph_info_table(const struct fv1_file *fv1)
|
||||
{
|
||||
int u;
|
||||
g_printf("character,width,height,baseline,offset,inc_by,datasize\n");
|
||||
|
||||
for (u = FV1_MIN_CHAR; u < FV1_GLYPH_END(fv1); ++u)
|
||||
{
|
||||
const struct fv1_glyph *g = FV1_GET_GLYPH(fv1, u);
|
||||
if (g != NULL)
|
||||
{
|
||||
int datasize = FONT_DATASIZE(g);
|
||||
g_printf("%d,%hu,%hu,%hd,%hd,%hu,%d\n",
|
||||
u, g->width, g->height, g->baseline,
|
||||
g->offset, g->inc_by, datasize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************//**
|
||||
* Converts a font data row to a printable string
|
||||
*
|
||||
* @param rowdata Pointer to the first byte of the row data
|
||||
* @param width Number of pixels in the row
|
||||
* @param out Output buffer. Must be sized by the caller to be at
|
||||
* least width+1 bytes
|
||||
*/
|
||||
static void
|
||||
row_to_str(const unsigned char *rowdata, int width, char *out)
|
||||
{
|
||||
int x;
|
||||
int mask = 1 << 7;
|
||||
for (x = 0 ; x < width ; ++x)
|
||||
{
|
||||
out[x] = ((*rowdata & mask) != 0) ? 'X' : '.';
|
||||
mask >>= 1;
|
||||
if (mask == 0)
|
||||
{
|
||||
mask = 1 << 7;
|
||||
++rowdata;
|
||||
}
|
||||
}
|
||||
out[width] = '\0';
|
||||
}
|
||||
|
||||
/**************************************************************************//**
|
||||
* Display info about a specific glyph
|
||||
* @param ucode Unicode character value
|
||||
* @param g Glyph
|
||||
*/
|
||||
static void
|
||||
display_glyph_info(int ucode, const struct fv1_glyph *g)
|
||||
{
|
||||
|
||||
char *row_buffer = (char *)g_malloc(g->width + 1, 0);
|
||||
if (row_buffer == NULL)
|
||||
{
|
||||
g_printf("<No memory>\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
g_printf("Glyph : U+%04X\n", ucode);
|
||||
g_printf(" Width : %d\n", g->width);
|
||||
g_printf(" Height : %d\n", g->height);
|
||||
g_printf(" Baseline : %d\n", g->baseline);
|
||||
g_printf(" Offset : %d\n", g->offset);
|
||||
g_printf(" Inc By : %d\n", g->inc_by);
|
||||
|
||||
g_printf(" Data :\n");
|
||||
int y;
|
||||
const unsigned char *dataptr = g->data;
|
||||
|
||||
for (y = 0 ; y < g->height; ++y)
|
||||
{
|
||||
row_to_str(dataptr, g->width, row_buffer);
|
||||
g_printf(" %+3d: %s\n", y + g->baseline, row_buffer);
|
||||
dataptr += (g->width + 7) / 8;
|
||||
}
|
||||
g_free(row_buffer);
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************//**
|
||||
* Main
|
||||
*
|
||||
* @param argc Argument count
|
||||
* @param argv Arguments
|
||||
*/
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
struct fv1_file *fv1 = NULL;
|
||||
struct log_config *logging;
|
||||
struct program_args pa;
|
||||
int rv = 1;
|
||||
|
||||
logging = log_config_init_for_console(LOG_LEVEL_WARNING,
|
||||
g_getenv("DUMPFV1_LOG_LEVEL"));
|
||||
log_start_from_param(logging);
|
||||
log_config_free(logging);
|
||||
|
||||
if (parse_program_args(argc, argv, &pa) &&
|
||||
(fv1 = fv1_file_load(pa.font_file)) != NULL)
|
||||
{
|
||||
switch (pa.mode)
|
||||
{
|
||||
case PM_INFO:
|
||||
display_font_file_info(fv1);
|
||||
rv = 0;
|
||||
break;
|
||||
|
||||
case PM_GLYPH_INFO_TABLE:
|
||||
display_glyph_info_table(fv1);
|
||||
rv = 0;
|
||||
break;
|
||||
|
||||
case PM_SHOW_CHAR:
|
||||
if (pa.ucode < FV1_MIN_CHAR)
|
||||
{
|
||||
LOG(LOG_LEVEL_ERROR, "Value for -c must be at least U+%04X",
|
||||
FV1_MIN_CHAR);
|
||||
}
|
||||
else if (pa.ucode >= FV1_GLYPH_END(fv1))
|
||||
{
|
||||
LOG(LOG_LEVEL_ERROR,
|
||||
"Value for -c must be less than U+%04X",
|
||||
FV1_GLYPH_END(fv1));
|
||||
}
|
||||
else
|
||||
{
|
||||
const struct fv1_glyph *g =
|
||||
(const struct fv1_glyph *)
|
||||
list_get_item(fv1->glyphs, pa.ucode - FV1_MIN_CHAR);
|
||||
display_glyph_info(pa.ucode, g);
|
||||
rv = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG(LOG_LEVEL_ERROR, "Specify one of '-i' or '-c'");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fv1_file_free(fv1);
|
||||
log_end();
|
||||
|
||||
return rv;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user