- Timestamp:
- Dec 2, 2011, 12:02:00 AM (13 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_ipvx.c
r321 r380 210 210 { 211 211 case AF_INET: 212 (ss->sin).sin_family = AF_INET; 212 213 (ss->sin).sin_port = htons (port); 213 214 break; 214 215 case AF_INET6: 216 (ss->sin6).sin6_family = AF_INET6; 215 217 (ss->sin6).sin6_port = htons (port); 216 218 break; … … 218 220 return 0; 219 221 #else 222 (ss->sin).sin_family = AF_INET; 220 223 (ss->sin).sin_port = htons (port); 221 224 return 0; -
trunk/src/sh_portcheck.c
r376 r380 321 321 #ifdef TEST_ONLY 322 322 323 static int portchk_debug = 0; 323 static int portchk_debug = 0; 324 324 #define SH_ALLOC malloc 325 325 #define SH_FREE free … … 433 433 struct sh_portentry * new = SH_ALLOC (sizeof(struct sh_portentry)); 434 434 435 if (portchk_debug)436 fprintf(stderr, _("add to list: port %d/%s %d %d (%s)\n"),437 port, SH_PROTO_STR(proto), flag, status, service ? service : _("undef"));438 439 435 new->port = port; 440 436 sh_ipvx_ntoa(new->interface, SH_INTERFACE_SIZE, paddr); … … 443 439 444 440 new->error = NULL; 441 442 if (portchk_debug) 443 fprintf(stderr, _("add to list: port %d/%s %d %d (%s) %s\n"), 444 port, SH_PROTO_STR(proto), flag, status, service ? service : _("undef"), 445 new->interface); 445 446 446 447 if (service) … … 648 649 649 650 650 static void sh_portchk_cmp_to_list (int proto, int port, struct sh_sockaddr * paddr, char * service) 651 static void sh_portchk_cmp_to_list (int proto, int port, 652 struct sh_sockaddr * paddr, char * service) 651 653 { 652 654 struct sh_portentry * portent; … … 669 671 snprintf (errbuf, sizeof(errbuf), _("port: %s:%d/%s (%s)"), 670 672 saddr, port, SH_PROTO_STR(proto), service); 671 #ifdef TEST_ONLY 672 fprintf(stderr, _("open port: %s:%d/%s (%s)\n"), 673 saddr, port, SH_PROTO_STR(proto), service); 674 #else 673 674 if (portchk_debug) 675 fprintf(stderr, _("cmp_to_list: open port: %s:%d/%s (%s)\n"), 676 saddr, port, SH_PROTO_STR(proto), service); 677 678 #ifndef TEST_ONLY 675 679 path = sh_port2proc_query(proto, paddr, port, &qpid, user, sizeof(user)); 676 680 SH_MUTEX_LOCK(mutex_thread_nolog); … … 751 755 snprintf (errbuf, sizeof(errbuf), _("port: %s:%d/%s (%s)"), 752 756 saddr, port, SH_PROTO_STR(proto), check_services(port, proto)); 753 #ifdef TEST_ONLY 754 fprintf(stderr, _("open port: %s:%d/%s (%s)\n"), 755 saddr, port, SH_PROTO_STR(proto), check_services(port, proto)); 756 #else 757 758 if (portchk_debug) 759 fprintf(stderr, _("cmp_to_list: open port: %s:%d/%s (%s) check_services\n"), 760 saddr, port, SH_PROTO_STR(proto), check_services(port, proto)); 761 762 #ifndef TEST_ONLY 757 763 path = sh_port2proc_query(proto, paddr, port, &qpid, user, sizeof(user)); 758 764 SH_MUTEX_LOCK(mutex_thread_nolog); … … 908 914 sh_ipvx_ntoa(ipbuf, sizeof(ipbuf), paddr); 909 915 if (portchk_debug) 910 fprintf(stderr, _("check port : %5d/udp on %15s established/time_wait\n"),916 fprintf(stderr, _("check port_udp: %5d/udp on %15s established/time_wait\n"), 911 917 port, ipbuf); 912 918 } … … 932 938 if (paddr->ss_family == AF_INET) 933 939 { 934 p = check_rpc_list (port, (struct sockaddr_in *) sh_ipvx_sockaddr_cast(paddr), IPPROTO_UDP); 940 p = check_rpc_list (port, 941 (struct sockaddr_in *) sh_ipvx_sockaddr_cast(paddr), 942 IPPROTO_UDP); 935 943 } 936 944 937 945 sh_portchk_cmp_to_list (IPPROTO_UDP, port, paddr, p ? p : NULL); 938 946 … … 945 953 { 946 954 sh_ipvx_ntoa(ipbuf, sizeof(ipbuf), paddr); 947 fprintf(stderr, _("check port : %5d/udp on %15s open %s\n"),955 fprintf(stderr, _("check port_udp: %5d/udp on %15s open %s\n"), 948 956 port, ipbuf, p); 949 957 } … … 979 987 { 980 988 sh_ipvx_ntoa(ipbuf, sizeof(ipbuf), paddr); 981 fprintf(stderr, _("check port : %5d on %15s established/time_wait\n"),989 fprintf(stderr, _("check port_tcp: %5d on %15s established/time_wait\n"), 982 990 port, ipbuf); 983 991 } … … 1005 1013 if (paddr->ss_family == AF_INET) 1006 1014 { 1007 p = check_rpc_list (port, (struct sockaddr_in *) sh_ipvx_sockaddr_cast(paddr), IPPROTO_TCP); 1015 p = check_rpc_list (port, 1016 (struct sockaddr_in *) sh_ipvx_sockaddr_cast(paddr), 1017 IPPROTO_TCP); 1008 1018 } 1009 1019 … … 1018 1028 { 1019 1029 sh_ipvx_ntoa(ipbuf, sizeof(ipbuf), paddr); 1020 fprintf(stderr, _("check port : %5d on %15s open %s\n"),1030 fprintf(stderr, _("check port_tcp: %5d on %15s open %s\n"), 1021 1031 port, ipbuf, p); 1022 1032 } … … 1137 1147 sh_ipvx_save(&(iface_list.iface[iface_list.used]), 1138 1148 AF_INET, (struct sockaddr *)&sin); 1149 1150 if (portchk_debug) 1151 { 1152 char buf[256]; 1153 sh_ipvx_ntoa(buf, sizeof(buf), &(iface_list.iface[iface_list.used])); 1154 fprintf(stderr, _("interface[%d]: %s\n"), i, buf); 1155 } 1139 1156 ++iface_list.used; 1140 1157 ++i; … … 1634 1651 portent = sh_portchk_get_from_list (proto, -1, &saddr, buf); 1635 1652 if (!portent) 1636 sh_portchk_add_to_list (proto, -1, &saddr, buf, type, SH_PORT_UNKN); 1653 { 1654 if (portchk_debug) 1655 fprintf(stderr, _("add_required_port\n")); 1656 sh_portchk_add_to_list (proto, -1, &saddr, buf, type, SH_PORT_UNKN); 1657 } 1637 1658 else 1638 1659 { … … 1652 1673 portent = sh_portchk_get_from_list (proto, port, &saddr, NULL); 1653 1674 if (!portent) 1654 sh_portchk_add_to_list (proto, port, &saddr, NULL, type, SH_PORT_UNKN); 1675 { 1676 if (portchk_debug) 1677 fprintf(stderr, _("add_required_port: open port: %d/%s\n"), 1678 (int) port, SH_PROTO_STR(proto)); 1679 sh_portchk_add_to_list (proto, port, &saddr, NULL, type, SH_PORT_UNKN); 1680 } 1655 1681 else 1656 1682 {
Note:
See TracChangeset
for help on using the changeset viewer.