cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Patch to send arbitrary SFTP commands

From: Nick Zitzmann <nick_at_chronosnet.com>
Date: Thu, 29 Mar 2007 14:46:22 -0600

On Mar 29, 2007, at 3:01 AM, Daniel Stenberg wrote:

> Thanks for your patch!

I've attached the second version. Changes:

* Replaced all tabs with two spaces
* Replaced all cases of strncasecmp() with curl_strnequal()
* Replaced the bzero() call
* Added failf() errors (which required the addition of a function to
turn libssh2 errors into strings)
* Added rename support
* chown, chgrp, and chmod now fail if the user tries a non-numerical
first parameter

> Also, could you please consider providing at least some rudimentary
> docs for the commands supported and how to use them?

OK, here are the commands and how to use them. Note that all
parameters can be quoted in order to support paths with spaces in
their names, and all parameters listed by their commands are required.

chgrp (gid) (path)
Changes the group ID of the file or directory at (path) to (gid).
(gid) must be a number.

chmod (perms) (path)
Changes the permissions of the file or directory at (path) to
(perms). (perms) must be a number in the format used by the chmod
Unix command.

chown (uid) (path)
Changes the user ID of the file or directory at (path) to (uid).
(uid) must be a number.

ln (source) (dest)
Creates a symbolic link at (dest) that points to the file located at
(source).

mkdir (path)
Creates a new directory at (path).

rename (source) (dest)
Moves the file or directory at (source) to (dest).

rm (path)
Deletes the file located at (path).

rmdir (path)
Deletes the directory located at (path). This command will raise an
error if the directory is not empty.

symlink (source) (dest)
Same as ln.

Nick Zitzmann
<http://www.chronosnet.com/>

Received on 2007-03-29