diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 8 | ||||
-rw-r--r-- | src/ssh.c | 2 | ||||
-rw-r--r-- | src/ssh.h | 18 |
3 files changed, 17 insertions, 11 deletions
@@ -82,7 +82,7 @@ int list_count(struct list_head *head) void usage(bool print_help) { printf("mscp v" VERSION ": copy files over multiple ssh connections\n" "\n" - "Usage: mscp [CvqDdh] [-n nr_conns]\n" + "Usage: mscp [vqDCHdh] [-n nr_conns]\n" " [-s min_chunk_sz] [-S max_chunk_sz]\n" " [-b sftp_buf_sz] [-B io_buf_sz]\n" " [-l login_name] [-p port] [-i identity_file]\n" @@ -108,6 +108,7 @@ void usage(bool print_help) { " -i IDENTITY identity file for publickey authentication\n" " -c CIPHER cipher spec, see `ssh -Q cipher`\n" " -C enable compression on libssh\n" + " -H disable hostkey check\n" " -d increment ssh debug output level\n" " -h print this help\n" "\n"); @@ -178,7 +179,7 @@ int main(int argc, char **argv) nr_threads = (int)(nr_cpus() / 2); nr_threads = nr_threads == 0 ? 1 : nr_threads; - while ((ch = getopt(argc, argv, "n:s:S:b:B:vqDl:p:i:c:Cdh")) != -1) { + while ((ch = getopt(argc, argv, "n:s:S:b:B:vqDl:p:i:c:CHdh")) != -1) { switch (ch) { case 'n': nr_threads = atoi(optarg); @@ -255,6 +256,9 @@ int main(int argc, char **argv) case 'C': opts.compress++; break; + case 'H': + opts.no_hostkey_check = true; + break; case 'd': opts.debuglevel++; break; @@ -106,7 +106,7 @@ static ssh_session ssh_make_ssh_session(char *sshdst, struct ssh_opts *opts) goto disconnect_out; } - if (ssh_verify_known_hosts(ssh) != 0) { + if (!opts->no_hostkey_check && ssh_verify_known_hosts(ssh) != 0) { goto disconnect_out; } @@ -1,19 +1,21 @@ #ifndef _SSH_H_ #define _SSH_H_ +#include <stdbool.h> #include <libssh/libssh.h> #include <libssh/sftp.h> struct ssh_opts { - char *login_name; /* -l */ - char *port; /* -p */ - char *identity; /* -i */ - char *cipher; /* -c */ - int compress; /* -C */ - int debuglevel; /* -v */ - - char *password; /* filled at the first connecting phase */ + char *login_name; /* -l */ + char *port; /* -p */ + char *identity; /* -i */ + char *cipher; /* -c */ + int compress; /* -C */ + int debuglevel; /* -v */ + bool no_hostkey_check; /* -H */ + + char *password; /* filled at the first connecting phase */ }; /* ssh_make_sftp_session() creates sftp_session. sshdst accpets |