Subversion Repositories Kolibri OS

Rev

Rev 3824 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3824 Rev 9916
Line 438... Line 438...
438
       @@:
438
       @@:
439
        mov     byte [edi], 0
439
        mov     byte [edi], 0
440
 
440
 
441
; Print the new working dir on the console
441
; TODO: Check directory on disk
Line -... Line 442...
-
 
442
 
-
 
443
 
-
 
444
; Print the new working dir on the console
442
        lea     eax, [ebp + thread_data.work_dir]
445
        lea     eax, [ebp + thread_data.work_dir]
443
        invoke  con_write_asciiz, eax
446
        invoke  con_write_asciiz, eax
444
        invoke  con_write_asciiz, str_newline
447
        invoke  con_write_asciiz, str_newline
445
 
448
 
Line 462... Line 465...
462
        test    [ebp + thread_data.permissions], PERMISSION_DELETE
465
        test    [ebp + thread_data.permissions], PERMISSION_DELETE
Line 463... Line 466...
463
        jz      permission_denied
466
        jz      permission_denied
464
 
467
 
Line -... Line 468...
-
 
468
        ; Create path
-
 
469
        cmp     ecx, 1024 + 5
-
 
470
        jae     .err
-
 
471
 
-
 
472
        sub     ecx, 5
-
 
473
        jb      .err
-
 
474
 
-
 
475
        call    create_path
-
 
476
        dec     edi
-
 
477
        lea     esi, [ebp + thread_data.buffer + 5]
-
 
478
        mov     ecx, 1024
-
 
479
        cmp     byte [esi], '/'
-
 
480
        jne     .loop
-
 
481
        inc     esi
-
 
482
  .loop:
-
 
483
        lodsb
-
 
484
        cmp     al, 0x20
-
 
485
        jl      .done
-
 
486
        stosb
-
 
487
        loop    .loop
-
 
488
  .done:
-
 
489
        xor     al, al
-
 
490
        stosb
-
 
491
 
-
 
492
        lea     ebx, [ebp + thread_data.fpath]
-
 
493
        invoke  con_write_asciiz, ebx
-
 
494
        invoke  con_write_asciiz, str_newline
-
 
495
        ; called fs function
-
 
496
        push    ebx
-
 
497
        dec     esp
-
 
498
        mov     byte[esp], 0
-
 
499
        push    dword 0
-
 
500
        push    dword 0
-
 
501
        push    dword 0
-
 
502
        push    dword 0
-
 
503
        push    dword 8
-
 
504
        mov     ebx, esp
-
 
505
        mcall   70
-
 
506
        add     esp, 6*4 + 1
-
 
507
 
-
 
508
        test    eax, eax
-
 
509
        jnz     .err
-
 
510
 
-
 
511
        sendFTP "250 Command succesful"
-
 
512
        ret
-
 
513
.err:
-
 
514
        sendFTP "550 No such file"
465
        ret
515
        ret
Line 466... Line 516...
466
 
516
 
467
;------------------------------------------------
517
;------------------------------------------------
468
; "LIST"
518
; "LIST"
Line 996... Line 1046...
996
        test    [ebp + thread_data.permissions], PERMISSION_WRITE
1046
        test    [ebp + thread_data.permissions], PERMISSION_WRITE
Line 997... Line 1047...
997
        jz      permission_denied
1047
        jz      permission_denied
998
 
1048
 
Line 999... Line 1049...
999
        sendFTP " Ready to receive"
1049
        ;sendFTP " Ready to receive"
-
 
1050
        ; open datasocket
-
 
1051
        cmp     ecx, 1024 + 5
-
 
1052
        jae     .cannot_open
Line -... Line 1053...
-
 
1053
 
-
 
1054
        sub     ecx, 5
Line 1000... Line 1055...
1000
 
1055
        jb      .cannot_open
Line -... Line 1056...
-
 
1056
 
-
 
1057
        call    open_datasock
-
 
1058
 
-
 
1059
        ; creat path
-
 
1060
        call    create_path
-
 
1061
        dec     edi
-
 
1062
        lea     esi, [ebp + thread_data.buffer + 5]
-
 
1063
        mov     ecx, 1024
-
 
1064
        cmp     byte [esi], '/'
-
 
1065
        jne     .loop
-
 
1066
        inc     esi
-
 
1067
  .loop:
-
 
1068
        lodsb
-
 
1069
        cmp     al, 0x20
-
 
1070
        jl      .done
-
 
1071
        stosb
-
 
1072
        loop    .loop
-
 
1073
  .done:
-
 
1074
        xor     al, al
-
 
1075
        stosb
-
 
1076
 
-
 
1077
        lea     ebx, [ebp + thread_data.fpath]
-
 
1078
        invoke  con_write_asciiz, ebx
-
 
1079
        invoke  con_write_asciiz, str_newline
-
 
1080
 
-
 
1081
        ; open file
-
 
1082
        invoke  file.open, ebx, O_CREATE + O_WRITE
-
 
1083
        test    eax, eax
-
 
1084
        jz      .cannot_open
-
 
1085
 
-
 
1086
        push    eax
-
 
1087
        sendFTP "150 Here it comes.."
1001
 
1088
        pop     ebx
1002
;;;;    TODO
1089
 
Line -... Line 1090...
-
 
1090
  .write_more:
-
 
1091
        test    [ebp + thread_data.permissions], ABORT
-
 
1092
        jnz     abort_transfer
-
 
1093
 
-
 
1094
        push    eax ebx
-
 
1095
        mov     esi, BUFFERSIZE ; eax
-
 
1096
        mov     ecx, [ebp + thread_data.datasocketnum]
-
 
1097
        lea     edx, [ebp + thread_data.buffer]
-
 
1098
        xor     edi, edi
-
 
1099
        mcall   recv
-
 
1100
        pop     ebx ecx
-
 
1101
        cmp     eax, -1
-
 
1102
        je      socketerror                                     ; FIXME: not the correct error
-
 
1103
 
-
 
1104
        test    eax, eax
-
 
1105
        jz      @f
-
 
1106
 
-
 
1107
        push    edx
-
 
1108
        mov     edx, eax
-
 
1109
        lea     eax, [ebp + thread_data.buffer]                 ; FIXME: use another buffer!! if we receive something on control connection now, we screw up!
-
 
1110
        invoke  file.write, ebx, eax, edx
-
 
1111
        pop     edx
-
 
1112
 
-
 
1113
        cmp     eax, -1
-
 
1114
        je      .cannot_open                                    ; FIXME: this is not the correct error
-
 
1115
 
-
 
1116
        invoke  con_write_asciiz, str2
-
 
1117
 
-
 
1118
;        cmp     eax, ecx
-
 
1119
;        jne     not_all_byes_sent                               ; TODO
-
 
1120
 
-
 
1121
        ;cmp     ecx, BUFFERSIZE
-
 
1122
        ;je      .write_more
-
 
1123
        jmp      .write_more
-
 
1124
@@:
-
 
1125
 
-
 
1126
        invoke  file.close, ebx
-
 
1127
 
-
 
1128
        invoke  con_write_asciiz, str2b
-
 
1129
 
-
 
1130
        mov     [ebp + thread_data.mode], MODE_NOTREADY
-
 
1131
        mcall   close, [ebp + thread_data.datasocketnum]
-
 
1132
 
-
 
1133
 
-
 
1134
 
-
 
1135
;;;;    TODO
1003
 
1136
;
Line 1004... Line 1137...
1004
        test    [ebp + thread_data.permissions], ABORT
1137
;        test    [ebp + thread_data.permissions], ABORT
-
 
1138
;        jnz     abort_transfer
Line -... Line 1139...
-
 
1139
;
-
 
1140
;;;;
1005
        jnz     abort_transfer
1141
 
Line 1006... Line 1142...
1006
 
1142
        sendFTP "226 Transfer OK"
1007
;;;;
1143
        ret
1008
 
1144