aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Szeredi <miklos@szeredi.hu>2005-02-09 13:16:36 +0000
committerMiklos Szeredi <miklos@szeredi.hu>2005-02-09 13:16:36 +0000
commit2705253d2c78e19e44e1b7e8c6dcc220de3c82d1 (patch)
treea0c8e0a0d828a2a0089214319ef897382b77be45
parentb31885531595665081fe79cd0e7e4ede452c1d2d (diff)
downloadsshfs-2705253d2c78e19e44e1b7e8c6dcc220de3c82d1.tar
sshfs-2705253d2c78e19e44e1b7e8c6dcc220de3c82d1.tar.gz
sshfs-2705253d2c78e19e44e1b7e8c6dcc220de3c82d1.tar.bz2
sshfs-2705253d2c78e19e44e1b7e8c6dcc220de3c82d1.zip
fix
-rw-r--r--ChangeLog7
-rw-r--r--configure.ac2
-rw-r--r--opts.c10
-rw-r--r--sshfs.c34
4 files changed, 45 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index b014217..dafdd17 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2005-02-09 Miklos Szeredi <miklos@szeredi.hu>
+
+ * Added option to start arbitary command instead of 'ssh'
+
+ * Re-added '-p PORT' as a convenience option, also '-C' works as
+ in ssh.
+
2005-02-08 Miklos Szeredi <miklos@szeredi.hu>
* Add caching of symlinks
diff --git a/configure.ac b/configure.ac
index 30e9f21..82d740c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT(sshfs-fuse, 1.0)
+AC_INIT(sshfs-fuse, 1.1-pre1)
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(config.h)
diff --git a/opts.c b/opts.c
index 3e3e34a..ab39f36 100644
--- a/opts.c
+++ b/opts.c
@@ -83,12 +83,17 @@ void process_options(int *argcp, char *argv[], struct opt opts[],
argctr++;
arg = argv[argctr];
removed = process_option_group(arg, opts, case_sensitive);
- if (!removed && argctr != newargctr)
+ if (removed)
+ free(argv[argctr-1]);
+ else if (argctr != newargctr)
argv[newargctr++] = argv[argctr-1];
+
}
}
}
- if (!removed) {
+ if (removed)
+ free(arg);
+ else {
if(argctr != newargctr)
argv[newargctr] = arg;
newargctr++;
@@ -96,4 +101,3 @@ void process_options(int *argcp, char *argv[], struct opt opts[],
}
*argcp = newargctr;
}
-
diff --git a/sshfs.c b/sshfs.c
index 7827dda..01c1dc9 100644
--- a/sshfs.c
+++ b/sshfs.c
@@ -163,11 +163,13 @@ static struct opt ssh_opts[] = {
enum {
SOPT_DIRECTPORT,
+ SOPT_SSHCMD,
SOPT_LAST /* Last entry in this list! */
};
static struct opt sshfs_opts[] = {
[SOPT_DIRECTPORT] = { .optname = "directport" },
+ [SOPT_SSHCMD] = { .optname = "ssh_command" },
[SOPT_LAST] = { .optname = NULL }
};
@@ -476,6 +478,11 @@ static int start_ssh(char *host)
} else if (pid == 0) {
int argctr = 0;
char *ssh_args[sizeof(ssh_opts)/sizeof(struct opt) + 32];
+ char *ssh_cmd;
+ if (sshfs_opts[SOPT_SSHCMD].present)
+ ssh_cmd = sshfs_opts[SOPT_SSHCMD].value;
+ else
+ ssh_cmd = "ssh";
if (dup2(outpipe[0], 0) == -1 || dup2(inpipe[1], 1) == -1) {
perror("failed to redirect input/output");
@@ -486,7 +493,7 @@ static int start_ssh(char *host)
close(outpipe[0]);
close(outpipe[1]);
- ssh_args[argctr++] = "ssh";
+ ssh_args[argctr++] = ssh_cmd;
ssh_args[argctr++] = "-2";
ssh_args[argctr++] = "-x";
ssh_args[argctr++] = "-a";
@@ -504,7 +511,7 @@ static int start_ssh(char *host)
ssh_args[argctr++] = "sftp";
ssh_args[argctr++] = NULL;
- execvp("ssh", ssh_args);
+ execvp(ssh_cmd, ssh_args);
exit(1);
}
close(inpipe[1]);
@@ -1157,6 +1164,9 @@ static void usage(const char *progname)
"usage: %s [user@]host:[dir]] mountpoint [options]\n"
"\n"
"SSHFS Options:\n"
+ " -p PORT equivalent to '-o port=PORT'\n"
+ " -C equivalent to '-o compression=yes'\n"
+ " -o ssh_command=CMD execute CMD instead of 'ssh'\n"
" -o directport=PORT directly connect to port bypassing ssh\n"
" -o SSHOPT=VAL ssh options (see man ssh_config)\n"
"\n", progname);
@@ -1182,9 +1192,25 @@ int main(int argc, char *argv[])
usage(argv[0]);
break;
- default:
- newargv[newargc++] = strdup(arg);
+ case 'C':
+ if (!arg[2])
+ arg = "-oCompression=yes";
+ break;
+
+ case 'p':
+ if (arg[2] || argctr + 1 < argc) {
+ char *newarg;
+ if (arg[2])
+ arg = arg + 2;
+ else
+ arg = argv[++argctr];
+ newarg = malloc(strlen(arg)+32);
+ sprintf(newarg, "-oPort=%s", arg);
+ arg = newarg;
+ }
+ break;
}
+ newargv[newargc++] = strdup(arg);
} else if (!host && strchr(arg, ':'))
host = g_strdup(arg);
else