source: npl/overig/netcat_openbsd/patches/0003-get-sev-by-name.patch @ a9c55d3

perl-5.22
Last change on this file since a9c55d3 was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100644
File size: 881 bytes
  • netcat.c

    From: Aron Xu <aron@debian.org>
    Date: Mon, 13 Feb 2012 14:45:08 +0800
    Subject: get sev by name
    
    ---
     netcat.c |    9 ++++++++-
     1 file changed, 8 insertions(+), 1 deletion(-)
    
    diff --git a/netcat.c b/netcat.c
    index f3cc8c1..d912544 100644
    a b atelnet(int nfd, unsigned char *buf, unsigned int size) 
    949949void
    950950build_ports(char *p)
    951951{
     952        struct servent *sv;
    952953        const char *errstr;
    953954        char *n;
    954955        int hi, lo, cp;
    955956        int x = 0;
    956957
    957         if ((n = strchr(p, '-')) != NULL) {
     958        sv = getservbyname(p, uflag ? "udp" : "tcp");
     959        if (sv) {
     960                portlist[0] = calloc(1, PORT_MAX_LEN);
     961                if (portlist[0] == NULL)
     962                        err(1, NULL);
     963                snprintf(portlist[0], PORT_MAX_LEN, "%d", ntohs(sv->s_port));
     964        } else if ((n = strchr(p, '-')) != NULL) {
    958965                *n = '\0';
    959966                n++;
    960967
Note: See TracBrowser for help on using the repository browser.