]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
src/login_nopam.c: Rely on the system's MAXHOSTNAMELEN
authorAlejandro Colomar <alx@kernel.org>
Tue, 22 Oct 2024 22:14:12 +0000 (00:14 +0200)
committerSerge Hallyn <serge@hallyn.com>
Mon, 11 Nov 2024 05:17:41 +0000 (23:17 -0600)
The reason for that code seems to be some ancient AIX version that
defined a value that was too small (32).  We don't support such systems.
In the link below, I found the following comment and code:

 /*
  * Some AIX versions advertise a too small MAXHOSTNAMELEN value (32).
  * Result: long hostnames would be truncated, and connections would be
  * dropped because of host name verification failures. Adrian van Bloois
  * (A.vanBloois@info.nic.surfnet.nl) figured out what was the problem.
  */

#if (MAXHOSTNAMELEN < 64)
#undef MAXHOSTNAMELEN
#endif

/* In case not defined in <sys/param.h>. */

#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN  256             /* storage for host name */
#endif

Today's systems seem to be much better regarding this macro.  Rely on
them.

Link: <https://sources.debian.org/src/tcp-wrappers/7.6.q-33/workarounds.c/?hl=36#L36>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
src/login_nopam.c

index 5c0ecc0e8dbe50bab23c8e3483d5dce57dfd73be..2d979323e116217720376313590cb4b323c3016d 100644 (file)
@@ -52,6 +52,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <stdlib.h>
+#include <sys/param.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>         /* for inet_ntoa() */
 #include "string/strtok/stpsep.h"
 
 
-#if !defined(MAXHOSTNAMELEN) || (MAXHOSTNAMELEN < 64)
-#undef MAXHOSTNAMELEN
-#define MAXHOSTNAMELEN 256
-#endif
-
  /* Path name of the access control file. */
 #ifndef        TABLE
 #define TABLE  "/etc/login.access"