forked from KolibriOS/kolibrios
Fixed PORT command (active mode) for FTPd (net branch)
git-svn-id: svn://kolibrios.org@2581 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
839afe4284
commit
e22890bbd0
@ -148,6 +148,7 @@ cmdCWD: ; Change Working Directory
|
|||||||
loop .find_zero
|
loop .find_zero
|
||||||
.found_zero:
|
.found_zero:
|
||||||
pop ecx
|
pop ecx
|
||||||
|
.scan2:
|
||||||
|
|
||||||
cmp byte [esi], '/'
|
cmp byte [esi], '/'
|
||||||
jne @f
|
jne @f
|
||||||
@ -182,8 +183,10 @@ cmdCWD: ; Change Working Directory
|
|||||||
cmp al, '.'
|
cmp al, '.'
|
||||||
jne .continue
|
jne .continue
|
||||||
|
|
||||||
;;;; call cmdCDUP ;;;;;; FIXME
|
;;;; TODO: find second last '\' in work_dir and make next char zero
|
||||||
jmp .scan
|
;;;; point edi to that 0
|
||||||
|
|
||||||
|
jmp .scan2
|
||||||
|
|
||||||
.err:
|
.err:
|
||||||
; TODO: print correct error message (550?)
|
; TODO: print correct error message (550?)
|
||||||
@ -208,7 +211,6 @@ cmdLIST:
|
|||||||
mov edx, [esp+4] ; thread_data pointer
|
mov edx, [esp+4] ; thread_data pointer
|
||||||
cmp eax, -1
|
cmp eax, -1
|
||||||
je socketerror
|
je socketerror
|
||||||
mov [edx + thread_data.datasocketnum], eax
|
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
; Create fpath from home_dir and work_dir
|
; Create fpath from home_dir and work_dir
|
||||||
@ -232,6 +234,7 @@ cmdLIST:
|
|||||||
|
|
||||||
lea edi, [edx + thread_data.buffer]
|
lea edi, [edx + thread_data.buffer]
|
||||||
.parse_file:
|
.parse_file:
|
||||||
|
|
||||||
test eax, eax ; did we find a file?
|
test eax, eax ; did we find a file?
|
||||||
jz .done
|
jz .done
|
||||||
mov ebx, eax ; yes, save the descripter in ebx
|
mov ebx, eax ; yes, save the descripter in ebx
|
||||||
@ -402,7 +405,8 @@ cmdPASV:
|
|||||||
|
|
||||||
mov ecx, eax ;[edx + thread_data.passivesocknum]
|
mov ecx, eax ;[edx + thread_data.passivesocknum]
|
||||||
lea edx, [edx + thread_data.datasock]
|
lea edx, [edx + thread_data.datasock]
|
||||||
mcall bind, , , sizeof.thread_data.datasock
|
mov esi, sizeof.thread_data.datasock
|
||||||
|
mcall bind
|
||||||
mov edx, [esp+4] ; thread_data pointer
|
mov edx, [esp+4] ; thread_data pointer
|
||||||
cmp eax, -1
|
cmp eax, -1
|
||||||
je bind_err
|
je bind_err
|
||||||
@ -439,7 +443,8 @@ cmdPASV:
|
|||||||
sub esi, edx
|
sub esi, edx
|
||||||
mov ecx, [edx + thread_data.socketnum]
|
mov ecx, [edx + thread_data.socketnum]
|
||||||
lea edx, [edx + thread_data.buffer]
|
lea edx, [edx + thread_data.buffer]
|
||||||
mcall send, , , ,0
|
xor esi, esi
|
||||||
|
mcall send
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -485,18 +490,19 @@ cmdPORT:
|
|||||||
lea esi, [esi+5]
|
lea esi, [esi+5]
|
||||||
; Convert the IP
|
; Convert the IP
|
||||||
call ascii_to_byte
|
call ascii_to_byte
|
||||||
mov bh, al
|
mov bl, al
|
||||||
inc esi ; skip past ','
|
inc esi ; skip past ','
|
||||||
call ascii_to_byte
|
call ascii_to_byte
|
||||||
mov bl, al
|
mov bh, al
|
||||||
shl ebx, 16
|
shl ebx, 16
|
||||||
inc esi
|
inc esi
|
||||||
call ascii_to_byte
|
call ascii_to_byte
|
||||||
mov bh, al
|
|
||||||
inc esi
|
|
||||||
call ascii_to_byte
|
|
||||||
mov bl, al
|
mov bl, al
|
||||||
inc esi
|
inc esi
|
||||||
|
call ascii_to_byte
|
||||||
|
mov bh, al
|
||||||
|
inc esi
|
||||||
|
rol ebx, 16
|
||||||
|
|
||||||
; And put it in datasock
|
; And put it in datasock
|
||||||
mov [edx + thread_data.datasock.sin_addr], ebx
|
mov [edx + thread_data.datasock.sin_addr], ebx
|
||||||
@ -532,6 +538,7 @@ cmdQUIT:
|
|||||||
mcall send, [edx + thread_data.socketnum], str221, str221.length, 0 ; 221 - bye!
|
mcall send, [edx + thread_data.socketnum], str221, str221.length, 0 ; 221 - bye!
|
||||||
mcall close;, [edx + thread_data.socketnum]
|
mcall close;, [edx + thread_data.socketnum]
|
||||||
|
|
||||||
|
add esp, 4 ; get rid of call return address
|
||||||
jmp thread_exit ; now close this thread
|
jmp thread_exit ; now close this thread
|
||||||
|
|
||||||
align 4
|
align 4
|
||||||
@ -545,12 +552,12 @@ cmdRETR:
|
|||||||
push esi
|
push esi
|
||||||
mov ecx, [edx + thread_data.datasocketnum]
|
mov ecx, [edx + thread_data.datasocketnum]
|
||||||
lea edx, [edx + thread_data.datasock]
|
lea edx, [edx + thread_data.datasock]
|
||||||
mcall connect, , , sizeof.thread_data.datasock
|
mov esi, sizeof.thread_data.datasock
|
||||||
|
mcall connect
|
||||||
pop esi
|
pop esi
|
||||||
mov edx, [esp+4] ; thread_data pointer
|
mov edx, [esp+4] ; thread_data pointer
|
||||||
cmp eax, -1
|
cmp eax, -1
|
||||||
je socketerror
|
je socketerror
|
||||||
mov [edx + thread_data.datasocketnum], eax
|
|
||||||
@@:
|
@@:
|
||||||
|
|
||||||
push esi
|
push esi
|
||||||
@ -601,7 +608,8 @@ cmdRETR:
|
|||||||
mov esi, eax
|
mov esi, eax
|
||||||
mov ecx, [edx + thread_data.datasocketnum]
|
mov ecx, [edx + thread_data.datasocketnum]
|
||||||
lea edx, [edx + thread_data.buffer]
|
lea edx, [edx + thread_data.buffer]
|
||||||
mcall send, , , , 0
|
xor esi, esi
|
||||||
|
mcall send
|
||||||
pop ebx
|
pop ebx
|
||||||
pop ecx
|
pop ecx
|
||||||
mov edx, [esp+4] ; thread_data pointer
|
mov edx, [esp+4] ; thread_data pointer
|
||||||
@ -777,10 +785,10 @@ dword_to_ascii: ; edi = ptr where to write, eax is number
|
|||||||
|
|
||||||
align 4
|
align 4
|
||||||
create_path: ; combine home_dir and work_dir strings into fpath
|
create_path: ; combine home_dir and work_dir strings into fpath
|
||||||
|
|
||||||
lea edi, [edx + thread_data.fpath]
|
lea edi, [edx + thread_data.fpath]
|
||||||
lea esi, [edx + thread_data.home_dir]
|
lea esi, [edx + thread_data.home_dir]
|
||||||
mov ecx, 1024
|
mov ecx, 1024
|
||||||
|
|
||||||
.loop1:
|
.loop1:
|
||||||
lodsb
|
lodsb
|
||||||
or al, al
|
or al, al
|
||||||
@ -796,7 +804,6 @@ create_path: ; combine home_dir and work_dir strings into fpath
|
|||||||
|
|
||||||
lea esi, [edx + thread_data.work_dir]
|
lea esi, [edx + thread_data.work_dir]
|
||||||
mov ecx, 1024
|
mov ecx, 1024
|
||||||
|
|
||||||
.loop2:
|
.loop2:
|
||||||
lodsb
|
lodsb
|
||||||
or al, al
|
or al, al
|
||||||
|
@ -31,6 +31,8 @@ MODE_ACTIVE = 1
|
|||||||
MODE_PASSIVE_WAIT = 2
|
MODE_PASSIVE_WAIT = 2
|
||||||
MODE_PASSIVE_OK = 3
|
MODE_PASSIVE_OK = 3
|
||||||
|
|
||||||
|
format binary as ""
|
||||||
|
|
||||||
use32
|
use32
|
||||||
db 'MENUET01' ; signature
|
db 'MENUET01' ; signature
|
||||||
dd 1 ; header version
|
dd 1 ; header version
|
||||||
|
Loading…
Reference in New Issue
Block a user