arthurdejong / nss-pam-ldapd

NSS and PAM modules for lookups using LDAP
https://arthurdejong.org/nss-pam-ldapd/
GNU Lesser General Public License v2.1
54 stars 42 forks source link

Tolerate missing definitions for NETDB_INTERNAL and NETDB_SUCCESS #43

Closed ashway83 closed 2 years ago

ashway83 commented 3 years ago

This fixes build issue on Alpine and potentially other non-glibc Linux distributions.

gcc -DHAVE_CONFIG_H -I. -I..  -I..  -fPIC -g -O2 -MT hosts.o -MD -MP -MF .deps/hosts.Tpo -c -o hosts.o hosts.c
hosts.c: In function 'read_one_hostent':
hosts.c:55:15: error: 'NETDB_INTERNAL' undeclared (first use in this function)
   55 |   *h_errnop = NETDB_INTERNAL;                                               \
      |               ^~~~~~~~~~~~~~
../common/nslcd-prot.h:220:5: note: in expansion of macro 'ERROR_OUT_BUFERROR'
  220 |     ERROR_OUT_BUFERROR(fp);                                                 \
      |     ^~~~~~~~~~~~~~~~~~
../common/nslcd-prot.h:265:3: note: in expansion of macro 'BUF_CHECK'
  265 |   BUF_CHECK(fp, tmpint32 + 1);                                              \
      |   ^~~~~~~~~
hosts.c:77:3: note: in expansion of macro 'READ_BUF_STRING'
   77 |   READ_BUF_STRING(fp, result->h_name);
      |   ^~~~~~~~~~~~~~~
hosts.c:55:15: note: each undeclared identifier is reported only once for each function it appears in
   55 |   *h_errnop = NETDB_INTERNAL;                                               \
      |               ^~~~~~~~~~~~~~
../common/nslcd-prot.h:220:5: note: in expansion of macro 'ERROR_OUT_BUFERROR'
  220 |     ERROR_OUT_BUFERROR(fp);                                                 \
      |     ^~~~~~~~~~~~~~~~~~
../common/nslcd-prot.h:265:3: note: in expansion of macro 'BUF_CHECK'
  265 |   BUF_CHECK(fp, tmpint32 + 1);                                              \
      |   ^~~~~~~~~
hosts.c:77:3: note: in expansion of macro 'READ_BUF_STRING'
   77 |   READ_BUF_STRING(fp, result->h_name);
      |   ^~~~~~~~~~~~~~~
make[2]: *** [Makefile:417: hosts.o] Error 1
make[2]: Leaving directory '/build/nss-pam-ldapd-0.9.11/nss'
make[1]: *** [Makefile:443: all-recursive] Error 1
make[1]: Leaving directory '/build/nss-pam-ldapd-0.9.11'
make: *** [Makefile:384: all] Error 2

Similar fix in the other project: https://github.com/gambit/gambit/commit/490f0a7d50125478f374330f0b8754bc0aee3746

Signed-off-by: Andriy Sharandakov ash.ashway@gmail.com

arthurdejong commented 3 years ago

Hi @ashway83,

Are you sure a value of -1 is correct for uClibc (as I understand what is used in Alpine)? The error is used specifically to signal to the C library that the buffer provided to fill in the result addresses is too small.

https://uclibc.org/downloads/Glibc_vs_uClibc_Differences.txt suggests that uClibc does not support NSS at all so there should not be much use of compiling the NSS module of nss-pam-ldapd on that platform (probably use --disable-nss).

arthurdejong commented 2 years ago

Closing this now due to lack of response (I know I'm not very responsive myself, sorry about that). If this is still relevant, please re-open.