Package: nss-pam-ldapd / 0.9.7-2+deb9u1

Increase-size-of-hostname-buffer.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
From: Arthur de Jong <arthur@arthurdejong.org>
Date: Fri, 16 Feb 2018 22:13:19 +0100
Subject: Increase size of hostname buffer
Origin: https://github.com/arthurdejong/nss-pam-ldapd/commit/c05e3265b7f62b83937f204119555c6a73f29b29
Bug-Debian: https://bugs.debian.org/890508
Bug: https://github.com/arthurdejong/nss-pam-ldapd/issues/22

This increases the host name buffer to support host names (that include
FQDNs) to 255 characters and removes the reliance on HOST_NAME_MAX and
_POSIX_HOST_NAME_MAX which may be smaller in some situations.

Closes https://github.com/arthurdejong/nss-pam-ldapd/issues/22
---
 nslcd/cfg.c    |  4 ++--
 nslcd/common.h | 13 ++-----------
 2 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/nslcd/cfg.c b/nslcd/cfg.c
index 60d860e..348e800 100644
--- a/nslcd/cfg.c
+++ b/nslcd/cfg.c
@@ -425,7 +425,7 @@ static void add_uris_from_dns(const char *filename, int lnr,
 {
   int rc;
   char *hostlist = NULL, *nxt;
-  char buf[HOST_NAME_MAX + sizeof("ldap://")];
+  char buf[BUFLEN_HOSTNAME + sizeof("ldap://")];
   log_log(LOG_DEBUG, "query %s for SRV records", domain);
   rc = ldap_domain2hostlist(domain, &hostlist);
   if (rc != LDAP_SUCCESS)
diff --git a/nslcd/common.h b/nslcd/common.h
index ffa07ba..26fcf48 100644
--- a/nslcd/common.h
+++ b/nslcd/common.h
@@ -150,15 +150,6 @@ int invalidator_start(void);
 /* signal invalidator to invalidate the selected external cache */
 void invalidator_do(enum ldap_map_selector map);
 
-/* fallback definition of HOST_NAME_MAX */
-#ifndef HOST_NAME_MAX
-#ifdef _POSIX_HOST_NAME_MAX
-#define HOST_NAME_MAX _POSIX_HOST_NAME_MAX
-#else
-#define HOST_NAME_MAX 255
-#endif /* _POSIX_HOST_NAME_MAX */
-#endif /* not HOST_NAME_MAX */
-
 /* common buffer lengths */
 #define BUFLEN_NAME         256  /* user, group names and such */
 #define BUFLEN_SAFENAME     300  /* escaped name */
@@ -167,7 +158,7 @@ void invalidator_do(enum ldap_map_selector map);
 #define BUFLEN_DN           512  /* distinguished names */
 #define BUFLEN_SAFEDN       600  /* escapedd dn */
 #define BUFLEN_FILTER      4096  /* search filters */
-#define BUFLEN_HOSTNAME (HOST_NAME_MAX + 1)  /* host names (+ escaped) */
+#define BUFLEN_HOSTNAME     256  /* host names or FQDN (and safe version) */
 #define BUFLEN_MESSAGE     1024  /* message strings */
 
 /* provide strtouid() function alias */
-- 
2.16.2