FTP client

...
  • Thanks 0CodErr. Is there any way to test this on local machine? Do I need to follow build instructions from root/build.txt?
  • Writing to log file at /usbhd0/1/ftpc.log fails with "access denied" error. It writes successfully if i compile and run ftpc from /usbhd0/1/. Why does the ftpc from the image give this error? Will it work if I change log destination to /tmp0/1/?
  • nisargshah95, which filesystem do you use on /usbhd0/1 ?
    nisargshah95 wrote:Will it work if I change log destination to /tmp0/1/?
    I think yes, on the tmp the FAT filesystem is used. Just try it.
  • 0CodErr wrote:nisargshah95, which filesystem do you use on /usbhd0/1 ?
    I use FAT (32-bit) on /usbhd0/1. I will try submitting a fix with /tmp0/1 and see if it works.
  • 0CodErr, it looks like there is still "Access denied" issue even after moving log location to /tmp0/1/ (Rev 7201).
  • nisargshah95, maybe you'll show some code?
    How do you writing to log?
  • 0CodErr wrote:How do you writing to log?
    From programs/network/ftpc/ftpc.asm:637:

    Code: Select all

    ;;================================================================================================;;
    write_to_file: ;//////////////////////////////////////////////////////////////////////////////////;;
    ;;------------------------------------------------------------------------------------------------;;
    ;? Writes input buffer to log file                                                                ;;
    ;;------------------------------------------------------------------------------------------------;;
    ;> eax = pointer to buffer                                                                        ;;
    ;> ecx = size of buffer                                                                           ;;
    ;;------------------------------------------------------------------------------------------------;;
    ;< eax = status of SF 70.3                                                                        ;;
    ;;================================================================================================;;
            cmp     [logfile_offset], -1 ; if offset == -1 => logging disabled
            jne     @f
            mov     eax, 0
            ret
          @@:
            mov     [filestruct2.subfn], 3
            m2m     [filestruct2.offset], [logfile_offset]
            mov     [filestruct2.size], ecx
            mov     [filestruct2.ptr], eax
            mov     [filestruct2.name], log_file
            mcall   70, filestruct2
            test    eax, eax
            jz      @f
            mov     [logfile_offset], -1 ; disable logging
            call    error_fs
            icall   ebx, interface_addr, interface.print, str_no_logging
            ret
          @@:
            mov     eax, [logfile_offset]
            add     eax, ecx
            mov     [logfile_offset], eax
            ret
    Just to clarify, it works if I compile the FTPC source from /usbhd0/1 and run the compiled binary. Doesn't work for the FTPC packaged in Kolibri image.
  • Hmm, according to you code above it seems that used SysFn70.3:WriteFile only.
    Maybe it need to use SysFn70.2 instead of SysFn70.3?

    Below the code that i tested and it works fine:

    Code: Select all

    ; to compile: nasm -f bin test.asm -o test.kex
    ORG 0
    BITS 32
    ; ---------------------------------------------------------------------------- ;
    STACK_SIZE        equ 256
    ; ---------------------------| Application Header |--------------------------- ;
    MENUET01          db "MENUET01"
    version           dd 1
    program.start     dd START
    program.end       dd END
    program.memory    dd END + STACK_SIZE
    program.stack     dd END + STACK_SIZE
    program.params    dd 0
    program.path      dd 0
    ; ---------------------------------------------------------------------------- ;
    Buf:
    db 'This is my data to save to log file.'
    .end:
    PathToMyLogFile db '/tmp0/1/MyLogFile.txt',0
    Buffer dd Buf
    Count dd (Buf.end - Buf)
    Path dd PathToMyLogFile
    ; ---------------------------------------------------------------------------- ;
    align 4
    START:
    ; ---------------------------------------------------------------------------- ;
    ; Create\Rewrite file      ;   SysFn70.2
            push   dword [Path]
            dec    esp
            mov    byte[esp], 0
            push   dword [Buffer]
            push   dword [Count]
            push   dword 0
            push   dword 0
            push   dword 2
            mov    ebx, esp
            mov    eax, 70
            int    64
            add    esp, 25
    ; terminate                ;   SysFn-1
            or     eax, -1
            int    64
    ; ---------------------------------------------------------------------------- ;
    align 4
    END:
  • 0CodErr, I think you are right. On reading sysfuncs.txt carefully, I see 70.3 is for writing to existing file. Using 70.2 should work. Thanks very much!
  • According to sysfuncs.txt for 70.3,
    * The file must already exist, otherwise function returns eax=5.
    But I get eax=10. How is this possible?
  • nisargshah95, is your app really can to find ini-file?
  • 0CodErr wrote:nisargshah95, is your app really can to find ini-file?
    It does. As I mentioned before, if I compile ftpc source on /usbhd0/1 and run it from there it can successfully create and write to file.
  • nisargshah95 wrote:Doesn't work for the FTPC packaged in Kolibri image.
    Is ini-file also packaged in the image?
  • 0CodErr wrote:
    nisargshah95 wrote:Doesn't work for the FTPC packaged in Kolibri image.
    Is ini-file also packaged in the image?
    No. I always assumed it would be. But I don't see the file in /rd/1/network. Thanks a lot! I'll try adding it to data/Tupfile.lua.
  • Who is online

    Users browsing this forum: No registered users and 3 guests