Config file parser for lists
Julien ÉLIE
julien at trigofacile.com
Sat Mar 28 12:20:15 UTC 2009
Hi Russ,
>> + /* Xref: is mandatory for INN and is the first field after the seven
>> + * overview fields defined in RFC 3977. */
>> + if (innconf->extraoverview == NULL) {
>> + innconf->extraoverview = vector_new();
>> + }
>> + if (innconf->extraoverview->strings == NULL) {
>> + vector_add(innconf->extraoverview, xstrdup("xref"));
>> + }
>
> If someone provides a list that doesn't include Xref, I don't think
> anything catches that right now.
It is normally done when innd starts:
if (!foundxref || !foundxreffull) {
syslog(L_FATAL, "%s 'Xref:full' must be included in %s", LogName, SCHEMA);
exit(1);
}
Can a header be listed twice? (It is not mentioned in RFC 3977.)
> (You also don't want to xstrdup
> something you're adding to a vector, as opposed to a cvector, since
> vector_add is just going to strdup it again and you end up leaking
> memory.)
OK!
Hmm... When we added that in innfeed (for the status file):
if (host->ipAddrs) {
int i;
char ip_addr[INET6_ADDRSTRLEN];
char *family;
for(i = 0; host->ipAddrs[i] != NULL; i++) {
switch(host->ipAddrs[i]->sa_family) {
case AF_INET:
family = xstrdup("IPv4");
break;
#ifdef HAVE_INET6
case AF_INET6:
family = xstrdup("IPv6");
break;
#endif
default:
family = xstrdup("????");
break;
}
network_sockaddr_sprint(ip_addr, sizeof(ip_addr),
host->ipAddrs[i]);
fprintf(fp, " Addr %-2u: %-4.4s %s\n", i+1, family, ip_addr);
}
}
is it necessary to free(family) at the end of the function?
Isn't it done automatically?
> What I'd suggest doing is removing Xref from user configuration entirely.
> INN requires it. We should just make it impossible to configure INN to
> not include it in the overview. The easiest way to do that, I think, is
> to define extraoverview as all overview fields *after* Xref and just
> unconditionally always add Xref as the first field after the standardized
> set.
OK. I was following your suggestion in <http://inn.eyrie.org/trac/ticket/101>
but well, not mentioning Xref is also fine.
Have a nice week-end (and a good night -- it is very late where you are!).
--
Julien ÉLIE
« Roma tibi subito motibus ibit amor. »
More information about the inn-workers
mailing list