Subversion Repositories Kolibri OS

Rev

Rev 2581 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2581 Rev 2585
Line 79... Line 79...
79
        dd cmdPASS
79
        dd cmdPASS
80
        db 'PASV'
80
        db 'PASV'
81
        dd cmdPASV
81
        dd cmdPASV
82
        db 'PWD', 0
82
        db 'PORT'
83
        dd cmdPWD
83
        dd cmdPORT
84
        db 'PORT'
-
 
85
        dd cmdPORT
-
 
86
        db 'QUIT'
84
        db 'PWD', 0
87
        dd cmdQUIT
85
        dd cmdPWD
-
 
86
        db 'QUIT'
-
 
87
        dd cmdQUIT
88
        db 'RETR'
88
        db 'RETR'
89
        dd cmdRETR
89
        dd cmdRETR
90
        db 'STOR'
90
        db 'STOR'
91
        dd cmdSTOR
91
        dd cmdSTOR
92
        db 'SYST'
92
        db 'SYST'
Line 95... Line 95...
95
        dd cmdTYPE
95
        dd cmdTYPE
96
        db 'USER'
96
        db 'USER'
97
        dd cmdUSER
97
        dd cmdUSER
98
        db 'XPWD'
98
        db 0            ; end marker
99
        dd cmdPWD
99
 
100
        db 0            ; end marker
-
 
101
 
-
 
102
 
100
 
Line 103... Line 101...
103
align 4
101
align 4
104
cmdABOR:
102
cmdABOR:
Line 110... Line 108...
110
align 4
108
align 4
Line 111... Line 109...
111
cmdCDUP:
109
cmdCDUP:
112
 
110
 
Line 113... Line 111...
113
        cmp     byte [edx + thread_data.work_dir+1], 0
111
        cmp     byte [edx + thread_data.work_dir+1], 0                          ; are we in "/" ?
114
        je      .done
112
        je      .done
Line 115... Line 113...
115
 
113
 
116
        mov     ecx, 1024
114
        mov     ecx, 1024
117
        xor     al, al
115
        xor     al, al
118
        lea     edi, [edx + thread_data.work_dir+1024]
116
        lea     edi, [edx + thread_data.work_dir]
119
        repne   scasb
117
        repne   scasb
120
        std
118
        std
-
 
119
        dec     edi
-
 
120
        dec     edi
121
        dec     edi
121
        dec     edi
122
        mov     al,'/'
122
        mov     al,'/'
123
        scasb
123
        repne   scasb
124
        cld
124
        cld
Line 125... Line 125...
125
        mov     byte[edi], 0
125
        mov     byte[edi+1], 0
-
 
126
 
-
 
127
  .done:
-
 
128
; Print the new working dir on the console
-
 
129
        lea     eax, [edx + thread_data.work_dir]
-
 
130
        push    eax
-
 
131
        call    [con_write_asciiz]
-
 
132
        push    str_newline
126
 
133
        call    [con_write_asciiz]
127
  .done:
134
 
Line -... Line 135...
-
 
135
        mcall   send, [edx + thread_data.socketnum], str250, str250.length, 0   ; command successful
128
        mcall   send, [edx + thread_data.socketnum], str250, str250.length, 0    ; command successful
136
        ret
129
        ret
137
 
Line 130... Line 138...
130
 
138
 
131
align 4
139
align 4
Line 172... Line 180...
172
       @@:
180
       @@:
173
        mov     byte [edi], 0
181
        mov     byte [edi], 0
174
 
182
 
175
        mcall   send, [edx + thread_data.socketnum], str250, str250.length, 0
183
; Print the new working dir on the console
Line -... Line 184...
-
 
184
        lea     eax, [edx + thread_data.work_dir]
-
 
185
        push    eax
-
 
186
        call    [con_write_asciiz]
-
 
187
        push    str_newline
-
 
188
        call    [con_write_asciiz]
-
 
189
 
-
 
190
        mcall   send, [edx + thread_data.socketnum], str250, str250.length, 0
176
 
191
 
Line 177... Line 192...
177
        ret
192
        ret
Line 178... Line 193...
178
 
193
 
Line 196... Line 211...
196
 
211
 
197
        ret
212
        ret
Line 198... Line 213...
198
 
213
 
Line -... Line 214...
-
 
214
 
199
align 4
215
align 4
200
cmdLIST:
216
cmdLIST:
Line 201... Line 217...
201
 
217
 
202
; If we are in active mode, it's time to open a data socket..
218
; If we are in active mode, it's time to open a data socket..
Line 342... Line 358...
342
; close the data socket..
358
; close the data socket..
Line 343... Line 359...
343
        mov     edx, [esp+4]                                    ; thread_data pointer
359
        mov     edx, [esp+4]                                    ; thread_data pointer
344
        mcall   close, [edx + thread_data.datasocketnum]
360
        mcall   close, [edx + thread_data.datasocketnum]
345
 
361
        mov     [edx + thread_data.mode], MODE_NOTREADY
346
        cmp     [edx + thread_data.mode], MODE_PASSIVE_OK
-
 
347
        jne     @f
-
 
348
        mov     [edx + thread_data.mode], MODE_NOTREADY
-
 
349
      @@:
362
 
350
 
-
 
Line 351... Line 363...
351
; And send "transfer ok" on the base connection
363
; And send "transfer ok" on the base connection
352
        mcall   send, [edx + thread_data.socketnum], str226, str226.length, 0
364
        mcall   send, [edx + thread_data.socketnum], str226, str226.length, 0
Line 353... Line 365...
353
 
365
 
Line 446... Line 458...
446
 
458
 
447
        ret
459
        ret
Line 448... Line 460...
448
 
460
 
Line -... Line 461...
-
 
461
 
449
align 4
462
align 4
450
cmdPWD:         ; Print Working Directory
463
cmdPWD:         ; Print Working Directory
Line 451... Line 464...
451
 
464
 
452
        mov     dword [edx + thread_data.buffer], '257 '
465
        mov     dword [edx + thread_data.buffer], '257 '
Line 469... Line 482...
469
        sub     esi, edx
482
        sub     esi, edx
470
        mov     ecx, [edx + thread_data.socketnum]
483
        mov     ecx, [edx + thread_data.socketnum]
471
        lea     edx, [edx + thread_data.buffer]
484
        lea     edx, [edx + thread_data.buffer]
472
        mcall   send, , , , 0
485
        xor     edi, edi
473
 
486
        mcall   send
-
 
487
 
474
;        push    work_dir
488
        mov     edx, [esp+4]
Line -... Line 489...
-
 
489
; Print the new working dir on the console
-
 
490
        lea     eax, [edx + thread_data.work_dir]
-
 
491
        push    eax
475
;        push    str_pwd
492
        call    [con_write_asciiz]
-
 
493
        push    str_newline
476
;        call    [con_printf]
494
        call    [con_write_asciiz]
477
 
495
 
Line 478... Line 496...
478
        ret
496
        ret
Line -... Line 497...
-
 
497
 
479
 
498
 
480
align 4
499
align 4
Line 481... Line 500...
481
cmdPORT:
500
cmdPORT:
482
 
501
 
Line 618... Line 637...
618
        je      .read_more
637
        je      .read_more
619
 
638
 
Line 620... Line 639...
620
        mcall   close, [edx + thread_data.datasocketnum]
639
        mcall   close, [edx + thread_data.datasocketnum]
621
 
-
 
622
        cmp     [edx + thread_data.mode], MODE_PASSIVE_OK
-
 
623
        jne     @f
-
 
624
        mov     [edx + thread_data.mode], MODE_PASSIVE_WAIT
640
        mov     [edx + thread_data.mode], MODE_NOTREADY
625
      @@:
-
 
Line 626... Line 641...
626
 
641
 
Line 627... Line 642...
627
        mcall   send, [edx + thread_data.socketnum], str226, str226.length, 0    ; transfer ok
642
        mcall   send, [edx + thread_data.socketnum], str226, str226.length, 0    ; transfer ok
Line 682... Line 697...
682
        mov     [edx + thread_data.type], TYPE_EBDIC
697
        mov     [edx + thread_data.type], TYPE_EBDIC
683
 
698
 
Line 684... Line 699...
684
  .subtype:
699
  .subtype:
685
 
-
 
686
        cmp     ecx, 8
700
        cmp     ecx, 8
687
        jb      .non_print
701
        jb      .non_print
Line 688... Line 702...
688
 
702
 
689
        mov     al, byte[esi+7]
703
        mov     al, byte[esi+7]
Line 731... Line 745...
731
 
745
 
732
        ret
746
        ret
Line 733... Line 747...
733
 
747
 
Line -... Line 748...
-
 
748
 
734
align 4
749
align 4
735
cmdUSER:
750
cmdUSER:
Line 736... Line 751...
736
 
751
 
Line 737... Line -...
737
        ; TODO: check user and set home directory (and permissions)
-
 
738
 
-
 
739
        mcall   send, [edx + thread_data.socketnum], str331, str331.length, 0
752
        ; TODO: check user and set home directory (and permissions)
740
        mov     edx, [esp+4]                                    ; thread_data pointer
-
 
741
        mov     [edx + thread_data.state], STATE_LOGIN
753
 
742
 
754
        mov     [edx + thread_data.state], STATE_LOGIN
Line 743... Line 755...
743
        mov     byte [edx + thread_data.work_dir], "/"
755
        mov     word [edx + thread_data.home_dir], "/"          ; "/", 0
744
        mov     byte [edx + thread_data.work_dir+1], 0
756
        mov     word [edx + thread_data.work_dir], "/"          ; "/", 0
Line -... Line 757...
-
 
757
 
-
 
758
        push    str_logged_in
745
 
759
        call    [con_write_asciiz]
Line 746... Line 760...
746
        push    str_logged_in
760