Introduce instance_name field into xrdp.ini and xrdp-sesrun, along with
the N policy in sesman.ini, allowing xrdp sessions to be tagged with an instance name to enable persistent association with a specific xrdp instance, to allow experiences where users reconnect to specific sessions based on e.g. the xrdp listening port used.
This commit is contained in:
+10
-6
@@ -279,19 +279,21 @@ eicp_send_create_session_request(struct trans *trans,
|
||||
unsigned short height,
|
||||
unsigned char bpp,
|
||||
const char *shell,
|
||||
const char *directory)
|
||||
const char *directory,
|
||||
const char *instance_name)
|
||||
{
|
||||
return libipm_msg_out_simple_send(
|
||||
trans,
|
||||
(int)E_EICP_CREATE_SESSION_REQUEST,
|
||||
"uyqqyss",
|
||||
"uyqqysss",
|
||||
display,
|
||||
type,
|
||||
width,
|
||||
height,
|
||||
bpp,
|
||||
shell,
|
||||
directory);
|
||||
directory,
|
||||
instance_name);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -304,7 +306,8 @@ eicp_get_create_session_request(struct trans *trans,
|
||||
unsigned short *height,
|
||||
unsigned char *bpp,
|
||||
const char **shell,
|
||||
const char **directory)
|
||||
const char **directory,
|
||||
const char **instance_name)
|
||||
{
|
||||
/* Intermediate values */
|
||||
uint32_t i_display;
|
||||
@@ -315,14 +318,15 @@ eicp_get_create_session_request(struct trans *trans,
|
||||
|
||||
int rv = libipm_msg_in_parse(
|
||||
trans,
|
||||
"uyqqyss",
|
||||
"uyqqysss",
|
||||
&i_display,
|
||||
&i_type,
|
||||
&i_width,
|
||||
&i_height,
|
||||
&i_bpp,
|
||||
shell,
|
||||
directory);
|
||||
directory,
|
||||
instance_name);
|
||||
|
||||
if (rv == 0)
|
||||
{
|
||||
|
||||
+6
-2
@@ -279,6 +279,7 @@ eicp_send_logout_request(struct trans *trans);
|
||||
* @param bpp Session bits-per-pixel (ignored for Xorg sessions)
|
||||
* @param shell User program to run. May be ""
|
||||
* @param directory Directory to run the program in. May be ""
|
||||
* @param instance_name Name of xrdp instance. May be ""
|
||||
* @return != 0 for error
|
||||
*
|
||||
* The UID for the session must have been set by a previous call.
|
||||
@@ -298,7 +299,8 @@ eicp_send_create_session_request(struct trans *trans,
|
||||
unsigned short height,
|
||||
unsigned char bpp,
|
||||
const char *shell,
|
||||
const char *directory);
|
||||
const char *directory,
|
||||
const char *instance_name);
|
||||
|
||||
|
||||
/**
|
||||
@@ -312,6 +314,7 @@ eicp_send_create_session_request(struct trans *trans,
|
||||
* @param[out] bpp Session bits-per-pixel (ignored for Xorg sessions)
|
||||
* @param[out] shell User program to run. May be ""
|
||||
* @param[out] directory Directory to run the program in. May be ""
|
||||
* @param[out] instance_name Name of xrdp instance. May be ""
|
||||
* @return != 0 for error
|
||||
*
|
||||
* Returned string pointers are valid until scp_msg_in_reset() is
|
||||
@@ -325,7 +328,8 @@ eicp_get_create_session_request(struct trans *trans,
|
||||
unsigned short *height,
|
||||
unsigned char *bpp,
|
||||
const char **shell,
|
||||
const char **directory);
|
||||
const char **directory,
|
||||
const char **instance_name);
|
||||
|
||||
/**
|
||||
* Send an E_EICP_CREATE_SESSION_RESPONSE
|
||||
|
||||
+10
-6
@@ -155,14 +155,15 @@ ercp_send_session_announce_event(struct trans *trans,
|
||||
unsigned char bpp,
|
||||
const struct guid *guid,
|
||||
const char *start_ip_addr,
|
||||
time_t start_time)
|
||||
time_t start_time,
|
||||
const char *instance_name)
|
||||
{
|
||||
struct libipm_fsb guid_descriptor = { (void *)guid, sizeof(*guid) };
|
||||
|
||||
return libipm_msg_out_simple_send(
|
||||
trans,
|
||||
(int)E_ERCP_SESSION_ANNOUNCE_EVENT,
|
||||
"uiyqqyBsx",
|
||||
"uiyqqyBsxs",
|
||||
display,
|
||||
uid,
|
||||
type,
|
||||
@@ -171,7 +172,8 @@ ercp_send_session_announce_event(struct trans *trans,
|
||||
bpp,
|
||||
&guid_descriptor,
|
||||
start_ip_addr,
|
||||
(int64_t)start_time);
|
||||
(int64_t)start_time,
|
||||
instance_name);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -186,7 +188,8 @@ ercp_get_session_announce_event(struct trans *trans,
|
||||
unsigned char *bpp,
|
||||
struct guid *guid,
|
||||
const char **start_ip_addr,
|
||||
time_t *start_time)
|
||||
time_t *start_time,
|
||||
const char **instance_name)
|
||||
{
|
||||
/* Intermediate values */
|
||||
uint32_t i_display;
|
||||
@@ -201,7 +204,7 @@ ercp_get_session_announce_event(struct trans *trans,
|
||||
|
||||
int rv = libipm_msg_in_parse(
|
||||
trans,
|
||||
"uiyqqyBsx",
|
||||
"uiyqqyBsxs",
|
||||
&i_display,
|
||||
&i_uid,
|
||||
&i_type,
|
||||
@@ -210,7 +213,8 @@ ercp_get_session_announce_event(struct trans *trans,
|
||||
&i_bpp,
|
||||
&guid_descriptor,
|
||||
start_ip_addr,
|
||||
&i_start_time);
|
||||
&i_start_time,
|
||||
instance_name);
|
||||
|
||||
if (rv == 0)
|
||||
{
|
||||
|
||||
+7
-3
@@ -172,7 +172,8 @@ ercp_msg_in_reset(struct trans *trans);
|
||||
* @param guid Session GUID
|
||||
* @param start_ip_addr Starting IP address of client
|
||||
* @param start_time Session start time
|
||||
* @return != 0 for error
|
||||
* @param instance_name Name of xrdp instance
|
||||
* * @return != 0 for error
|
||||
*/
|
||||
int
|
||||
ercp_send_session_announce_event(struct trans *trans,
|
||||
@@ -184,7 +185,8 @@ ercp_send_session_announce_event(struct trans *trans,
|
||||
unsigned char bpp,
|
||||
const struct guid *guid,
|
||||
const char *start_ip_addr,
|
||||
time_t start_time);
|
||||
time_t start_time,
|
||||
const char *instance_name);
|
||||
|
||||
|
||||
/**
|
||||
@@ -202,6 +204,7 @@ ercp_send_session_announce_event(struct trans *trans,
|
||||
* @param[out] guid Session GUID
|
||||
* @param[out] start_ip_addr Starting IP address of client
|
||||
* @param[out] start_time Session start time
|
||||
* @param[out] instance_name Name of xrdp instance
|
||||
* @return != 0 for error
|
||||
*/
|
||||
int
|
||||
@@ -214,7 +217,8 @@ ercp_get_session_announce_event(struct trans *trans,
|
||||
unsigned char *bpp,
|
||||
struct guid *guid,
|
||||
const char **start_ip_addr,
|
||||
time_t *start_time);
|
||||
time_t *start_time,
|
||||
const char **instance_name);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
+20
-11
@@ -419,18 +419,20 @@ scp_send_create_session_request(struct trans *trans,
|
||||
unsigned short height,
|
||||
unsigned char bpp,
|
||||
const char *shell,
|
||||
const char *directory)
|
||||
const char *directory,
|
||||
const char *instance_name)
|
||||
{
|
||||
return libipm_msg_out_simple_send(
|
||||
trans,
|
||||
(int)E_SCP_CREATE_SESSION_REQUEST,
|
||||
"yqqyss",
|
||||
"yqqysss",
|
||||
type,
|
||||
width,
|
||||
height,
|
||||
bpp,
|
||||
shell,
|
||||
directory);
|
||||
directory,
|
||||
instance_name);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -442,7 +444,8 @@ scp_get_create_session_request(struct trans *trans,
|
||||
unsigned short *height,
|
||||
unsigned char *bpp,
|
||||
const char **shell,
|
||||
const char **directory)
|
||||
const char **directory,
|
||||
const char **instance_name)
|
||||
{
|
||||
/* Intermediate values */
|
||||
uint8_t i_type;
|
||||
@@ -452,13 +455,14 @@ scp_get_create_session_request(struct trans *trans,
|
||||
|
||||
int rv = libipm_msg_in_parse(
|
||||
trans,
|
||||
"yqqyss",
|
||||
"yqqysss",
|
||||
&i_type,
|
||||
&i_width,
|
||||
&i_height,
|
||||
&i_bpp,
|
||||
shell,
|
||||
directory);
|
||||
directory,
|
||||
instance_name);
|
||||
|
||||
if (rv == 0)
|
||||
{
|
||||
@@ -743,7 +747,7 @@ scp_send_list_sessions_response(
|
||||
rv = libipm_msg_out_simple_send(
|
||||
trans,
|
||||
(int)E_SCP_LIST_SESSIONS_RESPONSE,
|
||||
"iiuyqqyxisssx",
|
||||
"iiuyqqyxisssxs",
|
||||
status,
|
||||
info->sid,
|
||||
info->display,
|
||||
@@ -756,7 +760,8 @@ scp_send_list_sessions_response(
|
||||
info->start_ip_addr,
|
||||
info->client_ip,
|
||||
info->client_name,
|
||||
(int64_t)info->last_connect_disconnect);
|
||||
(int64_t)info->last_connect_disconnect,
|
||||
info->xrdp_instance_name);
|
||||
}
|
||||
|
||||
return rv;
|
||||
@@ -797,10 +802,11 @@ scp_get_list_sessions_response(
|
||||
char *i_client_ip;
|
||||
char *i_client_name;
|
||||
int64_t i_last_connect_disconnect;
|
||||
char *i_instance_name;
|
||||
|
||||
rv = libipm_msg_in_parse(
|
||||
trans,
|
||||
"iuyqqyxisssx",
|
||||
"iuyqqyxisssxs",
|
||||
&i_sid,
|
||||
&i_display,
|
||||
&i_type,
|
||||
@@ -812,7 +818,8 @@ scp_get_list_sessions_response(
|
||||
&i_start_ip_addr,
|
||||
&i_client_ip,
|
||||
&i_client_name,
|
||||
&i_last_connect_disconnect);
|
||||
&i_last_connect_disconnect,
|
||||
&i_instance_name);
|
||||
|
||||
if (rv == 0)
|
||||
{
|
||||
@@ -821,7 +828,8 @@ scp_get_list_sessions_response(
|
||||
unsigned int len = sizeof(struct scp_session_info) +
|
||||
g_strlen(i_start_ip_addr) + 1 +
|
||||
g_strlen(i_client_ip) + 1 +
|
||||
g_strlen(i_client_name) + 1;
|
||||
g_strlen(i_client_name) + 1 +
|
||||
g_strlen(i_instance_name) + 1;
|
||||
if ((p = (struct scp_session_info *)g_malloc(len, 1)) == NULL)
|
||||
{
|
||||
*status = E_SCP_LS_NO_MEMORY;
|
||||
@@ -851,6 +859,7 @@ scp_get_list_sessions_response(
|
||||
COPY_STRING(p->client_ip, i_client_ip);
|
||||
COPY_STRING(p->client_name, i_client_name);
|
||||
p->last_connect_disconnect = i_last_connect_disconnect;
|
||||
COPY_STRING(p->xrdp_instance_name, i_instance_name);
|
||||
#undef COPY_STRING
|
||||
}
|
||||
}
|
||||
|
||||
+6
-2
@@ -344,6 +344,7 @@ scp_send_logout_request(struct trans *trans);
|
||||
* @param bpp Session bits-per-pixel (ignored for Xorg sessions)
|
||||
* @param shell User program to run. May be ""
|
||||
* @param directory Directory to run the program in. May be ""
|
||||
* @param instance_name Name of xrdp instance. May be ""
|
||||
* @return != 0 for error
|
||||
*
|
||||
* Server replies with E_SCP_CREATE_SESSION_RESPONSE
|
||||
@@ -355,7 +356,8 @@ scp_send_create_session_request(struct trans *trans,
|
||||
unsigned short height,
|
||||
unsigned char bpp,
|
||||
const char *shell,
|
||||
const char *directory);
|
||||
const char *directory,
|
||||
const char *instance_name);
|
||||
|
||||
|
||||
/**
|
||||
@@ -368,6 +370,7 @@ scp_send_create_session_request(struct trans *trans,
|
||||
* @param[out] bpp Session bits-per-pixel (ignored for Xorg sessions)
|
||||
* @param[out] shell User program to run. May be ""
|
||||
* @param[out] directory Directory to run the program in. May be ""
|
||||
* @param[out] instance_name Name of xrdp instance. May be ""
|
||||
* @return != 0 for error
|
||||
*
|
||||
* Returned string pointers are valid until scp_msg_in_reset() is
|
||||
@@ -380,7 +383,8 @@ scp_get_create_session_request(struct trans *trans,
|
||||
unsigned short *height,
|
||||
unsigned char *bpp,
|
||||
const char **shell,
|
||||
const char **directory);
|
||||
const char **directory,
|
||||
const char **instance_name);
|
||||
|
||||
/**
|
||||
* Send an E_SCP_CREATE_SESSION_RESPONSE (SCP server)
|
||||
|
||||
@@ -61,7 +61,8 @@ struct scp_session_info
|
||||
char *start_ip_addr; ///< IP address of starting client
|
||||
char *client_ip; ///< Current client IP
|
||||
char *client_name; ///< Current client name
|
||||
time_t last_connect_disconnect; ///< Time of last client connect/disconnect
|
||||
time_t last_connect_disconnect; ///< Time of last client connect/disconnect}
|
||||
char *xrdp_instance_name; ///< Name of xrdp instance
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user