Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
what to do if more aliases than MAXALIASES in /etc/hosts?
Hi -
just found that the hosts table distributed in my company has an entry
with ~40 aliases. There is a maximum of MAXALIASES=35 in NetBSD, and
the effect is that not just this line is ignored but also the rest
of the hosts file. This looks unreasonable.
Here is a patch which fixes this for me - the offending line is
ignored but the following lines are read.
One could also just ignore the bad line in gethostent_r(), or even
use the first MAXALIASES aliases and only ignore the aliases which
don't fit.
What do you think?
best regards
Matthias
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzender des Aufsichtsrats: MinDir Dr. Karl Eugen Huthmacher
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
Prof. Dr. Sebastian M. Schmidt
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
diff -r 1b4461463576 lib/libc/net/sethostent.c
--- a/lib/libc/net/sethostent.c Mon Jan 13 21:49:52 2014 +0100
+++ b/lib/libc/net/sethostent.c Thu Jan 16 20:00:46 2014 +0100
@@ -186,8 +186,12 @@
hp = gethostent_r(hf, info->hp, info->buf, info->buflen,
info->he);
- if (hp == NULL)
- break;
+ if (hp == NULL) {
+ if (*info->he == NETDB_INTERNAL && errno == ENOSPC)
+ continue; /* line with too many aliases */
+ else
+ break;
+ }
if (strcasecmp(hp->h_name, name) != 0) {
char **cp;
Home |
Main Index |
Thread Index |
Old Index