[petsc-dev] Checking hostnames

Jed Brown jedbrown at mcs.anl.gov
Thu Jun 6 13:46:38 CDT 2013

Barry, you added this logic in 2002.  Is it solving a particular
problem?  This is by no means a complete list of valid TLDs, and local
networks could use arbitrary hostnames.  Delete it?

    /* check if domain name is not a dnsdomainname and nuke it */
    ierr = PetscStrlen(name,&ll);CHKERRQ(ierr);
    if (ll > 4) {
      const char *suffixes[] = {".edu",".com",".net",".org",".mil",0};
      PetscInt   index;
      ierr = PetscStrendswithwhich(name,suffixes,&index);CHKERRQ(ierr);
      if (!suffixes[index]) {
        ierr      = PetscInfo1(0,"Rejecting domainname, likely is NIS %s\n",name);CHKERRQ(ierr);
        name[l-1] = 0;

More information about the petsc-dev mailing list