Skip to content

Commit c18a475

Browse files
committed
Merge branch 'devel' of https://github.com/neutrinolabs/xrdp into pcsc_0.9.14
Conflicts: sesman/chansrv/smartcard.h sesman/chansrv/smartcard_pcsc.h
2 parents 98d5c8b + 43107d5 commit c18a475

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1117
-836
lines changed

.github/workflows/build.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,32 @@ jobs:
146146
- run: ./bootstrap
147147
- run: scripts/install_cppcheck.sh $CPPCHECK_REPO $CPPCHECK_VER
148148
- run: scripts/run_cppcheck.sh -v $CPPCHECK_VER
149+
150+
code_formatting_check:
151+
name: code formatting check
152+
runs-on: ubuntu-latest
153+
env:
154+
CC: gcc
155+
# This is required to use a version of astyle other than that
156+
# supplied with the operating system
157+
ASTYLE_VER: 3.1
158+
ASTYLE_REPO: https://svn.code.sf.net/p/astyle/code/tags
159+
steps:
160+
# This is currently the only way to get a version into
161+
# the cache tag name - see https://github.com/actions/cache/issues/543
162+
- run: |
163+
echo "OS_VERSION=`lsb_release -sr`" >> $GITHUB_ENV
164+
- uses: actions/checkout@v2
165+
- name: Cache astyle
166+
uses: actions/cache@v2
167+
env:
168+
cache-name: cache-astyle
169+
with:
170+
path: ~/astyle.local
171+
key: ${{ runner.os }}-${{ env.OS_VERSION }}-build-${{ env.cache-name }}-${{ env.ASTYLE_VER }}
172+
- run: sudo scripts/install_astyle_dependencies_with_apt.sh
173+
- run: scripts/install_astyle.sh $ASTYLE_REPO $ASTYLE_VER
174+
- name: Format code with astyle
175+
run: scripts/run_astyle.sh
176+
- name: Check code formatting
177+
run: git diff --exit-code

astyle_config.as

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@
4545
# For each directory in the command line, process all subdirectories recursively.
4646
--recursive
4747

48+
# Exclude git submodule directories and generated files.
49+
--exclude=libpainter
50+
--exclude=librfxcodec
51+
--exclude=xrdp_configure_options.h
52+
53+
# ignore errors from generated files that do not exist
54+
--ignore-exclude-errors
55+
4856
# Preserve the original file's date and time modified.
4957
--preserve-date
5058
@@ -53,4 +61,3 @@
5361
--formatted
5462
5563
--lineend=linux
56-

common/log.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -767,9 +767,9 @@ log_end(void)
767767
/* log a hex dump */
768768
enum logReturns
769769
log_hexdump(const enum logLevels log_level,
770-
const char *message,
771-
const char *src,
772-
int len)
770+
const char *message,
771+
const char *src,
772+
int len)
773773
{
774774
return log_hexdump_with_location("", "", 0, log_level, message, src, len);
775775
}
@@ -820,12 +820,12 @@ log_hexdump_with_location(const char *function_name,
820820
if (g_strlen(file_name) > 0)
821821
{
822822
rv = log_message_with_location(function_name, file_name, line_number,
823-
log_level, "%s %s%s",
823+
log_level, "%s %s%s",
824824
message, HEX_DUMP_HEADER, dump_buffer);
825825
}
826826
else
827827
{
828-
rv = log_message(log_level, "%s %s%s",
828+
rv = log_message(log_level, "%s %s%s",
829829
message, HEX_DUMP_HEADER, dump_buffer);
830830
}
831831
g_free(dump_buffer);

common/os_calls.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ struct exit_status
2727
{
2828
/* set to -1 when the process exited via a signal */
2929
uint8_t exit_code;
30-
30+
3131
/* set to 0 when the process exited normally */
3232
uint8_t signal_no;
3333
};

common/string_calls.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ g_bytes_to_hexdump(const char *src, int len)
537537
+ HEX_DUMP_NEWLINE_SIZE);
538538

539539
dump_number_lines = (len / HEX_DUMP_SOURCE_BYTES_PER_LINE) + 1; /* +1 to round up */
540-
dump_length = (dump_number_lines *dump_line_length /* hex dump lines */
540+
dump_length = (dump_number_lines * dump_line_length /* hex dump lines */
541541
+ 1); /* terminating NULL */
542542
dump_buffer = (char *)g_malloc(dump_length, 1);
543543
if (dump_buffer == NULL)
@@ -818,7 +818,7 @@ g_strnjoin(char *dest, int dest_len, const char *joiner, const char *src[], int
818818
int dest_remaining;
819819
char *dest_pos = dest;
820820
char *dest_end;
821-
821+
822822
if (dest == NULL || dest_len < 1)
823823
{
824824
return dest;

genkeymap/evdev-map.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
* xfree86(base)->evdev keycode mapping
2323
*/
2424

25-
int xfree86_to_evdev[137-8+1] = {
25+
int xfree86_to_evdev[137 - 8 + 1] =
26+
{
2627
/* MDSW */ 203,
2728
/* ESC */ 9,
2829
/* AE01 */ 10,

genkeymap/genkeymap.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,16 @@
4444
#include <X11/XKBlib.h>
4545
#include <locale.h>
4646

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

4949
int main(int argc, char **argv)
5050
{
5151
const char *programname;
5252
char text[256];
5353
char *displayname = NULL;
5454
char *outfname;
55-
const char *sections[8] = {
55+
const char *sections[8] =
56+
{
5657
"noshift", "shift", "altgr", "shiftaltgr",
5758
"capslock", "capslockaltgr", "shiftcapslock", "shiftcapslockaltgr"
5859
};
@@ -139,9 +140,13 @@ int main(int argc, char **argv)
139140
for (i = 8; i < 137; i++) /* Keycodes */
140141
{
141142
if (is_evdev)
142-
e.keycode = xfree86_to_evdev[i-8];
143+
{
144+
e.keycode = xfree86_to_evdev[i - 8];
145+
}
143146
else
147+
{
144148
e.keycode = i;
149+
}
145150
nbytes = XLookupString(&e, text, 255, &ks, NULL);
146151
text[nbytes] = 0;
147152
char_count = mbstowcs(wtext, text, 255);

neutrinordp/xrdp-neutrinordp.c

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -182,18 +182,30 @@ lxrdp_connect(struct mod *mod)
182182
}
183183

184184
#endif
185-
LOG(LOG_LEVEL_ERROR, "freerdp_connect Failed to "
186-
"destination :%s:%d",
185+
LOG(LOG_LEVEL_ERROR, "NeutrinoRDP proxy connection: status [Failed],"
186+
" RDP client [%s:%s], RDP server [%s:%d], RDP server username [%s],"
187+
" xrdp pamusername [%s], xrdp process id [%d]",
188+
mod->client_info.client_addr,
189+
mod->client_info.client_port,
187190
mod->inst->settings->hostname,
188-
mod->inst->settings->port);
191+
mod->inst->settings->port,
192+
mod->inst->settings->username,
193+
mod->pamusername,
194+
g_getpid());
189195
return 1;
190196
}
191197
else
192198
{
193-
LOG(LOG_LEVEL_INFO, "freerdp_connect returned Success to "
194-
"destination :%s:%d",
199+
LOG(LOG_LEVEL_INFO, "NeutrinoRDP proxy connection: status [Success],"
200+
" RDP client [%s:%s], RDP server [%s:%d], RDP server username [%s],"
201+
" xrdp pamusername [%s], xrdp process id [%d]",
202+
mod->client_info.client_addr,
203+
mod->client_info.client_port,
195204
mod->inst->settings->hostname,
196-
mod->inst->settings->port);
205+
mod->inst->settings->port,
206+
mod->inst->settings->username,
207+
mod->pamusername,
208+
g_getpid());
197209
}
198210

199211
return 0;
@@ -433,6 +445,16 @@ lxrdp_end(struct mod *mod)
433445
}
434446

435447
LOG_DEVEL(LOG_LEVEL_DEBUG, "lxrdp_end:");
448+
LOG(LOG_LEVEL_INFO, "NeutrinoRDP proxy connection: status [Disconnect],"
449+
" RDP client [%s:%s], RDP server [%s:%d], RDP server username [%s],"
450+
" xrdp pamusername [%s], xrdp process id [%d]",
451+
mod->client_info.client_addr,
452+
mod->client_info.client_port,
453+
mod->inst->settings->hostname,
454+
mod->inst->settings->port,
455+
mod->inst->settings->username,
456+
mod->pamusername,
457+
g_getpid());
436458
return 0;
437459
}
438460

@@ -504,9 +526,12 @@ lxrdp_set_param(struct mod *mod, const char *name, const char *value)
504526
{
505527
settings->desktop_resize = g_text2bool(value);
506528
}
507-
else if (g_strcmp(name, "pamusername") == 0 ||
508-
g_strcmp(name, "pampassword") == 0 ||
509-
g_strcmp(name, "pammsessionmng") == 0)
529+
else if (g_strcmp(name, "pamusername") == 0)
530+
{
531+
g_strncpy(mod->pamusername, value, 255);
532+
}
533+
else if (g_strcmp(name, "pampassword") == 0 ||
534+
g_strcmp(name, "pamsessionmng") == 0)
510535
{
511536
/* Valid (but unused) parameters not logged */
512537
}

neutrinordp/xrdp-neutrinordp.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ struct mod
8383
int (*mod_suppress_output)(struct mod *mod, int suppress,
8484
int left, int top, int right, int bottom);
8585
int (*mod_server_monitor_resize)(struct mod *mod,
86-
int width, int height);
86+
int width, int height);
8787
int (*mod_server_monitor_full_invalidate)(struct mod *mod,
88-
int width, int height);
88+
int width, int height);
8989
int (*mod_server_version_message)(struct mod *mod);
9090
tintptr mod_dumby[100 - 14]; /* align, 100 minus the number of mod
9191
functions above */
@@ -216,5 +216,5 @@ struct mod
216216
struct bitmap_item bitmap_cache[4][4096];
217217
struct brush_item brush_cache[64];
218218
struct pointer_item pointer_cache[32];
219-
219+
char pamusername[255];
220220
};

scripts/install_astyle.sh

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
#!/bin/sh
2+
3+
# Script to install a version of astyle in ~/astyle.local/
4+
#
5+
# Used by CI builds
6+
#
7+
# Currently only supports git repos as sources
8+
#
9+
# Usage: /path/to/install_astyle.sh <astyle-git-repo> <version-tag>
10+
11+
INSTALL_ROOT=~/astyle.local
12+
13+
# ----------------------------------------------------------------------------
14+
# U S A G E
15+
# ----------------------------------------------------------------------------
16+
usage()
17+
{
18+
echo "** Usage: $0 <svn-tags-url> <tag-name>"
19+
echo " e.g. $0 https://svn.code.sf.net/p/astyle/code/tags 3.1"
20+
} >&2
21+
22+
# ----------------------------------------------------------------------------
23+
# C A L L _ M A K E
24+
#
25+
# Calls make with the specified parameters, but only displays the error
26+
# log if it fails
27+
# ----------------------------------------------------------------------------
28+
call_make()
29+
{
30+
# Disable set -e, if active
31+
set_entry_opts=`set +o`
32+
set +e
33+
34+
status=1
35+
log=`mktemp /tmp/astyle-log.XXXXXXXXXX`
36+
if [ -n "$log" ]; then
37+
make "$@" >$log 2>&1
38+
status=$?
39+
if [ $status -ne 0 ]; then
40+
cat $log >&2
41+
fi
42+
rm $log
43+
fi
44+
45+
# Re-enable `set -e` if active before
46+
$set_entry_opts
47+
48+
return $status
49+
}
50+
51+
52+
# ----------------------------------------------------------------------------
53+
# M A I N
54+
# ----------------------------------------------------------------------------
55+
if [ $# -ne 2 ]; then
56+
usage
57+
exit 1
58+
fi
59+
60+
REPO_URL="$1"
61+
ASTYLE_VER="$2"
62+
63+
# Already installed?
64+
exe=$INSTALL_ROOT/$ASTYLE_VER/usr/bin/astyle
65+
if [ -x "$exe" ]; then
66+
echo "astyle version $ASTYLE_VER is already installed at $exe" >&2
67+
exit 0
68+
fi
69+
70+
workdir=`mktemp -d /tmp/astyle.XXXXXXXXXX`
71+
if [ -z "$workdir" ]; then
72+
echo "** Unable to create temporary working directory" 2>&1
73+
exit 1
74+
fi
75+
76+
# Use a sub-process for the next bit to restrict the scope of 'set -e'
77+
(
78+
set -e ; # Exit sub-process on first error
79+
80+
# Put everything in this directory
81+
FILESDIR=$INSTALL_ROOT/$ASTYLE_VER
82+
83+
svn checkout ${REPO_URL}/${ASTYLE_VER}/AStyle $workdir
84+
85+
cd $workdir
86+
87+
make_args="DESTDIR=$FILESDIR"
88+
89+
echo "Creating Makefiles..."
90+
cmake .
91+
92+
echo "Making astyle..."
93+
call_make $make_args
94+
95+
echo "Installing astyle..."
96+
mkdir -p $FILESDIR
97+
call_make install $make_args
98+
# make install DESTDIR=~/astyle.local/3.1
99+
)
100+
status=$?
101+
102+
if [ $status -eq 0 ]; then
103+
rm -rf $workdir
104+
else
105+
"** Script failed. Work dir is $workdir" >&2
106+
fi
107+
108+
exit $status

0 commit comments

Comments
 (0)