|
|
@ -242,16 +242,18 @@ xrdp_wm_ok_clicked(struct xrdp_bitmap *wnd)
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* This is an internal function in this file used to parse the domain information
|
|
|
|
* This is an internal function in this file used to parse the domain
|
|
|
|
* sent from the client.
|
|
|
|
* information sent from the client. If the information starts
|
|
|
|
* If the information starts with '_' the domain field contains the
|
|
|
|
* with '_' the domain field contains the IP/DNS to connect to.
|
|
|
|
* IP/DNS to connect to. If the domain field contains an additional '__' the char
|
|
|
|
* If the domain field contains an additional '__' the char that
|
|
|
|
* that follows this '__' is an index number of a preferred combo choice.
|
|
|
|
* follows this '__' is an index number of a preferred combo choice.
|
|
|
|
* Valid values for this choice is 0-9. But this function will only return index
|
|
|
|
* Valid values for this choice is 0-9. But this function will only return
|
|
|
|
* numbers between 0 and the max number of combo items -1.
|
|
|
|
* index numbers between 0 and the max number of combo items -1.
|
|
|
|
* Example: _192.168.1.2__1 result in a resultbuffer containing 192.168.1.2 and
|
|
|
|
* Example: _192.168.1.2__1 result in a resultbuffer containing
|
|
|
|
* the return value will be 1. Meaning that index 1 is the preferred combo choice.
|
|
|
|
* 192.168.1.2 and the return value will be 1. Meaning that
|
|
|
|
|
|
|
|
* index 1 is the preferred combo choice.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Users can create shortcuts where this information is configured. These
|
|
|
|
* Users can create shortcuts where this information is configured. These
|
|
|
|
* shortcuts simplifies login.
|
|
|
|
* shortcuts simplifies login.
|
|
|
@ -263,51 +265,64 @@ xrdp_wm_ok_clicked(struct xrdp_bitmap *wnd)
|
|
|
|
* @return the index number of the combobox that the user prefer.
|
|
|
|
* @return the index number of the combobox that the user prefer.
|
|
|
|
* 0 if the user does not prefer any choice.
|
|
|
|
* 0 if the user does not prefer any choice.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static int APP_CC xrdp_wm_parse_domain_information(char *orginalDomainInfo, int comboMax, int decode, char *resultBuffer)
|
|
|
|
static int APP_CC
|
|
|
|
|
|
|
|
xrdp_wm_parse_domain_information(char *orginalDomainInfo, int comboMax,
|
|
|
|
|
|
|
|
int decode, char *resultBuffer)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/* If the first char in the domain name is '_' we use the domain name as IP*/
|
|
|
|
int ret;
|
|
|
|
int ret = 0; // default return value
|
|
|
|
int pos;
|
|
|
|
g_memset(resultBuffer, 0, 255);
|
|
|
|
int comboxindex;
|
|
|
|
if(orginalDomainInfo[0]=='_')
|
|
|
|
char index[2];
|
|
|
|
|
|
|
|
char debugstr[256];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* If the first char in the domain name is '_' we use the domain
|
|
|
|
|
|
|
|
name as IP*/
|
|
|
|
|
|
|
|
ret = 0; /* default return value */
|
|
|
|
|
|
|
|
/* resultBuffer assumed to be 256 chars */
|
|
|
|
|
|
|
|
g_memset(resultBuffer, 0, 256);
|
|
|
|
|
|
|
|
if (orginalDomainInfo[0] == '_')
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/* we try to locate a number indicating what combobox index the user prefer
|
|
|
|
/* we try to locate a number indicating what combobox index the user
|
|
|
|
* the information is loaded from domain field, from the client
|
|
|
|
* prefer the information is loaded from domain field, from the client
|
|
|
|
* log_message(LOG_LEVEL_DEBUG, "domain contains _");
|
|
|
|
* log_message(LOG_LEVEL_DEBUG, "domain contains _");
|
|
|
|
* We must use valid chars in the domain name.
|
|
|
|
* We must use valid chars in the domain name.
|
|
|
|
* Underscore is a valid name in the domain.
|
|
|
|
* Underscore is a valid name in the domain.
|
|
|
|
* Invalid chars are ignored in microsoft client therefore we use '_' again.
|
|
|
|
* Invalid chars are ignored in microsoft client therefore we use '_'
|
|
|
|
* this sec '__' contains the split for index.*/
|
|
|
|
* again. this sec '__' contains the split for index.*/
|
|
|
|
int pos = g_pos(&orginalDomainInfo[1],"__");
|
|
|
|
pos = g_pos(&orginalDomainInfo[1], "__");
|
|
|
|
if(pos>0)
|
|
|
|
if (pos > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/* an index is found we try to use it
|
|
|
|
/* an index is found we try to use it
|
|
|
|
log_message(LOG_LEVEL_DEBUG, "domain contains index char __");*/
|
|
|
|
log_message(LOG_LEVEL_DEBUG, "domain contains index char __");*/
|
|
|
|
if(decode)
|
|
|
|
if (decode)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
char index[2] ;
|
|
|
|
g_memset(index, 0, 2);
|
|
|
|
char debugstr[256] ;
|
|
|
|
/* we just accept values 0-9 (one figure) */
|
|
|
|
g_memset(index, 0, 2) ;
|
|
|
|
g_strncpy(index, &orginalDomainInfo[pos + 3], 1);
|
|
|
|
int comboxindex ;
|
|
|
|
comboxindex = g_htoi(index);
|
|
|
|
g_strncpy(index, &orginalDomainInfo[pos+3], 1); // we just accept values 0-9 (one figure)
|
|
|
|
g_snprintf(debugstr, 255, "Value of index (as char): %s "
|
|
|
|
comboxindex = g_htoi(index) ;
|
|
|
|
"(converted) : %d (max) : %d", index, comboxindex,
|
|
|
|
g_sprintf(debugstr, "Value of index (as char): %s (converted) : %d (max) : %d",index,comboxindex,comboMax-1);
|
|
|
|
comboMax - 1);
|
|
|
|
log_message(LOG_LEVEL_DEBUG, debugstr);
|
|
|
|
debugstr[255] = 0;
|
|
|
|
if(comboxindex>0 && comboxindex<comboMax) // limit to max number of items in combo box
|
|
|
|
log_message(LOG_LEVEL_DEBUG, debugstr);
|
|
|
|
{
|
|
|
|
/* limit to max number of items in combo box */
|
|
|
|
log_message(LOG_LEVEL_DEBUG, "domain contains a valid index number");
|
|
|
|
if ((comboxindex > 0) && (comboxindex < comboMax))
|
|
|
|
ret = comboxindex ; // preferred index for combo box.
|
|
|
|
{
|
|
|
|
}
|
|
|
|
log_message(LOG_LEVEL_DEBUG, "domain contains a valid "
|
|
|
|
}
|
|
|
|
"index number");
|
|
|
|
// pos limit the String to only contain the IP
|
|
|
|
ret = comboxindex; /* preferred index for combo box. */
|
|
|
|
g_strncpy(resultBuffer, &orginalDomainInfo[1], pos);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
/* pos limit the String to only contain the IP */
|
|
|
|
{
|
|
|
|
g_strncpy(resultBuffer, &orginalDomainInfo[1], pos);
|
|
|
|
//log_message(LOG_LEVEL_DEBUG, "domain does not contain _");
|
|
|
|
}
|
|
|
|
g_strncpy(resultBuffer, &orginalDomainInfo[1], 255);
|
|
|
|
else
|
|
|
|
}
|
|
|
|
{
|
|
|
|
|
|
|
|
/* log_message(LOG_LEVEL_DEBUG, "domain does not contain _"); */
|
|
|
|
|
|
|
|
g_strncpy(resultBuffer, &orginalDomainInfo[1], 255);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ret ;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
/******************************************************************************/
|
|
|
@ -323,6 +338,7 @@ xrdp_wm_show_edits(struct xrdp_wm *self, struct xrdp_bitmap *combo)
|
|
|
|
struct xrdp_mod_data *mod;
|
|
|
|
struct xrdp_mod_data *mod;
|
|
|
|
struct xrdp_bitmap *b;
|
|
|
|
struct xrdp_bitmap *b;
|
|
|
|
struct xrdp_cfg_globals *globals;
|
|
|
|
struct xrdp_cfg_globals *globals;
|
|
|
|
|
|
|
|
char resultIP[256];
|
|
|
|
|
|
|
|
|
|
|
|
globals = &self->xrdp_config->cfg_globals;
|
|
|
|
globals = &self->xrdp_config->cfg_globals;
|
|
|
|
|
|
|
|
|
|
|
@ -337,7 +353,7 @@ xrdp_wm_show_edits(struct xrdp_wm *self, struct xrdp_bitmap *combo)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
insert_index = list_index_of(self->login_window->child_list,
|
|
|
|
insert_index = list_index_of(self->login_window->child_list,
|
|
|
|
(long)combo); // find combo in the list
|
|
|
|
(long)combo); /* find combo in the list */
|
|
|
|
insert_index++;
|
|
|
|
insert_index++;
|
|
|
|
mod = (struct xrdp_mod_data *)
|
|
|
|
mod = (struct xrdp_mod_data *)
|
|
|
|
list_get_item(combo->data_list, combo->item_index);
|
|
|
|
list_get_item(combo->data_list, combo->item_index);
|
|
|
@ -391,15 +407,17 @@ xrdp_wm_show_edits(struct xrdp_wm *self, struct xrdp_bitmap *combo)
|
|
|
|
self->login_window->focused_control = b;
|
|
|
|
self->login_window->focused_control = b;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*Use the domain name as the destination IP/DNS
|
|
|
|
/* Use the domain name as the destination IP/DNS
|
|
|
|
This is useful in a gateway setup.*/
|
|
|
|
This is useful in a gateway setup. */
|
|
|
|
if (g_strncmp(name, "ip", 255) == 0)
|
|
|
|
if (g_strncmp(name, "ip", 255) == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/* If the first char in the domain name is '_' we use the domain name as IP*/
|
|
|
|
/* If the first char in the domain name is '_' we use the
|
|
|
|
if(self->session->client_info->domain[0]=='_')
|
|
|
|
domain name as IP */
|
|
|
|
|
|
|
|
if (self->session->client_info->domain[0] == '_')
|
|
|
|
{
|
|
|
|
{
|
|
|
|
char resultIP[256];
|
|
|
|
xrdp_wm_parse_domain_information(
|
|
|
|
xrdp_wm_parse_domain_information(self->session->client_info->domain,combo->data_list->count,0,resultIP);
|
|
|
|
self->session->client_info->domain,
|
|
|
|
|
|
|
|
combo->data_list->count, 0, resultIP);
|
|
|
|
g_strncpy(b->caption1, resultIP, 255);
|
|
|
|
g_strncpy(b->caption1, resultIP, 255);
|
|
|
|
b->edit_pos = g_mbstowcs(0, b->caption1, 0);
|
|
|
|
b->edit_pos = g_mbstowcs(0, b->caption1, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -596,6 +614,7 @@ xrdp_login_wnd_create(struct xrdp_wm *self)
|
|
|
|
|
|
|
|
|
|
|
|
char buf[256];
|
|
|
|
char buf[256];
|
|
|
|
char buf1[256];
|
|
|
|
char buf1[256];
|
|
|
|
|
|
|
|
char resultIP[256];
|
|
|
|
int log_width;
|
|
|
|
int log_width;
|
|
|
|
int log_height;
|
|
|
|
int log_height;
|
|
|
|
int regular;
|
|
|
|
int regular;
|
|
|
@ -652,9 +671,9 @@ xrdp_login_wnd_create(struct xrdp_wm *self)
|
|
|
|
|
|
|
|
|
|
|
|
if (regular)
|
|
|
|
if (regular)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Load the background image.
|
|
|
|
/* Load the background image. */
|
|
|
|
// If no file is specified no default image will be loaded.
|
|
|
|
/* If no file is specified no default image will be loaded. */
|
|
|
|
// We only load the image if bpp > 8
|
|
|
|
/* We only load the image if bpp > 8 */
|
|
|
|
if (globals->ls_background_image[0] != 0 && self->screen->bpp > 8)
|
|
|
|
if (globals->ls_background_image[0] != 0 && self->screen->bpp > 8)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
char fileName[256] ;
|
|
|
|
char fileName[256] ;
|
|
|
@ -739,8 +758,10 @@ xrdp_login_wnd_create(struct xrdp_wm *self)
|
|
|
|
* parameter: 1 = decode domain field index information from client.
|
|
|
|
* parameter: 1 = decode domain field index information from client.
|
|
|
|
* We only perform this the first time for each connection.
|
|
|
|
* We only perform this the first time for each connection.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
char resultIP[256]; // just a dummy place holder, we ignore
|
|
|
|
combo->item_index = xrdp_wm_parse_domain_information(
|
|
|
|
combo->item_index = xrdp_wm_parse_domain_information(self->session->client_info->domain,combo->data_list->count,1,resultIP);
|
|
|
|
self->session->client_info->domain,
|
|
|
|
|
|
|
|
combo->data_list->count, 1,
|
|
|
|
|
|
|
|
resultIP /* just a dummy place holder, we ignore */ );
|
|
|
|
xrdp_wm_show_edits(self, combo);
|
|
|
|
xrdp_wm_show_edits(self, combo);
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|