- Timestamp:
- Mar 29, 2014, 7:59:38 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Makefile.in
r444 r448 1805 1805 sh_audit.o: $(srcsrc)/sh_audit.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_extern.h $(srcinc)/sh_utils.h 1806 1806 sh_registry.o: $(srcsrc)/sh_registry.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_utils.h $(srcinc)/sh_unix.h $(srcinc)/sh_modules.h $(srcinc)/sh_hash.h $(srcinc)/sh_tiger.h 1807 sh_ipvx.o: $(srcsrc)/sh_ipvx.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_static.h $(srcinc)/sh_pthread.h $(srcinc)/sh_utils.h $(srcinc)/sh_ipvx.h 1807 sh_ipvx.o: $(srcsrc)/sh_ipvx.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_static.h $(srcinc)/sh_pthread.h $(srcinc)/sh_utils.h $(srcinc)/sh_ipvx.h $(srcinc)/CuTest.h 1808 1808 sh_restrict.o: $(srcsrc)/sh_restrict.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_mem.h $(srcinc)/sh_error_min.h $(srcinc)/sh_string.h $(srcinc)/sh_utils.h $(srcinc)/sh_restrict.h $(srcinc)/CuTest.h 1809 1809 sh_filetype.o: $(srcsrc)/sh_filetype.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_mem.h $(srcinc)/sh_error_min.h $(srcinc)/sh_utils.h -
trunk/depend.dep
r444 r448 85 85 sh_audit.o: $(srcsrc)/sh_audit.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_error.h $(srcinc)/sh_extern.h $(srcinc)/sh_utils.h 86 86 sh_registry.o: $(srcsrc)/sh_registry.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_pthread.h $(srcinc)/sh_utils.h $(srcinc)/sh_unix.h $(srcinc)/sh_modules.h $(srcinc)/sh_hash.h $(srcinc)/sh_tiger.h 87 sh_ipvx.o: $(srcsrc)/sh_ipvx.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_static.h $(srcinc)/sh_pthread.h $(srcinc)/sh_utils.h $(srcinc)/sh_ipvx.h 87 sh_ipvx.o: $(srcsrc)/sh_ipvx.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_static.h $(srcinc)/sh_pthread.h $(srcinc)/sh_utils.h $(srcinc)/sh_ipvx.h $(srcinc)/CuTest.h 88 88 sh_restrict.o: $(srcsrc)/sh_restrict.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_mem.h $(srcinc)/sh_error_min.h $(srcinc)/sh_string.h $(srcinc)/sh_utils.h $(srcinc)/sh_restrict.h $(srcinc)/CuTest.h 89 89 sh_filetype.o: $(srcsrc)/sh_filetype.c Makefile config_xor.h $(srcinc)/samhain.h $(srcinc)/sh_mem.h $(srcinc)/sh_error_min.h $(srcinc)/sh_utils.h -
trunk/depend.sum
r444 r448 1 3 3694997011 3861086825 -
trunk/docs/Changelog
r447 r448 1 1 3.1.1: 2 2 * Disable inline asm on Cygwin (issue reported by Erik) 3 * Fix sh_ipvx_is_ipv4 such that numeric hostnames are not 4 incorrectly recognised as IP address (reported by A. Hofland) 3 5 4 6 3.1.0 (31-10-2013): -
trunk/src/cutest_sh_tools.c
r295 r448 114 114 CuAssertTrue(tc, !sh_ipvx_is_numeric(input)); 115 115 input = strdup("127"); 116 CuAssertTrue(tc, sh_ipvx_is_numeric(input));116 CuAssertTrue(tc, !sh_ipvx_is_numeric(input)); 117 117 } 118 118 -
trunk/src/sh_ipvx.c
r422 r448 41 41 { 42 42 int j; 43 int count = 0; 43 44 int len = sl_strlen(addr); 45 unsigned int a, b, c, d; 44 46 45 for (j = 0; j < len; ++j) 47 if (len > 15) /* 3*4 + 3 dots */ 48 return (1 == 0); 49 50 for (j = 0; j < len; ++j) { 46 51 if ( (addr[j] < '0' || addr[j] > '9') && addr[j] != '.') 47 52 return (1 == 0); 53 if (addr[j] == '.') ++count; 54 } 55 56 if (count != 3) 57 return (1 == 0); 58 59 if (sscanf(addr, "%3u.%3u.%3u.%3u", &a, &b, &c, &d) != 4) 60 return( 1 == 0 ); 61 62 if ((a|b|c|d) > 255) 63 return( 1 == 0 ); 64 48 65 return (1 == 1); 49 66 } … … 538 555 return 0; 539 556 } 557 558 #ifdef SH_CUTEST 559 #include <stdlib.h> 560 #include "CuTest.h" 561 562 void Test_ipvx (CuTest *tc) { 563 564 int result; 565 566 result = sh_ipvx_is_ipv4("123456789"); 567 CuAssertTrue(tc, result == FALSE); 568 569 result = sh_ipvx_is_ipv4("123456789123..."); 570 CuAssertTrue(tc, result == FALSE); 571 572 result = sh_ipvx_is_ipv4("123.456.789.123"); 573 CuAssertTrue(tc, result == FALSE); 574 575 result = sh_ipvx_is_ipv4("123.156.189.254"); 576 CuAssertTrue(tc, result == TRUE); 577 578 result = sh_ipvx_is_ipv4("255.255.255.255"); 579 CuAssertTrue(tc, result == TRUE); 580 581 result = sh_ipvx_is_ipv4("0.0.0.0"); 582 CuAssertTrue(tc, result == TRUE); 583 584 result = sh_ipvx_is_ipv4("0022.156.189.254"); 585 CuAssertTrue(tc, result == FALSE); 586 587 result = sh_ipvx_is_ipv4("999999999.1.1.2"); 588 CuAssertTrue(tc, result == FALSE); 589 590 } 591 #endif 592
Note:
See TracChangeset
for help on using the changeset viewer.