netcat-openbsd/get-sev-by-name.patch
Vítězslav Čížek c0756e8f2c Accepting request 510980 from home:scarabeus_iv:branches:network:utilities
- Drop all patches that were never upstreamed:
  * connect-timeout.patch
  * dccp.patch
  * gcc-warnings.patch
  * getservbyname.patch
  * glib-strlcpy.patch
  * help-version-exit.patch
  * nc-1.84-udp_stop.patch
  * netcat-info.patch
  * netcat-openbsd-debian.patch
  * netcat-openbsd-examples.patch
  * netcat-openbsd-openbsd-compat.patch
  * no-strtonum.patch
  * pollhup.patch
  * quit-timer.patch
  * reuseaddr.patch
  * send-crlf.patch
  * silence-z.patch
  * socks-b64-prototype.patch
  * udp-scan-timeout.patch
  * verbose-message-to-stderr.patch
  * verbose-numeric-port.patch
- Switch to debian package to not waste resources on doing exactly
  the same.
- Switches URL for debian package
- Apply patches already prepared for debian package
  * port-to-linux-with-libsd.patch
  * compile-without-TLS-support.patch
  * connect-timeout.patch
  * get-sev-by-name.patch

OBS-URL: https://build.opensuse.org/request/show/510980
OBS-URL: https://build.opensuse.org/package/show/network:utilities/netcat-openbsd?expand=0&rev=16
2017-07-17 13:26:12 +00:00

29 lines
610 B
Diff

From: Aron Xu <aron@debian.org>
Date: Mon, 13 Feb 2012 14:45:08 +0800
Subject: get sev by name
---
netcat.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
--- a/netcat.c
+++ b/netcat.c
@@ -1603,11 +1603,16 @@ strtoport(char *portstr, int udp)
void
build_ports(char *p)
{
+ struct servent *sv;
char *n;
int hi, lo, cp;
int x = 0;
- if ((n = strchr(p, '-')) != NULL) {
+ sv = getservbyname(p, uflag ? "udp" : "tcp");
+ if (sv) {
+ if (asprintf(&portlist[0], "%d", ntohs(sv->s_port)) < 0)
+ err(1, "asprintf");
+ } else if ((n = strchr(p, '-')) != NULL) {
*n = '\0';
n++;