forked from KolibriOS/kolibrios
small bugfixes
git-svn-id: svn://kolibrios.org@4920 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
fc7ba40638
commit
914e67bd24
@ -6,7 +6,7 @@ server_parser:
|
|||||||
; thus they are simply ignored in this simple command parser.
|
; thus they are simply ignored in this simple command parser.
|
||||||
|
|
||||||
cmp dword[s], "150 "
|
cmp dword[s], "150 "
|
||||||
je data_ok
|
je data_loop
|
||||||
|
|
||||||
cmp dword[s], "220 "
|
cmp dword[s], "220 "
|
||||||
je welcome
|
je welcome
|
||||||
@ -100,7 +100,7 @@ pasv_ok:
|
|||||||
jmp wait_for_servercommand
|
jmp wait_for_servercommand
|
||||||
|
|
||||||
|
|
||||||
data_ok:
|
data_loop:
|
||||||
|
|
||||||
invoke con_write_asciiz, str2b
|
invoke con_write_asciiz, str2b
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ data_ok:
|
|||||||
|
|
||||||
; not retreiving, just print to console
|
; not retreiving, just print to console
|
||||||
invoke con_write_asciiz, buffer_ptr2
|
invoke con_write_asciiz, buffer_ptr2
|
||||||
jmp data_ok
|
jmp data_loop
|
||||||
|
|
||||||
; retreiving, save to file
|
; retreiving, save to file
|
||||||
.retr:
|
.retr:
|
||||||
@ -128,7 +128,7 @@ data_ok:
|
|||||||
mcall 70, filestruct
|
mcall 70, filestruct
|
||||||
pop eax
|
pop eax
|
||||||
add [filestruct.offset], eax
|
add [filestruct.offset], eax
|
||||||
jmp data_ok
|
jmp data_loop
|
||||||
|
|
||||||
; storing, send all data
|
; storing, send all data
|
||||||
.stor:
|
.stor:
|
||||||
@ -149,11 +149,13 @@ data_ok:
|
|||||||
.done:
|
.done:
|
||||||
invoke con_write_asciiz, str_close
|
invoke con_write_asciiz, str_close
|
||||||
mcall close, [datasocket]
|
mcall close, [datasocket]
|
||||||
|
mov [operation], OPERATION_NONE
|
||||||
jmp wait_for_servercommand
|
jmp wait_for_servercommand
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
close_datacon:
|
close_datacon:
|
||||||
|
cmp [operation], OPERATION_NONE
|
||||||
|
je wait_for_usercommand
|
||||||
invoke con_write_asciiz, str_close
|
invoke con_write_asciiz, str_close
|
||||||
mcall close, [datasocket]
|
mcall close, [datasocket]
|
||||||
jmp wait_for_usercommand
|
jmp wait_for_usercommand
|
||||||
|
@ -5,13 +5,19 @@ cmd_help:
|
|||||||
|
|
||||||
jmp wait_for_usercommand
|
jmp wait_for_usercommand
|
||||||
|
|
||||||
|
|
||||||
cmd_bye:
|
cmd_bye:
|
||||||
|
|
||||||
mcall close, [socketnum]
|
; Send BYE message to the server
|
||||||
mcall close, [datasocket]
|
mov dword[s], "BYE" + 13 shl 24
|
||||||
|
mov byte[s+4], 10
|
||||||
|
mcall send, [socketnum], s, 5, 0
|
||||||
|
|
||||||
|
; Close the control connection
|
||||||
|
mcall close, [socketnum]
|
||||||
jmp main
|
jmp main
|
||||||
|
|
||||||
|
|
||||||
cmd_pwd:
|
cmd_pwd:
|
||||||
|
|
||||||
mov dword[s], "PWD" + 13 shl 24
|
mov dword[s], "PWD" + 13 shl 24
|
||||||
@ -20,6 +26,7 @@ cmd_pwd:
|
|||||||
|
|
||||||
jmp wait_for_servercommand
|
jmp wait_for_servercommand
|
||||||
|
|
||||||
|
|
||||||
cmd_cwd:
|
cmd_cwd:
|
||||||
|
|
||||||
mov dword[s], "CWD "
|
mov dword[s], "CWD "
|
||||||
@ -35,6 +42,7 @@ cmd_cwd:
|
|||||||
|
|
||||||
jmp wait_for_servercommand
|
jmp wait_for_servercommand
|
||||||
|
|
||||||
|
|
||||||
cmd_dele:
|
cmd_dele:
|
||||||
|
|
||||||
mov dword[s], "DELE"
|
mov dword[s], "DELE"
|
||||||
@ -51,24 +59,27 @@ cmd_dele:
|
|||||||
|
|
||||||
jmp wait_for_servercommand
|
jmp wait_for_servercommand
|
||||||
|
|
||||||
cmd_list:
|
|
||||||
|
|
||||||
|
cmd_list:
|
||||||
call open_dataconnection
|
call open_dataconnection
|
||||||
|
|
||||||
mov [operation], OPERATION_LIST
|
mov [operation], OPERATION_LIST
|
||||||
|
|
||||||
mov dword[s], "LIST"
|
mov dword[s], "LIST"
|
||||||
mov word[s+4], 0x0a0d
|
mov word[s+4], 0x0a0d
|
||||||
mcall send, [socketnum], s, 6, 0
|
mcall send, [socketnum], s, 6, 0
|
||||||
|
|
||||||
jmp wait_for_servercommand
|
jmp wait_for_servercommand
|
||||||
|
|
||||||
|
|
||||||
cmd_retr:
|
cmd_retr:
|
||||||
|
|
||||||
call open_dataconnection
|
call open_dataconnection
|
||||||
|
|
||||||
|
; Create/open the file
|
||||||
|
|
||||||
mov [operation], OPERATION_RETR
|
mov esi, s+5
|
||||||
|
mov ecx, 256-5
|
||||||
|
call set_filename
|
||||||
|
|
||||||
mov [filestruct.subfn], 2 ; create/rewrite file
|
mov [filestruct.subfn], 2 ; create/rewrite file
|
||||||
mov [filestruct.offset], 0
|
mov [filestruct.offset], 0
|
||||||
@ -76,16 +87,16 @@ cmd_retr:
|
|||||||
mov [filestruct.size], 0
|
mov [filestruct.size], 0
|
||||||
mov [filestruct.ptr], 0
|
mov [filestruct.ptr], 0
|
||||||
|
|
||||||
lea esi, [s+5]
|
|
||||||
mov edi, filestruct.name
|
|
||||||
mov ecx, 256-5
|
|
||||||
call set_filename
|
|
||||||
|
|
||||||
mcall 70, filestruct
|
mcall 70, filestruct
|
||||||
cmp eax, -1
|
cmp eax, -1
|
||||||
; je fileerror
|
; je fileerror
|
||||||
|
|
||||||
|
; Prepare to write to the file
|
||||||
|
|
||||||
mov [filestruct.subfn], 3 ; write to file
|
mov [filestruct.subfn], 3 ; write to file
|
||||||
|
mov [operation], OPERATION_RETR
|
||||||
|
|
||||||
|
; Request the file from server
|
||||||
|
|
||||||
mov dword[s], "RETR"
|
mov dword[s], "RETR"
|
||||||
mov byte[s+4], " "
|
mov byte[s+4], " "
|
||||||
@ -95,9 +106,10 @@ cmd_retr:
|
|||||||
mov edi, s
|
mov edi, s
|
||||||
repne scasb
|
repne scasb
|
||||||
lea esi, [edi - s]
|
lea esi, [edi - s]
|
||||||
mov word [edi - 2], 0x0a0d
|
mov dword[edi - 2], 0x0a0d
|
||||||
mcall send, [socketnum], s, , 0
|
mcall send, [socketnum], s, , 0
|
||||||
|
|
||||||
|
invoke con_write_asciiz, s ; print command
|
||||||
jmp wait_for_servercommand
|
jmp wait_for_servercommand
|
||||||
|
|
||||||
|
|
||||||
@ -113,8 +125,7 @@ cmd_stor:
|
|||||||
mov [filestruct.size], BUFFERSIZE
|
mov [filestruct.size], BUFFERSIZE
|
||||||
mov [filestruct.ptr], buffer_ptr2
|
mov [filestruct.ptr], buffer_ptr2
|
||||||
|
|
||||||
lea esi, [s+5]
|
mov esi, s+5
|
||||||
mov edi, filestruct.name
|
|
||||||
mov ecx, 256-5
|
mov ecx, 256-5
|
||||||
call set_filename
|
call set_filename
|
||||||
|
|
||||||
@ -154,6 +165,7 @@ cmd_lcwd:
|
|||||||
|
|
||||||
jmp wait_for_usercommand
|
jmp wait_for_usercommand
|
||||||
|
|
||||||
|
|
||||||
cmd_cdup:
|
cmd_cdup:
|
||||||
|
|
||||||
mov dword[s], "CDUP"
|
mov dword[s], "CDUP"
|
||||||
@ -162,6 +174,7 @@ cmd_cdup:
|
|||||||
|
|
||||||
jmp wait_for_servercommand
|
jmp wait_for_servercommand
|
||||||
|
|
||||||
|
|
||||||
cmd_rmd:
|
cmd_rmd:
|
||||||
|
|
||||||
mov dword[s], "RMD "
|
mov dword[s], "RMD "
|
||||||
@ -177,6 +190,7 @@ cmd_rmd:
|
|||||||
|
|
||||||
jmp wait_for_servercommand
|
jmp wait_for_servercommand
|
||||||
|
|
||||||
|
|
||||||
cmd_mkd:
|
cmd_mkd:
|
||||||
|
|
||||||
mov dword[s], "MKD "
|
mov dword[s], "MKD "
|
||||||
@ -193,18 +207,15 @@ cmd_mkd:
|
|||||||
jmp wait_for_servercommand
|
jmp wait_for_servercommand
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; esi = source ptr
|
; esi = source ptr
|
||||||
; edi = dest ptr
|
|
||||||
; ecx = max length of source buffer
|
; ecx = max length of source buffer
|
||||||
set_filename:
|
set_filename:
|
||||||
|
|
||||||
|
mov edi, filestruct.name
|
||||||
.loop:
|
.loop:
|
||||||
lodsb
|
lodsb
|
||||||
test al, al
|
test al, al
|
||||||
jz .done
|
jz .done
|
||||||
cmp al, ' '
|
|
||||||
je .done
|
|
||||||
cmp al, 10
|
cmp al, 10
|
||||||
je .done
|
je .done
|
||||||
stosb
|
stosb
|
||||||
@ -213,5 +224,4 @@ set_filename:
|
|||||||
xor al, al ; append a 0 byte
|
xor al, al ; append a 0 byte
|
||||||
stosb
|
stosb
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
Loading…
Reference in New Issue
Block a user