INN commit: trunk (4 files)

INN Commit rra at isc.org
Tue Aug 27 17:52:38 UTC 2013


    Date: Tuesday, August 27, 2013 @ 10:52:38
  Author: iulius
Revision: 9533

ckpasswd:  use the right prototype for PAM functions

On AIX 7.1, security/pam_appl.h defines

struct pam_conv {
  int (*conv)(int, struct pam_message **,
    struct pam_response **, void *);
  void *appdata_ptr; 
};

so pam_message is not a const struct **.


Add m4/pam-const.m4 taken from rra-c-util to detect at configure
time whether pam_conv expects a const.

Added:
  trunk/m4/pam-const.m4
Modified:
  trunk/MANIFEST
  trunk/authprogs/ckpasswd.c
  trunk/configure.ac

----------------------+
 MANIFEST             |    3 ++-
 authprogs/ckpasswd.c |    8 ++++----
 configure.ac         |    8 +++++---
 m4/pam-const.m4      |   40 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 51 insertions(+), 8 deletions(-)

Modified: MANIFEST
===================================================================
--- MANIFEST	2013-08-25 13:50:55 UTC (rev 9532)
+++ MANIFEST	2013-08-27 17:52:38 UTC (rev 9533)
@@ -553,7 +553,7 @@
 lib/xwrite.c                          write that handles partial transfers
 m4                                    Autoconf support macros (Directory)
 m4/aux-libs.m4                        Autoconf macro for extra libraries
-m4/berkeleydb.m4                      Autoconf macro for Berkeley DB
+m4/berkeleydb.m4                      Autoconf macros for Berkeley DB
 m4/cc-c-o.m4                          Autoconf macro for -c -o compiler support
 m4/cc-flags.m4                        Autoconf macro for compiler flags
 m4/compress.m4                        Autoconf macro for compress detection
@@ -569,6 +569,7 @@
 m4/mmap.m4                            Autoconf macros for mmap facilities
 m4/modes.m4                           Autoconf macro for file modes
 m4/openssl.m4                         Autoconf macro for OpenSSL
+m4/pam-const.m4                       Autoconf macro for PAM using const
 m4/paths.m4                           Autoconf macro for installation paths
 m4/perl.m4                            Autoconf macro for Perl support
 m4/prog-ensure.m4                     Autoconf macro for finding programs

Modified: authprogs/ckpasswd.c
===================================================================
--- authprogs/ckpasswd.c	2013-08-25 13:50:55 UTC (rev 9532)
+++ authprogs/ckpasswd.c	2013-08-27 17:52:38 UTC (rev 9533)
@@ -55,10 +55,10 @@
 #endif
 
 #if HAVE_PAM
-# if HAVE_PAM_PAM_APPL_H
+# if HAVE_SECURITY_PAM_APPL_H
+#  include <security/pam_appl.h>
+# else
 #  include <pam/pam_appl.h>
-# else
-#  include <security/pam_appl.h>
 # endif
 #endif
 
@@ -83,7 +83,7 @@
 */
 #if HAVE_PAM
 static int
-pass_conv(int num_msg, const struct pam_message **msgm UNUSED,
+pass_conv(int num_msg, PAM_CONST struct pam_message **msgm UNUSED,
           struct pam_response **response, void *appdata_ptr)
 {
     int i;

Modified: configure.ac
===================================================================
--- configure.ac	2013-08-25 13:50:55 UTC (rev 9532)
+++ configure.ac	2013-08-27 17:52:38 UTC (rev 9533)
@@ -49,6 +49,7 @@
 m4_include([m4/mmap.m4])
 m4_include([m4/modes.m4])
 m4_include([m4/openssl.m4])
+m4_include([m4/pam-const.m4])
 m4_include([m4/paths.m4])
 m4_include([m4/perl.m4])
 m4_include([m4/prog-ensure.m4])
@@ -308,12 +309,13 @@
 dnl for use with it, so we have to check the header files first and then only
 dnl if one is found do we check for the library.
 inn_check_pam=1
-AC_CHECK_HEADERS([pam/pam_appl.h], ,
-    [AC_CHECK_HEADER([security/pam_appl.h], , [inn_check_pam=0])])
+AC_CHECK_HEADERS([security/pam_appl.h], [],
+    [AC_CHECK_HEADERS([pam/pam_appl.h], [], [inn_check_pam=0])])
 if test x"$inn_check_pam" = x1; then
     INN_SEARCH_AUX_LIBS([pam_start], [pam], [PAM_LIBS],
         [AC_DEFINE([HAVE_PAM], 1, [Define if you have PAM.])])
 fi
+INN_HEADER_PAM_CONST
 
 dnl If keyword generation support was requested, check for the appropriate
 dnl libraries.
@@ -359,7 +361,7 @@
 AC_HEADER_SYS_WAIT
 
 dnl Generic checks for header files.
-AC_CHECK_HEADERS([crypt.h inttypes.h limits.h pam/pam_appl.h stddef.h \
+AC_CHECK_HEADERS([crypt.h inttypes.h limits.h stddef.h \
                   stdint.h string.h sys/bitypes.h sys/filio.h sys/loadavg.h \
                   sys/select.h sys/time.h unistd.h])
 

Added: m4/pam-const.m4
===================================================================
--- m4/pam-const.m4	                        (rev 0)
+++ m4/pam-const.m4	2013-08-27 17:52:38 UTC (rev 9533)
@@ -0,0 +1,40 @@
+dnl Determine whether PAM uses const in prototypes.
+dnl $Id$
+dnl
+dnl Linux marks several PAM arguments const, including the argument to
+dnl pam_get_item and some arguments to conversation functions, which Solaris
+dnl doesn't.  This test tries to determine which style is in use to select
+dnl whether to declare variables const in order to avoid compiler warnings.
+dnl
+dnl Since this is just for compiler warnings, it's not horribly important if
+dnl we guess wrong.  This test is ugly, but it seems to work.
+dnl
+dnl Contributed by Markus Moeller.
+dnl
+dnl The canonical version of this file is maintained in the rra-c-util
+dnl package, available at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+dnl
+dnl Copyright 2007 Russ Allbery <rra at stanford.edu>
+dnl Copyright 2007, 2008 Markus Moeller
+dnl
+dnl This file is free software; the authors give unlimited permission to copy
+dnl and/or distribute it, with or without modifications, as long as this
+dnl notice is preserved.
+
+dnl Source used by INN_HEADER_PAM_CONST.
+AC_DEFUN([_INN_HEADER_PAM_CONST_SOURCE],
+[#ifdef HAVE_SECURITY_PAM_APPL_H
+# include <security/pam_appl.h>
+#else
+# include <pam/pam_appl.h>
+#endif
+])
+
+AC_DEFUN([INN_HEADER_PAM_CONST],
+[AC_CACHE_CHECK([whether PAM prefers const], [inn_cv_header_pam_const],
+    [AC_EGREP_CPP([const void \*\* *_?item], _INN_HEADER_PAM_CONST_SOURCE(),
+        [inn_cv_header_pam_const=yes], [inn_cv_header_pam_const=no])])
+AS_IF([test x"$inn_cv_header_pam_const" = xyes],
+    [inn_header_pam_const=const], [inn_header_pam_const=])
+AC_DEFINE_UNQUOTED([PAM_CONST], [$inn_header_pam_const],
+    [Define to const if PAM uses const in pam_get_item, empty otherwise.])])


Property changes on: trunk/m4/pam-const.m4
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision



More information about the inn-committers mailing list