/* -*-c-*-
*
- * $Id: class.c,v 1.2 1997/08/04 10:24:21 mdw Exp $
+ * $Id: class.c,v 1.4 1997/08/07 09:56:37 mdw Exp $
*
* Handling classes of things nicely
*
/*----- Revision history --------------------------------------------------*
*
* $Log: class.c,v $
+ * Revision 1.4 1997/08/07 09:56:37 mdw
+ * (Log entry for previous version is bogus.) Minor changes to host
+ * checking code.
+ *
* Revision 1.2 1997/08/04 10:24:21 mdw
* Sources placed under CVS control.
*
T( trace(TRACE_CHECK, "check: couldn't translate address (erk!)"); )
return (0);
}
- if ((he = gethostbyaddr((char *)&addr, sizeof(addr), AF_INET)) == 0) {
+
+ if ((he = gethostbyaddr((char *)&addr, sizeof(addr), AF_INET)) == 0)
T( trace(TRACE_CHECK, "check: couldn't resolve hostname for %s", a); )
- return (0);
- }
/* --- Now search the list for a match --- *
*
return (1);
}
- /* --- Now try the host's main name --- */
-
- if (class__wildMatch(s->name, he->h_name)) {
- T( trace(TRACE_CHECK, "check: host name `%s' matched by `%s'",
- he->h_name, s->name); )
- return (1);
- }
+ if (he) {
- /* --- Now go through all the names --- */
+ /* --- Now try the host's main name --- */
- for (p = he->h_aliases; *p; p++) {
- if (class__wildMatch(s->name, *p)) {
- T( trace(TRACE_CHECK, "check: host alias `%s' matched by `%s'",
- *p, s->name); )
+ if (class__wildMatch(s->name, he->h_name)) {
+ T( trace(TRACE_CHECK, "check: host name `%s' matched by `%s'",
+ he->h_name, s->name); )
return (1);
}
+
+ /* --- Now go through all the names --- */
+
+ for (p = he->h_aliases; *p; p++) {
+ if (class__wildMatch(s->name, *p)) {
+ T( trace(TRACE_CHECK, "check: host alias `%s' matched by `%s'",
+ *p, s->name); )
+ return (1);
+ }
+ }
}
}