Commit 00608d178819ccaed399fc4ffebc6779ddca1165
1 parent
a58e00b2
Exists in
master
and in
3 other branches
rpmlint estava reclamando do uso de gethostbyname
Showing
4 changed files
with
33 additions
and
20 deletions
Show diff stats
proxy.c
| @@ -516,8 +516,13 @@ proxy_telnet(int fd, char *host, unsigned short port) | @@ -516,8 +516,13 @@ proxy_telnet(int fd, char *host, unsigned short port) | ||
| 516 | } | 516 | } |
| 517 | 517 | ||
| 518 | /* SOCKS version 4 proxy. */ | 518 | /* SOCKS version 4 proxy. */ |
| 519 | -static int | ||
| 520 | -proxy_socks4(int fd, char *host, unsigned short port, int force_a) | 519 | +#if defined(HAVE_GETADDRINFO) |
| 520 | +static int proxy_socks4(int fd, char *host, unsigned short port, int force_a) | ||
| 521 | +{ | ||
| 522 | + popup_an_error(NULL,"%s", _( "Unsupported socks 4 proxy" ) ); | ||
| 523 | +} | ||
| 524 | +#else | ||
| 525 | +static int proxy_socks4(int fd, char *host, unsigned short port, int force_a) | ||
| 521 | { | 526 | { |
| 522 | struct hostent *hp; | 527 | struct hostent *hp; |
| 523 | struct in_addr ipaddr; | 528 | struct in_addr ipaddr; |
| @@ -673,6 +678,7 @@ proxy_socks4(int fd, char *host, unsigned short port, int force_a) | @@ -673,6 +678,7 @@ proxy_socks4(int fd, char *host, unsigned short port, int force_a) | ||
| 673 | 678 | ||
| 674 | return 0; | 679 | return 0; |
| 675 | } | 680 | } |
| 681 | +#endif // HAVE_GETADDRINFO | ||
| 676 | 682 | ||
| 677 | /* SOCKS version 5 (RFC 1928) proxy. */ | 683 | /* SOCKS version 5 (RFC 1928) proxy. */ |
| 678 | static int | 684 | static int |
resolver.c
| @@ -129,7 +129,7 @@ static int cresolve_host_and_port(H3270 *h, struct parms *p) | @@ -129,7 +129,7 @@ static int cresolve_host_and_port(H3270 *h, struct parms *p) | ||
| 129 | 129 | ||
| 130 | freeaddrinfo(res); | 130 | freeaddrinfo(res); |
| 131 | 131 | ||
| 132 | -#else /*][*/ | 132 | +#else |
| 133 | 133 | ||
| 134 | struct hostent *hp; | 134 | struct hostent *hp; |
| 135 | struct servent *sp; | 135 | struct servent *sp; |
| @@ -175,7 +175,7 @@ static int cresolve_host_and_port(H3270 *h, struct parms *p) | @@ -175,7 +175,7 @@ static int cresolve_host_and_port(H3270 *h, struct parms *p) | ||
| 175 | sin->sin_port = port; | 175 | sin->sin_port = port; |
| 176 | *p->sa_len = sizeof(struct sockaddr_in); | 176 | *p->sa_len = sizeof(struct sockaddr_in); |
| 177 | 177 | ||
| 178 | -#endif | 178 | +#endif // HAVE_GETADDRINFO |
| 179 | 179 | ||
| 180 | return 0; | 180 | return 0; |
| 181 | } | 181 | } |
| @@ -604,7 +604,7 @@ get_rpq_address(unsigned char *buf, const int maxlen) | @@ -604,7 +604,7 @@ get_rpq_address(unsigned char *buf, const int maxlen) | ||
| 604 | } | 604 | } |
| 605 | *p2 = '\0'; | 605 | *p2 = '\0'; |
| 606 | 606 | ||
| 607 | -#if defined(AF_INET6) /*[*/ | 607 | +#if defined(HAVE_GETADDRINFO) |
| 608 | ga_err = getaddrinfo(rpqtext, NULL, NULL, &res); | 608 | ga_err = getaddrinfo(rpqtext, NULL, NULL, &res); |
| 609 | if (ga_err == 0) { | 609 | if (ga_err == 0) { |
| 610 | void *src = NULL; | 610 | void *src = NULL; |
| @@ -623,8 +623,7 @@ get_rpq_address(unsigned char *buf, const int maxlen) | @@ -623,8 +623,7 @@ get_rpq_address(unsigned char *buf, const int maxlen) | ||
| 623 | len = sizeof(struct in6_addr); | 623 | len = sizeof(struct in6_addr); |
| 624 | break; | 624 | break; |
| 625 | default: | 625 | default: |
| 626 | - rpq_warning("RPQ ADDRESS term has unrecognized family %u", | ||
| 627 | - res->ai_family); | 626 | + rpq_warning("RPQ ADDRESS term has unrecognized family %u",res->ai_family); |
| 628 | break; | 627 | break; |
| 629 | } | 628 | } |
| 630 | 629 | ||
| @@ -663,16 +662,16 @@ get_rpq_address(unsigned char *buf, const int maxlen) | @@ -663,16 +662,16 @@ get_rpq_address(unsigned char *buf, const int maxlen) | ||
| 663 | } else { | 662 | } else { |
| 664 | rpq_warning("RPQ ADDRESS term incomplete due to space limit"); | 663 | rpq_warning("RPQ ADDRESS term incomplete due to space limit"); |
| 665 | } | 664 | } |
| 666 | -#endif /*]*/ | 665 | +#endif // HAVE_GETADDRINFO |
| 667 | free(rpqtext); | 666 | free(rpqtext); |
| 668 | } else { | 667 | } else { |
| 669 | /* No override... get our address from the actual socket */ | 668 | /* No override... get our address from the actual socket */ |
| 670 | union { | 669 | union { |
| 671 | struct sockaddr sa; | 670 | struct sockaddr sa; |
| 672 | struct sockaddr_in sa4; | 671 | struct sockaddr_in sa4; |
| 673 | -#if defined(AF_INET6) /*[*/ | 672 | +#if defined(HAVE_GETADDRINFO) |
| 674 | struct sockaddr_in6 sa6; | 673 | struct sockaddr_in6 sa6; |
| 675 | -#endif /*]*/ | 674 | +#endif // HAVE_GETADDRINFO |
| 676 | } u; | 675 | } u; |
| 677 | int addrlen = sizeof(u); | 676 | int addrlen = sizeof(u); |
| 678 | void *src = NULL; | 677 | void *src = NULL; |
| @@ -687,12 +686,12 @@ get_rpq_address(unsigned char *buf, const int maxlen) | @@ -687,12 +686,12 @@ get_rpq_address(unsigned char *buf, const int maxlen) | ||
| 687 | src = &u.sa4.sin_addr; | 686 | src = &u.sa4.sin_addr; |
| 688 | len = sizeof(struct in_addr); | 687 | len = sizeof(struct in_addr); |
| 689 | break; | 688 | break; |
| 690 | -#if defined(AF_INET6) /*[*/ | 689 | +#if defined(HAVE_GETADDRINFO) |
| 691 | case AF_INET6: | 690 | case AF_INET6: |
| 692 | src = &u.sa6.sin6_addr; | 691 | src = &u.sa6.sin6_addr; |
| 693 | len = sizeof(struct in6_addr); | 692 | len = sizeof(struct in6_addr); |
| 694 | break; | 693 | break; |
| 695 | -#endif /*]*/ | 694 | +#endif // HAVE_GETADDRINFO |
| 696 | default: | 695 | default: |
| 697 | rpq_warning("RPQ ADDRESS term has unrecognized family %u", u.sa.sa_family); | 696 | rpq_warning("RPQ ADDRESS term has unrecognized family %u", u.sa.sa_family); |
| 698 | break; | 697 | break; |
telnet.c
| @@ -491,8 +491,8 @@ static int connect_sock(H3270 *hSession, int sockfd, const struct sockaddr *addr | @@ -491,8 +491,8 @@ static int connect_sock(H3270 *hSession, int sockfd, const struct sockaddr *addr | ||
| 491 | */ | 491 | */ |
| 492 | int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Boolean *resolving, Boolean *pending) | 492 | int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Boolean *resolving, Boolean *pending) |
| 493 | { | 493 | { |
| 494 | - struct servent * sp; | ||
| 495 | - struct hostent * hp; | 494 | +// struct servent * sp; |
| 495 | +// struct hostent * hp; | ||
| 496 | char passthru_haddr[8]; | 496 | char passthru_haddr[8]; |
| 497 | int passthru_len = 0; | 497 | int passthru_len = 0; |
| 498 | unsigned short passthru_port = 0; | 498 | unsigned short passthru_port = 0; |
| @@ -548,21 +548,27 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo | @@ -548,21 +548,27 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo | ||
| 548 | /* get the passthru host and port number */ | 548 | /* get the passthru host and port number */ |
| 549 | if (session->passthru_host) | 549 | if (session->passthru_host) |
| 550 | { | 550 | { |
| 551 | - const char *hn = CN; | 551 | +#if defined(HAVE_GETADDRINFO) |
| 552 | + | ||
| 553 | + popup_an_error(session,"%s",_( "Unsupported passthru host session" ) ); | ||
| 554 | + | ||
| 555 | +#else | ||
| 556 | + struct hostent * hp = NULL; | ||
| 557 | + struct servent * sp = NULL; | ||
| 558 | + const char * hn = CN; | ||
| 552 | 559 | ||
| 553 | -#ifndef ANDROID | ||
| 554 | hn = getenv("INTERNET_HOST"); | 560 | hn = getenv("INTERNET_HOST"); |
| 555 | -#endif // ANDROID | ||
| 556 | 561 | ||
| 557 | if (hn == CN) | 562 | if (hn == CN) |
| 558 | hn = "internet-gateway"; | 563 | hn = "internet-gateway"; |
| 559 | 564 | ||
| 560 | hp = gethostbyname(hn); | 565 | hp = gethostbyname(hn); |
| 561 | - if (hp == (struct hostent *) 0) { | ||
| 562 | - popup_an_error(NULL,"Unknown passthru host: %s", hn); | 566 | + if (hp == (struct hostent *) 0) |
| 567 | + { | ||
| 568 | + popup_an_error(session,_( "Unknown passthru host: %s" ), hn); | ||
| 563 | return -1; | 569 | return -1; |
| 564 | } | 570 | } |
| 565 | - (void) memmove(passthru_haddr, hp->h_addr, hp->h_length); | 571 | + memmove(passthru_haddr, hp->h_addr, hp->h_length); |
| 566 | passthru_len = hp->h_length; | 572 | passthru_len = hp->h_length; |
| 567 | 573 | ||
| 568 | sp = getservbyname("telnet-passthru","tcp"); | 574 | sp = getservbyname("telnet-passthru","tcp"); |
| @@ -570,6 +576,8 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo | @@ -570,6 +576,8 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo | ||
| 570 | passthru_port = sp->s_port; | 576 | passthru_port = sp->s_port; |
| 571 | else | 577 | else |
| 572 | passthru_port = htons(3514); | 578 | passthru_port = htons(3514); |
| 579 | + | ||
| 580 | +#endif // HAVE_GETADDRINFO | ||
| 573 | } | 581 | } |
| 574 | else if(session->proxy != CN && !proxy_type) | 582 | else if(session->proxy != CN && !proxy_type) |
| 575 | { | 583 | { |