X-Git-Url: https://git.distorted.org.uk/~mdw/become/blobdiff_plain/a37d956f675449e7dc2911b36da156b4f24e1931..607937a4e1c4cdb3da09617fa7bfda536278ca95:/src/class.c diff --git a/src/class.c b/src/class.c index 7a7d016..3ee5f7d 100644 --- a/src/class.c +++ b/src/class.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: class.c,v 1.2 1997/08/04 10:24:21 mdw Exp $ + * $Id: class.c,v 1.3 1997/08/07 09:49:38 mdw Exp $ * * Handling classes of things nicely * @@ -29,6 +29,10 @@ /*----- Revision history --------------------------------------------------* * * $Log: class.c,v $ + * Revision 1.3 1997/08/07 09:49:38 mdw + * Extensive modifications to handle netgroups. Also sanitise user and group + * names before adding them to the symbol table. + * * Revision 1.2 1997/08/04 10:24:21 mdw * Sources placed under CVS control. * @@ -251,10 +255,9 @@ int class_hostMatch(classdef *c, struct in_addr addr) 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 --- * * @@ -271,22 +274,25 @@ int class_hostMatch(classdef *c, struct in_addr addr) 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); + } + } } }