{admin_uri} substitution
Rafal
rafal at poczta.homelinux.com
Fri Sep 9 01:24:50 PDT 2005
> Anonymous wrote:
> > Like: when `hostname` returns string without dots, just compare the
> > (dot-separated) first part of the ServerName?
>
> That won't work if you have two systems with the same name in
> different subdomains (e.g. printserver.lab1.foo.com and
> printserver.lab2.foo.com)
>
> Go ahead an file a bug report against CUPS 1.2 at:
>
> http://www.cups.org/str.php
>
I'm doing this just now.
But still checking to have the problem stated as correctly as possible. And here is 'more evidence' I gathered.
--------------------/bin/bash-------------
anonymous at model:~/work/tmp$ hostname --fqdn
model.home.waw.pl
--------------man hostname ----------------
SYNOPSIS
hostname [-v] [-a] [--alias] [-d] [--domain] [-f]
[--fqdn] [-i] [--ip-address] [--long] [-s] [--short] [-y]
[--yp] [--nis]
....
THE FQDN
You can't change the FQDN (as returned by hostname --fqdn)
or the DNS domain name (as returned by dnsdomainname) with
this command. The FQDN of the system is the name that the
resolver(3) returns for the host name.
Technically: The FQDN is the name gethostbyname(2) returns
for the host name returned by gethostname(2). The DNS
domain name is the part after the first dot.
Therefore it depends on the configuration (usually in
/etc/host.conf) how you can change it. Usually (if the
hosts file is parsed before DNS or NIS) you can change it
in /etc/hosts.
-------------------------------
So I assume, that I have my configuration *exactly* as the command 'hostname' expects. It spills out FQDN only when requested explicitly.
on the other hand, I tried getdomainname() (looking for actual system call, the library referes to), and the results are not encouriging:
--------------test.c------------
main() {
if (getdomainname(buff, BSIZE) == 0) {
printf("%s\n", buff);
}
}
-----------------------bash------------
anonymous at model:~/work/tmp$ ./a.out
(none)
anonymous at model:~/work/tmp$ strace ./a.out
....
uname({sys="Linux", node="model", ...}) = 0
...
write(1, "(none)\n", 7(none)
) = 7
------------------------------------------
in short, the getdomainname() does not solve the none-FQDN problem, my system does not have setdomainname() set, still it yields an 'as expected': "dnsdomainname" AND "hostname --fqdn".
But it looks like libc authors (the hostname manpages) assume, that a correct way of looking for an FQDN is to use 'resolvers' calls not just gethostname. (some of their statements look a bit contradicting to me, so I'm not quite sure of the overall meaning).
So may be my bug report should request modification that: "function ippRewriteURL() should call resolver to get FQDN, when gethostname() returns string without dots."
Whout that be more apropriate?
More information about the cups
mailing list