Merge branch 'neutrinolabs:devel' into devel

This commit is contained in:
bin zhong 2022-02-15 09:52:28 +08:00 committed by GitHub
commit f8f18e27c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 66 additions and 18 deletions

View File

@ -495,6 +495,11 @@ internal_log_config_copy(struct log_config *dest, const struct log_config *src)
{ {
int i; int i;
if (src == NULL || dest == NULL)
{
return;
}
dest->enable_syslog = src->enable_syslog; dest->enable_syslog = src->enable_syslog;
dest->fd = src->fd; dest->fd = src->fd;
dest->log_file = g_strdup(src->log_file); dest->log_file = g_strdup(src->log_file);
@ -508,6 +513,21 @@ internal_log_config_copy(struct log_config *dest, const struct log_config *src)
dest->console_level = src->console_level; dest->console_level = src->console_level;
dest->enable_pid = src->enable_pid; dest->enable_pid = src->enable_pid;
dest->dump_on_start = src->dump_on_start; dest->dump_on_start = src->dump_on_start;
if (src->per_logger_level == NULL)
{
return;
}
if (dest->per_logger_level == NULL)
{
dest->per_logger_level = list_create();
if (dest->per_logger_level == NULL)
{
return;
}
dest->per_logger_level->auto_free = 1;
}
for (i = 0; i < src->per_logger_level->count; ++i) for (i = 0; i < src->per_logger_level->count; ++i)
{ {
struct log_logger_level *dst_logger = struct log_logger_level *dst_logger =

View File

@ -89,9 +89,6 @@ parser_stream_overflow_check(const struct stream *s, int n, int is_out,
# define S_CHECK_REM_OUT(s,n) # define S_CHECK_REM_OUT(s,n)
#endif #endif
/******************************************************************************/
#define s_check(s) s_check_rem(s, 0)
/******************************************************************************/ /******************************************************************************/
#define s_check_rem(s, n) ((s)->p + (n) <= (s)->end) #define s_check_rem(s, n) ((s)->p + (n) <= (s)->end)

View File

@ -45,6 +45,7 @@ libxrdp_la_SOURCES = \
xrdp_bitmap_compress.c \ xrdp_bitmap_compress.c \
xrdp_caps.c \ xrdp_caps.c \
xrdp_channel.c \ xrdp_channel.c \
xrdp_channel.h \
xrdp_fastpath.c \ xrdp_fastpath.c \
xrdp_iso.c \ xrdp_iso.c \
xrdp_jpeg_compress.c \ xrdp_jpeg_compress.c \

View File

@ -24,6 +24,7 @@
#include "libxrdp.h" #include "libxrdp.h"
#include "string_calls.h" #include "string_calls.h"
#include "xrdp_channel.h"
#define CMD_DVC_OPEN_CHANNEL 0x10 #define CMD_DVC_OPEN_CHANNEL 0x10
#define CMD_DVC_DATA_FIRST 0x20 #define CMD_DVC_DATA_FIRST 0x20
@ -31,19 +32,6 @@
#define CMD_DVC_CLOSE_CHANNEL 0x40 #define CMD_DVC_CLOSE_CHANNEL 0x40
#define CMD_DVC_CAPABILITY 0x50 #define CMD_DVC_CAPABILITY 0x50
#define XRDP_DRDYNVC_STATUS_CLOSED 0
#define XRDP_DRDYNVC_STATUS_OPEN_SENT 1
#define XRDP_DRDYNVC_STATUS_OPEN 2
#define XRDP_DRDYNVC_STATUS_CLOSE_SENT 3
#define XRDP_DRDYNVC_STATUS_TO_STR(status) \
((status) == XRDP_DRDYNVC_STATUS_CLOSED ? "CLOSED" : \
(status) == XRDP_DRDYNVC_STATUS_OPEN_SENT ? "OPEN_SENT" : \
(status) == XRDP_DRDYNVC_STATUS_OPEN ? "OPEN" : \
(status) == XRDP_DRDYNVC_STATUS_CLOSE_SENT ? "CLOSE_SENT" : \
"unknown" \
)
#define XRDP_DRDYNVC_CHANNEL_ID_TO_NAME(self, chan_id) \ #define XRDP_DRDYNVC_CHANNEL_ID_TO_NAME(self, chan_id) \
(xrdp_channel_get_item((self), (chan_id)) != NULL \ (xrdp_channel_get_item((self), (chan_id)) != NULL \
? xrdp_channel_get_item((self), (chan_id))->name \ ? xrdp_channel_get_item((self), (chan_id))->name \

42
libxrdp/xrdp_channel.h Normal file
View File

@ -0,0 +1,42 @@
/**
* xrdp: A Remote Desktop Protocol server.
*
* MS-RDPEDYC : Definitions related to documentation in [MS-RDPEDYC]
*
* 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-RDPEDYC are currently correct for v20210406 of that
* document
*/
#if !defined(XRDP_CHANNEL_H)
#define XRDP_CHANNEL_H
/*
These are not directly defined in MS-RDPEDYC, but
they are derived statuses needed to implement it.
*/
#define XRDP_DRDYNVC_STATUS_CLOSED 0
#define XRDP_DRDYNVC_STATUS_OPEN_SENT 1
#define XRDP_DRDYNVC_STATUS_OPEN 2
#define XRDP_DRDYNVC_STATUS_CLOSE_SENT 3
#define XRDP_DRDYNVC_STATUS_TO_STR(status) \
((status) == XRDP_DRDYNVC_STATUS_CLOSED ? "CLOSED" : \
(status) == XRDP_DRDYNVC_STATUS_OPEN_SENT ? "OPEN_SENT" : \
(status) == XRDP_DRDYNVC_STATUS_OPEN ? "OPEN" : \
(status) == XRDP_DRDYNVC_STATUS_CLOSE_SENT ? "CLOSE_SENT" : \
"unknown" \
)
#endif /* XRDP_CHANNEL_H */

View File

@ -1334,7 +1334,7 @@ clipboard_process_data_response(struct stream *s, int clip_msg_status,
return 0; return 0;
} }
index = 0; index = 0;
while (s_check(s)) while (s_check_rem(s, 2))
{ {
in_uint16_le(s, wchr); in_uint16_le(s, wchr);
wtext[index] = wchr; wtext[index] = wchr;

View File

@ -575,7 +575,7 @@ handle_cb_format_data_response(struct vnc *v, struct stream *s)
{ {
case CF_TEXT: case CF_TEXT:
lastc = '\0'; lastc = '\0';
while (s_check(s)) while (s_check_rem(s, 1))
{ {
in_uint8(s, c); in_uint8(s, c);
if (c == '\n' && lastc == '\r') if (c == '\n' && lastc == '\r')