Merge pull request #3088 from matt335672/v0_10_cherry_picks

Further cherry-picks for v0.10
This commit is contained in:
metalefty 2024-06-17 21:07:34 +09:00 committed by GitHub
commit 7aa2b34ca0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 53 additions and 35 deletions

View File

@ -4,7 +4,7 @@ FreeBSD_task:
SSL: libressl
matrix:
freebsd_instance:
image_family: freebsd-13-2
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 nasm fusefs-libs check imlib2 freetype2 cmocka
- git submodule update --init --recursive

View File

@ -2,7 +2,7 @@
Description=xrdp daemon
Documentation=man:xrdp(8) man:xrdp.ini(5)
Requires=xrdp-sesman.service
After=network.target xrdp-sesman.service
After=network-online.target xrdp-sesman.service
[Service]
Type=exec

View File

@ -540,10 +540,25 @@ xfuse_init(void)
return -1;
}
g_snprintf(g_fuse_clipboard_path, 255, "%s/.clipboard", g_fuse_root_path);
g_snprintf(g_fuse_clipboard_path, sizeof(g_fuse_clipboard_path),
"%s/.clipboard", g_fuse_root_path);
/* if FUSE mount point does not exist, create it */
if (!g_directory_exist(g_fuse_root_path))
{
(void)g_create_path(g_fuse_root_path);
if (!g_create_dir(g_fuse_root_path))
{
LOG(LOG_LEVEL_ERROR, "mkdir %s failed (%s)",
g_fuse_root_path, g_get_strerror());
return -1;
}
}
/* Get the characteristics of the parent directory of the FUSE mount
* point. Used by xfuse_path_in_xfuse_fs() */
g_fuse_root_parent_dev = -1;
g_fuse_root_parent_ino = -1;
p = (char *)g_strrchr(g_fuse_root_path, '/');
if (p != NULL)
{
@ -554,11 +569,6 @@ xfuse_init(void)
g_fuse_root_parent_ino = g_file_get_inode_num(g_fuse_root_path);
*p = '/';
}
else
{
g_fuse_root_parent_dev = -1;
g_fuse_root_parent_ino = -1;
}
if (g_fuse_root_parent_dev == -1 || g_fuse_root_parent_ino == -1)
{
@ -568,18 +578,6 @@ xfuse_init(void)
return -1;
}
/* if FUSE mount point does not exist, create it */
if (!g_directory_exist(g_fuse_root_path))
{
(void)g_create_path(g_fuse_root_path);
if (!g_create_dir(g_fuse_root_path))
{
LOG(LOG_LEVEL_ERROR, "mkdir %s failed. If %s is already mounted, you must "
"first unmount it", g_fuse_root_path, g_fuse_root_path);
return -1;
}
}
/* setup xrdp file system */
if (xfuse_init_xrdp_fs())
{
@ -906,14 +904,16 @@ static int xfuse_init_lib(struct fuse_args *args)
{
if (fuse_parse_cmdline(args, &g_mount_point, 0, 0) < 0)
{
LOG_DEVEL(LOG_LEVEL_ERROR, "fuse_parse_cmdline() failed");
LOG(LOG_LEVEL_ERROR, "fuse_parse_cmdline() failed");
fuse_opt_free_args(args);
return -1;
}
if ((g_ch = fuse_mount(g_mount_point, args)) == 0)
{
LOG_DEVEL(LOG_LEVEL_ERROR, "fuse_mount() failed");
LOG(LOG_LEVEL_ERROR, "FUSE mount on %s failed."
" If %s is already mounted, you must first unmount it",
g_mount_point, g_mount_point);
fuse_opt_free_args(args);
return -1;
}
@ -921,7 +921,7 @@ static int xfuse_init_lib(struct fuse_args *args)
g_se = fuse_lowlevel_new(args, &g_xfuse_ops, sizeof(g_xfuse_ops), 0);
if (g_se == 0)
{
LOG_DEVEL(LOG_LEVEL_ERROR, "fuse_lowlevel_new() failed");
LOG(LOG_LEVEL_ERROR, "fuse_lowlevel_new() failed");
fuse_unmount(g_mount_point, g_ch);
g_ch = 0;
fuse_opt_free_args(args);

View File

@ -209,9 +209,12 @@ x_server_running_check_ports(int display)
/******************************************************************************/
/* Helper function for get_sorted_display_list():qsort() */
static int
icmp(const void *i1, const void *i2)
icmp(const void *v1, const void *v2)
{
return *(const unsigned int *)i2 - *(const unsigned int *)i1;
// Pointers point to unsigned ints
unsigned int i1 = *(unsigned int *)v1;
unsigned int i2 = *(unsigned int *)v2;
return (i1 < i2) ? -1 : (i1 > i2) ? 1 : 0;
}
/******************************************************************************/

View File

@ -82,8 +82,15 @@ static void
xrdp_enc_data_destructor(void *item, void *closure)
{
XRDP_ENC_DATA *enc = (XRDP_ENC_DATA *)item;
g_free(enc->u.sc.drects);
g_free(enc->u.sc.crects);
if (ENC_IS_BIT_SET(enc->flags, ENC_FLAGS_GFX_BIT))
{
g_free(enc->u.gfx.cmd);
}
else
{
g_free(enc->u.sc.drects);
g_free(enc->u.sc.crects);
}
g_free(enc);
}
@ -197,7 +204,8 @@ xrdp_encoder_create(struct xrdp_mm *mm)
g_snprintf(buf, 1024, "xrdp_%8.8x_encoder_event_processed", pid);
self->xrdp_encoder_event_processed = g_create_wait_obj(buf);
g_snprintf(buf, 1024, "xrdp_%8.8x_encoder_term", pid);
self->xrdp_encoder_term = g_create_wait_obj(buf);
self->xrdp_encoder_term_request = g_create_wait_obj(buf);
self->xrdp_encoder_term_done = g_create_wait_obj(buf);
if (client_info->gfx)
{
const char *env_var = g_getenv("XRDP_GFX_FRAMES_IN_FLIGHT");
@ -273,8 +281,12 @@ xrdp_encoder_delete(struct xrdp_encoder *self)
return;
}
/* tell worker thread to shut down */
g_set_wait_obj(self->xrdp_encoder_term);
g_sleep(1000);
g_set_wait_obj(self->xrdp_encoder_term_request);
g_obj_wait(&self->xrdp_encoder_term_done, 1, NULL, 0, 5000);
if (!g_is_wait_obj_set(self->xrdp_encoder_term_done))
{
LOG(LOG_LEVEL_WARNING, "Encoder failed to shut down cleanly");
}
#ifdef XRDP_RFXCODEC
for (index = 0; index < 16; index++)
@ -307,7 +319,8 @@ xrdp_encoder_delete(struct xrdp_encoder *self)
/* destroy wait objects used for signalling */
g_delete_wait_obj(self->xrdp_encoder_event_to_proc);
g_delete_wait_obj(self->xrdp_encoder_event_processed);
g_delete_wait_obj(self->xrdp_encoder_term);
g_delete_wait_obj(self->xrdp_encoder_term_request);
g_delete_wait_obj(self->xrdp_encoder_term_done);
/* cleanup fifos */
fifo_delete(self->fifo_to_proc, NULL);
@ -1120,7 +1133,7 @@ proc_enc_msg(void *arg)
event_to_proc = self->xrdp_encoder_event_to_proc;
term_obj = g_get_term();
lterm_obj = self->xrdp_encoder_term;
lterm_obj = self->xrdp_encoder_term_request;
cont = 1;
while (cont)
@ -1171,6 +1184,7 @@ proc_enc_msg(void *arg)
}
} /* end while (cont) */
g_set_wait_obj(self->xrdp_encoder_term_done);
LOG_DEVEL(LOG_LEVEL_DEBUG, "proc_enc_msg: thread exit");
return 0;
}

View File

@ -24,7 +24,8 @@ struct xrdp_encoder
int max_compressed_bytes;
tbus xrdp_encoder_event_to_proc;
tbus xrdp_encoder_event_processed;
tbus xrdp_encoder_term;
tbus xrdp_encoder_term_request;
tbus xrdp_encoder_term_done;
struct fifo *fifo_to_proc;
struct fifo *fifo_processed;
tbus mutex;

View File

@ -86,7 +86,7 @@ rdp_layout_pt=0x00000816
; <rdp layout name> = <X11 keyboard layout value>
[default_layouts_map]
rdp_layout_us=us
rdp_layout_us_dvorak=dvorak
rdp_layout_us_dvorak=us(dvorak)
rdp_layout_us_dvp=us(dvp)
rdp_layout_dk=dk
rdp_layout_de=de
@ -125,7 +125,7 @@ layouts_map=default_layouts_map
[rdp_layouts_map_mac]
rdp_layout_us=us
rdp_layout_us_dvorak=dvorak
rdp_layout_us_dvorak=us(dvorak)
rdp_layout_us_dvp=us(dvp)
rdp_layout_dk=dk
rdp_layout_de=de