diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/usr.bin/nc/netcat.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/usr.bin/nc/netcat.c b/src/usr.bin/nc/netcat.c index e60527199f..c013d2328a 100644 --- a/src/usr.bin/nc/netcat.c +++ b/src/usr.bin/nc/netcat.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: netcat.c,v 1.220 2022/12/18 12:45:34 tb Exp $ */ | 1 | /* $OpenBSD: netcat.c,v 1.221 2022/12/18 12:47:31 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2001 Eric Jackson <ericj@monkey.org> | 3 | * Copyright (c) 2001 Eric Jackson <ericj@monkey.org> |
| 4 | * Copyright (c) 2015 Bob Beck. All rights reserved. | 4 | * Copyright (c) 2015 Bob Beck. All rights reserved. |
| @@ -131,7 +131,7 @@ int timeout_connect(int, const struct sockaddr *, socklen_t); | |||
| 131 | int socks_connect(const char *, const char *, struct addrinfo, | 131 | int socks_connect(const char *, const char *, struct addrinfo, |
| 132 | const char *, const char *, struct addrinfo, int, const char *); | 132 | const char *, const char *, struct addrinfo, int, const char *); |
| 133 | int udptest(int); | 133 | int udptest(int); |
| 134 | void connection_info(const char *, const char *, const char *); | 134 | void connection_info(const char *, const char *, const char *, const char *); |
| 135 | int unix_bind(char *, int); | 135 | int unix_bind(char *, int); |
| 136 | int unix_connect(char *); | 136 | int unix_connect(char *); |
| 137 | int unix_listen(char *); | 137 | int unix_listen(char *); |
| @@ -708,7 +708,8 @@ main(int argc, char *argv[]) | |||
| 708 | } | 708 | } |
| 709 | } | 709 | } |
| 710 | 710 | ||
| 711 | connection_info(host, portlist[i], ipaddr); | 711 | connection_info(host, portlist[i], |
| 712 | uflag ? "udp" : "tcp", ipaddr); | ||
| 712 | } | 713 | } |
| 713 | if (Fflag) | 714 | if (Fflag) |
| 714 | fdpass(s); | 715 | fdpass(s); |
| @@ -1519,7 +1520,8 @@ udptest(int s) | |||
| 1519 | } | 1520 | } |
| 1520 | 1521 | ||
| 1521 | void | 1522 | void |
| 1522 | connection_info(const char *host, const char *port, const char *ipaddr) | 1523 | connection_info(const char *host, const char *port, const char *proto, |
| 1524 | const char *ipaddr) | ||
| 1523 | { | 1525 | { |
| 1524 | struct servent *sv; | 1526 | struct servent *sv; |
| 1525 | 1527 | ||
| @@ -1527,7 +1529,7 @@ connection_info(const char *host, const char *port, const char *ipaddr) | |||
| 1527 | if (nflag) | 1529 | if (nflag) |
| 1528 | sv = NULL; | 1530 | sv = NULL; |
| 1529 | else { | 1531 | else { |
| 1530 | sv = getservbyport(ntohs(atoi(port)), uflag ? "udp" : "tcp"); | 1532 | sv = getservbyport(ntohs(atoi(port)), proto); |
| 1531 | } | 1533 | } |
| 1532 | 1534 | ||
| 1533 | fprintf(stderr, "Connection to %s", host); | 1535 | fprintf(stderr, "Connection to %s", host); |
| @@ -1539,8 +1541,8 @@ connection_info(const char *host, const char *port, const char *ipaddr) | |||
| 1539 | if (!nflag && !xflag && strcmp(host, ipaddr) != 0) | 1541 | if (!nflag && !xflag && strcmp(host, ipaddr) != 0) |
| 1540 | fprintf(stderr, " (%s)", ipaddr); | 1542 | fprintf(stderr, " (%s)", ipaddr); |
| 1541 | 1543 | ||
| 1542 | fprintf(stderr, " %s port [%s/%s] succeeded!\n", | 1544 | fprintf(stderr, " %s port [%s/%s] succeeded!\n", port, proto, |
| 1543 | port, uflag ? "udp" : "tcp", sv ? sv->s_name : "*"); | 1545 | sv ? sv->s_name : "*"); |
| 1544 | } | 1546 | } |
| 1545 | 1547 | ||
| 1546 | void | 1548 | void |
