summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--xrdp/xrdp.h8
-rw-r--r--xrdp/xrdp_bitmap.c10
-rw-r--r--xrdp/xrdp_login_wnd.c34
-rw-r--r--xrdp/xrdp_mm.c22
-rw-r--r--xrdp/xrdp_types.h2
-rw-r--r--xrdp/xrdp_wm.c112
6 files changed, 59 insertions, 129 deletions
diff --git a/xrdp/xrdp.h b/xrdp/xrdp.h
index 18f52f02..0c058c75 100644
--- a/xrdp/xrdp.h
+++ b/xrdp/xrdp.h
@@ -317,13 +317,9 @@ int APP_CC
xrdp_mm_signal(struct xrdp_mm* self);
int APP_CC
-xrdp_mm_setup_mod1(struct xrdp_mm* self,
- struct list* names,
- struct list* values);
+xrdp_mm_setup_mod1(struct xrdp_mm* self);
int APP_CC
-xrdp_mm_setup_mod2(struct xrdp_mm* self,
- struct list* names,
- struct list* values);
+xrdp_mm_setup_mod2(struct xrdp_mm* self);
int DEFAULT_CC
server_begin_update(struct xrdp_mod* mod);
diff --git a/xrdp/xrdp_bitmap.c b/xrdp/xrdp_bitmap.c
index 122fb268..69dd7e69 100644
--- a/xrdp/xrdp_bitmap.c
+++ b/xrdp/xrdp_bitmap.c
@@ -979,6 +979,16 @@ xrdp_bitmap_invalidate(struct xrdp_bitmap* self, struct xrdp_rect* rect)
0, 0);
}
}
+ else
+ {
+ x = 0;
+ y = 0;
+ w = self->wm->screen->width;
+ h = self->wm->screen->height;
+ self->wm->mm->mod->mod_event(self->wm->mm->mod, WM_INVALIDATE,
+ MAKELONG(y, x), MAKELONG(h, w),
+ 0, 0);
+ }
}
}
else
diff --git a/xrdp/xrdp_login_wnd.c b/xrdp/xrdp_login_wnd.c
index ee71008f..8a7523be 100644
--- a/xrdp/xrdp_login_wnd.c
+++ b/xrdp/xrdp_login_wnd.c
@@ -93,15 +93,17 @@ xrdp_wm_popup_notify(struct xrdp_bitmap* wnd,
int APP_CC
xrdp_wm_delete_all_childs(struct xrdp_wm* self)
{
- int i;
+ int index;
struct xrdp_bitmap* b;
+ struct xrdp_rect rect;
- for (i = self->screen->child_list->count - 1; i >= 0; i--)
+ for (index = self->screen->child_list->count - 1; index >= 0; index--)
{
- b = (struct xrdp_bitmap*)list_get_item(self->screen->child_list, i);
+ b = (struct xrdp_bitmap*)list_get_item(self->screen->child_list, index);
+ MAKERECT(rect, b->left, b->top, b->width, b->height);
xrdp_bitmap_delete(b);
+ xrdp_bitmap_invalidate(self->screen, &rect);
}
- xrdp_bitmap_invalidate(self->screen, 0);
return 0;
}
@@ -217,8 +219,6 @@ xrdp_wm_ok_clicked(struct xrdp_bitmap* wnd)
/* gota copy these cause dialog gets freed */
list_append_list_strdup(mod_data->names, wm->mm->login_names, 0);
list_append_list_strdup(mod_data->values, wm->mm->login_values, 0);
- list_add_item(wm->mm->login_names, (long)g_strdup("lib"));
- list_add_item(wm->mm->login_values, (long)g_strdup(mod_data->lib));
wm->login_mode = 2;
}
}
@@ -287,7 +287,7 @@ xrdp_wm_show_edits(struct xrdp_wm* self, struct xrdp_bitmap* combo)
b->pointer = 1;
b->tab_stop = 1;
b->caption1 = (char*)g_malloc(256, 1);
- g_strcpy(b->caption1, value + 3);
+ g_strncpy(b->caption1, value + 3, 255);
b->edit_pos = g_strlen(b->caption1);
if (self->login_window->focused_control == 0)
{
@@ -295,7 +295,7 @@ xrdp_wm_show_edits(struct xrdp_wm* self, struct xrdp_bitmap* combo)
}
if (g_strncmp(name, "username", 255) == 0)
{
- g_strcpy(b->caption1, self->session->client_info->username);
+ g_strncpy(b->caption1, self->session->client_info->username, 255);
b->edit_pos = g_strlen(b->caption1);
if (g_strlen(b->caption1) > 0)
{
@@ -389,6 +389,7 @@ xrdp_wm_login_fill_in_combo(struct xrdp_wm* self, struct xrdp_bitmap* b)
char* p;
char* q;
char* r;
+ char name[256];
struct xrdp_mod_data* mod_data;
sections = list_create();
@@ -408,32 +409,25 @@ xrdp_wm_login_fill_in_combo(struct xrdp_wm* self, struct xrdp_bitmap* b)
}
else
{
+ g_strncpy(name, p, 255);
mod_data = (struct xrdp_mod_data*)
g_malloc(sizeof(struct xrdp_mod_data), 1);
mod_data->names = list_create();
mod_data->names->auto_free = 1;
mod_data->values = list_create();
mod_data->values->auto_free = 1;
- g_strcpy(mod_data->name, p); /* set name in square bracket */
for (j = 0; j < section_names->count; j++)
{
q = (char*)list_get_item(section_names, j);
r = (char*)list_get_item(section_values, j);
if (g_strncmp("name", q, 255) == 0)
{
- g_strcpy(mod_data->name, r);
- }
- else if (g_strncmp("lib", q, 255) == 0)
- {
- g_strcpy(mod_data->lib, r);
- }
- else
- {
- list_add_item(mod_data->names, (long)g_strdup(q));
- list_add_item(mod_data->values, (long)g_strdup(r));
+ g_strncpy(name, r, 255);
}
+ list_add_item(mod_data->names, (long)g_strdup(q));
+ list_add_item(mod_data->values, (long)g_strdup(r));
}
- list_add_item(b->string_list, (long)g_strdup(mod_data->name));
+ list_add_item(b->string_list, (long)g_strdup(name));
list_add_item(b->data_list, (long)mod_data);
}
}
diff --git a/xrdp/xrdp_mm.c b/xrdp/xrdp_mm.c
index d9655be3..96f5947c 100644
--- a/xrdp/xrdp_mm.c
+++ b/xrdp/xrdp_mm.c
@@ -254,9 +254,9 @@ xrdp_mm_process_login_response(struct xrdp_mm* self, struct stream* s)
self->display = display;
g_snprintf(text, 255, "login successful for display %d", display);
xrdp_wm_log_msg(self->wm, text);
- if (xrdp_mm_setup_mod1(self, self->login_names, self->login_values) == 0)
+ if (xrdp_mm_setup_mod1(self) == 0)
{
- if (xrdp_mm_setup_mod2(self, self->login_names, self->login_values) == 0)
+ if (xrdp_mm_setup_mod2(self) == 0)
{
self->wm->login_mode = 10;
self->wm->pro_layer->app_sck = self->mod->sck;
@@ -457,9 +457,7 @@ xrdp_mm_get_lib(struct xrdp_mm* self, char* dest, int dest_len)
/*****************************************************************************/
int APP_CC
-xrdp_mm_setup_mod1(struct xrdp_mm* self,
- struct list* names,
- struct list* values)
+xrdp_mm_setup_mod1(struct xrdp_mm* self)
{
void* func;
char lib[256];
@@ -553,9 +551,7 @@ xrdp_mm_setup_mod1(struct xrdp_mm* self,
/*****************************************************************************/
int APP_CC
-xrdp_mm_setup_mod2(struct xrdp_mm* self,
- struct list* names,
- struct list* values)
+xrdp_mm_setup_mod2(struct xrdp_mm* self)
{
char text[256];
char* name;
@@ -594,17 +590,17 @@ xrdp_mm_setup_mod2(struct xrdp_mm* self,
/* this adds the port to the end of the list, it will already be in
the list as -1
the module should use the last one */
- list_add_item(names, (long)g_strdup("port"));
- list_add_item(values, (long)g_strdup(text));
+ list_add_item(self->login_names, (long)g_strdup("port"));
+ list_add_item(self->login_values, (long)g_strdup(text));
/* always set these */
name = self->wm->session->client_info->hostname;
self->mod->mod_set_param(self->mod, "hostname", name);
g_snprintf(text, 255, "%d", self->wm->session->client_info->keylayout);
self->mod->mod_set_param(self->mod, "keylayout", text);
- for (i = 0; i < names->count; i++)
+ for (i = 0; i < self->login_names->count; i++)
{
- name = (char*)list_get_item(names, i);
- value = (char*)list_get_item(values, i);
+ name = (char*)list_get_item(self->login_names, i);
+ value = (char*)list_get_item(self->login_values, i);
self->mod->mod_set_param(self->mod, name, value);
}
/* connect */
diff --git a/xrdp/xrdp_types.h b/xrdp/xrdp_types.h
index f8f63203..0acb5a38 100644
--- a/xrdp/xrdp_types.h
+++ b/xrdp/xrdp_types.h
@@ -343,8 +343,6 @@ struct xrdp_font
/* module */
struct xrdp_mod_data
{
- char name[256];
- char lib[256];
struct list* names;
struct list* values;
};
diff --git a/xrdp/xrdp_wm.c b/xrdp/xrdp_wm.c
index 2c879e0e..3cce8b18 100644
--- a/xrdp/xrdp_wm.c
+++ b/xrdp/xrdp_wm.c
@@ -342,22 +342,17 @@ xrdp_wm_load_static_pointers(struct xrdp_wm* self)
int APP_CC
xrdp_wm_init(struct xrdp_wm* self)
{
-#if 0
int fd;
int index;
- struct xrdp_mod_data* mod_data;
struct list* names;
struct list* values;
char* q;
char* r;
char section_name[256];
-#endif
xrdp_wm_load_static_colors(self);
xrdp_wm_load_static_pointers(self);
self->screen->bg_color = self->black;
-#if 0
- // todo, get autologin working
if (self->session->client_info->rdp_autologin)
{
fd = g_file_open(XRDP_CFG_FILE); /* xrdp.ini */
@@ -367,12 +362,6 @@ xrdp_wm_init(struct xrdp_wm* self)
names->auto_free = 1;
values = list_create();
values->auto_free = 1;
- mod_data = (struct xrdp_mod_data*)
- g_malloc(sizeof(struct xrdp_mod_data), 1);
- mod_data->names = list_create();
- mod_data->names->auto_free = 1;
- mod_data->values = list_create();
- mod_data->values->auto_free = 1;
g_strncpy(section_name, self->session->client_info->domain, 255);
if (section_name[0] == 0)
{
@@ -396,95 +385,38 @@ xrdp_wm_init(struct xrdp_wm* self)
{
q = (char*)list_get_item(names, index);
r = (char*)list_get_item(values, index);
- if (g_strncmp("name", q, 255) == 0)
+ if (g_strncmp("password", q, 255) == 0)
{
- g_strcpy(mod_data->name, r);
+ list_add_item(self->mm->login_names, (long)g_strdup("password"));
+ list_add_item(self->mm->login_values,
+ (long)g_strdup(self->session->client_info->password));
}
- else if (g_strncmp("lib", q, 255) == 0)
+ else if (g_strncmp("username", q, 255) == 0)
{
- g_strcpy(mod_data->lib, r);
+ list_add_item(self->mm->login_names, (long)g_strdup("username"));
+ list_add_item(self->mm->login_values,
+ (long)g_strdup(self->session->client_info->username));
}
else
{
- if (g_strncmp("password", q, 255) == 0)
- {
- list_add_item(mod_data->names, (long)g_strdup("password"));
- list_add_item(mod_data->values,
- (long)g_strdup(self->session->client_info->password));
- }
- else if (g_strncmp("username", q, 255) == 0)
- {
- list_add_item(mod_data->names, (long)g_strdup("username"));
- list_add_item(mod_data->values,
- (long)g_strdup(self->session->client_info->username));
- }
- else
- {
- list_add_item(mod_data->names, (long)g_strdup(q));
- list_add_item(mod_data->values, (long)g_strdup(r));
- }
- }
- }
- if (xrdp_wm_setup_mod1(self, mod_data) != 0)
- {
- /* totaly free mod */
- if (self->mod_exit != 0)
- {
- self->mod_exit(self->mod);
- }
- g_xrdp_sync(sync_unload, self->mod_handle, 0);
- self->mod = 0;
- self->mod_handle = 0;
- self->mod_init = 0;
- self->mod_exit = 0;
- }
- else if (xrdp_wm_setup_mod2(self, mod_data->names, mod_data->values) != 0)
- {
- /* totaly free mod */
- if (self->mod_exit != 0)
- {
- self->mod_exit(self->mod);
- }
- g_xrdp_sync(sync_unload, self->mod_handle, 0);
- self->mod = 0;
- self->mod_handle = 0;
- self->mod_init = 0;
- self->mod_exit = 0;
- /* don't close here so user can see error */
- }
- else /* close connection log window if connection is ok */
- {
- if (self->log_wnd != 0)
- {
- xrdp_bitmap_delete(self->log_wnd);
- }
- }
- if (!self->pro_layer->term)
- {
- if (self->mod != 0)
- {
- if (self->mod->sck != 0)
- {
- self->pro_layer->app_sck = self->mod->sck;
- }
+ list_add_item(self->mm->login_names, (long)g_strdup(q));
+ list_add_item(self->mm->login_values, (long)g_strdup(r));
}
}
+ self->login_mode = 2;
}
- list_delete(mod_data->names);
- list_delete(mod_data->values);
list_delete(names);
list_delete(values);
- g_free(mod_data);
g_file_close(fd);
}
}
else
-#endif
{
xrdp_login_wnd_create(self);
/* clear screen */
xrdp_bitmap_invalidate(self->screen, 0);
xrdp_wm_set_focused(self, self->login_window);
+ self->login_mode = 1;
}
return 0;
}
@@ -1385,20 +1317,22 @@ xrdp_wm_idle(struct xrdp_wm* self)
if (self->login_mode == 0)
{
/* this is the inital state of the login window */
+ self->login_mode = 1; /* put the wm in login mode */
list_clear(self->log);
xrdp_wm_delete_all_childs(self);
- if (xrdp_wm_init(self) == 0)
- {
- /* put the wm in login mode */
- self->login_mode = 1;
- }
+ xrdp_wm_init(self);
}
else if (self->login_mode == 2)
{
- self->login_mode = 3;
+ self->login_mode = 3; /* put the wm in connected mode */
xrdp_wm_delete_all_childs(self);
xrdp_mm_connect(self->mm);
}
+ else if (self->login_mode == 10)
+ {
+ xrdp_wm_delete_all_childs(self);
+ self->login_mode = 11;
+ }
return 0;
}
@@ -1415,7 +1349,7 @@ xrdp_wm_app_sck_signal(struct xrdp_wm* self, int app_sck)
return 1;
}
}
- else if (self->login_mode == 10)
+ else if (self->login_mode > 9)
{
if (self->mm->mod == 0)
{
@@ -1467,9 +1401,11 @@ xrdp_wm_log_wnd_notify(struct xrdp_bitmap* wnd,
MAKERECT(rect, wnd->left, wnd->top, wnd->width, wnd->height);
xrdp_bitmap_delete(wnd);
xrdp_bitmap_invalidate(wm->screen, &rect);
- /* if module is gone, end the session when ok is clicked */
+ /* if module is gone, reset the session when ok is clicked */
if (wm->mm->mod_handle == 0)
{
+ /* make sure autologin is off */
+ wm->session->client_info->rdp_autologin = 0;
wm->login_mode = 0; /* reset session */
}
}