libssh2 x routeros problem

Hi,

I work at an ISP and I’m writing a C program to fetch backup files via SCP using the libssh2, I’m writing in C for performance and learning purposes (I’ll use pthreads to open a thread for each router). After some struggle with key exchange problems and stuff, I finally got the program to authenticate into the routeros, the problem now is when it tries to fetch the backup file, here is the debug output of libssh2:

[libssh2] 0.948341 SCP: got 01 scp error: /'MikroTik-13032013-0751.backup’7Whz.Ie)>Tk (Ggx$>Yu: no such file or directory!

Whatever the file name is, it always says that the file doesn’t exist. After that, I tried to fetch a file from a FreeBSD machine using my program and it worked fine.

Any suggestions?

It’s great to learn C, but it’d be better to focus the learning on things you can debug with various methods (encryption makes it harder) and have open source throughout, so you can add debugging code to what it’s talking to for instance.

I use a higher level of programming; a bash script with scp to do the backups.

Hi,

I could use bash to do it, but, it would be a waste of time to throw away all the code that I’ve written so far, the only thing that isn’t working is the file fetching, and I’m quite sure that is something to do with RouterOS, as I said, I could fetch files from other systems (FreeBSD).

If you want it fast, then switching from SCP to SFTP transfers might help, libssh2 supports them too. Because I can see the same problem happening with Total Commander and SFTP plugin (which uses libssh2). SFTP transfers work, but when switched to SCP, I can’t access any file on RouterOS. No problem with Linux, so it’s the combination RouterOS+SCP+libssh2.