aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Szeredi <miklos@szeredi.hu>2005-03-08 13:11:12 +0000
committerMiklos Szeredi <miklos@szeredi.hu>2005-03-08 13:11:12 +0000
commitb1ddd5f430836251058e2d0e71728f2beee62a17 (patch)
tree08ad07b9739c28a1c3ee3f9f62d44d432f8b57a7
parentb3aac4e035e572e4fc01ad32e2fe936e40ab5b09 (diff)
downloadsshfs-b1ddd5f430836251058e2d0e71728f2beee62a17.tar
sshfs-b1ddd5f430836251058e2d0e71728f2beee62a17.tar.gz
sshfs-b1ddd5f430836251058e2d0e71728f2beee62a17.tar.bz2
sshfs-b1ddd5f430836251058e2d0e71728f2beee62a17.zip
fix
-rw-r--r--ChangeLog9
-rw-r--r--sshfs.c19
2 files changed, 24 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 242c1b7..89001eb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2005-03-08 Miklos Szeredi <miklos@szeredi.hu>
+
+ * Make it work on server version 2 (e.g. Sun_SSH_1.0.1). Report
+ and testing by Pieter J. Kersten
+
+2005-03-04 Miklos Szeredi <miklos@szeredi.hu>
+
+ * Released 1.1
+
2005-03-03 Miklos Szeredi <miklos@szeredi.hu>
* Slightly optimize readahead. Still not clever enough to always
diff --git a/sshfs.c b/sshfs.c
index 39ffc4e..1f11e43 100644
--- a/sshfs.c
+++ b/sshfs.c
@@ -86,6 +86,7 @@
static int infd;
static int outfd;
+static int server_version;
static int debug = 0;
static int sync_write = 0;
static int sync_read = 0;
@@ -924,6 +925,10 @@ static int sshfs_readlink(const char *path, char *linkbuf, size_t size)
int err;
struct buffer buf;
struct buffer name;
+
+ if (server_version < 3)
+ return -EPERM;
+
buf_init(&buf, 0);
buf_add_path(&buf, path);
err = sftp_request(SSH_FXP_READLINK, &buf, SSH_FXP_NAME, &name);
@@ -1022,6 +1027,10 @@ static int sshfs_symlink(const char *from, const char *to)
{
int err;
struct buffer buf;
+
+ if (server_version < 3)
+ return -EPERM;
+
/* openssh sftp server doesn't follow standard: link target and
link name are mixed up, so we must also be non-standard :( */
buf_init(&buf, 0);
@@ -1465,12 +1474,14 @@ static int sftp_init()
}
if (buf_get_uint32(&buf, &version) == -1)
goto out;
- if (version != PROTO_VERSION) {
- fprintf(stderr, "server version: %i, we need: %i\n",
+
+ server_version = version;
+ DEBUG("Server version: %i\n", server_version);
+ if (version > PROTO_VERSION)
+ fprintf(stderr, "Warning: server uses version: %i, we support: %i\n",
version, PROTO_VERSION);
- goto out;
- }
res = 0;
+
out:
buf_free(&buf);
return res;