Menu

#79 is_hostname seems broken on some domains

open
nobody
utils (2)
5
2001-06-16
2001-06-16
Anonymous
No

is_hostname seems to believe that a hostname.Xdomain.com where X is any real integer, is an
invalid domain. This is not true as there are domains with such a name in existance. I did not
really check the RFCs to see if the functions error checking is sane. I just worked around it by
commenting out a subsection of the code.

int is_hostname(char *s1)
{
if (strlen(s1)>63)
return FALSE;
if
(strcspn(s1,"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUWVXYZ0123456789-.")!=0)
return FALSE;
if (strspn(s1,"0123456789-.")==1)
return FALSE;
while((s1=index(s1,'.'))){
s1++;
/* if(strspn(s1,"0123456789-.")==1){
printf("%s\n",s1);
return FALSE;
}
*/
}
return TRUE;
}

Discussion


Log in to post a comment.

MongoDB Logo MongoDB