Send inn-committers mailing list submissions to
        inn-committers@lists.isc.org

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.isc.org/mailman/listinfo/inn-committers
or, via email, send a message with subject or body 'help' to
        inn-committers-requ...@lists.isc.org

You can reach the person managing the list at
        inn-committers-ow...@lists.isc.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of inn-committers digest..."


Today's Topics:

   1. INN commit: trunk (4 files) (INN Commit)
   2. INN commit: trunk/lib (network.c) (INN Commit)


----------------------------------------------------------------------

Message: 1
Date: Tue, 27 Aug 2013 10:52:38 -0700 (PDT)
From: INN Commit <r...@isc.org>
To: inn-committ...@isc.org
Subject: INN commit: trunk (4 files)
Message-ID: <20130827175238.c613067...@hope.eyrie.org>

    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 <r...@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



------------------------------

Message: 2
Date: Tue, 27 Aug 2013 11:41:25 -0700 (PDT)
From: INN Commit <r...@isc.org>
To: inn-committ...@isc.org
Subject: INN commit: trunk/lib (network.c)
Message-ID: <20130827184125.89eed67...@hope.eyrie.org>

    Date: Tuesday, August 27, 2013 @ 11:41:25
  Author: iulius
Revision: 9534

add const casts

Modified:
  trunk/lib/network.c

-----------+
 network.c |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

Modified: network.c
===================================================================
--- network.c   2013-08-27 17:52:38 UTC (rev 9533)
+++ network.c   2013-08-27 18:41:25 UTC (rev 9534)
@@ -645,7 +645,7 @@
     if (addr->sa_family == AF_INET6) {
         const struct sockaddr_in6 *sin6;
 
-        sin6 = (const struct sockaddr_in6 *) (void *) addr;
+        sin6 = (const struct sockaddr_in6 *) (const void *) addr;
         if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
             struct in_addr in;
 
@@ -659,7 +659,7 @@
     if (addr->sa_family == AF_INET) {
         const struct sockaddr_in *sin;
 
-        sin = (const struct sockaddr_in *) (void *) addr;
+        sin = (const struct sockaddr_in *) (const void *) addr;
         result = inet_ntop(AF_INET, &sin->sin_addr, dst, size);
         return (result != NULL);
     } else {
@@ -677,20 +677,20 @@
 bool
 network_sockaddr_equal(const struct sockaddr *a, const struct sockaddr *b)
 {
-    const struct sockaddr_in *a4 = (const struct sockaddr_in *) (void *) a;
-    const struct sockaddr_in *b4 = (const struct sockaddr_in *) (void *) b;
+    const struct sockaddr_in *a4 = (const struct sockaddr_in *) (const void *) 
a;
+    const struct sockaddr_in *b4 = (const struct sockaddr_in *) (const void *) 
b;
 
 #ifdef HAVE_INET6
-    const struct sockaddr_in6 *a6 = (const struct sockaddr_in6 *) (void *) a;
-    const struct sockaddr_in6 *b6 = (const struct sockaddr_in6 *) (void *) b;
+    const struct sockaddr_in6 *a6 = (const struct sockaddr_in6 *) (const void 
*) a;
+    const struct sockaddr_in6 *b6 = (const struct sockaddr_in6 *) (const void 
*) b;
     const struct sockaddr *tmp;
 
     if (a->sa_family == AF_INET && b->sa_family == AF_INET6) {
         tmp = a;
         a = b;
         b = tmp;
-        a6 = (const struct sockaddr_in6 *) (void *) a;
-        b4 = (const struct sockaddr_in *) (void *) b;
+        a6 = (const struct sockaddr_in6 *) (const void *) a;
+        b4 = (const struct sockaddr_in *) (const void *) b;
     }
     if (a->sa_family == AF_INET6) {
         if (b->sa_family == AF_INET6)
@@ -726,14 +726,14 @@
     const struct sockaddr_in6 *sin6;
 
     if (sa->sa_family == AF_INET6) {
-        sin6 = (const struct sockaddr_in6 *) (void *) sa;
+        sin6 = (const struct sockaddr_in6 *) (const void *) sa;
         return htons(sin6->sin6_port);
     }
 #endif
     if (sa->sa_family != AF_INET)
         return 0;
     else {
-        sin = (const struct sockaddr_in *) (void *) sa;
+        sin = (const struct sockaddr_in *) (const void *) sa;
         return htons(sin->sin_port);
     }
 }



------------------------------

_______________________________________________
inn-committers mailing list
inn-committers@lists.isc.org
https://lists.isc.org/mailman/listinfo/inn-committers

End of inn-committers Digest, Vol 54, Issue 7
*********************************************

Reply via email to