[Mono-bugs] [Bug 464539] New: FtpWebRequest logs into the wrong user directory on Windows FTP servers

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Jan 8 13:16:49 EST 2009


https://bugzilla.novell.com/show_bug.cgi?id=464539


           Summary: FtpWebRequest logs into the wrong user directory on
                    Windows FTP servers
           Product: Mono: Class Libraries
           Version: 2.0.x
          Platform: PC
        OS/Version: openSUSE 11.0
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: programacion at cae.net
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


When accessing a ftp account on a Windows server, the FtpWebRequest is logging
into the root directory of the server, instead of the home directory of the
user.

On login, the Microsoft .NET implementation sends a PWD command to obtain the
starting directory, and then sends a CWD command to that same directory (maybe
as a safety measure).

The Mono implementation, doesn't send the PWD command at all, but it does send
a "CWD /" command that changes the current directory to the root of the server.
This is not the appropiate behaviour for connecting to a Windows FTP Server.

This is a sample code where this behaviour can be cheched:

   FtpWebRequest ftp =
(FtpWebRequest)FtpWebRequest.Create("ftp://xxxx.xxx.com");
   ftp.Credentials = new NetworkCredential("username", "xxxxx");
   ftp.Method = WebRequestMethods.Ftp.PrintWorkingDirectory;
   FtpWebResponse response = (FtpWebResponse)ftp.GetResponse();
   StreamReader sr = new StreamReader(response.GetResponseStream(),
Encoding.Default);
   string result = sr.ReadToEnd();
   Console.WriteLine("Working directory: " + result);
   sr.Close();
   response.Close();


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list