| 739 | } |
| 740 | |
| 741 | static apr_status_t fix_hostname_non_v6(request_rec *r, char *host) |
| 742 | { |
| 743 | char *dst; |
| 744 | |
| 745 | for (dst = host; *dst; dst++) { |
| 746 | if (apr_islower(*dst)) { |
| 747 | /* leave char unchanged */ |
| 748 | } |
| 749 | else if (*dst == '.') { |
| 750 | if (*(dst + 1) == '.') { |
| 751 | return APR_EINVAL; |
| 752 | } |
| 753 | } |
| 754 | else if (apr_isupper(*dst)) { |
| 755 | *dst = apr_tolower(*dst); |
| 756 | } |
| 757 | else if (*dst == '/' || *dst == '\\') { |
| 758 | return APR_EINVAL; |
| 759 | } |
| 760 | } |
| 761 | /* strip trailing gubbins */ |
| 762 | if (dst > host && dst[-1] == '.') { |
| 763 | dst[-1] = '\0'; |
| 764 | } |
| 765 | return APR_SUCCESS; |
| 766 | } |
| 767 | |
| 768 | /* |
| 769 | * If strict mode ever becomes the default, this should be folded into |