[openssl-users] Dealing with RFC2553 and RFC3493 where NI_MAXHOST and NI_MAXSERV no longer exist

Dennis Clarke dclarke at blastwave.org
Fri Jan 18 06:53:08 UTC 2019


Going in circles trying to compile 1.1.1a with strict C99 and no
optimizations and with a ready to debug and single step resultant
library.  Ran headlong into crypto/bio/b_addr.c where we see :

    176  /*-
    177   * addr_strings - helper function to get host and service names
    178   * @ap: the BIO_ADDR that has the input info
    179   * @numeric: 0 if actual names should be returned, 1 if the numeric
    180   * representation should be returned.
    181   * @hostname: a pointer to a pointer to a memory area to store the
    182   * host name or numeric representation.  Unused if NULL.
    183   * @service: a pointer to a pointer to a memory area to store the
    184   * service name or numeric representation.  Unused if NULL.
    185   *
    186   * The return value is 0 on failure, with the error code in the 
error
    187   * stack, and 1 on success.
    188   */
    189  static int addr_strings(const BIO_ADDR *ap, int numeric,
    190                          char **hostname, char **service)
    191  {
    192      if (BIO_sock_init() != 1)
    193          return 0;
    194
    195      if (1) {
    196  #ifdef AI_PASSIVE
    197          int ret = 0;
    198          char host[NI_MAXHOST] = "", serv[NI_MAXSERV] = "";
    199          int flags = 0;
    200
.
.
.

Where we see NI_MAXHOST and NI_MAXSERV used however those did exist in 
RFC2553 and then were removed in RFC3493 and thus strict C99 halts in a 
noisey way unless __EXTENSIONS__ is defined.

"crypto/bio/b_addr.c", line 198: error: undefined symbol: NI_MAXHOST
"crypto/bio/b_addr.c", line 198: error: variable length array can not be 
initialized: host
"crypto/bio/b_addr.c", line 198: error: undefined symbol: NI_MAXSERV
"crypto/bio/b_addr.c", line 198: error: variable length array can not be 
initialized: serv
c99: acomp failed for crypto/bio/b_addr.c

Right.

If I attempt to use "extensions" and other things then this compiles
just fine and the process fails in other places.  For now, however, the
values NI_MAXHOST and NI_MAXSERV don't really exist in netdb.h as
far as I can see.

Dennis


More information about the openssl-users mailing list