Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] devel from neutrinolabs:devel #22

Open
wants to merge 141 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
7eb586d
Combine code paths for handling channel joins
matt335672 Sep 29, 2024
fcc82c3
Announce server RNS_UD_SC_SKIP_CHANNELJOIN_SUPPORTED
matt335672 Sep 27, 2024
f4d7305
Use client earlyCapabilities to determine channel join count
matt335672 Sep 29, 2024
b9703af
Pick up correct includes/libraries for FUSE3
matt335672 Oct 14, 2024
dea4b00
Update xrdp CI build dependencies for FUSE3
matt335672 Oct 14, 2024
edd4276
Migrate chansrv to FUSE3 interface
matt335672 Oct 14, 2024
28ad8c6
Merge pull request #3261 from matt335672/skip_channeljoin
matt335672 Oct 21, 2024
b5772ce
Only use fuse_set_log_func() for libfuse >= 3.7
matt335672 Oct 21, 2024
c734be3
Ask for no videos on the bug form
matt335672 Oct 21, 2024
2c19a20
Bug report 'no videos' text updated after comments
matt335672 Oct 22, 2024
ab56c2b
Fix minor comment errors in libipm/scp.h
matt335672 Sep 13, 2024
dd1dc7c
Use proper define for sesman listen_port size
matt335672 Sep 13, 2024
4d80cf6
Move SCP synch calls from sesman tools to library
matt335672 Sep 13, 2024
c0ccb56
Add calls to SCP to request sockdir creation
matt335672 Sep 13, 2024
661885f
Add support for SCP create_sockdir message to sesman
matt335672 Sep 13, 2024
c46eece
Add support for creating sockdir to chansrv
matt335672 Sep 13, 2024
d17d12d
Add optional UID to DISPLAY() in chansrvport
matt335672 Sep 23, 2024
6a54c21
Merge pull request #3243 from matt335672/chansrv_connect_to_sesman
matt335672 Oct 22, 2024
b318624
Merge pull request #3281 from matt335672/no_videos
matt335672 Oct 23, 2024
514c62c
Merge pull request #3275 from matt335672/move_to_fuse3
matt335672 Oct 23, 2024
a958e37
Remove calls to SSL_CTX_set_ecdh_auto()
matt335672 Oct 28, 2024
1e3acce
cppcheck 2.15.0 -> 2.16.0
matt335672 Oct 28, 2024
e58796d
Clarify size limit for uploaded videos
matt335672 Nov 4, 2024
9c0a0a8
Merge pull request #3294 from matt335672/rework_video_size_warning
matt335672 Nov 4, 2024
5dc4fdb
Add support for statvfs() to FUSE
matt335672 Nov 6, 2024
6a49ff9
Add fix for chromium saving files to FUSE filesys
matt335672 Nov 11, 2024
595bda6
Merge pull request #3291 from matt335672/update_cppcheck_ver
matt335672 Nov 14, 2024
01c262a
Re-introduce -DHAVE_BOOST to cppcheck builds
matt335672 Nov 15, 2024
b40ace3
Merge pull request #3312 from matt335672/cppcheck_add_have_boost
matt335672 Nov 15, 2024
5fb59a7
Set different frame capture interval for H.264 and RFX
metalefty Nov 15, 2024
25e5612
Add Colemak keyboard definition files
matt335672 Nov 18, 2024
cbf5f7a
Add support for keymaps with no Caps Lock key
matt335672 Nov 18, 2024
17ad375
Allow a programmable backspace key for the login screen
matt335672 Nov 18, 2024
53079c4
Regenerate keymap files
matt335672 Nov 18, 2024
b1025bc
add openh264 support
jsorg71 Nov 10, 2024
7214afb
Add DEFAULT_ prefix for default frame capture intervals
metalefty Nov 19, 2024
1964dab
Frame capture intervals are not private to xrdp
metalefty Nov 19, 2024
7d1c3f1
Merge pull request #3318 from metalefty/frame_rates
metalefty Nov 21, 2024
90e3258
Wait for capabilities message from Xorg
matt335672 Aug 6, 2024
84970a8
xup: Display mismatched version number to user
matt335672 Nov 23, 2024
a0989d9
Merge pull request #3197 from matt335672/wait_for_xorg_caps
matt335672 Nov 23, 2024
80fab03
waitforx changes
matt335672 Nov 4, 2024
600549c
Merge pull request #3297 from matt335672/waitforx_improvements
matt335672 Nov 27, 2024
3d853d5
Merge pull request #3319 from matt335672/colemak_support
matt335672 Nov 29, 2024
6162b0b
Merge pull request #3311 from jsorg71/openh264
metalefty Nov 29, 2024
14a1888
Revice OpenH264 description
metalefty Nov 22, 2024
79bff10
Add preferred H.264 encoder configuration in gfx.toml
metalefty Nov 24, 2024
e745ff6
OpenH264: apply encoding parameters from gfx.toml
metalefty Nov 27, 2024
cee29ac
OpenH264: throw out some logs to TRACE level
metalefty Nov 28, 2024
97cc0bc
x264: cleanup gfx.toml
metalefty Nov 28, 2024
4b177da
tests: fix tests after OpenH264
metalefty Nov 28, 2024
49c5070
x264 is the default H.264 encoder
metalefty Nov 28, 2024
032b9b0
tests: add tests for OpenH264 params and prefered H264 encoder
metalefty Nov 28, 2024
28669a8
CI: add OpenH264 to max features
metalefty Nov 29, 2024
0c13792
CI: fix build with g++
metalefty Nov 30, 2024
e404509
Merge pull request #3327 from metalefty/openh264
metalefty Dec 4, 2024
2a190a2
Fix regression in opening local display in waitforx
matt335672 Dec 9, 2024
83cf04b
Merge pull request #3336 from matt335672/fix_x11_socket_check
matt335672 Dec 12, 2024
f61a591
tools: fix for make dist
metalefty Dec 12, 2024
a857f0b
tools: make the output of xrdp-chkpriv fancy
metalefty Dec 12, 2024
31a09f5
Merge pull request #3304 from matt335672/add_statfs_to_fuse
matt335672 Dec 13, 2024
e07cc72
Merge pull request #3340 from metalefty/chkpriv
metalefty Dec 13, 2024
2f7be3f
Allow a path to be specified for the chansrv log
matt335672 Dec 12, 2024
162153a
Move LogFilePath parameter to [ChansrvLogging]
matt335672 Dec 16, 2024
54a6bf1
Merge pull request #3345 from matt335672/chansrv_log_file_path
matt335672 Dec 16, 2024
b02689a
Remove g_time1() call
matt335672 Dec 4, 2024
90798cd
Remove g_time2() call
matt335672 Dec 4, 2024
1f79eb1
Replace g_time3() with g_get_elapsed_ms()
matt335672 Dec 4, 2024
f581d8e
pam: debian: Explicitly include pam_limits for xrdp sessions
ximion Dec 14, 2024
441f427
Merge pull request #3343 from ximion/wip/debian-pam-limits
matt335672 Dec 17, 2024
61271b1
docs: update man page for H.264 stuff
metalefty Dec 18, 2024
c722cb5
docs: fix typos and revise the man page of gfx.toml
metalefty Dec 22, 2024
834e488
Merge pull request #3349 from metalefty/docs
metalefty Dec 23, 2024
ae6b1ed
xrdp-droppriv erroneous includes
matt335672 Dec 23, 2024
5a49312
Merge pull request #3355 from matt335672/link_error_old_glibc
matt335672 Dec 23, 2024
c97bb7d
Regression: restore keyboard debug for non-XUP
matt335672 Dec 23, 2024
3f1c4b1
Merge pull request #3357 from matt335672/fix_debug_keyboard
matt335672 Dec 23, 2024
eb77601
Add Czech keyboard km-00000405.toml
matt335672 Dec 23, 2024
cbbfdb4
Add Czech keyboard definition for xorgxrdp
matt335672 Dec 23, 2024
4c8c773
Merge pull request #3359 from matt335672/czech_kbd
matt335672 Dec 24, 2024
5fe1820
Fix memory leak reported by QiAnXinCodeSafe
matt335672 Dec 24, 2024
75736f4
Allow to change config file (sub)directory
metalefty Dec 27, 2024
ad5b76d
x264: make threads configurable
metalefty Dec 26, 2024
6c3738f
x264: update docs for x264 threads
metalefty Dec 26, 2024
981cead
keygen: replace hardcoded path with sysconf(sub)dir
metalefty Dec 28, 2024
81f3671
genkeymap: replace hardcoded path with sysconf(sub)dir
metalefty Dec 28, 2024
7db81f8
genkeymap: pet cppcheck
metalefty Dec 28, 2024
4e378c9
Merge pull request #3368 from metalefty/sysconfsubdir
metalefty Dec 29, 2024
65a02d0
x264: minor modifications to docs about x264 multithreading
metalefty Dec 31, 2024
bd56127
Merge pull request #3370 from metalefty/x264-threads
metalefty Dec 31, 2024
0c66d2f
Bump copyright year
metalefty Dec 31, 2024
9b1194a
Merge pull request #3373 from metalefty/copyright
metalefty Jan 1, 2025
e70d316
Fix possible memory leak
peter15914 Jan 4, 2025
721c546
Merge pull request #3378 from peter15914/fix_memory_leak_os
matt335672 Jan 6, 2025
75aa785
Merge pull request #3363 from matt335672/fix_qianxin_mem_leak
matt335672 Jan 6, 2025
e3d502c
Merge pull request #3328 from matt335672/fix_time_calls
matt335672 Jan 6, 2025
151c555
Add sesman.ini FuseMountNameColonCharReplacement option
Bad-ptr Jan 5, 2025
35179f0
Fix potential memory leak in vnc_clip.c
matt335672 Jan 9, 2025
99b6aaf
Merge pull request #3382 from Bad-ptr/devel
matt335672 Jan 9, 2025
d98c883
Merge pull request #3387 from matt335672/fix_mem_leak_vnc_clip
matt335672 Jan 9, 2025
b047430
Fix coverity-reported issues
matt335672 Jan 13, 2025
a0f1b65
Merge pull request #3392 from matt335672/fix_cov_err
matt335672 Jan 13, 2025
2a4b40a
Address some Coverity warnings
matt335672 Jan 13, 2025
30b47ba
Merge pull request #3394 from matt335672/more_coverity_fixes
matt335672 Jan 15, 2025
3657b5a
Fix 32-bit CI build
matt335672 Jan 15, 2025
0bef59a
Merge pull request #3396 from matt335672/fix_32bit_build
matt335672 Jan 15, 2025
110df32
CI: Move to V4 of upload-artifact
matt335672 Jan 16, 2025
0a456cb
Merge pull request #3397 from matt335672/update_upload_artifact
matt335672 Jan 16, 2025
6a92ee1
xrdp.8.in: Fix "SEE ALSO" refs to xrdp-sesman, xrdp-sesrun
mvf Jan 19, 2025
64cfeb3
Merge pull request #3402 from mvf/manpage-fix
matt335672 Jan 20, 2025
0f46b79
Fix Coverity error triggered in utf8_get_next_char()
matt335672 Jan 24, 2025
b56b2da
Fix potential double-free (Coverity)
matt335672 Jan 24, 2025
201cdc1
Fix coverity warning over mem leak in smartcard code
matt335672 Jan 24, 2025
8196314
Fix Coverity warnings in neutrinordp
matt335672 Jan 27, 2025
7eb96dd
Merge pull request #3410 from matt335672/coverity_scan
matt335672 Jan 27, 2025
6757b90
Fix typo around lime development package
matt335672 Jan 31, 2025
c1042e8
Merge pull request #3418 from matt335672/fix_typo
matt335672 Jan 31, 2025
195d04a
Check the H.264 library works before trying to load it
matt335672 Jan 30, 2025
825070b
Add software H.264 code to Coverity scan
matt335672 Jan 31, 2025
db32f9c
Coverity CID 468119
matt335672 Feb 1, 2025
2d29342
Coverity CID 468110/468131
matt335672 Feb 1, 2025
c122e05
Coverity CID 468110/468131 - fix newly detected error
matt335672 Feb 3, 2025
eff8ba7
Coverity CID 468140
matt335672 Feb 3, 2025
b7a94bd
Coverity CID 468157
matt335672 Feb 3, 2025
d924440
Merge pull request #3421 from matt335672/coverity_scan
matt335672 Feb 3, 2025
e169733
Update TCP proxy to address Coverity errors
matt335672 Feb 4, 2025
aae69f4
Merge pull request #3422 from matt335672/coverity_scan
matt335672 Feb 4, 2025
f7543c2
Coverity CID 468100
matt335672 Feb 5, 2025
6088ba3
Address offline Coverity issue
matt335672 Feb 5, 2025
cb90458
Coverity CID 468116
matt335672 Feb 5, 2025
8769481
Coverity CID 468118
matt335672 Feb 5, 2025
f376196
Coverity CID 468135
matt335672 Feb 10, 2025
5800c4c
Merge pull request #3426 from matt335672/coverity_scan
matt335672 Feb 10, 2025
023dbf2
Bump Cirrus CI to 14.2
matt335672 Feb 11, 2025
d86dc49
Merge pull request #3428 from matt335672/update_freebsd_ci
matt335672 Feb 11, 2025
bc6a91c
Add Hungarian keyboard km-0000040e.toml
matt335672 Feb 7, 2025
fb9e543
Add xorgxrdp keyboard 040e -> hu
matt335672 Feb 7, 2025
8c69cb0
Merge pull request #3429 from matt335672/add_hu_kbd
matt335672 Feb 12, 2025
fa9cc88
Merge pull request #3413 from matt335672/detect_noopenh264
matt335672 Feb 13, 2025
67fbccc
Address Coverity mutex issues
matt335672 Feb 14, 2025
6889a07
Merge pull request #3433 from matt335672/coverity_scan
matt335672 Feb 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ FreeBSD_task:
SSL: libressl
matrix:
freebsd_instance:
image_family: freebsd-13-3
image_family: freebsd-14-2
prepare_script:
- pkg install -y $SSL git autoconf automake libtool pkgconf opus jpeg-turbo fdk-aac pixman libX11 libXfixes libXrandr libxkbfile nasm fusefs-libs check imlib2 freetype2 cmocka ibus
- 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
Expand Down
7 changes: 5 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ 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**
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
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,11 @@ jobs:
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
--with-imlib2 --with-freetype2 --enable-tests --with-x264
--enable-openh264"
CONF_FLAGS_i386_max: "--enable-ipv6 --enable-jpeg
--enable-mp3lame --enable-opus --enable-rfxcodec
--enable-painter --disable-pixman --with-imlib2
--enable-painter --disable-pixman
--with-freetype2 --host=i686-linux --enable-tests"

PKG_CONFIG_PATH_i386: "/usr/lib/i386-linux-gnu/pkgconfig"
Expand Down Expand Up @@ -167,7 +168,7 @@ jobs:
if: ${{ matrix.DISTCHECK }}
run: make distcheck -j $(nproc)
- name: "Artifact: test-suite.log distcheck"
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: always() && steps.dist_check.outcome == 'failure'
with:
name: test-suite-distcheck-${{ matrix.cc }}-${{ matrix.feature_set }}
Expand All @@ -180,7 +181,7 @@ jobs:
CC: gcc
# This is required to use a version of cppcheck other than that
# supplied with the operating system
CPPCHECK_VER: "2.15.0"
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')
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/coverity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
CONF_FLAGS_amd64_max: "--enable-ipv6 --enable-jpeg --enable-fuse --enable-mp3lame
--enable-fdkaac --enable-opus --enable-rfxcodec --enable-painter
--enable-pixman --enable-utmp
--enable-x264 --enable-openh264
--with-imlib2 --with-freetype2 --enable-tests"
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion common/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ include_HEADERS = \
xrdp_sockets.h

AM_CPPFLAGS = \
-DXRDP_CFG_PATH=\"${sysconfdir}/xrdp\" \
-DXRDP_CFG_PATH=\"${sysconfdir}/${sysconfsubdir}\" \
-DXRDP_SBIN_PATH=\"${sbindir}\" \
-DXRDP_SHARE_PATH=\"${datadir}/xrdp\" \
-DXRDP_PID_PATH=\"${localstatedir}/run\" \
Expand Down
1 change: 1 addition & 0 deletions common/ms-erref.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ enum NTSTATUS
STATUS_NO_MORE_FILES = 0x80000006,

STATUS_UNSUCCESSFUL = 0xc0000001,
STATUS_INFO_LENGTH_MISMATCH = 0xc0000004,
STATUS_NO_SUCH_FILE = 0xc000000f,
STATUS_ACCESS_DENIED = 0xc0000022,
STATUS_OBJECT_NAME_INVALID = 0xc0000033,
Expand Down
22 changes: 21 additions & 1 deletion common/ms-fscc.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
/*
* File information classes (section 2.4)
*/
enum FS_INFORMATION_CLASS
enum FILE_INFORMATION_CLASS
{
FileAllocationInformation = 19, /* Set */
FileBasicInformation = 4, /* Query, Set */
Expand All @@ -52,6 +52,26 @@ enum FS_INFORMATION_CLASS
#define FILE_STD_INFORMATION_SIZE 22
#define FILE_END_OF_FILE_INFORMATION_SIZE 8

/*
* File System information classes (section 2.5)
*/
enum FILE_SYSTEM_INFORMATION_CLASS
{
FileFsVolumeInformation = 1,
FileFsSizeInformation = 3,
FileFsDeviceInformation = 4,
FileFsAttributeInformation = 5,
FileFsFullSizeInformation = 7
};

/*
* Size of structs above without trailing RESERVED fields (MS-RDPEFS
* 2.2.3.3.6)
*/
#define FILE_FS_SIZE_INFORMATION_SIZE 24
#define FILE_FS_DEVICE_INFORMATION_SIZE 8
#define FILE_FS_FULL_SIZE_INFORMATION_SIZE 32

/* Windows file attributes (section 2.6) */
#define W_FILE_ATTRIBUTE_DIRECTORY 0x00000010
#define W_FILE_ATTRIBUTE_READONLY 0x00000001
Expand Down
4 changes: 4 additions & 0 deletions common/ms-rdpbcgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
#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
Expand Down Expand Up @@ -136,6 +137,9 @@
#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 */
Expand Down
88 changes: 29 additions & 59 deletions common/os_calls.c
Original file line number Diff line number Diff line change
Expand Up @@ -1805,7 +1805,7 @@ g_set_wait_obj(tintptr obj)
return 0;
}
fd = obj >> 16;
to_write = 4;
to_write = sizeof(buf);
written = 0;
while (written < to_write)
{
Expand All @@ -1823,12 +1823,13 @@ g_set_wait_obj(tintptr obj)
return 1;
}
}
else if (error > 0)
else if (error > 0 && error <= (int)sizeof(buf))
{
written += error;
}
else
{
// Shouldn't get here.
return 1;
}
}
Expand Down Expand Up @@ -2045,18 +2046,6 @@ g_obj_wait(tintptr *read_objs, int rcount, tintptr *write_objs, int wcount,
void
g_random(char *data, int len)
{
#if defined(_WIN32)
int index;

srand(g_time1());

for (index = 0; index < len; index++)
{
data[index] = (char)rand(); /* rand returns a number between 0 and
RAND_MAX */
}

#else
int fd;

memset(data, 0x44, len);
Expand All @@ -2075,8 +2064,6 @@ g_random(char *data, int len)

close(fd);
}

#endif
}

/*****************************************************************************/
Expand Down Expand Up @@ -2311,15 +2298,27 @@ g_file_set_cloexec(int fd, int status)
struct list *
g_get_open_fds(int min, int max)
{
if (min < 0)
{
min = 0;
}

struct list *result = list_create();

if (result != NULL)
{
if (max < 0)
{
max = sysconf(_SC_OPEN_MAX);
// sysconf() returns a long. Limit it to a sane value
#define SANE_MAX 100000
long sc_max = sysconf(_SC_OPEN_MAX);
max = (sc_max < 0) ? 0 :
(sc_max > (long)SANE_MAX) ? SANE_MAX :
sc_max;
#undef SANE_MAX
}

// max and min are now both guaranteed to be >= 0
if (max > min)
{
struct pollfd *fds = g_new0(struct pollfd, max - min);
Expand All @@ -2344,6 +2343,7 @@ g_get_open_fds(int min, int max)
// Descriptor is open
if (!list_add_item(result, i))
{
g_free(fds);
goto nomem;
}
}
Expand Down Expand Up @@ -3778,51 +3778,21 @@ g_check_user_in_group(const char *username, int gid, int *ok)
#endif // HAVE_GETGROUPLIST

/*****************************************************************************/
/* returns the time since the Epoch (00:00:00 UTC, January 1, 1970),
measured in seconds.
for windows, returns the number of seconds since the machine was
started. */
int
g_time1(void)
{
#if defined(_WIN32)
return GetTickCount() / 1000;
#else
return time(0);
#endif
}

/*****************************************************************************/
/* returns the number of milliseconds since the machine was
started. */
int
g_time2(void)
unsigned int
g_get_elapsed_ms(void)
{
#if defined(_WIN32)
return (int)GetTickCount();
#else
struct tms tm;
clock_t num_ticks = 0;
g_memset(&tm, 0, sizeof(struct tms));
num_ticks = times(&tm);
return (int)(num_ticks * 10);
#endif
}
unsigned int result = 0;
struct timespec tp;

/*****************************************************************************/
/* returns time in milliseconds, uses gettimeofday
does not work in win32 */
int
g_time3(void)
{
#if defined(_WIN32)
return 0;
#else
struct timeval tp;
if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
{
result = (unsigned int)tp.tv_sec * 1000;
// POSIX 1003.1-2004 specifies that tv_nsec is a long (i.e. a
// signed type), but can only contain [0..999,999,999]
result += tp.tv_nsec / 1000000;
}

gettimeofday(&tp, 0);
return (tp.tv_sec * 1000) + (tp.tv_usec / 1000);
#endif
return result;
}

/******************************************************************************/
Expand Down
23 changes: 20 additions & 3 deletions common/os_calls.h
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,26 @@ int g_getgroup_info(const char *groupname, int *gid);
* 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);

/**
* Gets elapsed milliseconds since some arbitrary point in the past
*
* The returned value is unaffected by leap-seconds or time zone changes.
*
* @return elaped ms since some arbitrary point
*
* Calculate the duration of a task by calling this routine before and
* after the task, and subtracting the two values.
*
* The value wraps every so often (every 49.7 days on a 32-bit system),
* but as we are using unsigned arithmetic, the difference of any of these
* two values can be used to calculate elapsed time, whether-or-not a wrap
* occurs during the interval - provided of course the time being measured
* is less than the total wrap-around interval.
*/
unsigned int
g_get_elapsed_ms(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);
Expand Down
13 changes: 5 additions & 8 deletions common/ssl_calls.c
Original file line number Diff line number Diff line change
Expand Up @@ -1104,15 +1104,12 @@ ssl_tls_accept(struct ssl_tls *self, long ssl_protocols,
return 1;
}
DH_free(dh); // ok to free, copied into ctx by SSL_CTX_set_tmp_dh()
#else
if (!SSL_CTX_set_dh_auto(self->ctx, 1))
{
LOG(LOG_LEVEL_ERROR, "TLS DHE auto failed to be enabled");
dump_ssl_error_stack(self);
return 1;
}
#endif
#if defined(SSL_CTX_set_ecdh_auto)

#if (OPENSSL_VERSION_NUMBER >= 0x10000020L) && \
OPENSSL_VERSION_NUMBER < (0x10100000L)
// SSL_CTX_set_ecdh_auto() added in OpenSSL 1.0.2 and
// removed for OpenSSL 1.1.0
if (!SSL_CTX_set_ecdh_auto(self->ctx, 1))
{
LOG(LOG_LEVEL_WARNING, "TLS ecdh auto failed to be enabled");
Expand Down
5 changes: 3 additions & 2 deletions common/string_calls.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ g_atoix(const char *str)
str += 2;
base = 16;
}
//coverity[OVERRUN:FALSE]
return strtol(str, NULL, base);
}

Expand Down Expand Up @@ -1190,7 +1191,7 @@ utf8_get_next_char(const char **utf8str_ref, unsigned int *len_ref)
/*
* Macro used to parse a continuation character
* @param cp Character Pointer (incremented on success)
* @param end One character past end of input string
* @param end One character past end of input string, or NULL
* @param value The value we're constructing
* @param finish_label Where to go in the event of an error */
#define PARSE_CONTINUATION_CHARACTER(cp, end, value, finish_label) \
Expand All @@ -1209,7 +1210,7 @@ utf8_get_next_char(const char **utf8str_ref, unsigned int *len_ref)

/* Easier to work with unsigned chars and no indirection */
const unsigned char *cp = (const unsigned char *)*utf8str_ref;
const unsigned char *end = (len_ref != NULL) ? cp + *len_ref : cp + 6;
const unsigned char *end = (len_ref != NULL) ? cp + *len_ref : NULL;

if (cp == end)
{
Expand Down
13 changes: 10 additions & 3 deletions common/thread_calls.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <semaphore.h>
#endif
#include "arch.h"
#include "log.h"
#include "thread_calls.h"
#include "os_calls.h"

Expand Down Expand Up @@ -136,11 +137,17 @@ tc_mutex_lock(tbus mutex)
{
#if defined(_WIN32)
WaitForSingleObject((HANDLE)mutex, INFINITE);
return 0;
#else
pthread_mutex_lock((pthread_mutex_t *)mutex);
return 0;
if (mutex != 0)
{
pthread_mutex_lock((pthread_mutex_t *)mutex);
}
else
{
LOG(LOG_LEVEL_ERROR, "Attempt made to lock NULL mutex");
}
#endif
return 0;
}

/*****************************************************************************/
Expand Down
Loading