Forum: CFEngine Help
Subject: Re: Hostname gets truncated at 8 chars in cfengine-community 3.3.5 on 
hpux 11.31
Author: mvpel
Link to topic: https://cfengine.com/forum/read.php?3,27262,27291#msg-27291

The classes are set in sysinfo.c in the DetectDomainName() function, which is 
given one argument orig_nodename, which comes from VSYSNAME.nodename.

This should show up during bootstrap as "This host is:"
bootstrap.c:    printf(" -> This host is: %s\n", VSYSNAME.nodename);

It runs gethostname() first to set fqn, then runs gethostbyname() with that 
value to get dnsname. 

nodename is copied to uqname in CalculateDomainName(), which explains why 
sys.host and sys.uqhost are the same.

The VSYSNAME is a struct utsname type, and it is set up in GetNameInfo3() with 
a uname() call, and in /usr/include/sys/utsname.h on HP-UX 11.11, if 
_INCLUDE_POSIX_SOURCE is defined then the _SYS_NMLN is defined to 9, which 
limits the length of the sysname, nodename, release, version, and machine 
elements of a utsname structure. You probably have something similar in HP-UX 
11.11.


#ifdef _INCLUDE_POSIX_SOURCE
#  define _SYS_NMLN     9       /* length of strings returned by uname(OS) */
#  define _SNLEN        15

/*
 * WARNING: MAXSFNAMLEN (the maximum length of a swap file name ) in
 * vm_swalloc.c has a dependency on the length of the nodename field in
 * utsname.  The nodename is part of the swap file name.  Therefore if
 * the size of nodename increases, MAXSFNAMLEN must also be increased.
 */
   struct utsname {
        char    sysname[_SYS_NMLN];
        char    nodename[_SYS_NMLN];
        char    release[_SYS_NMLN];
        char    version[_SYS_NMLN];
        char    machine[_SYS_NMLN];
        char    __idnumber[_SNLEN];
   };



So it's the use of uname() that's at the root of the problem.

Here's some HP-UX documentation about the expanded_node_host_names kernel 
parameter, which is available on 11i v2 and v3:
http://h30499.www3.hp.com/hpeb/attachments/hpeb/itrc-156/360527/1/335175.pdf

I suspect that if you ran "uname -n" you'll also see the truncated name, yes?

_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to