Thread View: news.software.readers
8 messages
8 total messages
Started by Daniel Price
Fri, 11 Feb 2000 00:00
[slrn] slrn can't deduce my fqdn, so I can't get customized MsgIDs
Author: Daniel Price
Date: Fri, 11 Feb 2000 00:00
Date: Fri, 11 Feb 2000 00:00
159 lines
5437 bytes
5437 bytes
I'm trying to get slrn to create Message-IDs for me, so that I can
score against them, as has be discussed in previous postings.
As far as I can tell, slrn_create_message_id() is returning NULL,
because Slrn_User_Info.posting_host is null:
static char *slrn_create_message_id (void)
{
...
if (Slrn_Generate_Message_Id == 0)
return NULL;
while (1)
{
if ((Slrn_User_Info.posting_host == NULL)
|| ((time_t) -1 == time ((time_t *)&now)))
return NULL;
if (now != last_now) break;
sleep (1);
}
I've checked that Slrn_Generate_Message_Id is '1' in a debugger, and
that Slrn_User_Info.posting_host is indeed NULL. So why is
Slrn_User_Info.posting_host NULL?
This leads to misc.c, where the key bit is:
/* Now get default values for rest. */
host = get_hostname ();
if (host != NULL)
{
if (slrn_is_fqdn (host))
Slrn_User_Info.posting_host = slrn_safe_strmalloc (host);
This is the only place in slrn where Slrn_User_Info.posting_host is ever
set. This code calls get_hostname(), which looks like this:
static char *get_hostname (void)
{
struct hostent *host_entry;
char buf[MAX_HOST_NAME_LEN + 1];
host_entry = NULL;
if ((-1 == gethostname (buf, MAX_HOST_NAME_LEN))
|| (*buf == 0))
return NULL;
/* gethostname may not provide the full name so use gethostbyname
* to get more information. Why isn't there a simplified interface
* to get the FQDN!!!!
*/
host_entry = gethostbyname (buf);
#if defined(TRY_AGAIN) && !defined(MULTINET)
if ((host_entry == NULL) && (h_errno == TRY_AGAIN))
{
sleep (2);
host_entry = gethostbyname (buf);
}
#endif
if ((host_entry != NULL)
&& (host_entry->h_name != NULL)
&& (host_entry->h_name[0] != 0))
{
char **aliases;
if ((0 == slrn_is_fqdn ((char *)host_entry->h_name))
&& (NULL != (aliases = host_entry->h_aliases)))
{
while (*aliases != NULL)
{
if (slrn_is_fqdn (*aliases))
return slrn_safe_strmalloc (*aliases);
aliases++;
}
}
return slrn_safe_strmalloc ((char *)host_entry->h_name);
}
return slrn_safe_strmalloc (buf);
}
I use a tracing tool available in Solaris to see what library calls are being
made at this point in the code:
slrn -> libslang.so:SLmake_string(0x59e94, 0x0, 0x0)
slrn -> libnsl.so.1:gethostname(name = "xanadu", namelen = 0x100) = 0x0
name = (char *) 0xffbef094 "xanadu"
namelen = (int) 256 (0x100)
return = (int) 0 (0x0)
slrn -> libnsl.so.1:gethostbyname(name = "xanadu") = 0x7e2ac
name = (char *) 0xffbef094 "xanadu"
return = (struct hostent *) 0x7e2ac (struct hostent) {
h_name: (char *) 0x7e2cc "xanadu"
h_aliases: (char **) 0x7e2c0
h_addrtype: (int) 2 (0x2)
h_length: (int) 4 (0x4)
h_addr_list: (char **) 0x7e2c4
}
So from this, it is clear that neither gethostname() or gethostbyname() failed.
As a side note, there are no aliases to examine, as shown by running
$ perl
($name, $aliases) = gethostbyname("xanadu");
print "name = '$name'\n";
print "aliases = '$aliases'\n";
^D
name = 'xanadu'
aliases = ''
It is also clear that the if statement:
if ((host_entry != NULL)
&& (host_entry->h_name != NULL)
&& (host_entry->h_name[0] != 0))
succeeded (that is, the branch was taken).
Next up is a call to slrn_is_fqdn("xanadu"). By inspection, this fails, since
"xanadu" doesn't contain a ".". This causes slrn_is_fqdn to return "xanadu"
to its caller (slrn_get_user_info()).
Now what? slrn_get_user_info() checks to see if "xanadu" is fully qualified.
Of course it isn't.
At this point, there is no possible way to set posting_host-- the rest of the
function drives on and ignores posting_host.
So: I dunno. Is this a bug? To my way of thinking, if the user supplied
MY_DOMAIN_NAME in config.h and set USE_DOMAIN_NAME to 1, shouldn't slrn
use that?
Furthermore, shouldn't slrn have a runtime configuration option to set the
domain? This would be very handy for those preparing distributions for
other people at remote sites; in this case, you *can't* compile in
USE_DOMAIN_NAME and MY_DOMAIN_NAME, since you don't know it in advance.
As a side note, wouldn't it be good to have something about Message-ID
generation in the FAQ?
Thanks for your patience,
-dp
--
Daniel Price - Solaris I/O - dp@eng.sun.com
Expressed in this posting are my opinions. They are in no way related to
opinions held by my employer, Sun Microsystems. Statements on Sun products
included here are not gospel and may be fiction rather than truth.
Re: [slrn] slrn can't deduce my fqdn, so I can't get customized MsgIDs
Author: Daniel Price
Date: Fri, 11 Feb 2000 00:00
Date: Fri, 11 Feb 2000 00:00
17 lines
1281 bytes
1281 bytes
On 11 Feb 2000 09:01:06 GMT, Daniel Price <dp@xanadu.eng.sun.com> wrote:
>
>I'm trying to get slrn to create Message-IDs for me, so that I can
>score against them, as has be discussed in previous postings.
^^^^
Please excuse my spotty grammar. It is clearly past my bedtime.
-dp
--
Daniel Price - Solaris I/O - dp@eng.sun.com
Expressed in this posting are my opinions. They are in no way related to
opinions held by my employer, Sun Microsystems. Statements on Sun products
included here are not gospel and may be fiction rather than truth.
Re: [slrn] slrn can't deduce my fqdn, so I can't get customized MsgIDs
Author: Daniel Price
Date: Fri, 11 Feb 2000 00:00
Date: Fri, 11 Feb 2000 00:00
56 lines
2980 bytes
2980 bytes
On 11 Feb 2000 13:25:14 GMT, Jens Wahnes <jewa@gmx.net> wrote:
>Daniel Price wrote:
>
>> I use a tracing tool available in Solaris to see what library calls are being
>> made at this point in the code:
>[...]
>> Now what? slrn_get_user_info() checks to see if "xanadu" is fully qualified.
>> Of course it isn't.
>> At this point, there is no possible way to set posting_host-- the rest of the
>> function drives on and ignores posting_host.
>
>Looking at your email address, _you_ are certainly the Solaris expert. :-)
Thanks (I think).
>So I wonder why gethostbyname doesn't return the FQDN but only the host
>name? I never had access to a Solaris system so I don't know if this
>is a generic problem there, but maybe the FQDN just isn't properly set?
>slrn does get the correct FQDN on all systems I've tried so far, which
>were Linux, AIX, and Windows.
Today I reproduced this problem on a machine running linux as well-- I
think the invariant in the problem is *NIS*. If you get your naming
data from NIS, then you don't get FQ names. On a machine outside of
Sun, which resolves names from DNS, the name was fully qualified.
So, I would call this a bug-- slrn doesn't play nice with systems
resolving hosts via NIS.
One idea for a fallback algorithm is to call
sysinfo(SI_SRPC_DOMAIN, buf, 256);
On my host, that returns sunsoft.eng.sun.com in buf, which is close
enough ("sunsoft" is an artifact).
This works on Solaris; I'm not sure what the linux equivalent is, since
inexplicably linux seems to implement a sysinfo(2) system call that has
a completely different interface and provides different data items.
Sigh. However, there is a domainname[65] in the utsname structure.
I have no idea about other OS variants. According to the
sys/systeminfo.h header file, these SI_ constants were assigned by Unix
International, so this ought to be at least vaguely portable....
Any thoughts?
-dp
--
Daniel Price - Solaris I/O - dp@eng.sun.com
Expressed in this posting are my opinions. They are in no way related to
opinions held by my employer, Sun Microsystems. Statements on Sun products
included here are not gospel and may be fiction rather than truth.
Re: [slrn] slrn can't deduce my fqdn, so I can't get customized MsgIDs
Author: Jens Wahnes
Date: Fri, 11 Feb 2000 00:00
Date: Fri, 11 Feb 2000 00:00
44 lines
2068 bytes
2068 bytes
Daniel Price wrote:
> I use a tracing tool available in Solaris to see what library calls are being
> made at this point in the code:
[...]
> Now what? slrn_get_user_info() checks to see if "xanadu" is fully qualified.
> Of course it isn't.
> At this point, there is no possible way to set posting_host-- the rest of the
> function drives on and ignores posting_host.
Looking at your email address, _you_ are certainly the Solaris expert. :-)
So I wonder why gethostbyname doesn't return the FQDN but only the host
name? I never had access to a Solaris system so I don't know if this
is a generic problem there, but maybe the FQDN just isn't properly set?
slrn does get the correct FQDN on all systems I've tried so far, which
were Linux, AIX, and Windows.
> Furthermore, shouldn't slrn have a runtime configuration option to set the
> domain?
I added
#v+
{"posting_host", &Slrn_User_Info.posting_host},
#v-
at line 464 of startup.c and recompiled (slrn 0.9.6.2). Now I'm able
to set the posting_host in .slrnrc like this:
#v+
set posting_host "message-id.wahnes-world.de"
#v-
I think that should at least be a workaround for your problem.
Jens
--
"What is robbing a bank compared with founding a bank?"
- Bertolt Brecht
Re: [slrn] slrn can't deduce my fqdn, so I can't get customized MsgIDs
Author: John E. Davis
Date: Sat, 12 Feb 2000 00:00
Date: Sat, 12 Feb 2000 00:00
16 lines
1246 bytes
1246 bytes
On 11 Feb 2000 23:30:07 GMT, Daniel Price <dp@xanadu.eng.sun.com>
wrote:
>One idea for a fallback algorithm is to call
>
> sysinfo(SI_SRPC_DOMAIN, buf, 256);
>
>On my host, that returns sunsoft.eng.sun.com in buf, which is close
>enough ("sunsoft" is an artifact).
It does not return the proper hostname on my solaris system. It fact,
it appears to return the NIS domainname and not the fully qualified
domain name.
--John
Re: [slrn] slrn can't deduce my fqdn, so I can't get customized MsgIDs
Author: John E. Davis
Date: Sat, 12 Feb 2000 00:00
Date: Sat, 12 Feb 2000 00:00
17 lines
1460 bytes
1460 bytes
On 11 Feb 2000 23:30:07 GMT, Daniel Price <dp@xanadu.eng.sun.com> wrote: >So, I would call this a bug-- slrn doesn't play nice with systems >resolving hosts via NIS. I am not convinced. A brief web search indicates that this is a common problem on solaris and is due to a misconfigured system. In particular, I encourage you to look at http://www.sendmail.org/sun-specific/check-hostname.html This will try to find your FQDN and then if it does not find it, it will suggest what to fix. --John
Re: [slrn] slrn can't deduce my fqdn, so I can't get customized MsgIDs
Author: Daniel Price
Date: Sat, 12 Feb 2000 00:00
Date: Sat, 12 Feb 2000 00:00
64 lines
3381 bytes
3381 bytes
On 12 Feb 2000 04:00:32 GMT, John E. Davis <davis@space.mit.edu> wrote:
>On 11 Feb 2000 23:30:07 GMT, Daniel Price <dp@xanadu.eng.sun.com>
>wrote:
>>So, I would call this a bug-- slrn doesn't play nice with systems
>>resolving hosts via NIS.
>
>I am not convinced. A brief web search indicates that this is a
>common problem on solaris and is due to a misconfigured system. In
>particular, I encourage you to look at
>
> http://www.sendmail.org/sun-specific/check-hostname.html
>
>This will try to find your FQDN and then if it does not find it, it
>will suggest what to fix.
$ ./check-hostname.sh
Hostname xanadu OK: fully qualified as xanadu.eng.sun.com
I think the difference here is that you have /etc/nsswitch.conf
configured differently than I do. In particular, I have:
# consult /etc "files" only if nis is down.
hosts: nis dns [NOTFOUND=return] files
This is the default for Solaris when it is configured for NIS at install
time. Perhaps you or your sites administrators have overridden this
setting? When gethostbyname is called, the name service switch consults
the nis map; since an entry for xanadu is available there, it returns
with that record. No DNS lookup is attempted, since the host is found.
The script you pointed to looks in /etc/hosts, then attempts a nis
lookup, using 'ypmatch', then tries an 'nslookup', which is forced to
use DNS. On my system, this third lookup attempt succeeds.
+ check_nis xanadu
+ ypmatch xanadu hosts
+ awk {for (f=2; f <= NF; f++) print $f}
+ accept_if_fully_qualified xanadu
nis_domains= nis
+ check_dns xanadu
+ nslookup xanadu
+ awk $1 == "Name:" || $1 == "Aliases:"{print $2}
+ accept_if_fully_qualified xanadu.eng.sun.com
+ echo Hostname xanadu OK: fully qualified as xanadu.eng.sun.com
Hostname xanadu OK: fully qualified as xanadu.eng.sun.com
+ exit 0
My suggestion about using SI_SRPC_DOMAIN as a fallback was simply to
suggest a way to get *some* domain that makes sense-- since the FQDN is
only used in generting message IDs it didn't seem to matter much whether
it mapped exactly to your machine's FQ network name.
Perhaps a more aggressive (and correct) approach is to use libresolv to
actually force a DNS query when other means fail.
-dp
--
Daniel Price - Solaris I/O - dp@eng.sun.com
Expressed in this posting are my opinions. They are in no way related to
opinions held by my employer, Sun Microsystems. Statements on Sun products
included here are not gospel and may be fiction rather than truth.
Re: [slrn] slrn can't deduce my fqdn, so I can't get customized MsgIDs
Author: John E. Davis
Date: Sat, 12 Feb 2000 00:00
Date: Sat, 12 Feb 2000 00:00
17 lines
1194 bytes
1194 bytes
On 11 Feb 2000 23:30:07 GMT, Daniel Price <dp@xanadu.eng.sun.com> wrote: >So, I would call this a bug-- slrn doesn't play nice with systems >resolving hosts via NIS. The current mechanism works fine on my solaris system which uses NIS. > >One idea for a fallback algorithm is to call > > sysinfo(SI_SRPC_DOMAIN, buf, 256); I will look into this function. Thanks, --John
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads