Hans Leidekker : wininet: Correct several ftp server response to error code mappings.

Alexandre Julliard julliard at winehq.org
Thu Nov 1 07:39:42 CDT 2007


Module: wine
Branch: master
Commit: 5270b429fae84afe45316df6d70c03ce07e2a7e2
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=5270b429fae84afe45316df6d70c03ce07e2a7e2

Author: Hans Leidekker <hans at it.vu.nl>
Date:   Wed Oct 31 22:53:51 2007 +0100

wininet: Correct several ftp server response to error code mappings.

---

 dlls/wininet/ftp.c       |   69 ++++++++++++++++++++--------------------------
 dlls/wininet/tests/ftp.c |   16 ++--------
 2 files changed, 34 insertions(+), 51 deletions(-)

diff --git a/dlls/wininet/ftp.c b/dlls/wininet/ftp.c
index d763043..c045217 100644
--- a/dlls/wininet/ftp.c
+++ b/dlls/wininet/ftp.c
@@ -3437,45 +3437,36 @@ static DWORD FTP_SetResponseError(DWORD dwResponse)
 
     switch(dwResponse)
     {
-	case 421: /* Service not available - Server may be shutting down. */
-	    dwCode = ERROR_INTERNET_EXTENDED_ERROR;
-	    break;
-
-	case 425: /* Cannot open data connection. */
-	    dwCode = ERROR_INTERNET_CANNOT_CONNECT;
-	    break;
-
-	case 426: /* Connection closed, transer aborted. */
-	    dwCode = ERROR_INTERNET_CONNECTION_ABORTED;
-	    break;
-
-	case 500: /* Syntax error. Command unrecognized. */
-	case 501: /* Syntax error. Error in parameters or arguments. */
-	    dwCode = ERROR_INTERNET_INCORRECT_FORMAT;
-	    break;
-
-	case 530: /* Not logged in. Login incorrect. */
-	    dwCode = ERROR_INTERNET_LOGIN_FAILURE;
-	    break;
-
-	case 550: /* File action not taken. File not found or no access. */
-	    dwCode = ERROR_INTERNET_ITEM_NOT_FOUND;
-	    break;
-
-	case 450: /* File action not taken. File may be busy. */
-	case 451: /* Action aborted. Server error. */
-	case 452: /* Action not taken. Insufficient storage space on server. */
-	case 502: /* Command not implemented. */
-	case 503: /* Bad sequence of commands. */
-	case 504: /* Command not implemented for that parameter. */
-	case 532: /* Need account for storing files */
-	case 551: /* Requested action aborted. Page type unknown */
-	case 552: /* Action aborted. Exceeded storage allocation */
-	case 553: /* Action not taken. File name not allowed. */
-
-	default:
-            dwCode = ERROR_INTERNET_EXTENDED_ERROR;
-	    break;
+    case 425: /* Cannot open data connection. */
+        dwCode = ERROR_INTERNET_CANNOT_CONNECT;
+        break;
+
+    case 426: /* Connection closed, transer aborted. */
+        dwCode = ERROR_INTERNET_CONNECTION_ABORTED;
+        break;
+
+    case 530: /* Not logged in. Login incorrect. */
+        dwCode = ERROR_INTERNET_LOGIN_FAILURE;
+        break;
+
+    case 421: /* Service not available - Server may be shutting down. */
+    case 450: /* File action not taken. File may be busy. */
+    case 451: /* Action aborted. Server error. */
+    case 452: /* Action not taken. Insufficient storage space on server. */
+    case 500: /* Syntax error. Command unrecognized. */
+    case 501: /* Syntax error. Error in parameters or arguments. */
+    case 502: /* Command not implemented. */
+    case 503: /* Bad sequence of commands. */
+    case 504: /* Command not implemented for that parameter. */
+    case 532: /* Need account for storing files */
+    case 550: /* File action not taken. File not found or no access. */
+    case 551: /* Requested action aborted. Page type unknown */
+    case 552: /* Action aborted. Exceeded storage allocation */
+    case 553: /* Action not taken. File name not allowed. */
+
+    default:
+        dwCode = ERROR_INTERNET_EXTENDED_ERROR;
+        break;
     }
 
     INTERNET_SetLastError(dwCode);
diff --git a/dlls/wininet/tests/ftp.c b/dlls/wininet/tests/ftp.c
index 7bbaf02..fa13fdc 100644
--- a/dlls/wininet/tests/ftp.c
+++ b/dlls/wininet/tests/ftp.c
@@ -125,7 +125,6 @@ static void test_createdir(HINTERNET hFtp, HINTERNET hConnect)
     SetLastError(0xdeadbeef);
     bRet = FtpCreateDirectoryA(hFtp, "new_directory_deadbeef");
     ok ( bRet == FALSE, "Expected FtpCreateDirectoryA to fail\n");
-    todo_wine
     ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR,
         "Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError());
 
@@ -165,7 +164,6 @@ static void test_deletefile(HINTERNET hFtp, HINTERNET hConnect)
     SetLastError(0xdeadbeef);
     bRet = FtpDeleteFileA(hFtp, "non_existent_file_deadbeef");
     ok ( bRet == FALSE, "Expected FtpDeleteFileA to fail\n");
-    todo_wine
     ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR,
         "Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError());
 
@@ -256,14 +254,13 @@ static void test_getfile(HINTERNET hFtp, HINTERNET hConnect)
     SetLastError(0xdeadbeef);
     bRet = FtpGetFileA(hFtp, "should_be_non_existing_deadbeef", "should_also_be_non_existing_deadbeef", FALSE, FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_UNKNOWN, 0);
     ok ( bRet == FALSE, "Expected FtpGetFileA to fail\n");
-    todo_wine
-    {
     ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR,
         "Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError());
     /* Currently Wine always creates the local file (even on failure) which is not correct, hence the test */
+    todo_wine
     ok (GetFileAttributesA("should_also_be_non_existing_deadbeef") == INVALID_FILE_ATTRIBUTES,
         "Local file should not have been created\n");
-    }
+
     DeleteFileA("should_also_be_non_existing_deadbeef");
 
     /* Same call as the previous but now the local file does exists. Windows just removes the file if the call fails
@@ -278,14 +275,13 @@ static void test_getfile(HINTERNET hFtp, HINTERNET hConnect)
     SetLastError(0xdeadbeef);
     bRet = FtpGetFileA(hFtp, "should_be_non_existing_deadbeef", "should_also_be_non_existing_deadbeef", FALSE, FILE_ATTRIBUTE_NORMAL, FTP_TRANSFER_TYPE_UNKNOWN, 0);
     ok ( bRet == FALSE, "Expected FtpGetFileA to fail\n");
-    todo_wine
-    {
     ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR,
         "Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError());
     /* Currently Wine always creates the local file (even on failure) which is not correct, hence the test */
+    todo_wine
     ok (GetFileAttributesA("should_also_be_non_existing_deadbeef") == INVALID_FILE_ATTRIBUTES,
         "Local file should not have been created\n");
-    }
+
     DeleteFileA("should_also_be_non_existing_deadbeef");
 
     /* This one should succeed */
@@ -537,7 +533,6 @@ static void test_putfile(HINTERNET hFtp, HINTERNET hConnect)
     SetLastError(0xdeadbeef);
     bRet = FtpPutFileA(hFtp, "now_existing_local", "non_existing_remote", FTP_TRANSFER_TYPE_UNKNOWN, 0);
     ok ( bRet == FALSE, "Expected FtpPutFileA to fail\n");
-    todo_wine
     ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR,
         "Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError());
 
@@ -587,7 +582,6 @@ static void test_removedir(HINTERNET hFtp, HINTERNET hConnect)
     SetLastError(0xdeadbeef);
     bRet = FtpRemoveDirectoryA(hFtp, "should_be_non_existing_deadbeef_dir");
     ok ( bRet == FALSE, "Expected FtpRemoveDirectoryA to fail\n");
-    todo_wine
     ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR,
         "Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError());
 
@@ -595,7 +589,6 @@ static void test_removedir(HINTERNET hFtp, HINTERNET hConnect)
     SetLastError(0xdeadbeef);
     bRet = FtpRemoveDirectoryA(hFtp, "pub");
     ok ( bRet == FALSE, "Expected FtpRemoveDirectoryA to fail\n");
-    todo_wine
     ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR,
         "Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError());
 
@@ -642,7 +635,6 @@ static void test_renamefile(HINTERNET hFtp, HINTERNET hConnect)
     SetLastError(0xdeadbeef);
     bRet = FtpRenameFileA(hFtp , "should_be_non_existing_deadbeef", "new");
     ok ( bRet == FALSE, "Expected FtpRenameFileA to fail\n");
-    todo_wine
     ok ( GetLastError() == ERROR_INTERNET_EXTENDED_ERROR,
         "Expected ERROR_INTERNET_EXTENDED_ERROR, got %d\n", GetLastError());
 




More information about the wine-cvs mailing list