diff --git a/host.c b/host.c index 274da86..2c8ecf5 100644 --- a/host.c +++ b/host.c @@ -156,6 +156,7 @@ host_readlist(char *fname) { FILE *hstlist; struct host *hst; + struct host *hst_it; struct host *hst_head; char line[MAXNAME*3]; int i; @@ -238,6 +239,23 @@ host_readlist(char *fname) continue; } + /* check for duplicate host */ + hst_it = hst_head; + do + { + if ((hst_it->host != NULL && !strcmp(hst_it->host, hostname)) + && (hst_it->user != NULL && !strcmp(hst_it->user, login)) + && (hst_it->port == (uint16_t)port)) + { + break; + } + } + while ((hst_it = hst_it->next)); + + /* throw out duplicate host */ + if (hst_it) + continue; + /* add the host record */ hst = host_add(hst, login, hostname, (uint16_t)port); diff --git a/mpssh.c b/mpssh.c index b59731b..c75c1b1 100644 --- a/mpssh.c +++ b/mpssh.c @@ -178,8 +178,9 @@ child() != NON_DEFINED_PORT ? ps->hst->port : DEFAULT_PORT)); ssh_argv[sap++] = "-oPermitLocalCommand=yes"; lcmd = calloc(1, 2048); - snprintf(lcmd, 2048, "-oLocalCommand=%s %s -p %s %s@%s:%s", + snprintf(lcmd, 2048, "-oLocalCommand=%s %s %s -p %s %s@%s:%s", SCPPATH, + (ssh_quiet) ? "-q" : "", port_arg, script, ps->hst->user,