lists.arthurdejong.org
RSS feed

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

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

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



Author: arthur
Date: Fri Oct  1 10:11:37 2010
New Revision: 1233
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?view=rev&revision=1233

Log:
use AC_CHECK_DECLS to check for definitions of functions we provide a 
replacement definition for

Modified:
   nss-pam-ldapd/compat/ether.c
   nss-pam-ldapd/compat/ldap_passwd_s.c
   nss-pam-ldapd/configure.ac

Modified: nss-pam-ldapd/compat/ether.c
==============================================================================
--- nss-pam-ldapd/compat/ether.c        Thu Sep 30 21:58:21 2010        (r1232)
+++ nss-pam-ldapd/compat/ether.c        Fri Oct  1 10:11:37 2010        (r1233)
@@ -37,11 +37,11 @@
 
 #ifndef HAVE_ETHER_NTOA_R
 
-#ifndef HAVE_ETHER_NTOA_DEFINED
+#if !HAVE_DECL_ETHER_NTOA
 /* we define ether_ntoa() here because on some platforms the function is
    underfined */
 extern char *ether_ntoa(const struct ether_addr *e);
-#endif /* not HAVE_ETHER_NTOA_DEFINED */
+#endif /* not HAVE_DECL_ETHER_NTOA */
 
 char *ether_ntoa_r(const struct ether_addr *addr,char *buf)
 {
@@ -56,11 +56,11 @@
 
 #ifndef HAVE_ETHER_ATON_R
 
-#ifndef HAVE_ETHER_ATON_DEFINED
+#if !HAVE_DECL_ETHER_ATON
 /* we define ether_aton() here because on some platforms the function is
    underfined */
 extern struct ether_addr *ether_aton(const char *s);
-#endif /* not HAVE_ETHER_ATON_DEFINED */
+#endif /* not HAVE_DECL_ETHER_ATON */
 
 struct ether_addr *ether_aton_r(const char *asc,struct ether_addr *addr)
 {

Modified: nss-pam-ldapd/compat/ldap_passwd_s.c
==============================================================================
--- nss-pam-ldapd/compat/ldap_passwd_s.c        Thu Sep 30 21:58:21 2010        
(r1232)
+++ nss-pam-ldapd/compat/ldap_passwd_s.c        Fri Oct  1 10:11:37 2010        
(r1233)
@@ -4,7 +4,7 @@
    (taken from _update_authtok() in pam_ldap.c).
 
    Copyright (C) 1998-2004 Luke Howard
-   Copyright (C) 2009 Arthur de Jong
+   Copyright (C) 2009, 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
@@ -53,11 +53,13 @@
 #define ber_memfree free
 #endif /* not HAVE_BER_MEMFREE */
 
+#if !HAVE_DECL_LDAP_EXTENDED_OPERATION_S
 /* we define this ourselves here because some LDAP header versions don't
    seem to define this */
-int ldap_extended_operation_s(LDAP *ld,LDAP_CONST char *reqoid,
+extern int ldap_extended_operation_s(LDAP *ld,LDAP_CONST char *reqoid,
     struct berval *reqdata,LDAPControl **serverctrls,LDAPControl **clientctrls,
     char **retoidp,struct berval **retdatap);
+#endif /* not HAVE_DECL_LDAP_EXTENDED_OPERATION_S */
 
 /* Replacement for password modification. user is the DN of the entry to
    change, oldpw is the old password (may not always be needed?), newpw is

Modified: nss-pam-ldapd/configure.ac
==============================================================================
--- nss-pam-ldapd/configure.ac  Thu Sep 30 21:58:21 2010        (r1232)
+++ nss-pam-ldapd/configure.ac  Fri Oct  1 10:11:37 2010        (r1233)
@@ -437,60 +437,15 @@
   AC_CHECK_FUNCS(ether_aton_r ether_ntoa_r,,[AC_LIBOBJ(ether)])
 
   # check requirements for our replacement functions
-  if test "x$ac_cv_func_ether_aton_r_func" != "xyes"
-  then
-    # we should have a simple ether_aton()
-    AC_CHECK_FUNCS(ether_aton)
-    # see if ether_aton() is defined in some header file
-    AC_CACHE_CHECK([for ether_aton() definition],
-        nss_pam_ldapd_cv_have_ether_aton_defined,
-        [AC_COMPILE_IFELSE(
-            [AC_LANG_PROGRAM([[
-                #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
-                ]],[[
-                extern int ether_aton(int);
-                ]])],
-            [nss_pam_ldapd_cv_have_ether_aton_defined=no],
-            [nss_pam_ldapd_cv_have_ether_aton_defined=yes]) ])
-    if test "x$nss_pam_ldapd_cv_have_ether_aton_defined" = "xyes"
-    then
-      AC_DEFINE_UNQUOTED(HAVE_ETHER_ATON_DEFINED,1,
-                         [Define to 1 if you have the definition for 
`ether_aton'.])
-    fi
-  fi
-  if test "x$ac_cv_func_ether_ntoa_r_func" != "xyes"
-  then
-    # we should have a simple ether_ntoa()
-    AC_CHECK_FUNCS(ether_ntoa)
-    # see if ether_ntoa() is defined in some header file
-    AC_CACHE_CHECK([for ether_ntoa() definition],
-        nss_pam_ldapd_cv_have_ether_ntoa_defined,
-        [AC_COMPILE_IFELSE(
-            [AC_LANG_PROGRAM([[
-                #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
-                ]],[[
-                extern int ether_ntoa(int);
-                ]])],
-            [nss_pam_ldapd_cv_have_ether_ntoa_defined=no],
-            [nss_pam_ldapd_cv_have_ether_ntoa_defined=yes]) ])
-    if test "x$nss_pam_ldapd_cv_have_ether_ntoa_defined" = "xyes"
-    then
-      AC_DEFINE_UNQUOTED(HAVE_ETHER_NTOA_DEFINED,1,
-                         [Define to 1 if you have the definition for 
`ether_ntoa'.])
-    fi
-  fi
+  AC_CHECK_FUNCS(ether_ntoa ether_aton)
+  AC_CHECK_DECLS([ether_ntoa,ether_aton],,,[
+      #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 to see if struct sockaddr_storage is defined
   AC_CHECK_TYPE(struct sockaddr_storage,,
@@ -585,6 +540,11 @@
 
   # replace ldap_create_page_control() and ldap_parse_page_control()
   AC_CHECK_FUNCS(ldap_create_page_control 
ldap_parse_page_control,,[AC_LIBOBJ(pagectrl)])
+  AC_CHECK_DECLS(ldap_extended_operation_s,,,[
+      #if HAVE_LBER_H
+      #include <lber.h>
+      #endif
+      #include <ldap.h>])
 
   # replace other ldap functions
   AC_REPLACE_FUNCS(ldap_passwd_s)
--
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits