From 48283261192f67270c43dadd9ccfef55d1723bd8 Mon Sep 17 00:00:00 2001 From: hidnplayr Date: Fri, 12 Jul 2013 20:35:53 +0000 Subject: [PATCH] FTPc: bugfix for passive, other small improvements. git-svn-id: svn://kolibrios.org@3818 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/network/ftpc/ftpc.asm | 11 ++++++++++- programs/network/ftpc/servercommands.inc | 11 +++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/programs/network/ftpc/ftpc.asm b/programs/network/ftpc/ftpc.asm index 1c746d2881..1e2e81d36a 100644 --- a/programs/network/ftpc/ftpc.asm +++ b/programs/network/ftpc/ftpc.asm @@ -164,6 +164,7 @@ wait_for_servercommand: .no_more_data: mov [offset], 0 .go_cmd: + lea ecx, [edi - s] ; length of command xor al, al stosb @@ -292,21 +293,29 @@ open_dataconnection: ; only passive for now.. ret .fail: + invoke con_get_flags + push eax + invoke con_set_flags, 0x0c ; print errors in red invoke con_write_asciiz, str_err_socket + invoke con_set_flags ; reset color ret error_socket: + invoke con_set_flags, 0x0c ; print errors in red invoke con_write_asciiz, str_err_socket jmp wait_for_keypress error_resolve: + invoke con_set_flags, 0x0c ; print errors in red invoke con_write_asciiz, str_err_resolve wait_for_keypress: + invoke con_set_flags, 0x07 ; reset color to grey invoke con_write_asciiz, str_push invoke con_getch2 + mcall close, [socketnum] jmp main done: @@ -320,7 +329,7 @@ exit: ; data str_title db 'FTP client',0 -str_welcome db 'FTP client for KolibriOS v0.08',10 +str_welcome db 'FTP client for KolibriOS v0.09',10 db 10 db 'Please enter ftp server address.',10,0 diff --git a/programs/network/ftpc/servercommands.inc b/programs/network/ftpc/servercommands.inc index cdf20efd8c..03ab7836ab 100644 --- a/programs/network/ftpc/servercommands.inc +++ b/programs/network/ftpc/servercommands.inc @@ -29,6 +29,9 @@ server_parser: ; cmp dword[s], "421 " ; je timeout + cmp dword[s], "503 " ; login first + je welcome + cmp dword[s], "530 " ; password incorrect je welcome @@ -58,10 +61,10 @@ login_ok: pasv_ok: - sub ecx, 5 + sub ecx, 4 jb .fail mov al, "(" - mov edi, s + 5 + mov edi, s + 4 repne scasb mcall socket, AF_INET4, SOCK_STREAM, 0 @@ -86,8 +89,12 @@ pasv_ok: invoke con_write_asciiz, str_open mcall connect, [datasocket], sockaddr2, 18 +; cmp eax, -1 +; je error_socket + jmp wait_for_servercommand .fail: + invoke con_write_asciiz, str_unknown jmp wait_for_servercommand