[3146] in testers
lert bug
daemon@ATHENA.MIT.EDU (Mike Barker)
Thu May 22 10:32:39 1997
To: testers@MIT.EDU
Cc: mbarker@MIT.EDU
Date: Thu, 22 May 1997 10:32:32 EDT
From: Mike Barker <mbarker@MIT.EDU>
recently the lert service was put into /etc/services as
lert 3717/udp # login user notification
Unfortunately, this caused the first line of this piece of code to
be exercised (getservbyname). I'm not sure why I never noticed it,
but this line of code is trash. it returns the name of the service,
not the server host name. This causes lert to ask for the host lert,
leading to a deceptive error message.
the quick workaround is to pull that line out of /etc/services, which
makes lert go back to hesiod and DTRT.
I should probably just kill that line and rely purely on hesiod or
hardcoded, but does anyone have a good idea for overriding the server
location (for testing, etc?). Command line option?
Mike
/*
find out where lert lives
do it in this order
getservbyname()
struct servent *getservbyname(const char *name,
char *proto);
hesiod lookup
hardcode
rationale--if someone wants to override for some reason...
/etc/services is easier to fix
*/
buggy = getservbyname(LERT_SERVED, LERT_PROTO);
if (buggy != NULL){
ip = buggy->s_name;
} else {
/*
note the presumption that there is only one lert!
*/
tip = (hes_resolve(LERT_SERVER, LERT_TYPE));
if (tip == NULL){
/*
No Hesiod available
fall into hardcoded--below for realmofhost
*/
ip = LERT_HOME;
} else {
ip = tip[0];
}
}