Fix maximum length of hostnames including domain name.
authorTatsuo Ishii <ishii@sraoss.co.jp>
Thu, 27 May 2021 10:15:46 +0000 (19:15 +0900)
committerTatsuo Ishii <ishii@sraoss.co.jp>
Thu, 27 May 2021 10:27:23 +0000 (19:27 +0900)
The maximum length of hostnames was 128, which is not incorrect.
Moreover there were multiple places where the maximum length of hostname is defined.
So create unified definition of it in libpcp_ext.h.

Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2021-May/003904.html

src/include/pcp/libpcp_ext.h
src/include/pool_config.h

index 63227f82369a60b27eff4a69843ae8a6a55e6512..d443a4a111a0d05e7aa8057743ad890825cce835 100644 (file)
@@ -4,7 +4,7 @@
  * pgpool: a language independent connection pool server for PostgreSQL 
  * written by Tatsuo Ishii
  *
- * Copyright (c) 2003-2017     PgPool Global Development Group
+ * Copyright (c) 2003-2021     PgPool Global Development Group
  *
  * Permission to use, copy, modify, and distribute this software and
  * its documentation for any purpose and without fee is hereby
 #define SM_UNUSED              64
 #define SM_TTY                 64
 
+/*
+ * Maximum hostname length including domain name and "." including NULL
+ * terminate.
+ * https://en.wikipedia.org/wiki/Hostname#cite_note-Raymond,_Microsoft_devblog,_2012-3
+ */
+#define MAX_FDQN_HOSTNAME_LEN  254
+
 #define MAX_NUM_BACKENDS 128
 #define MAX_CONNECTION_SLOTS MAX_NUM_BACKENDS
-#define MAX_DB_HOST_NAMELEN     128
+#define MAX_DB_HOST_NAMELEN     MAX_FDQN_HOSTNAME_LEN
 #define MAX_PATH_LENGTH 256
 
 typedef enum {
index 0138175679322cb9551a0ad713c388ee0a72fb0b..12b0aafd8b55e6b998ee95d422bd9759952ce0a8 100644 (file)
@@ -6,7 +6,7 @@
  * pgpool: a language independent connection pool server for PostgreSQL
  * written by Tatsuo Ishii
  *
- * Copyright (c) 2003-2017     PgPool Global Development Group
+ * Copyright (c) 2003-2021     PgPool Global Development Group
  *
  * Permission to use, copy, modify, and distribute this software and
  * its documentation for any purpose and without fee is hereby
@@ -31,7 +31,7 @@
 /*
  * watchdog
  */
-#define WD_MAX_HOST_NAMELEN (128)
+#define WD_MAX_HOST_NAMELEN MAX_FDQN_HOSTNAME_LEN
 #define WD_MAX_PATH_LEN (128)
 #define MAX_WATCHDOG_NUM (128)
 #define WD_SEND_TIMEOUT (1)