On Wed, Jun 30, 2010 at 11:50 PM, Murtaza Munaim <mur...@gmail.com> wrote: > On 6/30/2010 10:12 PM, Robert Seward wrote: >> >> On Wed, Jun 30, 2010 at 1:20 PM, Murtaza Munaim<mur...@gmail.com> wrote: >>> >>> On 6/29/2010 12:00 AM, Murtaza Munaim wrote: >>>> >>>> On 6/28/2010 8:19 PM, Robert Seward wrote: >>>>> >>>>> On Mon, Jun 28, 2010 at 5:46 PM, Murtaza Munaim<mur...@gmail.com> >>>>> wrote: >>>>>> >>>>>> On 6/23/2010 9:42 AM, Jay Sorg wrote: >>>>>>>> >>>>>>>> Hey guys. So I was looking at the code for xrdp. I know I need to >>>>>>>> have >>>>>>>> the >>>>>>>> connection between sesman and xrdp be maintained for the entire >>>>>>>> session, >>>>>>>> and >>>>>>>> then have sesman kill the session when xrdp sees a user disconnect. >>>>>>>> I >>>>>>>> could >>>>>>>> go looking through all the code, but I was just wondering if >>>>>>>> someone knew >>>>>>>> where in the code xrdp connects/disconnects from sesman. Thanks >>>>>>> >>>>>>> Hi Murtaza, >>>>>>> >>>>>>> The connection goes up in >>>>>>> file xrdp/xrdp_mm.c >>>>>>> function xrdp_mm_connect >>>>>>> >>>>>>> It uses an object called struct trans to talk to sesman. >>>>>>> trans_connect is the call to do the connect. >>>>>>> >>>>>>> The connection goes down in xrdp_mm_process_login_response >>>>>>> self->delete_sesman_trans = 1; will cause the disconnect later. >>>>>>> >>>>>>> Then on the sesman side, I have to look more. >>>>>>> >>>>>>> Jay >>>>>> >>>>>> Hey Jay. Let me know what you remember/find from the sesman side. >>>>>> Also, the >>>>>> enviornment I was running xrdp before was using xrdp-0.4.0~dfsg as >>>>>> the main >>>>>> xrdp server. I downloaded the cvs version of xrdp, and did the >>>>>> standard make >>>>>> && make install and it worked fine, the compiling and installing at >>>>>> least. >>>>>> Then when I rdesktop'ed like I usually would have. As it was >>>>>> connecting, it >>>>>> would get to "connecting to 127.0.0.1 5910". Then I would get an error >>>>>> - >>>>>> problem connecting. Is there a debug or verbose mode to xrdp or >>>>>> something of >>>>>> the like? What could be different between the two version to break it? >>>>>> >>>>>> -Murtaza >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> ------------------------------------------------------------------------------ >>>>>> >>>>>> This SF.net email is sponsored by Sprint >>>>>> What will you do first with EVO, the first 4G phone? >>>>>> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first >>>>>> _______________________________________________ >>>>>> xrdp-devel mailing list >>>>>> xrdp-devel@lists.sourceforge.net >>>>>> https://lists.sourceforge.net/lists/listinfo/xrdp-devel >>>>> >>>>> Hey Murtaza, >>>>> >>>>> I don't know if you are interested, but I did pretty much want you are >>>>> trying to do. However, the changes were done to xrdp 0.4.1, and there >>>>> are a number of other changes that I made that you may or may not >>>>> want. >>>>> >>>>> I haven't had time to try to submit all the patches against the latest >>>>> CVS, but you can take what I have if you want. >>>>> >>>>> Robert >>>> >>>> Robert, >>>> >>>> Could you briefly summarize the changes you made? >>>> >>>> And send me a tarball of your patches? That would be awesome. Thanks >>>> >>>> -Murtaza >>>> >>> >>> Hey Guys. >>> >>> Robert: If you have time, could you send me the patches you have written >>> so >>> I can see what you did? Thanks a bunch >> >> Attached is the tar file. >> >> Here are the changes (as best as I can tell - I have been hacking on >> this for a while, so my memory is a bit dim on some of it): >> >> - Optionally disconnect a session after a specified idle time (idle >> time means no input from the client). Controlled by the >> 'max_idle_time' global option in xrdp.ini. >> - Make the port over which xrdp and sesman communicate configurable. >> - Limit the number of sessions that a user can have active at one >> time. Controlled by the 'MaxSessionsPerUser' option in sesman.ini >> under 'Sessions'. >> - Add an option to allow/disallow sharing of a session by multiple >> logins from the same user. Controlled by the 'AllowSharing' option in >> sesman.ini under 'Sessions'. >> - Add a minimum X server color depth. Certain programs (notably >> Firefox) don't work with a 8 bpp. However, I wanted to use 8 bpp on >> the RDP side for bandwidth efficiency. VNC will do the translation >> from one color depth to another. This option is controlled by the >> 'MinServerDepth' option in sesman.ini under 'Xvnc'. >> - Added options to control the ports used for VNC. These are >> controlled by the options 'MinDisplay' and 'MaxDisplay' in sesman.ini >> under 'Globals'. >> - Allow the RDP client to use 8 bit unicode. >> - Do conversions of text and rectangles to bitmaps. One of these is >> controlled by the client capability, but the other is hardcoded. I >> was having a problem with a particularly crippled client, and the only >> way to make it work was to basically only send bitmaps. This only >> effects the startup screen. However, the code I wrote doesn't handle >> large text - it makes the bitmap too large, which causes nothing to be >> sent to the client. >> - Because the above, I changed the checks on bitmap size to be a >> little more tolerant (but still OK in RDP). >> - I had problems with the child VNC/X-server processes not being >> killed reliably, so I changed things a bit to make that work better. >> The original xrdp had a separate program that just babysat those child >> processes. I made it to where that program isn't necessary. >> - Fixed a problem where xrdp would go into an infinite loop on certain >> malformed input. >> - If the client screen width or height is zero, shove in a width and >> height that is acceptable. >> - Print the IP address of bad logins in the sesman log file. >> - Redid locking in sesman a little. It looked to me like there were >> some conditions that wouldn't work, so I fixed it. >> - I vaguely recall I had problems with sesman not waiting properly for >> the X server to start, so I changed how it waits a bit. >> - I took out the login window - I only allow auto login. This should >> probably be configurable. >> >> I hope this helps. >> >> Robert > > Yeah this will really help. I could probably look at the code and figure it > out, but I wanted to know how you added the disconnect functionality in the > first place, like what did you do? I know xrdp can tell when the session is > disconnected, using the function libxrdp_disconnect, and sesman has the > capability to kill a session using sig_sesman_session_end, but how did you > relay this information to one another? Could you maybe point out in the code > what you did?
Sorry for the late response - the 4th of July weekend in the States. As you may know, a VNC/X server session is started by xrdp sending a message to sesman. Once the session has started, sesman sends a message back to xrdp. I enhanced this messaging a bit. In the original, there was a code that was being sent that was always zero. If you look in xrdp_mm_send_msg() (was xrdp_mm_send_login() in the original code), you will see that the code can now be one of three values. These three values are the different commands that can be sent - start, disconnect, and terminate. If you look at xrdp_process_main_loop() in xrdp_process.c, you will see where the code sends the disconnect command to sesman. It calls xrdp_mm_connect() with a SCP_CMD_TYPE_DISCONNECT command. The code around there is a bit tricky, as we only want to send a disconnect if sesman actually got something running. Also, if we told sesman to start a session, and it hasn't responded yet, and the client drops the connection, we need to wait for the response from sesman before possibly sending the disconnect. On the sesman side, look at scp_v0_process() in scp_v0.c to see how the code processes the different commands. Note that I enhanced the messaging a bit to send the display that needs to be disconnected. Once a display has zero connections and the configuration says to kill disconnected displays, then the code will kill the child processes associated with that display. Robert ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ xrdp-devel mailing list xrdp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xrdp-devel