[BZ,17956] Fix build failure due to missing definitions from header file nss/nss.h when Mozilla NSS is used for cryptography

Message ID 1464635653.24965.5.camel@trentalancia.net
State New, archived
Headers

Commit Message

Guido Trentalancia May 30, 2016, 7:14 p.m. UTC
  A build failure occurs when glibc is configured with the --enable-nss-crypt
option in order to use Mozilla NSS library for cryptography.

Such failure is due to conflicting "nss.h" header files: one from GNU
glibc and the other from the Mozilla NSS library (usually located at
/usr/include/nss3/nss.h).

This patch aims to fix such build failure (BZ 17956) by helping the
preprocessor pick the right (local) "nss.h" header file during compilation.

Signed-off-by: Guido Trentalancia <guido@trentalancia.net>
---
 hesiod/nss_hesiod/hesiod-grp.c   |    2 +-
 hesiod/nss_hesiod/hesiod-pwd.c   |    2 +-
 include/nsswitch.h               |    2 +-
 nss/nss_db/db-initgroups.c       |    1 +
 nss/nss_db/db-open.c             |    1 +
 nss/nss_files/files-initgroups.c |    2 +-
 nss/nsswitch.h                   |    2 +-
 nss/rewrite_field.c              |    2 +-
 nss/valid_field.c                |    2 +-
 nss/valid_list_field.c           |    2 +-
 10 files changed, 10 insertions(+), 8 deletions(-)
  

Patch

diff -pru glibc/hesiod/nss_hesiod/hesiod-grp.c glibc-30052016-2000/hesiod/nss_hesiod/hesiod-grp.c
--- glibc/hesiod/nss_hesiod/hesiod-grp.c	2016-05-30 13:25:35.407697033 +0200
+++ glibc-30052016-2000/hesiod/nss_hesiod/hesiod-grp.c	2016-05-30 20:55:26.649690780 +0200
@@ -20,7 +20,7 @@ 
 #include <errno.h>
 #include <grp.h>
 #include <hesiod.h>
-#include <nss.h>
+#include <nsswitch.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff -pru glibc/hesiod/nss_hesiod/hesiod-pwd.c glibc-30052016-2000/hesiod/nss_hesiod/hesiod-pwd.c
--- glibc/hesiod/nss_hesiod/hesiod-pwd.c	2016-05-30 13:25:35.407697033 +0200
+++ glibc-30052016-2000/hesiod/nss_hesiod/hesiod-pwd.c	2016-05-30 20:55:40.096657000 +0200
@@ -19,7 +19,7 @@ 
 #include <errno.h>
 #include <hesiod.h>
 #include <pwd.h>
-#include <nss.h>
+#include <nsswitch.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff -pru glibc/include/nsswitch.h glibc-30052016-2000/include/nsswitch.h
--- glibc/include/nsswitch.h	2016-05-30 13:25:35.699697966 +0200
+++ glibc-30052016-2000/include/nsswitch.h	2016-05-30 20:13:23.526750349 +0200
@@ -1 +1 @@ 
-#include <nss/nsswitch.h>
+#include "../nss/nsswitch.h"
diff -pru glibc/nss/nss_db/db-initgroups.c glibc-30052016-2000/nss/nss_db/db-initgroups.c
--- glibc/nss/nss_db/db-initgroups.c	2016-05-30 13:25:36.268699785 +0200
+++ glibc-30052016-2000/nss/nss_db/db-initgroups.c	2016-05-30 20:29:49.855696425 +0200
@@ -26,6 +26,7 @@ 
 #include <string.h>
 #include <stdint.h>
 #include <sys/param.h>
+#include "../nss.h"
 
 #include "nss_db.h"
 
diff -pru glibc/nss/nss_db/db-open.c glibc-30052016-2000/nss/nss_db/db-open.c
--- glibc/nss/nss_db/db-open.c	2016-05-30 13:25:36.268699785 +0200
+++ glibc-30052016-2000/nss/nss_db/db-open.c	2016-05-30 20:29:24.877770621 +0200
@@ -24,6 +24,7 @@ 
 #include <unistd.h>
 #include <sys/mman.h>
 #include <not-cancel.h>
+#include "../nss.h"
 
 #include "nss_db.h"
 
diff -pru glibc/nss/nss_files/files-initgroups.c glibc-30052016-2000/nss/nss_files/files-initgroups.c
--- glibc/nss/nss_files/files-initgroups.c	2016-05-30 13:25:36.269699788 +0200
+++ glibc-30052016-2000/nss/nss_files/files-initgroups.c	2016-05-30 20:27:39.332085182 +0200
@@ -19,7 +19,7 @@ 
 #include <alloca.h>
 #include <errno.h>
 #include <grp.h>
-#include <nss.h>
+#include "../nss.h"
 #include <stdio_ext.h>
 #include <string.h>
 #include <sys/param.h>
diff -pru glibc/nss/nsswitch.h glibc-30052016-2000/nss/nsswitch.h
--- glibc/nss/nsswitch.h	2016-05-30 13:25:36.270699791 +0200
+++ glibc-30052016-2000/nss/nsswitch.h	2016-05-30 20:13:23.527750346 +0200
@@ -22,7 +22,7 @@ 
 
 #include <arpa/nameser.h>
 #include <netinet/in.h>
-#include <nss.h>
+#include "nss.h"
 #include <resolv.h>
 #include <search.h>
 #include <dlfcn.h>
diff -pru glibc/nss/rewrite_field.c glibc-30052016-2000/nss/rewrite_field.c
--- glibc/nss/rewrite_field.c	2016-05-30 13:25:36.270699791 +0200
+++ glibc-30052016-2000/nss/rewrite_field.c	2016-05-30 20:13:23.527750346 +0200
@@ -15,7 +15,7 @@ 
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <nss.h>
+#include "../include/nss.h"
 #include <string.h>
 
 /* Rewrite VALUE to a valid field value in the NSS database.  Invalid
diff -pru glibc/nss/valid_field.c glibc-30052016-2000/nss/valid_field.c
--- glibc/nss/valid_field.c	2016-05-30 13:25:36.271699794 +0200
+++ glibc-30052016-2000/nss/valid_field.c	2016-05-30 20:13:23.527750346 +0200
@@ -15,7 +15,7 @@ 
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <nss.h>
+#include "../include/nss.h"
 #include <string.h>
 
 const char __nss_invalid_field_characters[] = NSS_INVALID_FIELD_CHARACTERS;
diff -pru glibc/nss/valid_list_field.c glibc-30052016-2000/nss/valid_list_field.c
--- glibc/nss/valid_list_field.c	2016-05-30 13:25:36.271699794 +0200
+++ glibc-30052016-2000/nss/valid_list_field.c	2016-05-30 20:13:23.527750346 +0200
@@ -15,7 +15,7 @@ 
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <nss.h>
+#include "../include/nss.h"
 #include <stdbool.h>
 #include <string.h>