Changeset 472 for trunk/src/sh_tools.c
- Timestamp:
- May 29, 2015, 7:08:24 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_tools.c
r425 r472 93 93 #undef FIL__ 94 94 #define FIL__ _("sh_tools.c") 95 96 static int tools_debug = 0; 95 97 96 98 #ifdef SH_ENCRYPT … … 564 566 SL_ENTER(_("connect_port")); 565 567 568 if (tools_debug) 569 fprintf(stderr, _("-00- <%s> <%d> no IPv6 support\n"), address, port); 570 566 571 if (errsiz > 0) errmsg[0] = '\0'; 567 572 … … 575 580 while (check_cache && check_cache->address) 576 581 { 582 if (tools_debug) 583 fprintf(stderr, _("-01- <%s> <%s>\n"), 584 address, check_cache->address); 585 577 586 if ( 0 == sl_strncmp(check_cache->address, 578 587 address, sl_strlen(address)) ) … … 584 593 break; 585 594 } 595 if (tools_debug) 596 { 597 char eaddr[SH_IP_BUF]; 598 sl_strlcpy(eaddr, 599 inet_ntoa(*(struct in_addr *) &(sinr.sin_addr)), 600 sizeof(eaddr)); 601 fprintf(stderr, _("-02- <AF_INET> <%s> <%d> <%d>\n"), 602 eaddr, 603 port, cached); 604 } 586 605 if (check_cache->next) 587 606 check_cache = check_cache->next; … … 595 614 if (cached == 0) 596 615 { 616 if (tools_debug) 617 fputs(_("-03- not cached\n"), stderr); 597 618 #ifdef HAVE_INET_ATON 598 619 if (0 == inet_aton(address, &haddr)) … … 625 646 sinr.sin_addr = *(struct in_addr *) host_entry->h_addr; 626 647 648 if (tools_debug) 649 fprintf(stderr, 650 _("-04- <%s> <%s> hostent->h_name %s <%s> hostent->h_addr\n"), 651 address, 652 (host_entry->h_name == NULL) ? _("NULL") : host_entry->h_name, 653 (host_entry->h_addrtype == AF_INET) ? _("AF_INET") : _("AF_INET6"), 654 inet_ntoa(*(struct in_addr *) &(sinr.sin_addr))); 627 655 628 656 /* reverse DNS lookup … … 688 716 sinr.sin_port = htons (port); 689 717 sinr.sin_addr = haddr; 718 719 if (tools_debug) 720 fprintf(stderr, 721 _("-04- <%s> is_numeric AF_INET <%s> \n"), 722 address, 723 inet_ntoa(*(struct in_addr *) &(sinr.sin_addr))); 690 724 } 691 725 … … 743 777 *errnum = status; 744 778 sl_strlcpy(errmsg, sh_error_message (status, errbuf, sizeof(errbuf)), errsiz); 779 sl_strlcat(errmsg, 780 (sinr.sin_family == AF_INET) ? _(", AF_INET ") : _(", AF_INET6 "), 781 errsiz); 745 782 sl_strlcat(errmsg, _(", address "), errsiz); 746 783 sl_strlcat(errmsg, address, errsiz); … … 776 813 delete_cache(); 777 814 815 if (tools_debug) 816 fprintf(stderr, _("-00- <%s> <%d>\n"), address, port); 817 778 818 if (check_cache != NULL) 779 819 { 780 820 while (check_cache && check_cache->address) 781 821 { 822 if (tools_debug) 823 fprintf(stderr, _("-01- <%s> <%s>\n"), 824 address, check_cache->address); 825 782 826 if ( 0 == sl_strcmp(check_cache->address, address) ) 783 827 { … … 798 842 break; 799 843 } 844 if (tools_debug) 845 { 846 char eaddr[SH_IP_BUF]; 847 sh_ipvx_ntoa(eaddr, sizeof(eaddr), &ss); 848 fprintf(stderr, _("-02- <%s> <%s> <%d> <%d>\n"), 849 (ss.ss_family == AF_INET) ? _("AF_INET") : _("AF_INET6"), 850 eaddr, 851 port, cached); 852 } 800 853 break; 801 854 } … … 809 862 if (cached != 0) 810 863 { 864 if (tools_debug) 865 fputs(_("-03- cached\n"), stderr); 811 866 fd = socket(ss.ss_family, SOCK_STREAM, 0); 812 867 if (fd < 0) … … 854 909 struct addrinfo hints; 855 910 911 if (tools_debug) 912 fputs(_("-03- not cached\n"), stderr); 913 856 914 memset (&hints, '\0', sizeof (hints)); 857 915 hints.ai_flags = AI_ADDRCONFIG; … … 882 940 const char * canonical; 883 941 942 884 943 #if defined(AI_CANONNAME) 885 944 if (ai->ai_canonname && strlen(ai->ai_canonname) > 0) 886 945 { 887 946 canonical = ai->ai_canonname; 947 if (tools_debug) 948 fprintf(stderr, _("-04- <%s> <%s> ai->ai_canonname\n"), 949 address, canonical); 888 950 } 889 951 else 890 952 { 891 953 canonical = address; 954 if (tools_debug) 955 fprintf(stderr, _("-04- <%s> <%s> defined ai_canonname\n"), 956 address, canonical); 892 957 } 893 958 #else 894 959 canonical = address; 960 if (tools_debug) 961 fprintf(stderr, _("-04- <%s> <%s> not defined ai_canonname\n"), 962 address, canonical); 895 963 #endif 896 964 … … 903 971 if (e == 0) 904 972 { 973 if (tools_debug) 974 { 975 fprintf(stderr, _("-05- <%s> <%s> <%s>\n"), 976 (p->ai_family == AF_INET) ? _("AF_INET") : _("AF_INET6"), 977 sh_ipvx_print_sockaddr (p->ai_addr, p->ai_family), 978 hostname); 979 } 980 905 981 if (sl_strcasecmp(hostname, canonical) == 0) 906 982 { 983 if (tools_debug) 984 fprintf(stderr, _("-06- <%s> <%s> match\n"), 985 hostname, canonical); 907 986 success = 1; 908 987 break; 909 988 } 989 910 990 } 911 991 … … 1418 1498 SH_IS_ASCII(head[5]) && isalpha(head[5]) && 1419 1499 SH_IS_ASCII(head[6]) && isalpha(head[6])) { 1420 fprintf(stderr, "%c %3o %s %5d %c %c %c %c\n", sign,1500 fprintf(stderr, _("%c %3o %s %5d %c %c %c %c\n"), sign, 1421 1501 head[0], code, msg_size, head[3], head[4], head[5], head[6]); 1422 1502 } else { 1423 fprintf(stderr, "%c %3o %s %5d %2X %2X %2X %2X\n", sign,1503 fprintf(stderr, _("%c %3o %s %5d %2X %2X %2X %2X\n"), sign, 1424 1504 head[0], code, msg_size, head[3], head[4], head[5], head[6]); 1425 1505 }
Note:
See TracChangeset
for help on using the changeset viewer.