This patch allows you to specify a module as being hidden, by setting
"hidden=yes" in xrdp.ini.  It has the effect of only allowing automatic
logins to access that module.

It also incorporates my previous patch to make it so interactive logins
with the domain specified have the module name set.  However, this does
not apply for hidden items.

I'm torn as to whether to handle hidden modules in this way, or to allow
interactive logins with the domain specified to be able to see them
again.  The current method would prevent you from accessing any hidden
module that required additional options (such as IP address and port),
however it has the upshot of discouraging poor security practices such
as simply hiding items that allow connections to other arbitrary hosts
that could be potentially undesirable in a production environment.

Maybe this become another configuration option in the future, but in the
interests in simplicity I opted for this method by default.

I wrote an ebuild for xrdp CVS since I started my endeavour, and I've
now created a proper overlay for it, which contains all of my patches I
wrote to make it work properly in Gentoo.  The ebuild isn't fantastic,
but it works for now.  It is based off the normal Gentoo ebuild for
xrdp, and I'm working my way through updating it nicely.  The project
page for it is http://micolous.id.au/projects/gentoo-overlay/

Cheers,


--Michael
--- xrdp/xrdp/xrdp_login_wnd.c.orig	2009-05-28 19:26:05.000000000 +0930
+++ xrdp/xrdp/xrdp_login_wnd.c	2009-05-28 19:30:37.000000000 +0930
@@ -386,6 +386,8 @@
   int fd;
   int i;
   int j;
+  int k = 0; // real number of the items in the list
+  int h = 0; // is the current item hidden?
   char* p;
   char* q;
   char* r;
@@ -411,26 +413,58 @@
     }
     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;
-      for (j = 0; j < section_names->count; j++)
-      {
+    	// check to see if this is a hidden item
+    	// do this early so we don't need to mess around freeing memory
+    	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)
+        if (g_strncmp("hidden", q, 255) == 0)
         {
-          g_strncpy(name, r, 255);
+          if (g_strncmp("yes", r, 255) == 0) {
+            h = 1;
+            break;
+          }
         }
-        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(name));
-      list_add_item(b->data_list, (long)mod_data);
+      
+      if (h == 1) {
+        // yup, hidden, reset state
+        h = 0;
+    	} else {
+        // not hidden
+        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;
+        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_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(name));
+        list_add_item(b->data_list, (long)mod_data);
+
+        if (g_strncmp(self->session->client_info->domain, p, 255) == 0) {
+          // "domain" matches this module's name. change the default selected item to this.
+          // normally this only applies to autologin.  now this applies it in non-auto mode
+          //
+          // we can't use (i) here as that is the index of the section in the ini, not the index of
+          // the current item in the combobox.
+          b->item_index = k;
+        }
+
+        k++;
+      }
     }
   }
   g_file_close(fd);
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
_______________________________________________
xrdp-devel mailing list
xrdp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xrdp-devel

Reply via email to