chiark
/
gitweb
/
~mdw
/
become
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Replace `name_reinit' by `name_end' for more sensible restart.
[become]
/
src
/
class.c
diff --git
a/src/class.c
b/src/class.c
index 7a7d016281fd9126efc8791f01035fe547eb20b7..990822d61b5ab501c927cd8acfd2412c0b5f2ca2 100644
(file)
--- a/
src/class.c
+++ b/
src/class.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: class.c,v 1.
2 1997/08/04 10:24:21
mdw Exp $
+ * $Id: class.c,v 1.
5 1997/08/20 16:16:13
mdw Exp $
*
* Handling classes of things nicely
*
*
* Handling classes of things nicely
*
@@
-29,6
+29,13
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: class.c,v $
/*----- Revision history --------------------------------------------------*
*
* $Log: class.c,v $
+ * Revision 1.5 1997/08/20 16:16:13 mdw
+ * Patch memory leak. Don't try to trace when tracing's turned off.
+ *
+ * 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.
*
* Revision 1.2 1997/08/04 10:24:21 mdw
* Sources placed under CVS control.
*
@@
-152,6
+159,7
@@
void class_dec(classdef *c)
{
if (c != class_all && !--c->ref) {
sym_destroyTable(c->t);
{
if (c != class_all && !--c->ref) {
sym_destroyTable(c->t);
+ free(c->t);
free(c);
}
}
free(c);
}
}
@@
-251,10
+259,9
@@
int class_hostMatch(classdef *c, struct in_addr addr)
T( trace(TRACE_CHECK, "check: couldn't translate address (erk!)"); )
return (0);
}
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); )
T( trace(TRACE_CHECK, "check: couldn't resolve hostname for %s", a); )
- return (0);
- }
/* --- Now search the list for a match --- *
*
/* --- Now search the list for a match --- *
*
@@
-271,22
+278,25
@@
int class_hostMatch(classdef *c, struct in_addr addr)
return (1);
}
return (1);
}
- /* --- Now try the host's main name --- */
+ if (he) {
- 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 --- */
+ /* --- 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);
}
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);
+ }
+ }
}
}
}
}
@@
-307,6
+317,7
@@
int class_hostMatch(classdef *c, struct in_addr addr)
void class_dump(classdef *c)
{
void class_dump(classdef *c)
{
+#ifdef TRACING
sym_iter i;
sym_base *s;
sym_iter i;
sym_base *s;
@@
-327,6
+338,7
@@
void class_dump(classdef *c)
}
else
trace(TRACE_RULE, " ALL");
}
else
trace(TRACE_RULE, " ALL");
+#endif
}
/*----- That's all, folks -------------------------------------------------*/
}
/*----- That's all, folks -------------------------------------------------*/