Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/neutrinolabs/xrdp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBolke de Bruin <bolke@xs4all.nl>2020-08-30 22:20:21 +0300
committerBolke de Bruin <bolke@xs4all.nl>2020-08-30 22:56:16 +0300
commita6a0e5e004dad5166b6b9b42bba7653ba363a40e (patch)
tree034b54dfcd0a434fc41725e9e82921281bfe35a6 /libxrdp
parentb0bca1363e9ec9338c805efbcd100b79d10da296 (diff)
Allow domain name to be concatenated to username
If a server is multihomed (i.e. mutiple domains) the users are identified by their domain name. This change allows to concat the domain name to the username with a specific separator.
Diffstat (limited to 'libxrdp')
-rw-r--r--libxrdp/xrdp_rdp.c6
-rw-r--r--libxrdp/xrdp_sec.c17
2 files changed, 17 insertions, 6 deletions
diff --git a/libxrdp/xrdp_rdp.c b/libxrdp/xrdp_rdp.c
index 629dd88b..9167eaf1 100644
--- a/libxrdp/xrdp_rdp.c
+++ b/libxrdp/xrdp_rdp.c
@@ -280,7 +280,11 @@ xrdp_rdp_read_config(struct xrdp_client_info *client_info)
client_info->key_file, g_get_strerror());
}
}
-
+ else if (g_strcasecmp(item, "domain_user_separator") == 0
+ && g_strlen(value) > 0)
+ {
+ g_strncpy(client_info->domain_user_separator, value, sizeof(client_info->domain_user_separator) - 1);
+ }
}
list_delete(items);
diff --git a/libxrdp/xrdp_sec.c b/libxrdp/xrdp_sec.c
index fde6f110..7317c639 100644
--- a/libxrdp/xrdp_sec.c
+++ b/libxrdp/xrdp_sec.c
@@ -738,7 +738,7 @@ xrdp_sec_process_logon_info(struct xrdp_sec *self, struct stream *s)
if (len_domain >= INFO_CLIENT_MAX_CB_LEN)
{
- DEBUG(("ERROR [xrdp_sec_process_logon_info()]: len_domain > 511"));
+ DEBUG(("ERROR [xrdp_sec_process_logon_info()]: len_domain >= %d", INFO_CLIENT_MAX_CB_LEN));
return 1;
}
@@ -760,7 +760,7 @@ xrdp_sec_process_logon_info(struct xrdp_sec *self, struct stream *s)
if (len_user >= INFO_CLIENT_MAX_CB_LEN)
{
- DEBUG(("ERROR [xrdp_sec_process_logon_info()]: len_user > 511"));
+ DEBUG(("ERROR [xrdp_sec_process_logon_info()]: len_user >= %d", INFO_CLIENT_MAX_CB_LEN));
return 1;
}
@@ -772,7 +772,7 @@ xrdp_sec_process_logon_info(struct xrdp_sec *self, struct stream *s)
if (len_password >= INFO_CLIENT_MAX_CB_LEN)
{
- DEBUG(("ERROR [xrdp_sec_process_logon_info()]: len_password > 511"));
+ DEBUG(("ERROR [xrdp_sec_process_logon_info()]: len_password >= %d", INFO_CLIENT_MAX_CB_LEN));
return 1;
}
@@ -784,7 +784,7 @@ xrdp_sec_process_logon_info(struct xrdp_sec *self, struct stream *s)
if (len_program >= INFO_CLIENT_MAX_CB_LEN)
{
- DEBUG(("ERROR [xrdp_sec_process_logon_info()]: len_program > 511"));
+ DEBUG(("ERROR [xrdp_sec_process_logon_info()]: len_program >= %d", INFO_CLIENT_MAX_CB_LEN));
return 1;
}
@@ -796,7 +796,7 @@ xrdp_sec_process_logon_info(struct xrdp_sec *self, struct stream *s)
if (len_directory >= INFO_CLIENT_MAX_CB_LEN)
{
- DEBUG(("ERROR [xrdp_sec_process_logon_info()]: len_directory > 511"));
+ DEBUG(("ERROR [xrdp_sec_process_logon_info()]: len_directory >= %d", INFO_CLIENT_MAX_CB_LEN));
return 1;
}
@@ -842,6 +842,13 @@ xrdp_sec_process_logon_info(struct xrdp_sec *self, struct stream *s)
return 1; /* credentials on cmd line is mandatory */
}
}
+ if (self->rdp_layer->client_info.domain_user_separator[0] != '\0'
+ && self->rdp_layer->client_info.domain[0] != '\0')
+ {
+ int size = sizeof(self->rdp_layer->client_info.username);
+ g_strncat(self->rdp_layer->client_info.username, self->rdp_layer->client_info.domain_user_separator, size - 1 - g_strlen(self->rdp_layer->client_info.domain_user_separator));
+ g_strncat(self->rdp_layer->client_info.username, self->rdp_layer->client_info.domain, size - 1 - g_strlen(self->rdp_layer->client_info.domain));
+ }
DEBUG(("username %s", self->rdp_layer->client_info.username));
if (unicode_utf16_in(s, len_program, self->rdp_layer->client_info.program, sizeof(self->rdp_layer->client_info.program) - 1) != 0)