[Nagiosplug-checkins] CVS: nagiosplug/plugins check_http.c,1.24,1.24.2.1 utils.c,1.16,1.16.2.1
Karl DeBisschop
kdebisschop at users.sourceforge.net
Tue Apr 22 21:58:04 CEST 2003
Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv19513/plugins
Modified Files:
Tag: r1_3_0
check_http.c utils.c
Log Message:
update to RFC1123 hostname specs
Index: check_http.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_http.c,v
retrieving revision 1.24
retrieving revision 1.24.2.1
diff -C2 -r1.24 -r1.24.2.1
*** check_http.c 21 Feb 2003 21:59:17 -0000 1.24
--- check_http.c 23 Apr 2003 04:57:08 -0000 1.24.2.1
***************
*** 188,192 ****
enum {
! MAX_IPV4_HOSTLENGTH = 64,
HTTP_PORT = 80,
HTTPS_PORT = 443
--- 188,192 ----
enum {
! MAX_IPV4_HOSTLENGTH = 255,
HTTP_PORT = 80,
HTTPS_PORT = 443
***************
*** 735,739 ****
pos = header;
while (pos) {
! server_address = realloc (server_address, MAX_IPV4_HOSTLENGTH);
if (server_address == NULL)
terminate (STATE_UNKNOWN,
--- 735,739 ----
pos = header;
while (pos) {
! server_address = realloc (server_address, MAX_IPV4_HOSTLENGTH + 1);
if (server_address == NULL)
terminate (STATE_UNKNOWN,
Index: utils.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/utils.c,v
retrieving revision 1.16
retrieving revision 1.16.2.1
diff -C2 -r1.16 -r1.16.2.1
*** utils.c 16 Jan 2003 05:21:18 -0000 1.16
--- utils.c 23 Apr 2003 04:57:08 -0000 1.16.2.1
***************
*** 193,214 ****
/* from RFC-1035
! *
! * The labels must follow the rules for ARPANET host names. They must
! * start with a letter, end with a letter or digit, and have as interior
! * characters only letters, digits, and hyphen. There are also some
! * restrictions on the length. Labels must be 63 characters or less. */
int
is_hostname (char *s1)
{
! if (!s1 || strlen (s1) > 63) {
return FALSE;
}
if (strcspn (s1, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUWVXYZ0123456789-.") != 0) {
return FALSE;
}
! if (strspn (s1, "0123456789-.") == 1) {
return FALSE;
}
while ((s1 = index (s1, '.'))) {
s1++;
--- 193,231 ----
/* from RFC-1035
! *
! * The labels must follow the rules for ARPANET host names. They must
! * start with a letter, end with a letter or digit, and have as interior
! * characters only letters, digits, and hyphen. There are also some
! * restrictions on the length. Labels must be 63 characters or less.
! *
! * Then RFC-1123:
! *
! * 2.1 Host Names and Numbers
! *
! * The syntax of a legal Internet host name was specified in RFC-952
! * [DNS:4]. One aspect of host name syntax is hereby changed: the
! * restriction on the first character is relaxed to allow either a
! * letter or a digit. Host software MUST support this more liberal
! * syntax.
! *
! * Host software MUST handle host names of up to 63 characters and
! * SHOULD handle host names of up to 255 characters.
! */
int
is_hostname (char *s1)
{
! if (!s1 || strlen (s1) > 255) {
return FALSE;
}
+ /* if s1 contains anything but ALPHA, NUM, dash, or period*/
if (strcspn (s1, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUWVXYZ0123456789-.") != 0) {
return FALSE;
}
! /* or if s1 begins with dash or period */
! if (strspn (s1, "-.") == 1) {
return FALSE;
}
+ /* '..' and '.-' are not legal either */
while ((s1 = index (s1, '.'))) {
s1++;
More information about the Commits
mailing list