xrdp: for proxy modules, pass target ip to module (if ip passed-in from

client into domain field (starting with _))
This commit is contained in:
speidy 2014-04-11 02:24:17 +03:00
parent 1e631717a0
commit 5ff8aee291
2 changed files with 26 additions and 2 deletions

View File

@ -329,8 +329,8 @@ xrdp_wm_show_edits(struct xrdp_wm *self, struct xrdp_bitmap *combo)
/* If the first char in the domain name is '_' we use the domain name as IP*/
if(self->session->client_info->domain[0]=='_')
{
g_strncpy(b->caption1, &self->session->client_info->domain[1], 255);
b->edit_pos = g_mbstowcs(0, b->caption1, 0);
g_strncpy(b->caption1, &self->session->client_info->domain[1], 255);
b->edit_pos = g_mbstowcs(0, b->caption1, 0);
}
}

View File

@ -540,6 +540,7 @@ xrdp_wm_init(struct xrdp_wm *self)
struct list *values;
char *q;
char *r;
char param[256];
char section_name[256];
char cfg_file[256];
char autorun_name[256];
@ -632,6 +633,29 @@ xrdp_wm_init(struct xrdp_wm *self)
r = self->session->client_info->username;
}
}
else if (g_strncmp("ip", q, 255) == 0)
{
/* if the ip has been asked for by the module, use what the
client says (target ip should be in 'domain' field, when starting with "_")
if the ip has been manually set in the config, use that
instead of what the client says. */
if (g_strncmp("ask", r, 3) == 0)
{
if (self->session->client_info->domain[0] == '_')
{
g_strncpy(param, &self->session->client_info->domain[1], 255);
r = param;
}
}
}
else if (g_strncmp("port", q, 255) == 0)
{
if (g_strncmp("ask3389", r, 7) == 0)
{
r = "3389"; /* use default */
}
}
list_add_item(self->mm->login_names, (long)g_strdup(q));
list_add_item(self->mm->login_values, (long)g_strdup(r));