[ rdesktop-Bugs-3428380 ] session redirection broken in 1.7.0

SourceForge.net <[email protected]> Fri, 28 Oct 2011 19:29:05 -0700
Newsgroups gmane.network.rdesktop.devel
Message-ID <[email protected]>
Bugs item #3428380, was opened at 2011-10-25 13:21
Message generated for change (Comment added) made by 
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=381347&aid=3428380&group_id=24366

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Authentication
Group: v1.7.1
Status: Closed
Resolution: Fixed
Priority: 7
Private: No
Submitted By: m_etscheid (m_etscheid)
Assigned to: Nobody/Anonymous (nobody)
Summary: session redirection broken in 1.7.0

Initial Comment:
Hi,

the support for session redirection for W2003 is broken in 1.7.0. The RDP redirect paket does not contain the complete user name. 
Version 1.6.0 works fine.

----------------------------------------------------------------------

Comment By: Robert de Forest ()
Date: 2011-10-28 19:29

Message:
Sorry, I left out some information.  The systems I'm connecting to are
setting the flags such that the password field has a length of 120 bytes
and is definitely not unicode (I get an EINVAL from iconv()).  I also saw
at the RDP protocol docs that the password field could also be a cookie
(http://msdn.microsoft.com/en-us/library/ee443575(v=PROT.10).aspx).  The
relevant portion of the protocol text is below the packet diagram and says,
"Password (variable): A variable-length array of bytes containing the
password used by the user in Unicode format, including a null-terminator or
a cookie value that MUST be passed to the target server on successful
connection."  I think it's the "or a cookie value" portion that is messing
stuff up for me.

----------------------------------------------------------------------

Comment By: Robert de Forest ()
Date: 2011-10-28 19:21

Message:
I haven't tried r1639 from svn yet, but I suspect it will not work in my
case.  The problem I have is that the redirect is coming with a 120 byte
cookie instead of a password, so the iconv() on it fails because it's not a
unicode string.  It's just binary.

To be clear, I'm sure the username will remain intact after a Broker
redurect, but the password will not, so even though a user has entered the
correct password they will have to enter it again if they are redirected to
a different server.  This redirection without re-entering your password
feature works correctly in Mac and Windows RDP clients (or so I am told).

I'm going to work on a patch, but my C skills are super rusty so I'm
offering this comment in case someone is inspired to come up with a fix
faster than I can.

I'm also not sure if this bug should be re-opened or if I should open a
separate bug for the "password not kept" behavior.  I kinda lump it all
together in my head as "redirect data not kept intact between receipt and
re-connection."

----------------------------------------------------------------------

Comment By: m_etscheid (m_etscheid)
Date: 2011-10-26 04:26

Message:
I used last SVN version and it works. Thanks 

----------------------------------------------------------------------

Comment By: Peter Åstrand (astrand)
Date: 2011-10-26 03:54

Message:
I've committed a patch to trunk now. Can you try the latest SVN version and
see if it works?


----------------------------------------------------------------------

Comment By: m_etscheid (m_etscheid)
Date: 2011-10-26 02:50

Message:
Found following changes:


--- rdesktop-1.7.0.org/rdp.c	2011-04-18 04:21:57.000000000 -0700
+++ rdesktop-1.7.0/rdp.c	2011-10-26 01:01:00.789038907 -0700
@@ -1520,7 +1520,7 @@
 
 		/* read username string */
 		g_redirect_username = (char *) xmalloc(len + 1);
-		rdp_in_unistr(s, g_redirect_username, strlen(g_redirect_username),
len);
+		rdp_in_unistr(s, g_redirect_username, len + 1, len);
 	}
 
 	if (g_redirect_flags & PDU_REDIRECT_HAS_DOMAIN)


--- rdesktop-1.7.0.org/rdesktop.c	2011-04-18 04:21:57.000000000 -0700
+++ rdesktop-1.7.0/rdesktop.c	2011-10-26 00:58:33.445042788 -0700
@@ -988,7 +988,7 @@
 			STRNCPY(domain, g_redirect_domain, sizeof(domain));
 			xfree(g_username);
 			g_username = (char *) xmalloc(strlen(g_redirect_username) + 1);
-			STRNCPY(g_username, g_redirect_username, sizeof(g_username));
+			STRNCPY(g_username, g_redirect_username, strlen(g_redirect_username) +
1);
 			STRNCPY(password, g_redirect_password, sizeof(password));
 			STRNCPY(server, g_redirect_server, sizeof(server));
 			flags |= RDP_LOGON_AUTO;




----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=381347&aid=3428380&group_id=24366

------------------------------------------------------------------------------
Get your Android app more play: Bring it to the BlackBerry PlayBook 
in minutes. BlackBerry App World&#153; now supports Android&#153; Apps 
for the BlackBerry&reg; PlayBook&#153;. Discover just how easy and simple 
it is! http://p.sf.net/sfu/android-dev2dev
_______________________________________________
rdesktop-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdesktop-devel