mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-29 00:34:33 +02:00
upstream: make host/banner comments go to stderr instead of stdout,
so they are useful as comments without extra shell redirection and so they don't clutter actual errors on stderr. Add a -q flag to shut them up. ok dtucker@ OpenBSD-Commit-ID: bec813de56a71adb5c1a76adcf49621130d24264
This commit is contained in:
parent
3e806d0118
commit
1e84d0cf40
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: ssh-keyscan.c,v 1.157 2024/05/06 19:26:17 tobias Exp $ */
|
/* $OpenBSD: ssh-keyscan.c,v 1.158 2024/06/14 00:25:25 djm Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>.
|
* Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>.
|
||||||
*
|
*
|
||||||
@ -84,6 +84,8 @@ int found_one = 0; /* Successfully found a key */
|
|||||||
|
|
||||||
int hashalg = -1; /* Hash for SSHFP records or -1 for all */
|
int hashalg = -1; /* Hash for SSHFP records or -1 for all */
|
||||||
|
|
||||||
|
int quiet = 0; /* Don't print key comment lines */
|
||||||
|
|
||||||
#define MAXMAXFD 256
|
#define MAXMAXFD 256
|
||||||
|
|
||||||
/* The number of seconds after which to give up on a TCP connection */
|
/* The number of seconds after which to give up on a TCP connection */
|
||||||
@ -542,8 +544,10 @@ congreet(int s)
|
|||||||
confree(s);
|
confree(s);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fprintf(stderr, "%c %s:%d %s\n", print_sshfp ? ';' : '#',
|
if (!quiet) {
|
||||||
|
fprintf(stdout, "%c %s:%d %s\n", print_sshfp ? ';' : '#',
|
||||||
c->c_name, ssh_port, chop(buf));
|
c->c_name, ssh_port, chop(buf));
|
||||||
|
}
|
||||||
keygrab_ssh2(c);
|
keygrab_ssh2(c);
|
||||||
confree(s);
|
confree(s);
|
||||||
}
|
}
|
||||||
@ -665,7 +669,7 @@ static void
|
|||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"usage: ssh-keyscan [-46cDHv] [-f file] [-O option] [-p port] [-T timeout]\n"
|
"usage: ssh-keyscan [-46cDHqv] [-f file] [-O option] [-p port] [-T timeout]\n"
|
||||||
" [-t type] [host | addrlist namelist]\n");
|
" [-t type] [host | addrlist namelist]\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@ -692,7 +696,7 @@ main(int argc, char **argv)
|
|||||||
if (argc <= 1)
|
if (argc <= 1)
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "cDHv46O:p:T:t:f:")) != -1) {
|
while ((opt = getopt(argc, argv, "cDHqv46O:p:T:t:f:")) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'H':
|
case 'H':
|
||||||
hash_hosts = 1;
|
hash_hosts = 1;
|
||||||
@ -727,6 +731,9 @@ main(int argc, char **argv)
|
|||||||
else
|
else
|
||||||
fatal("Too high debugging level.");
|
fatal("Too high debugging level.");
|
||||||
break;
|
break;
|
||||||
|
case 'q':
|
||||||
|
quiet = 1;
|
||||||
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
if (strcmp(optarg, "-") == 0)
|
if (strcmp(optarg, "-") == 0)
|
||||||
optarg = NULL;
|
optarg = NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user