[Libssh] libssh and sftp

Andreas Schneider mail at cynapses.org
Fri Aug 8 16:19:23 CEST 2008


Hi,

I've found the libssh mailinglist now. I'm developing a file synchronizer 
(http://www.csync.org) for Linux. The file synchronizer is modular so I've 
started to write a module for sftp with libssh.

To get it working I've created several patches for libssh. Most of them are to 
map ssh server responses to errno. They are attached.

Apply order:
libssh_sftp_const_void.patch
libssh_sftp_open_errno.patch
libssh_sftp_opendir_errno.patch
libssh_sftp_read_write_errno.patch
libssh_sftp_rename_remove.patch
libssh_sftp_mkdir_rmdir.patch
libssh_sftp_xstat.patch
libssh_sftp_mkdir_posix.patch


It would be great to have more POSIX like functions for the sftp stuff.

sftp_mkdirs for example shouldn't take SFTP_ATTRIBUTES as arguments it should 
just use mode_t.

int sftp_mkdir(SFTP_SESSION *sftp, char *directory, mode_t mode) {
...
SFTP_ATTRIBUTES attr;

attr.permissions = mode;
attr.flags |= SSH_FILEXFER_ATTR_PERMISSIONS;
...
buffer_add_attributes(buffer, &attr);
...
}

or

int sftp_utimes(SFTP_SESSION *sftp, const char *file,
  const struct timeval *times) {
  SFTP_ATTRIBUTES attr;

  attrs.atime = times[0].tv_sec;
  attrs.atime_nseconds = times[0].tv_usec;                                                      

  attrs.mtime = times[1].tv_sec;                                                                     
  attrs.mtime_nseconds = times[1].tv_usec;                                                      
  attrs.flags |= SSH_FILEXFER_ATTR_ACCESSTIME|SSH_FILEXFER_ATTR_MODIFYTIME;

  return sftp_setstat(sftp_session, path, &attrs);
}

I do the changes to be mostly POSIX conform. Please let me know if the patches 
would get accepted and if I should work on this.


Best regards,

	-- andreas

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.cerkinfo.be/pipermail/libssh/attachments/20080808/e9dc4e4d/attachment-0001.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libssh_sftp_const_void.patch
Type: text/x-patch
Size: 2212 bytes
Desc: not available
Url : http://www.cerkinfo.be/pipermail/libssh/attachments/20080808/e9dc4e4d/attachment-0008.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libssh_sftp_mkdir_posix.patch
Type: text/x-patch
Size: 873 bytes
Desc: not available
Url : http://www.cerkinfo.be/pipermail/libssh/attachments/20080808/e9dc4e4d/attachment-0009.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libssh_sftp_read_write_errno.patch
Type: text/x-patch
Size: 1750 bytes
Desc: not available
Url : http://www.cerkinfo.be/pipermail/libssh/attachments/20080808/e9dc4e4d/attachment-0010.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libssh_sftp_opendir_errno.patch
Type: text/x-patch
Size: 783 bytes
Desc: not available
Url : http://www.cerkinfo.be/pipermail/libssh/attachments/20080808/e9dc4e4d/attachment-0011.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libssh_sftp_mkdir_rmdir.patch
Type: text/x-patch
Size: 2703 bytes
Desc: not available
Url : http://www.cerkinfo.be/pipermail/libssh/attachments/20080808/e9dc4e4d/attachment-0012.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libssh_sftp_open_errno.patch
Type: text/x-patch
Size: 1556 bytes
Desc: not available
Url : http://www.cerkinfo.be/pipermail/libssh/attachments/20080808/e9dc4e4d/attachment-0013.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libssh_sftp_rename_remove.patch
Type: text/x-patch
Size: 2749 bytes
Desc: not available
Url : http://www.cerkinfo.be/pipermail/libssh/attachments/20080808/e9dc4e4d/attachment-0014.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libssh_sftp_xstat.patch
Type: text/x-patch
Size: 825 bytes
Desc: not available
Url : http://www.cerkinfo.be/pipermail/libssh/attachments/20080808/e9dc4e4d/attachment-0015.bin 
-------------- next part --------------
libssh_sftp_const_void.patch
libssh_sftp_open_errno.patch
libssh_sftp_opendir_errno.patch
libssh_sftp_read_write_errno.patch
libssh_sftp_rename_remove.patch
libssh_sftp_mkdir_rmdir.patch
libssh_sftp_xstat.patch
libssh_sftp_mkdir_posix.patch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://www.cerkinfo.be/pipermail/libssh/attachments/20080808/e9dc4e4d/attachment-0001.pgp 


More information about the Libssh mailing list