Skip to content

Commit

Permalink
Merge branch 'devel' of https://github.com/neutrinolabs/xrdp into pcs…
Browse files Browse the repository at this point in the history
…c_0.9.14

Conflicts:
	sesman/chansrv/smartcard.h
	sesman/chansrv/smartcard_pcsc.h
  • Loading branch information
zorgluf committed May 28, 2021
2 parents 98d5c8b + 43107d5 commit c18a475
Show file tree
Hide file tree
Showing 65 changed files with 1,117 additions and 836 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,32 @@ jobs:
- run: ./bootstrap
- 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.1
ASTYLE_REPO: https://svn.code.sf.net/p/astyle/code/tags
steps:
# This is currently the only way to get a version into
# the cache tag name - see https://github.com/actions/cache/issues/543
- run: |
echo "OS_VERSION=`lsb_release -sr`" >> $GITHUB_ENV
- uses: actions/checkout@v2
- name: Cache astyle
uses: actions/cache@v2
env:
cache-name: cache-astyle
with:
path: ~/astyle.local
key: ${{ runner.os }}-${{ env.OS_VERSION }}-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
- name: Check code formatting
run: git diff --exit-code
9 changes: 8 additions & 1 deletion astyle_config.as
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@
# 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
Expand All @@ -53,4 +61,3 @@
--formatted
--lineend=linux
10 changes: 5 additions & 5 deletions common/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -767,9 +767,9 @@ log_end(void)
/* log a hex dump */
enum logReturns
log_hexdump(const enum logLevels log_level,
const char *message,
const char *src,
int len)
const char *message,
const char *src,
int len)
{
return log_hexdump_with_location("", "", 0, log_level, message, src, len);
}
Expand Down Expand Up @@ -820,12 +820,12 @@ log_hexdump_with_location(const char *function_name,
if (g_strlen(file_name) > 0)
{
rv = log_message_with_location(function_name, file_name, line_number,
log_level, "%s %s%s",
log_level, "%s %s%s",
message, HEX_DUMP_HEADER, dump_buffer);
}
else
{
rv = log_message(log_level, "%s %s%s",
rv = log_message(log_level, "%s %s%s",
message, HEX_DUMP_HEADER, dump_buffer);
}
g_free(dump_buffer);
Expand Down
2 changes: 1 addition & 1 deletion common/os_calls.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct exit_status
{
/* set to -1 when the process exited via a signal */
uint8_t exit_code;

/* set to 0 when the process exited normally */
uint8_t signal_no;
};
Expand Down
4 changes: 2 additions & 2 deletions common/string_calls.c
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ g_bytes_to_hexdump(const char *src, int len)
+ HEX_DUMP_NEWLINE_SIZE);

dump_number_lines = (len / HEX_DUMP_SOURCE_BYTES_PER_LINE) + 1; /* +1 to round up */
dump_length = (dump_number_lines *dump_line_length /* hex dump lines */
dump_length = (dump_number_lines * dump_line_length /* hex dump lines */
+ 1); /* terminating NULL */
dump_buffer = (char *)g_malloc(dump_length, 1);
if (dump_buffer == NULL)
Expand Down Expand Up @@ -818,7 +818,7 @@ g_strnjoin(char *dest, int dest_len, const char *joiner, const char *src[], int
int dest_remaining;
char *dest_pos = dest;
char *dest_end;

if (dest == NULL || dest_len < 1)
{
return dest;
Expand Down
3 changes: 2 additions & 1 deletion genkeymap/evdev-map.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
* xfree86(base)->evdev keycode mapping
*/

int xfree86_to_evdev[137-8+1] = {
int xfree86_to_evdev[137 - 8 + 1] =
{
/* MDSW */ 203,
/* ESC */ 9,
/* AE01 */ 10,
Expand Down
11 changes: 8 additions & 3 deletions genkeymap/genkeymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,16 @@
#include <X11/XKBlib.h>
#include <locale.h>

extern int xfree86_to_evdev[137-8+1];
extern int xfree86_to_evdev[137 - 8 + 1];

int main(int argc, char **argv)
{
const char *programname;
char text[256];
char *displayname = NULL;
char *outfname;
const char *sections[8] = {
const char *sections[8] =
{
"noshift", "shift", "altgr", "shiftaltgr",
"capslock", "capslockaltgr", "shiftcapslock", "shiftcapslockaltgr"
};
Expand Down Expand Up @@ -139,9 +140,13 @@ int main(int argc, char **argv)
for (i = 8; i < 137; i++) /* Keycodes */
{
if (is_evdev)
e.keycode = xfree86_to_evdev[i-8];
{
e.keycode = xfree86_to_evdev[i - 8];
}
else
{
e.keycode = i;
}
nbytes = XLookupString(&e, text, 255, &ks, NULL);
text[nbytes] = 0;
char_count = mbstowcs(wtext, text, 255);
Expand Down
43 changes: 34 additions & 9 deletions neutrinordp/xrdp-neutrinordp.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,18 +182,30 @@ lxrdp_connect(struct mod *mod)
}

#endif
LOG(LOG_LEVEL_ERROR, "freerdp_connect Failed to "
"destination :%s:%d",
LOG(LOG_LEVEL_ERROR, "NeutrinoRDP proxy connection: status [Failed],"
" RDP client [%s:%s], RDP server [%s:%d], RDP server username [%s],"
" xrdp pamusername [%s], xrdp process id [%d]",
mod->client_info.client_addr,
mod->client_info.client_port,
mod->inst->settings->hostname,
mod->inst->settings->port);
mod->inst->settings->port,
mod->inst->settings->username,
mod->pamusername,
g_getpid());
return 1;
}
else
{
LOG(LOG_LEVEL_INFO, "freerdp_connect returned Success to "
"destination :%s:%d",
LOG(LOG_LEVEL_INFO, "NeutrinoRDP proxy connection: status [Success],"
" RDP client [%s:%s], RDP server [%s:%d], RDP server username [%s],"
" xrdp pamusername [%s], xrdp process id [%d]",
mod->client_info.client_addr,
mod->client_info.client_port,
mod->inst->settings->hostname,
mod->inst->settings->port);
mod->inst->settings->port,
mod->inst->settings->username,
mod->pamusername,
g_getpid());
}

return 0;
Expand Down Expand Up @@ -433,6 +445,16 @@ lxrdp_end(struct mod *mod)
}

LOG_DEVEL(LOG_LEVEL_DEBUG, "lxrdp_end:");
LOG(LOG_LEVEL_INFO, "NeutrinoRDP proxy connection: status [Disconnect],"
" RDP client [%s:%s], RDP server [%s:%d], RDP server username [%s],"
" xrdp pamusername [%s], xrdp process id [%d]",
mod->client_info.client_addr,
mod->client_info.client_port,
mod->inst->settings->hostname,
mod->inst->settings->port,
mod->inst->settings->username,
mod->pamusername,
g_getpid());
return 0;
}

Expand Down Expand Up @@ -504,9 +526,12 @@ lxrdp_set_param(struct mod *mod, const char *name, const char *value)
{
settings->desktop_resize = g_text2bool(value);
}
else if (g_strcmp(name, "pamusername") == 0 ||
g_strcmp(name, "pampassword") == 0 ||
g_strcmp(name, "pammsessionmng") == 0)
else if (g_strcmp(name, "pamusername") == 0)
{
g_strncpy(mod->pamusername, value, 255);
}
else if (g_strcmp(name, "pampassword") == 0 ||
g_strcmp(name, "pamsessionmng") == 0)
{
/* Valid (but unused) parameters not logged */
}
Expand Down
6 changes: 3 additions & 3 deletions neutrinordp/xrdp-neutrinordp.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ struct mod
int (*mod_suppress_output)(struct mod *mod, int suppress,
int left, int top, int right, int bottom);
int (*mod_server_monitor_resize)(struct mod *mod,
int width, int height);
int width, int height);
int (*mod_server_monitor_full_invalidate)(struct mod *mod,
int width, int height);
int width, int height);
int (*mod_server_version_message)(struct mod *mod);
tintptr mod_dumby[100 - 14]; /* align, 100 minus the number of mod
functions above */
Expand Down Expand Up @@ -216,5 +216,5 @@ struct mod
struct bitmap_item bitmap_cache[4][4096];
struct brush_item brush_cache[64];
struct pointer_item pointer_cache[32];

char pamusername[255];
};
108 changes: 108 additions & 0 deletions scripts/install_astyle.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
#!/bin/sh

# Script to install a version of astyle in ~/astyle.local/
#
# Used by CI builds
#
# Currently only supports git repos as sources
#
# Usage: /path/to/install_astyle.sh <astyle-git-repo> <version-tag>

INSTALL_ROOT=~/astyle.local

# ----------------------------------------------------------------------------
# U S A G E
# ----------------------------------------------------------------------------
usage()
{
echo "** Usage: $0 <svn-tags-url> <tag-name>"
echo " e.g. $0 https://svn.code.sf.net/p/astyle/code/tags 3.1"
} >&2

# ----------------------------------------------------------------------------
# C A L L _ M A K E
#
# Calls make with the specified parameters, but only displays the error
# log if it fails
# ----------------------------------------------------------------------------
call_make()
{
# Disable set -e, if active
set_entry_opts=`set +o`
set +e

status=1
log=`mktemp /tmp/astyle-log.XXXXXXXXXX`
if [ -n "$log" ]; then
make "$@" >$log 2>&1
status=$?
if [ $status -ne 0 ]; then
cat $log >&2
fi
rm $log
fi

# Re-enable `set -e` if active before
$set_entry_opts

return $status
}


# ----------------------------------------------------------------------------
# M A I N
# ----------------------------------------------------------------------------
if [ $# -ne 2 ]; then
usage
exit 1
fi

REPO_URL="$1"
ASTYLE_VER="$2"

# Already installed?
exe=$INSTALL_ROOT/$ASTYLE_VER/usr/bin/astyle
if [ -x "$exe" ]; then
echo "astyle version $ASTYLE_VER is already installed at $exe" >&2
exit 0
fi

workdir=`mktemp -d /tmp/astyle.XXXXXXXXXX`
if [ -z "$workdir" ]; then
echo "** Unable to create temporary working directory" 2>&1
exit 1
fi

# Use a sub-process for the next bit to restrict the scope of 'set -e'
(
set -e ; # Exit sub-process on first error

# Put everything in this directory
FILESDIR=$INSTALL_ROOT/$ASTYLE_VER

svn checkout ${REPO_URL}/${ASTYLE_VER}/AStyle $workdir

cd $workdir

make_args="DESTDIR=$FILESDIR"

echo "Creating Makefiles..."
cmake .

echo "Making astyle..."
call_make $make_args

echo "Installing astyle..."
mkdir -p $FILESDIR
call_make install $make_args
# make install DESTDIR=~/astyle.local/3.1
)
status=$?

if [ $status -eq 0 ]; then
rm -rf $workdir
else
"** Script failed. Work dir is $workdir" >&2
fi

exit $status
6 changes: 6 additions & 0 deletions scripts/install_astyle_dependencies_with_apt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
set -eufx

PACKAGES="subversion cmake"

apt-get -yq --no-install-suggests --no-install-recommends install $PACKAGES
Loading

0 comments on commit c18a475

Please sign in to comment.