lists.arthurdejong.org
RSS feed

nss-pam-ldapd commit: r1146 - in nss-pam-ldapd: . compat nss

[Date Prev][Date Next] [Thread Prev][Thread Next]

nss-pam-ldapd commit: r1146 - in nss-pam-ldapd: . compat nss



Author: arthur
Date: Thu Jun 17 21:05:33 2010
New Revision: 1146
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?view=rev&revision=1146

Log:
have more compatibility code for NSS module and move compatibility code to 
compat directory

Added:
   nss-pam-ldapd/compat/nss_compat.h
Modified:
   nss-pam-ldapd/compat/Makefile.am
   nss-pam-ldapd/configure.ac
   nss-pam-ldapd/nss/common.h
   nss-pam-ldapd/nss/prototypes.h

Modified: nss-pam-ldapd/compat/Makefile.am
==============================================================================
--- nss-pam-ldapd/compat/Makefile.am    Wed Jun 16 22:59:34 2010        (r1145)
+++ nss-pam-ldapd/compat/Makefile.am    Thu Jun 17 21:05:33 2010        (r1146)
@@ -25,6 +25,7 @@
 EXTRA_DIST = getopt_long.c getopt_long.h \
              daemon.c daemon.h \
              ether.c ether.h \
+             nss_compat.h \
              ldap_compat.h pagectrl.c ldap_passwd_s.c ldap_initialize.c \
              pam_compat.h pam_get_authtok.c pam_prompt.c
 

Added: nss-pam-ldapd/compat/nss_compat.h
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ nss-pam-ldapd/compat/nss_compat.h   Thu Jun 17 21:05:33 2010        (r1146)
@@ -0,0 +1,112 @@
+/*
+   nss_compat.h - compatibility definitions for NSS functions
+
+   Copyright (C) 2010 Arthur de Jong
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with this library; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301 USA
+*/
+
+#ifndef COMPAT__NSS_H
+#define COMPAT__NSS_H
+
+#include <nss.h>
+#ifdef HAVE_ALIASES_H
+#include <aliases.h>
+#endif
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <grp.h>
+#include <netdb.h>
+#include <pwd.h>
+#ifdef HAVE_SHADOW_H
+#include <shadow.h>
+#endif /* HAVE_SHADOW_H */
+#ifdef HAVE_RPC_RPCENT_H
+#include <rpc/rpcent.h>
+#endif /* HAVE_RPC_RPCENT_H */
+
+#include "compat/ether.h"
+
+/* Define an aliasent if it was not found on the system. */
+#ifndef HAVE_STRUCT_ALIASENT
+struct aliasent
+{
+  char *alias_name;
+  size_t alias_members_len;
+  char **alias_members;
+  int alias_local;
+};
+#endif /* not HAVE_STRUCT_ALIASENT */
+
+/* Define an rpcent if it was not found on the system */
+#ifndef HAVE_STRUCT_RPCENT
+struct rpcent
+{
+  char *r_name;
+  char **r_aliases;
+  int r_number;
+};
+#endif /* not HAVE_STRUCT_RPCENT */
+
+/* We define struct etherent here because it does not seem to
+   be defined in any publicly available header file exposed
+   by glibc. This is taken from include/netinet/ether.h
+   of the glibc (2.3.6) source tarball. */
+#ifndef HAVE_STRUCT_ETHERENT
+struct etherent
+{
+  const char *e_name;
+  struct ether_addr e_addr;
+};
+#endif /* not HAVE_STRUCT_ETHERENT */
+
+/* We also define struct __netgrent because it's definition is
+   not publically available. This is taken from inet/netgroup.h
+   of the glibc (2.3.6) source tarball.
+   The first part of the struct is the only part that is modified
+   by our getnetgrent() function, all the other fields are not
+   touched at all. */
+struct __netgrent
+{
+  enum { triple_val, group_val } type;
+  union
+  {
+    struct
+    {
+      const char *host;
+      const char *user;
+      const char *domain;
+    } triple;
+    const char *group;
+  } val;
+  /* the following stuff is used by some NSS services
+     but not by ours (it's not completely clear how these
+     are shared between different services) or is used
+     by our caller */
+  char *data;
+  size_t data_size;
+  union
+  {
+    char *cursor;
+    unsigned long int position;
+  } insertedname; /* added name to union to avoid warning */
+  int first;
+  struct name_list *known_groups;
+  struct name_list *needed_groups;
+  void *nip; /* changed from `service_user *nip' */
+};
+
+#endif /* not COMPAT__NSS_H */

Modified: nss-pam-ldapd/configure.ac
==============================================================================
--- nss-pam-ldapd/configure.ac  Wed Jun 16 22:59:34 2010        (r1145)
+++ nss-pam-ldapd/configure.ac  Thu Jun 17 21:05:33 2010        (r1146)
@@ -200,7 +200,7 @@
 
 # checks for availability of header files
 AC_CHECK_HEADERS([ctype.h strings.h pthread.h fcntl.h limits.h])
-AC_CHECK_HEADERS([nss.h grp.h shadow.h aliases.h netdb.h])
+AC_CHECK_HEADERS([nss.h grp.h shadow.h aliases.h netdb.h rpc/rpcent.h])
 AC_CHECK_HEADERS([netinet/ether.h arpa/inet.h netinet/in.h])
 AC_CHECK_HEADERS([sys/socket.h sys/un.h sys/ucred.h ucred.h sys/param.h 
sys/time.h])
 AC_CHECK_HEADERS([getopt.h syslog.h])
@@ -256,8 +256,7 @@
 AM_CONDITIONAL([HAVE_VERSION_SCRIPT_FLAG], [test "x${VERSION_SCRIPT_FLAG}" != 
x])
 
 # check for support for the struct ether_addr structure
-AC_CHECK_TYPE(struct ether_addr,
-    AC_DEFINE(HAVE_STRUCT_ETHER_ADDR,1,[Define to 1 if you have a `struct 
ether_addr' definition.]),,[
+AC_CHECK_TYPES(struct ether_addr,,,[
     #include <sys/socket.h>
     #include <net/if.h>
     #include <netinet/in.h>
@@ -272,6 +271,41 @@
     #include <sys/types.h>
     #include <sys/socket.h>])
 
+# NSS module-specific tests
+if test "x$enable_nss" = "xyes"
+then
+  # save CFLAGS and LIBS to restore later
+  nss_save_CFLAGS="$CFLAGS"
+  nss_save_LIBS="$LIBS"
+
+  # check for a definition of struct aliasent
+  AC_CHECK_TYPES(struct aliasent,,,[
+      #ifdef HAVE_ALIASES_H
+      #include <aliases.h>
+      #endif])
+
+  # check for a definition of struct etherent
+  AC_CHECK_TYPES(struct etherent,,,[
+    #include <sys/socket.h>
+    #include <net/if.h>
+    #include <netinet/in.h>
+    #include <netinet/if_ether.h>
+    #ifdef HAVE_NETINET_ETHER_H
+    #include <netinet/ether.h>
+    #endif])
+
+  # check for a definition of struct rpcent
+  AC_CHECK_TYPES(struct rpcent,,,[
+      #include <netdb.h>
+      #ifdef HAVE_RPC_RPCENT_H
+      #include <rpc/rpcent.h>
+      #endif])
+
+  # restore CFLAGS and LIBS
+  CFLAGS="$nss_save_CFLAGS"
+  LIBS="$nss_save_LIBS"
+fi
+
 # PAM module-specific tests
 if test "x$enable_pam" = "xyes"
 then
@@ -315,8 +349,6 @@
   # save CFLAGS and LIBS to restore later
   nslcd_save_CFLAGS="$CFLAGS"
   nslcd_save_LIBS="$LIBS"
-  CFLAGS="$CFLAGS"
-  LIBS="$LIBS"
 
   # check header files
   AC_CHECK_HEADERS(lber.h)

Modified: nss-pam-ldapd/nss/common.h
==============================================================================
--- nss-pam-ldapd/nss/common.h  Wed Jun 16 22:59:34 2010        (r1145)
+++ nss-pam-ldapd/nss/common.h  Thu Jun 17 21:05:33 2010        (r1146)
@@ -24,11 +24,11 @@
 #define NSS__COMMON_H 1
 
 #include <stdio.h>
-#include <nss.h>
 
 #include "nslcd.h"
 #include "common/nslcd-prot.h"
 #include "compat/attrs.h"
+#include "compat/nss_compat.h"
 
 /* These are macros for handling read and write problems, they are
    NSS specific due to the return code so are defined here. They

Modified: nss-pam-ldapd/nss/prototypes.h
==============================================================================
--- nss-pam-ldapd/nss/prototypes.h      Wed Jun 16 22:59:34 2010        (r1145)
+++ nss-pam-ldapd/nss/prototypes.h      Thu Jun 17 21:05:33 2010        (r1146)
@@ -23,66 +23,7 @@
 #ifndef NSS__PROTOTYPES_H
 #define NSS__PROTOTYPES_H 1
 
-#include <nss.h>
-#ifdef HAVE_ALIASES_H
-#include <aliases.h>
-#endif
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <grp.h>
-#include <netdb.h>
-#include <pwd.h>
-#ifdef HAVE_SHADOW_H
-#include <shadow.h>
-#endif /* HAVE_SHADOW_H */
-
-#include "compat/ether.h"
-
-/* We define struct etherent here because it does not seem to
-   be defined in any publicly available header file exposed
-   by glibc. This is taken from include/netinet/ether.h
-   of the glibc (2.3.6) source tarball. */
-struct etherent
-{
-  const char *e_name;
-  struct ether_addr e_addr;
-};
-
-/* We also define struct __netgrent because it's definition is
-   not publically available. This is taken from inet/netgroup.h
-   of the glibc (2.3.6) source tarball.
-   The first part of the struct is the only part that is modified
-   by the getnetgrent() function, all the other fields are not
-   touched at all. */
-struct __netgrent
-{
-  enum { triple_val, group_val } type;
-  union
-  {
-    struct
-    {
-      const char *host;
-      const char *user;
-      const char *domain;
-    } triple;
-    const char *group;
-  } val;
-  /* the following stuff is used by some NSS services
-     but not by ours (it's not completely clear how these
-     are shared between different services) or is used
-     by our caller */
-  char *data;
-  size_t data_size;
-  union
-  {
-    char *cursor;
-    unsigned long int position;
-  } insertedname; /* added name to union to avoid warning */
-  int first;
-  struct name_list *known_groups;
-  struct name_list *needed_groups;
-  void *nip; /* changed from `service_user *nip' */
-};
+#include "compat/nss_compat.h"
 
 /*
    These are prototypes for functions exported from the ldap NSS module.
--
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits