port to new RADIUS client library
authorLuke Howard <lukeh@padl.com>
Sun, 13 Nov 2011 06:16:14 +0000 (17:16 +1100)
committerLuke Howard <lukeh@padl.com>
Mon, 14 Nov 2011 01:33:38 +0000 (12:33 +1100)
59 files changed:
.gitignore
lib/HACKING
lib/Makefile.am
lib/attr.c
lib/avp.c [new file with mode: 0644]
lib/build-aux/config.guess
lib/build-aux/config.sub
lib/build-aux/depcomp
lib/build-aux/ltmain.sh
lib/build-aux/missing
lib/conf.c
lib/configure.ac
lib/conn.c
lib/debug.c
lib/err.c
lib/event.c
lib/examples/client-blocking.c
lib/include/Makefile.am
lib/include/radsec/.gitignore [new file with mode: 0644]
lib/include/radsec/radsec-impl.h
lib/include/radsec/radsec.h
lib/include/radsec/request-impl.h
lib/include/radsec/request.h
lib/m4/libtool.m4
lib/m4/ltoptions.m4
lib/m4/ltversion.m4
lib/m4/lt~obsolete.m4
lib/packet.c
lib/peer.c
lib/radius/.gitignore [new file with mode: 0644]
lib/radius/Makefile [deleted file]
lib/radius/Makefile.am [new file with mode: 0644]
lib/radius/attrs.c
lib/radius/client.h
lib/radius/common.pl
lib/radius/convert.pl
lib/radius/crypto.c
lib/radius/custom.c
lib/radius/dict.c
lib/radius/dictionaries.c [deleted file]
lib/radius/examples/example_1.c
lib/radius/examples/example_2.c
lib/radius/examples/example_3.c
lib/radius/examples/example_4.c
lib/radius/id.c
lib/radius/packet.c
lib/radius/parse.c
lib/radius/print.c
lib/radius/radius.h [deleted file]
lib/radius/share/dictionary.ukerna [new file with mode: 0644]
lib/radius/static.c
lib/radius/valuepair.c
lib/radsec.c
lib/radsec.sym
lib/request.c
lib/tcp.c
lib/tests/test-udp.c
lib/tests/udp.c
lib/udp.c

index d06b205..8876103 100644 (file)
@@ -1,4 +1,3 @@
-.gitignore
 *.*~*
 TAGS
 lib/doc
@@ -14,5 +13,9 @@ config.status
 configure
 aclocal.m4
 *.lo
+*.la
 obs/
-
+Makefile.in
+Makefile
+stamp-h1
+libtool
index 7b1f298..1494941 100644 (file)
@@ -18,14 +18,11 @@ examples/client -r examples/client.conf blocking-tls; echo $?
   - Application runs its own event loop, using fd's for select and
     performs I/O using the libradsec send/receive calls
     (a.k.a. on-your-own mode)
-- Fully reentrant (FIXME: issues with libfreeradius-radius?)
 - User chooses allocation regime
 
 * Dependencies
 Details apply to Ubuntu 10.10.
 
-- libfreeradius-radius (2.1.9+dfsg-1ubuntu1)
-  sudo apt-get install libfreeradius-dev libfreeradius2
 - libconfuse (2.7-1)
   sudo apt-get install libconfuse-dev libconfuse0
 - libevent from source (release-2.0.10-stable)
index a26750d..3eb4a2b 100644 (file)
@@ -1,7 +1,7 @@
 AUTOMAKE_OPTIONS = foreign
 ACLOCAL_AMFLAGS = -I m4
 
-SUBDIRS = . examples include 
+SUBDIRS = radius . include examples
 
 INCLUDES = -I$(srcdir)/include
 AM_CFLAGS = -Wall -g
@@ -9,6 +9,7 @@ AM_CFLAGS = -Wall -g
 lib_LTLIBRARIES = libradsec.la
 
 libradsec_la_SOURCES = \
+       avp.c \
        compat.c \
        conf.c \
        conn.c \
@@ -35,5 +36,6 @@ libradsec_la_SOURCES += \
        rsp_tlscommon.c
 endif
 
+libradsec_la_LIBADD = radius/libradsec-radius.la
 libradsec_la_LDFLAGS = -version-info 0:0:0 -export-symbols radsec.sym
 libradsec_la_CFLAGS = $(AM_CFLAGS) -Werror # -DDEBUG -DDEBUG_LEVENT 
index 16a6d39..9b11cf6 100644 (file)
@@ -7,7 +7,7 @@
 #include <config.h>
 #endif
 
-#include <freeradius/libradius.h>
+#include <radius/client.h>
 #include <radsec/radsec.h>
 #include <radsec/radsec-impl.h>
 
diff --git a/lib/avp.c b/lib/avp.c
new file mode 100644 (file)
index 0000000..1bc1128
--- /dev/null
+++ b/lib/avp.c
@@ -0,0 +1,457 @@
+/* Copyright 2011 PADL Software Pty Ltd. All rights reserved.
+   See the file COPYING for licensing information.  */
+
+#if defined HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include <libgen.h>
+#include <assert.h>
+
+#include <radsec/radsec.h>
+#include <radius/client.h>
+
+#define RS_ERR(err) ((err) < 0 ? -err : RSE_OK)
+
+void
+rs_avp_free (rs_avp **vps)
+{
+  nr_vp_free (vps);
+}
+
+size_t
+rs_avp_length (rs_const_avp *vp)
+{
+  assert (vp != NULL);
+  return vp->length;
+}
+
+rs_attr_type_t
+rs_avp_typeof (rs_const_avp *vp)
+{
+  return vp ? vp->da->type : RS_TYPE_INVALID;
+}
+
+void
+rs_avp_attrid (rs_const_avp *vp,
+              unsigned int *attr,
+              unsigned int *vendor)
+{
+  *attr = vp->da->attr;
+  *vendor = vp->da->vendor;
+}
+
+const char *
+rs_avp_name (rs_const_avp *vp)
+{
+  return vp ? vp->da->name : NULL;
+}
+
+void
+rs_avp_append (rs_avp **head, rs_avp *tail)
+{
+  return nr_vps_append (head, tail);
+}
+
+rs_avp *
+rs_avp_find (rs_avp *vp, unsigned int attr, unsigned int vendor)
+{
+  if (vp == NULL)
+    return NULL;
+
+  return nr_vps_find (vp, attr, vendor);
+}
+
+rs_const_avp *
+rs_avp_find_const (rs_const_avp *vp,
+                   unsigned int attr, unsigned int vendor)
+{
+  if (vp == NULL)
+    return NULL;
+
+  return nr_vps_find ((rs_avp *)vp, attr, vendor);
+}
+
+rs_avp *
+rs_avp_alloc (unsigned int attr, unsigned int vendor)
+{
+  const DICT_ATTR *da;
+  VALUE_PAIR *vp;
+
+  da = nr_dict_attr_byvalue (attr, vendor);
+  if (da == NULL) {
+    vp = nr_vp_alloc_raw (attr, vendor);
+  } else {
+    vp = nr_vp_alloc (da);
+  }
+
+  if (vp == NULL)
+    return NULL;
+
+  return vp;
+}
+
+rs_avp *
+rs_avp_dup (rs_const_avp *vp)
+{
+  rs_avp *vp2;
+
+  vp2 = nr_vp_alloc (vp->da);
+  if (vp2 == NULL)
+    return NULL;
+
+  vp2->length = vp->length;
+  vp2->tag = vp->tag;
+  vp2->next = NULL;
+
+#ifdef RS_TYPE_TLV
+  if (rs_avp_is_tlv (vp)) {
+    vp2->vp_tlv = malloc (vp->length);
+    if (vp2->vp_tlv == NULL) {
+      rs_avp_free (vp2);
+      return NULL;
+    }
+    memcpy (vp2->vp_tlv, vp->vp_tlv, vp->length);
+    return vp2;
+  }
+#endif
+
+  memcpy (vp2->vp_strvalue, vp->vp_strvalue, vp->length);
+  if (rs_avp_is_string (vp))
+    vp2->vp_strvalue[vp->length] = '\0';
+
+  return vp2;
+}
+
+rs_avp *
+rs_avp_next (rs_avp *avp)
+{
+  return avp ? avp->next : NULL;
+}
+
+rs_const_avp *
+rs_avp_next_const (rs_const_avp *avp)
+{
+  return avp ? avp->next : NULL;
+}
+
+int
+rs_avp_delete (rs_avp **first,
+               unsigned int attr, unsigned int vendor)
+{
+  int found = 0;
+  rs_avp **p;
+
+  for (p = first; *p != NULL; p++) {
+    if ((*p)->da->attr == attr &&
+        (*p)->da->vendor == vendor) {
+      rs_avp *next = (*p)->next;
+
+      (*p)->next = NULL;
+      rs_avp_free (p);
+
+      *p = next;
+      found++;
+    }
+  }
+
+  return found ? RSE_OK : RSE_ATTR_UNKNOWN;
+}
+
+const char *
+rs_avp_string_value (rs_const_avp *vp)
+{
+  if (!rs_avp_is_string (vp))
+    return NULL;
+
+  return vp->vp_strvalue;
+}
+
+int
+rs_avp_string_set (rs_avp *vp, const char *str)
+{
+  int err;
+
+  if (vp == NULL)
+    return RSE_INVAL;
+  if (!rs_avp_is_string (vp))
+    return RSE_ATTR_INVALID;
+
+  err = nr_vp_set_data (vp, str, strlen (str));
+  return RS_ERR(err);
+}
+
+uint32_t
+rs_avp_integer_value (rs_const_avp *vp)
+{
+  if (!rs_avp_is_integer (vp))
+    return 0;
+  return vp->vp_integer;
+}
+
+int
+rs_avp_integer_set (rs_avp *vp, uint32_t val)
+{
+  int err;
+
+  if (vp == NULL)
+    return RSE_INVAL;
+  if (!rs_avp_is_integer (vp))
+    return RSE_ATTR_INVALID;
+
+  err = nr_vp_set_data (vp, &val, sizeof (val));
+  return RS_ERR(err);
+}
+
+uint32_t
+rs_avp_ipaddr_value (rs_const_avp *vp)
+{
+  if (!rs_avp_is_ipaddr (vp))
+    return 0;
+  return vp->vp_ipaddr;
+}
+
+int
+rs_avp_ipaddr_set (rs_avp *vp, struct in_addr in)
+{
+  int err;
+
+  if (vp == NULL)
+    return RSE_INVAL;
+  if (!rs_avp_is_ipaddr (vp))
+    return RSE_ATTR_INVALID;
+
+  err = nr_vp_set_data (vp, &in, sizeof (in));
+  return RS_ERR(err);
+}
+
+time_t
+rs_avp_date_value (rs_const_avp *vp)
+{
+  if (!rs_avp_is_date (vp))
+    return 0;
+  return vp->vp_date;
+}
+
+int
+rs_avp_date_set (rs_avp *vp, time_t date)
+{
+  uint32_t date32;
+  int err;
+
+  if (vp == NULL)
+    return RSE_INVAL;
+  if (!rs_avp_is_date (vp))
+    return RSE_ATTR_INVALID;
+  if (date > 0xFFFFFFFF)
+    return RSE_ATTR_INVALID;
+
+  date32 = (uint32_t)date;
+  err = nr_vp_set_data (vp, &date32, sizeof (date32));
+
+  return RS_ERR(err);
+}
+
+const unsigned char *
+rs_avp_octets_value_const_ptr (rs_const_avp *vp)
+{
+  return rs_avp_octets_value_ptr ((rs_avp *)vp);
+}
+
+unsigned char *
+rs_avp_octets_value_ptr (rs_avp *vp)
+{
+  if (vp == NULL)
+    return NULL;
+
+#ifdef RS_TYPE_TLV
+  if (rs_avp_is_tlv (vp))
+    return vp->vp_tlv;
+#endif
+
+  return vp->vp_octets;
+}
+
+int
+rs_avp_octets_value_byref (rs_avp *vp,
+                          unsigned char **p,
+                          size_t *len)
+{
+  if (vp == NULL)
+    return RSE_INVAL;
+
+  *len = vp->length;
+  *p = (unsigned char *)rs_avp_octets_value_ptr (vp);
+
+  return RSE_OK;
+}
+
+int
+rs_avp_octets_value (rs_const_avp *vp,
+                    unsigned char *buf,
+                    size_t *len)
+{
+  if (vp == NULL)
+    return RSE_INVAL;
+
+  if (vp->length > *len) {
+    *len = vp->length;
+    return RSE_ATTR_TOO_SMALL;
+  }
+
+  *len = vp->length;
+
+#ifdef RS_TYPE_TLV
+  if (rs_avp_is_tlv (vp))
+    memcpy (buf, vp->vp_tlv, vp->length);
+  else
+#endif
+    memcpy (buf, vp->vp_octets, vp->length);
+
+  return RSE_OK;
+}
+
+int
+rs_avp_fragmented_value (rs_const_avp *vps,
+                        unsigned char *buf,
+                        size_t *len)
+{
+  size_t total_len = 0;
+  unsigned char *p;
+  rs_const_avp *vp;
+
+  if (vps == NULL)
+    return RSE_INVAL;
+
+  if (!rs_avp_is_octets (vps) &&
+      !rs_avp_is_string (vps))
+    return RSE_ATTR_INVALID;
+
+  for (vp = vps;
+       vp != NULL;
+       vp = rs_avp_find_const (vp->next, vp->da->attr, vp->da->vendor))
+    total_len += vp->length;
+
+  if (*len < total_len) {
+    *len = total_len;
+    return RSE_ATTR_TOO_SMALL;
+  }
+
+  for (vp = vps, p = buf;
+       vp != NULL;
+       vp = rs_avp_find_const (vp->next, vp->da->attr, vp->da->vendor)) {
+    memcpy (p, vp->vp_octets, vp->length);
+    p += vp->length;
+  }
+
+  *len = total_len;
+
+  return RSE_OK;
+}
+
+int
+rs_avp_octets_set (rs_avp *vp,
+                  const unsigned char *buf,
+                  size_t len)
+{
+  int err;
+
+  if (!rs_avp_is_octets (vp))
+    return RSE_ATTR_INVALID;
+
+  err = nr_vp_set_data (vp, buf, len);
+
+  return RS_ERR(err);
+}
+
+int
+rs_avp_ifid_value (rs_const_avp *vp, uint8_t val[8])
+{
+  if (!rs_avp_is_ifid (vp))
+    return RSE_ATTR_INVALID;
+
+  memcpy (val, vp->vp_ifid, 8);
+
+  return RSE_OK;
+}
+
+int
+rs_avp_ifid_set (rs_avp *vp, const uint8_t val[8])
+{
+  int err;
+
+  if (!rs_avp_is_ifid (vp))
+    return RSE_ATTR_INVALID;
+
+  err = nr_vp_set_data (vp, val, 8);
+  return RS_ERR(err);
+}
+
+uint8_t
+rs_avp_byte_value (rs_const_avp *vp)
+{
+  if (!rs_avp_is_byte (vp))
+    return 0;
+  return vp->vp_integer;
+}
+
+int
+rs_avp_byte_set (rs_avp *vp, uint8_t val)
+{
+  int err;
+
+  if (!rs_avp_is_byte (vp))
+    return RSE_ATTR_INVALID;
+
+  err = nr_vp_set_data (vp, &val, sizeof (val));
+  return RS_ERR(err);
+}
+
+uint16_t
+rs_avp_short_value (rs_const_avp *vp)
+{
+  if (!rs_avp_is_short (vp))
+    return 0;
+  return vp->vp_integer;
+}
+
+int
+rs_avp_short_set (rs_avp *vp, uint16_t val)
+{
+  int err;
+
+  if (!rs_avp_is_short (vp))
+    return RSE_ATTR_INVALID;
+
+  err = nr_vp_set_data (vp, &val, sizeof (val));
+  return RS_ERR(err);
+}
+
+int
+rs_attr_find (const char *name,
+              unsigned int *attr,
+              unsigned int *vendor)
+{
+  const DICT_ATTR *da;
+
+  da = nr_dict_attr_byname (name);
+  if (da == NULL)
+    return RSE_ATTR_UNKNOWN;
+
+  *attr = da->attr;
+  *vendor = da->vendor;
+
+  return RSE_OK;
+}
+
+size_t
+rs_avp_display_value (rs_const_avp *vp,
+                      char *buffer,
+                      size_t buflen)
+{
+  return nr_vp_snprintf_value (buffer, buflen, vp);
+}
index c2246a4..dc84c68 100755 (executable)
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
 #   Free Software Foundation, Inc.
 
-timestamp='2009-12-30'
+timestamp='2009-11-20'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -56,9 +56,8 @@ version="\
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
-Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
index c2d1257..2a55a50 100755 (executable)
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Configuration validation subroutine script.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
 #   Free Software Foundation, Inc.
 
-timestamp='2010-01-22'
+timestamp='2009-11-20'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -75,9 +75,8 @@ Report bugs and patches to <config-patches@gnu.org>."
 version="\
 GNU config.sub ($timestamp)
 
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
-Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -381,8 +380,7 @@ case $basic_machine in
        | sparclite-* \
        | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
        | tahoe-* | thumb-* \
-       | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
-       | tile-* | tilegx-* \
+       | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
        | tron-* \
        | ubicom32-* \
        | v850-* | v850e-* | vax-* \
@@ -1087,11 +1085,6 @@ case $basic_machine in
                basic_machine=tic6x-unknown
                os=-coff
                ;;
-        # This must be matched before tile*.
-        tilegx*)
-               basic_machine=tilegx-unknown
-               os=-linux-gnu
-               ;;
        tile*)
                basic_machine=tile-unknown
                os=-linux-gnu
@@ -1442,8 +1435,6 @@ case $os in
        -dicos*)
                os=-dicos
                ;;
-        -nacl*)
-               ;;
        -none)
                ;;
        *)
index df8eea7..aeba4e8 100755 (executable)
@@ -17,7 +17,9 @@ scriptversion=2009-04-28.21; # UTC
 # GNU General Public License for more details.
 
 # You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
 
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
index 7ed280b..04eaea4 100755 (executable)
@@ -1,9 +1,10 @@
 # Generated from ltmain.m4sh.
 
-# ltmain.sh (GNU libtool) 2.2.6b
+# libtool (GNU libtool) 2.2.10
 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
 
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
+# 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 # This is free software; see the source for copying conditions.  There is NO
 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 #
 # Provide generalized library-building support services.
 #
-#     --config             show all configuration variables
-#     --debug              enable verbose shell tracing
-# -n, --dry-run            display commands without modifying any files
-#     --features           display basic configuration information and exit
-#     --mode=MODE          use operation mode MODE
-#     --preserve-dup-deps  don't remove duplicate dependency libraries
-#     --quiet, --silent    don't print informational messages
-#     --tag=TAG            use configuration variables from tag TAG
-# -v, --verbose            print informational messages (default)
-#     --version            print version information
-# -h, --help               print short or long help message
+#       --config             show all configuration variables
+#       --debug              enable verbose shell tracing
+#   -n, --dry-run            display commands without modifying any files
+#       --features           display basic configuration information and exit
+#       --mode=MODE          use operation mode MODE
+#       --preserve-dup-deps  don't remove duplicate dependency libraries
+#       --quiet, --silent    don't print informational messages
+#       --no-quiet, --no-silent
+#                            print informational messages (default)
+#       --tag=TAG            use configuration variables from tag TAG
+#   -v, --verbose            print more informational messages than default
+#       --no-verbose         don't print the extra informational messages
+#       --version            print version information
+#   -h, --help, --help-all   print short, long, or detailed help message
 #
 # MODE must be one of the following:
 #
-#       clean              remove files from the build directory
-#       compile            compile a source file into a libtool object
-#       execute            automatically set library path, then run a program
-#       finish             complete the installation of libtool libraries
-#       install            install libraries or executables
-#       link               create a library or an executable
-#       uninstall          remove libraries from an installed directory
+#         clean              remove files from the build directory
+#         compile            compile a source file into a libtool object
+#         execute            automatically set library path, then run a program
+#         finish             complete the installation of libtool libraries
+#         install            install libraries or executables
+#         link               create a library or an executable
+#         uninstall          remove libraries from an installed directory
 #
-# MODE-ARGS vary depending on the MODE.
+# MODE-ARGS vary depending on the MODE.  When passed as first option,
+# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
 #
 # When reporting a bug, please describe a test case to reproduce it and
 # include the following information:
 #
-#       host-triplet:  $host
-#       shell:         $SHELL
-#       compiler:              $LTCC
-#       compiler flags:                $LTCFLAGS
-#       linker:                $LD (gnu? $with_gnu_ld)
-#       $progname:             (GNU libtool) 2.2.6b Debian-2.2.6b-2ubuntu1
-#       automake:              $automake_version
-#       autoconf:              $autoconf_version
+#         host-triplet:        $host
+#         shell:               $SHELL
+#         compiler:            $LTCC
+#         compiler flags:              $LTCFLAGS
+#         linker:              $LD (gnu? $with_gnu_ld)
+#         $progname:   (GNU libtool) 2.2.10
+#         automake:    $automake_version
+#         autoconf:    $autoconf_version
 #
 # Report bugs to <bug-libtool@gnu.org>.
 
-PROGRAM=ltmain.sh
+PROGRAM=libtool
 PACKAGE=libtool
-VERSION="2.2.6b Debian-2.2.6b-2ubuntu1"
+VERSION=2.2.10
 TIMESTAMP=""
-package_revision=1.3017
+package_revision=1.3175
 
 # Be Bourne compatible
 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
@@ -91,10 +96,15 @@ fi
 BIN_SH=xpg4; export BIN_SH # for Tru64
 DUALCASE=1; export DUALCASE # for MKS sh
 
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+}
+
 # NLS nuisances: We save the old values to restore during execute mode.
-# Only set LANG and LC_ALL to C if already set.
-# These must not be set unconditionally because not all systems understand
-# e.g. LANG=C (notably SCO).
 lt_user_locale=
 lt_safe_locale=
 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
@@ -107,24 +117,33 @@ do
          lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
        fi"
 done
+LC_ALL=C
+LANGUAGE=C
+export LANGUAGE LC_ALL
 
 $lt_unset CDPATH
 
 
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath="$0"
 
 
 
 : ${CP="cp -f"}
-: ${ECHO="echo"}
-: ${EGREP="/bin/grep -E"}
-: ${FGREP="/bin/grep -F"}
-: ${GREP="/bin/grep"}
+test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
+: ${EGREP="grep -E"}
+: ${FGREP="grep -F"}
+: ${GREP="grep"}
 : ${LN_S="ln -s"}
 : ${MAKE="make"}
 : ${MKDIR="mkdir"}
 : ${MV="mv -f"}
 : ${RM="rm -f"}
-: ${SED="/bin/sed"}
+: ${SED="sed"}
 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
 : ${Xsed="$SED -e 1s/^X//"}
 
@@ -159,32 +178,168 @@ basename="s,^.*/,,"
 func_dirname_and_basename ()
 {
   # Extract subdirectory from the argument.
-  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
+  func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
   if test "X$func_dirname_result" = "X${1}"; then
     func_dirname_result="${3}"
   else
     func_dirname_result="$func_dirname_result${2}"
   fi
-  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
+  func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
 }
 
 # Generated shell functions inserted here.
 
-# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
-# is ksh but when the shell is invoked as "sh" and the current value of
-# the _XPG environment variable is not equal to 1 (one), the special
-# positional parameter $0, within a function call, is the name of the
-# function.
-progpath="$0"
+# These SED scripts presuppose an absolute path with a trailing slash.
+pathcar='s,^/\([^/]*\).*$,\1,'
+pathcdr='s,^/[^/]*,,'
+removedotparts=':dotsl
+               s@/\./@/@g
+               t dotsl
+               s,/\.$,/,'
+collapseslashes='s@/\{1,\}@/@g'
+finalslash='s,/*$,/,'
+
+# func_normal_abspath PATH
+# Remove doubled-up and trailing slashes, "." path components,
+# and cancel out any ".." path components in PATH after making
+# it an absolute path.
+#             value returned in "$func_normal_abspath_result"
+func_normal_abspath ()
+{
+  # Start from root dir and reassemble the path.
+  func_normal_abspath_result=
+  func_normal_abspath_tpath=$1
+  func_normal_abspath_altnamespace=
+  case $func_normal_abspath_tpath in
+    "")
+      # Empty path, that just means $cwd.
+      func_stripname '' '/' "`pwd`"
+      func_normal_abspath_result=$func_stripname_result
+      return
+    ;;
+    # The next three entries are used to spot a run of precisely
+    # two leading slashes without using negated character classes;
+    # we take advantage of case's first-match behaviour.
+    ///*)
+      # Unusual form of absolute path, do nothing.
+    ;;
+    //*)
+      # Not necessarily an ordinary path; POSIX reserves leading '//'
+      # and for example Cygwin uses it to access remote file shares
+      # over CIFS/SMB, so we conserve a leading double slash if found.
+      func_normal_abspath_altnamespace=/
+    ;;
+    /*)
+      # Absolute path, do nothing.
+    ;;
+    *)
+      # Relative path, prepend $cwd.
+      func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
+    ;;
+  esac
+  # Cancel out all the simple stuff to save iterations.  We also want
+  # the path to end with a slash for ease of parsing, so make sure
+  # there is one (and only one) here.
+  func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
+        -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
+  while :; do
+    # Processed it all yet?
+    if test "$func_normal_abspath_tpath" = / ; then
+      # If we ascended to the root using ".." the result may be empty now.
+      if test -z "$func_normal_abspath_result" ; then
+        func_normal_abspath_result=/
+      fi
+      break
+    fi
+    func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
+        -e "$pathcar"`
+    func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
+        -e "$pathcdr"`
+    # Figure out what to do with it
+    case $func_normal_abspath_tcomponent in
+      "")
+        # Trailing empty path component, ignore it.
+      ;;
+      ..)
+        # Parent dir; strip last assembled component from result.
+        func_dirname "$func_normal_abspath_result"
+        func_normal_abspath_result=$func_dirname_result
+      ;;
+      *)
+        # Actual path component, append it.
+        func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
+      ;;
+    esac
+  done
+  # Restore leading double-slash if one was found on entry.
+  func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
+}
+
+# func_relative_path SRCDIR DSTDIR
+# generates a relative path from SRCDIR to DSTDIR, with a trailing
+# slash if non-empty, suitable for immediately appending a filename
+# without needing to append a separator.
+#             value returned in "$func_relative_path_result"
+func_relative_path ()
+{
+  func_relative_path_result=
+  func_normal_abspath "$1"
+  func_relative_path_tlibdir=$func_normal_abspath_result
+  func_normal_abspath "$2"
+  func_relative_path_tbindir=$func_normal_abspath_result
+
+  # Ascend the tree starting from libdir
+  while :; do
+    # check if we have found a prefix of bindir
+    case $func_relative_path_tbindir in
+      $func_relative_path_tlibdir)
+        # found an exact match
+        func_relative_path_tcancelled=
+        break
+        ;;
+      $func_relative_path_tlibdir*)
+        # found a matching prefix
+        func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
+        func_relative_path_tcancelled=$func_stripname_result
+        if test -z "$func_relative_path_result"; then
+          func_relative_path_result=.
+        fi
+        break
+        ;;
+      *)
+        func_dirname $func_relative_path_tlibdir
+        func_relative_path_tlibdir=${func_dirname_result}
+        if test "x$func_relative_path_tlibdir" = x ; then
+          # Have to descend all the way to the root!
+          func_relative_path_result=../$func_relative_path_result
+          func_relative_path_tcancelled=$func_relative_path_tbindir
+          break
+        fi
+        func_relative_path_result=../$func_relative_path_result
+        ;;
+    esac
+  done
+
+  # Now calculate path; take care to avoid doubling-up slashes.
+  func_stripname '' '/' "$func_relative_path_result"
+  func_relative_path_result=$func_stripname_result
+  func_stripname '/' '/' "$func_relative_path_tcancelled"
+  if test "x$func_stripname_result" != x ; then
+    func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
+  fi
+
+  # Normalisation. If bindir is libdir, return empty string,
+  # else relative path ending with a slash; either way, target
+  # file name can be directly appended.
+  if test ! -z "$func_relative_path_result"; then
+    func_stripname './' '' "$func_relative_path_result/"
+    func_relative_path_result=$func_stripname_result
+  fi
+}
 
 # The name of this program:
-# In the unlikely event $progname began with a '-', it would play havoc with
-# func_echo (imagine progname=-n), so we prepend ./ in that case:
 func_dirname_and_basename "$progpath"
 progname=$func_basename_result
-case $progname in
-  -*) progname=./$progname ;;
-esac
 
 # Make sure we have an absolute path for reexecution:
 case $progpath in
@@ -258,6 +413,13 @@ func_verbose ()
     :
 }
 
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO "$*"
+}
+
 # func_error arg...
 # Echo program name prefixed message to standard error.
 func_error ()
@@ -326,9 +488,9 @@ func_mkdir_p ()
         case $my_directory_path in */*) ;; *) break ;; esac
 
         # ...otherwise throw away the child directory and loop
-        my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
+        my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
       done
-      my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
+      my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
 
       save_mkdir_p_IFS="$IFS"; IFS=':'
       for my_dir in $my_dir_list; do
@@ -378,7 +540,7 @@ func_mktempdir ()
         func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
     fi
 
-    $ECHO "X$my_tmpdir" | $Xsed
+    $ECHO "$my_tmpdir"
 }
 
 
@@ -392,7 +554,7 @@ func_quote_for_eval ()
 {
     case $1 in
       *[\\\`\"\$]*)
-       func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
+       func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
       *)
         func_quote_for_eval_unquoted_result="$1" ;;
     esac
@@ -419,7 +581,7 @@ func_quote_for_expand ()
 {
     case $1 in
       *[\\\`\"]*)
-       my_arg=`$ECHO "X$1" | $Xsed \
+       my_arg=`$ECHO "$1" | $SED \
            -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
       *)
         my_arg="$1" ;;
@@ -489,14 +651,19 @@ func_show_eval_locale ()
 }
 
 
-
-
-
 # func_version
 # Echo version message to standard output and exit.
 func_version ()
 {
-    $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
+    $SED -n '/(C)/!b go
+       :more
+       /\./!{
+         N
+         s/\n# / /
+         b more
+       }
+       :go
+       /^# '$PROGRAM' (GNU /,/# warranty; / {
         s/^# //
        s/^# *$//
         s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
@@ -509,19 +676,20 @@ func_version ()
 # Echo short help message to standard output and exit.
 func_usage ()
 {
-    $SED -n '/^# Usage:/,/# -h/ {
+    $SED -n '/^# Usage:/,/^#  *.*--help/ {
         s/^# //
        s/^# *$//
        s/\$progname/'$progname'/
        p
     }' < "$progpath"
-    $ECHO
+    echo
     $ECHO "run \`$progname --help | more' for full usage"
     exit $?
 }
 
-# func_help
-# Echo long help message to standard output and exit.
+# func_help [NOEXIT]
+# Echo long help message to standard output and exit,
+# unless 'noexit' is passed as argument.
 func_help ()
 {
     $SED -n '/^# Usage:/,/# Report bugs to/ {
@@ -538,7 +706,10 @@ func_help ()
        s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
        p
      }' < "$progpath"
-    exit $?
+    ret=$?
+    if test -z "$1"; then
+      exit $ret
+    fi
 }
 
 # func_missing_arg argname
@@ -546,7 +717,7 @@ func_help ()
 # exit_cmd.
 func_missing_arg ()
 {
-    func_error "missing argument for $1"
+    func_error "missing argument for $1."
     exit_cmd=exit
 }
 
@@ -556,29 +727,6 @@ exit_cmd=:
 
 
 
-# Check that we have a working $ECHO.
-if test "X$1" = X--no-reexec; then
-  # Discard the --no-reexec flag, and continue.
-  shift
-elif test "X$1" = X--fallback-echo; then
-  # Avoid inline document here, it may be left over
-  :
-elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
-  # Yippee, $ECHO works!
-  :
-else
-  # Restart under the correct shell, and then maybe $ECHO will work.
-  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
-fi
-
-if test "X$1" = X--fallback-echo; then
-  # used as fallback echo
-  shift
-  cat <<EOF
-$*
-EOF
-  exit $EXIT_SUCCESS
-fi
 
 magic="%%%MAGIC variable%%%"
 magic_exe="%%%MAGIC EXE variable%%%"
@@ -636,16 +784,16 @@ func_config ()
 # Display the features supported by this script.
 func_features ()
 {
-    $ECHO "host: $host"
+    echo "host: $host"
     if test "$build_libtool_libs" = yes; then
-      $ECHO "enable shared libraries"
+      echo "enable shared libraries"
     else
-      $ECHO "disable shared libraries"
+      echo "disable shared libraries"
     fi
     if test "$build_old_libs" = yes; then
-      $ECHO "enable static libraries"
+      echo "enable static libraries"
     else
-      $ECHO "disable static libraries"
+      echo "disable static libraries"
     fi
 
     exit $?
@@ -772,10 +920,21 @@ func_enable_tag ()
 
       --quiet|--silent)        preserve_args="$preserve_args $opt"
                        opt_silent=:
+                       opt_verbose=false
+                       ;;
+
+      --no-quiet|--no-silent)
+                       preserve_args="$preserve_args $opt"
+                       opt_silent=false
                        ;;
 
       --verbose| -v)   preserve_args="$preserve_args $opt"
                        opt_silent=false
+                       opt_verbose=:
+                       ;;
+
+      --no-verbose)    preserve_args="$preserve_args $opt"
+                       opt_verbose=false
                        ;;
 
       --tag)           test "$#" -eq 0 && func_missing_arg "$opt" && break
@@ -793,6 +952,7 @@ func_enable_tag ()
 
       -\?|-h)          func_usage                                      ;;
       --help)          opt_help=:                                      ;;
+      --help-all)      opt_help=': help-all'                           ;;
       --version)       func_version                                    ;;
 
       -*)              func_fatal_help "unrecognized option \`$opt'"   ;;
@@ -1016,10 +1176,13 @@ func_infer_tag ()
         func_quote_for_eval "$arg"
        CC_quoted="$CC_quoted $func_quote_for_eval_result"
       done
+      CC_expanded=`func_echo_all $CC`
+      CC_quoted_expanded=`func_echo_all $CC_quoted`
       case $@ in
       # Blanks in the command may have been stripped by the calling shell,
       # but not from the CC environment variable when configure was run.
-      " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
+      " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
+      " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
       # Blanks at the start of $base_compile will cause this to fail
       # if we don't check for them as well.
       *)
@@ -1033,8 +1196,11 @@ func_infer_tag ()
              func_quote_for_eval "$arg"
              CC_quoted="$CC_quoted $func_quote_for_eval_result"
            done
+           CC_expanded=`func_echo_all $CC`
+           CC_quoted_expanded=`func_echo_all $CC_quoted`
            case "$@ " in
-             " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
+           " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
+           " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
              # The compiler in the base compile command matches
              # the one in the tagged configuration.
              # Assume this is the tagged configuration we want.
@@ -1213,7 +1379,7 @@ func_mode_compile ()
     *.[cCFSifmso] | \
     *.ada | *.adb | *.ads | *.asm | \
     *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
-    *.[fF][09]? | *.for | *.java | *.obj | *.sx)
+    *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup)
       func_xform "$libobj"
       libobj=$func_xform_result
       ;;
@@ -1288,7 +1454,7 @@ func_mode_compile ()
     # Calculate the filename of the output object if compiler does
     # not support -o with -c
     if test "$compiler_c_o" = no; then
-      output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
+      output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
       lockfile="$output_obj.lock"
     else
       output_obj=
@@ -1445,7 +1611,7 @@ compiler."
 }
 
 $opt_help || {
-test "$mode" = compile && func_mode_compile ${1+"$@"}
+  test "$mode" = compile && func_mode_compile ${1+"$@"}
 }
 
 func_mode_help ()
@@ -1482,10 +1648,11 @@ This mode accepts the following additional options:
 
   -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
   -no-suppress      do not suppress compiler output for multiple passes
-  -prefer-pic       try to building PIC objects only
-  -prefer-non-pic   try to building non-PIC objects only
+  -prefer-pic       try to build PIC objects only
+  -prefer-non-pic   try to build non-PIC objects only
   -shared           do not build a \`.o' file suitable for static linking
   -static           only build a \`.o' file suitable for static linking
+  -Wc,FLAG          pass FLAG directly to the compiler
 
 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
 from the given SOURCEFILE.
@@ -1538,7 +1705,7 @@ either the \`install' or \`cp' program.
 
 The following components of INSTALL-COMMAND are treated specially:
 
-  -inst-prefix PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
+  -inst-prefix-dir PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
 
 The rest of the components are interpreted as arguments to that command (only
 BSD-compatible install options are recognized)."
@@ -1558,6 +1725,8 @@ The following components of LINK-COMMAND are treated specially:
 
   -all-static       do not do any dynamic linking at all
   -avoid-version    do not add a version suffix if possible
+  -bindir BINDIR    specify path to binaries directory (for systems where
+                    libraries must be found in the PATH setting at runtime)
   -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
   -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
   -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
@@ -1586,6 +1755,11 @@ The following components of LINK-COMMAND are treated specially:
   -version-info CURRENT[:REVISION[:AGE]]
                     specify library version info [each variable defaults to 0]
   -weak LIBNAME     declare that the target provides the LIBNAME interface
+  -Wc,FLAG
+  -Xcompiler FLAG   pass linker-specific FLAG directly to the compiler
+  -Wl,FLAG
+  -Xlinker FLAG     pass linker-specific FLAG directly to the linker
+  -XCClinker FLAG   pass link-specific FLAG to the compiler driver (CC)
 
 All other options (arguments beginning with \`-') are ignored.
 
@@ -1623,14 +1797,40 @@ Otherwise, only FILE itself is deleted using RM."
         ;;
     esac
 
-    $ECHO
+    echo
     $ECHO "Try \`$progname --help' for more information about other modes."
-
-    exit $?
 }
 
-  # Now that we've collected a possible --mode arg, show help if necessary
-  $opt_help && func_mode_help
+# Now that we've collected a possible --mode arg, show help if necessary
+if $opt_help; then
+  if test "$opt_help" = :; then
+    func_mode_help
+  else
+    {
+      func_help noexit
+      for mode in compile link execute install finish uninstall clean; do
+       func_mode_help
+      done
+    } | sed -n '1p; 2,$s/^Usage:/  or: /p'
+    {
+      func_help noexit
+      for mode in compile link execute install finish uninstall clean; do
+       echo
+       func_mode_help
+      done
+    } |
+    sed '1d
+      /^When reporting/,/^Report/{
+       H
+       d
+      }
+      $x
+      /information about other modes/d
+      /more detailed .*MODE/d
+      s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
+  fi
+  exit $?
+fi
 
 
 # func_mode_execute arg...
@@ -1712,7 +1912,7 @@ func_mode_execute ()
     for file
     do
       case $file in
-      -*) ;;
+      -* | *.la | *.lo ) ;;
       *)
        # Do a test to see if this is really a libtool program.
        if func_ltwrapper_script_p "$file"; then
@@ -1754,7 +1954,7 @@ func_mode_execute ()
       # Display what would be done.
       if test -n "$shlibpath_var"; then
        eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
-       $ECHO "export $shlibpath_var"
+       echo "export $shlibpath_var"
       fi
       $ECHO "$cmd$args"
       exit $EXIT_SUCCESS
@@ -1795,23 +1995,23 @@ func_mode_finish ()
     # Exit here if they wanted silent mode.
     $opt_silent && exit $EXIT_SUCCESS
 
-    $ECHO "X----------------------------------------------------------------------" | $Xsed
-    $ECHO "Libraries have been installed in:"
+    echo "----------------------------------------------------------------------"
+    echo "Libraries have been installed in:"
     for libdir in $libdirs; do
       $ECHO "   $libdir"
     done
-    $ECHO
-    $ECHO "If you ever happen to want to link against installed libraries"
-    $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
-    $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
-    $ECHO "flag during linking and do at least one of the following:"
+    echo
+    echo "If you ever happen to want to link against installed libraries"
+    echo "in a given directory, LIBDIR, you must either use libtool, and"
+    echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
+    echo "flag during linking and do at least one of the following:"
     if test -n "$shlibpath_var"; then
-      $ECHO "   - add LIBDIR to the \`$shlibpath_var' environment variable"
-      $ECHO "     during execution"
+      echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
+      echo "     during execution"
     fi
     if test -n "$runpath_var"; then
-      $ECHO "   - add LIBDIR to the \`$runpath_var' environment variable"
-      $ECHO "     during linking"
+      echo "   - add LIBDIR to the \`$runpath_var' environment variable"
+      echo "     during linking"
     fi
     if test -n "$hardcode_libdir_flag_spec"; then
       libdir=LIBDIR
@@ -1823,21 +2023,21 @@ func_mode_finish ()
       $ECHO "   - have your system administrator run these commands:$admincmds"
     fi
     if test -f /etc/ld.so.conf; then
-      $ECHO "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+      echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
     fi
-    $ECHO
+    echo
 
-    $ECHO "See any operating system documentation about shared libraries for"
+    echo "See any operating system documentation about shared libraries for"
     case $host in
       solaris2.[6789]|solaris2.1[0-9])
-        $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
-       $ECHO "pages."
+        echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
+       echo "pages."
        ;;
       *)
-        $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
+        echo "more information, such as the ld(1) and ld.so(8) manual pages."
         ;;
     esac
-    $ECHO "X----------------------------------------------------------------------" | $Xsed
+    echo "----------------------------------------------------------------------"
     exit $EXIT_SUCCESS
 }
 
@@ -1852,7 +2052,7 @@ func_mode_install ()
     # install_prog (especially on Windows NT).
     if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
        # Allow the use of GNU shtool's install command.
-       $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
+       case $nonopt in *shtool*) :;; *) false;; esac; then
       # Aesthetically quote it.
       func_quote_for_eval "$nonopt"
       install_prog="$func_quote_for_eval_result "
@@ -1867,6 +2067,11 @@ func_mode_install ()
     # Aesthetically quote it.
     func_quote_for_eval "$arg"
     install_prog="$install_prog$func_quote_for_eval_result"
+    install_shared_prog=$install_prog
+    case " $install_prog " in
+      *[\\\ /]cp\ *) install_cp=: ;;
+      *) install_cp=false ;;
+    esac
 
     # We need to accept at least all the BSD install flags.
     dest=
@@ -1876,8 +2081,10 @@ func_mode_install ()
     install_type=
     isdir=no
     stripme=
+    no_mode=:
     for arg
     do
+      arg2=
       if test -n "$dest"; then
        files="$files $dest"
        dest=$arg
@@ -1887,10 +2094,9 @@ func_mode_install ()
       case $arg in
       -d) isdir=yes ;;
       -f)
-       case " $install_prog " in
-       *[\\\ /]cp\ *) ;;
-       *) prev=$arg ;;
-       esac
+       if $install_cp; then :; else
+         prev=$arg
+       fi
        ;;
       -g | -m | -o)
        prev=$arg
@@ -1904,6 +2110,10 @@ func_mode_install ()
       *)
        # If the previous option needed an argument, then skip it.
        if test -n "$prev"; then
+         if test "x$prev" = x-m && test -n "$install_override_mode"; then
+           arg2=$install_override_mode
+           no_mode=false
+         fi
          prev=
        else
          dest=$arg
@@ -1915,6 +2125,10 @@ func_mode_install ()
       # Aesthetically quote the argument.
       func_quote_for_eval "$arg"
       install_prog="$install_prog $func_quote_for_eval_result"
+      if test -n "$arg2"; then
+       func_quote_for_eval "$arg2"
+      fi
+      install_shared_prog="$install_shared_prog $func_quote_for_eval_result"
     done
 
     test -z "$install_prog" && \
@@ -1923,6 +2137,13 @@ func_mode_install ()
     test -n "$prev" && \
       func_fatal_help "the \`$prev' option requires an argument"
 
+    if test -n "$install_override_mode" && $no_mode; then
+      if $install_cp; then :; else
+       func_quote_for_eval "$install_override_mode"
+       install_shared_prog="$install_shared_prog -m $func_quote_for_eval_result"
+      fi
+    fi
+
     if test -z "$files"; then
       if test -z "$dest"; then
        func_fatal_help "no file or destination specified"
@@ -2010,7 +2231,7 @@ func_mode_install ()
 
        if test -n "$relink_command"; then
          # Determine the prefix the user has applied to our future dir.
-         inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
+         inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
 
          # Don't allow the user to place us outside of our expected
          # location b/c this prevents finding dependent libraries that
@@ -2023,9 +2244,9 @@ func_mode_install ()
 
          if test -n "$inst_prefix_dir"; then
            # Stick the inst_prefix_dir data into the link command.
-           relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+           relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
          else
-           relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
+           relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
          fi
 
          func_warning "relinking \`$file'"
@@ -2043,7 +2264,7 @@ func_mode_install ()
          test -n "$relink_command" && srcname="$realname"T
 
          # Install the shared library and build the symlinks.
-         func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
+         func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
              'exit $?'
          tstripme="$stripme"
          case $host_os in
@@ -2183,7 +2404,7 @@ func_mode_install ()
            if test -f "$lib"; then
              func_source "$lib"
            fi
-           libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
+           libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
            if test -n "$libdir" && test ! -f "$libfile"; then
              func_warning "\`$lib' has not been installed in \`$libdir'"
              finalize=no
@@ -2202,7 +2423,7 @@ func_mode_install ()
                file="$func_basename_result"
                outputname="$tmpdir/$file"
                # Replace the output file specification.
-               relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
+               relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
 
                $opt_silent || {
                  func_quote_for_expand "$relink_command"
@@ -2221,7 +2442,7 @@ func_mode_install ()
            }
          else
            # Install the binary that we compiled earlier.
-           file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
+           file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
          fi
        fi
 
@@ -2323,6 +2544,10 @@ func_generate_dlsyms ()
 extern \"C\" {
 #endif
 
+#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
+#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
+#endif
+
 /* External symbol declarations for the compiler. */\
 "
 
@@ -2332,7 +2557,7 @@ extern \"C\" {
          $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
 
          # Add our own program objects to the symbol list.
-         progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+         progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
          for progfile in $progfiles; do
            func_verbose "extracting global C symbols from \`$progfile'"
            $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
@@ -2371,7 +2596,7 @@ extern \"C\" {
              eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
              eval '$MV "$nlist"T "$nlist"'
              case $host in
-               *cygwin | *mingw* | *cegcc* )
+               *cygwin* | *mingw* | *cegcc* )
                  eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
                  eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
                  ;;
@@ -2415,10 +2640,10 @@ extern \"C\" {
          if test -f "$nlist"S; then
            eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
          else
-           $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
+           echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
          fi
 
-         $ECHO >> "$output_objdir/$my_dlsyms" "\
+         echo >> "$output_objdir/$my_dlsyms" "\
 
 /* The mapping between symbol names and symbols.  */
 typedef struct {
@@ -2428,7 +2653,7 @@ typedef struct {
 "
          case $host in
          *cygwin* | *mingw* | *cegcc* )
-           $ECHO >> "$output_objdir/$my_dlsyms" "\
+           echo >> "$output_objdir/$my_dlsyms" "\
 /* DATA imports from DLLs on WIN32 con't be const, because
    runtime relocations are performed -- see ld's documentation
    on pseudo-relocs.  */"
@@ -2441,7 +2666,7 @@ typedef struct {
            lt_dlsym_const=const ;;
          esac
 
-         $ECHO >> "$output_objdir/$my_dlsyms" "\
+         echo >> "$output_objdir/$my_dlsyms" "\
 extern $lt_dlsym_const lt_dlsymlist
 lt_${my_prefix}_LTX_preloaded_symbols[];
 $lt_dlsym_const lt_dlsymlist
@@ -2457,7 +2682,7 @@ lt_${my_prefix}_LTX_preloaded_symbols[] =
            eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
            ;;
          esac
-         $ECHO >> "$output_objdir/$my_dlsyms" "\
+         echo >> "$output_objdir/$my_dlsyms" "\
   {0, (void *) 0}
 };
 
@@ -2515,16 +2740,16 @@ static const void *lt_preloaded_setup() {
        case $host in
        *cygwin* | *mingw* | *cegcc* )
          if test -f "$output_objdir/$my_outputname.def"; then
-           compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
-           finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+           compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+           finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
          else
-           compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
-           finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+           compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+           finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
          fi
          ;;
        *)
-         compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
-         finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+         compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+         finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
          ;;
        esac
        ;;
@@ -2538,8 +2763,8 @@ static const void *lt_preloaded_setup() {
       # really was required.
 
       # Nullify the symbol file.
-      compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
-      finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
+      compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
+      finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
     fi
 }
 
@@ -2549,6 +2774,7 @@ static const void *lt_preloaded_setup() {
 # Need a lot of goo to handle *both* DLLs and import libs
 # Has to be a shell function in order to 'eat' the argument
 # that is supplied when $file_magic_command is called.
+# Despite the name, also deal with 64 bit binaries.
 func_win32_libid ()
 {
   $opt_debug
@@ -2559,8 +2785,9 @@ func_win32_libid ()
     win32_libid_type="x86 archive import"
     ;;
   *ar\ archive*) # could be an import, or static
+    # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
     if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
-       $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
+       $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
       win32_nmres=`eval $NM -f posix -A $1 |
        $SED -n -e '
            1,100{
@@ -2598,7 +2825,18 @@ func_extract_an_archive ()
     $opt_debug
     f_ex_an_ar_dir="$1"; shift
     f_ex_an_ar_oldlib="$1"
-    func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
+    if test "$lock_old_archive_extraction" = yes; then
+      lockfile=$f_ex_an_ar_oldlib.lock
+      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
+       func_echo "Waiting for $lockfile to be removed"
+       sleep 2
+      done
+    fi
+    func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
+                  'stat=$?; rm -f "$lockfile"; exit $stat'
+    if test "$lock_old_archive_extraction" = yes; then
+      $opt_dry_run || rm -f "$lockfile"
+    fi
     if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
      :
     else
@@ -2669,7 +2907,7 @@ func_extract_archives ()
            darwin_file=
            darwin_files=
            for darwin_file in $darwin_filelist; do
-             darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
+             darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
              $LIPO -create -output "$darwin_file" $darwin_files
            done # $darwin_filelist
            $RM -rf unfat-$$
@@ -2684,25 +2922,30 @@ func_extract_archives ()
         func_extract_an_archive "$my_xdir" "$my_xabs"
        ;;
       esac
-      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
+      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
     done
 
     func_extract_archives_result="$my_oldobjs"
 }
 
 
-
-# func_emit_wrapper_part1 [arg=no]
+# func_emit_wrapper [arg=no]
 #
-# Emit the first part of a libtool wrapper script on stdout.
-# For more information, see the description associated with
-# func_emit_wrapper(), below.
-func_emit_wrapper_part1 ()
+# Emit a libtool wrapper script on stdout.
+# Don't directly open a file because we may want to
+# incorporate the script contents within a cygwin/mingw
+# wrapper executable.  Must ONLY be called from within
+# func_mode_link because it depends on a number of variables
+# set therein.
+#
+# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
+# variable will take.  If 'yes', then the emitted script
+# will assume that the directory in which it is stored is
+# the $objdir directory.  This is a cygwin/mingw-specific
+# behavior.
+func_emit_wrapper ()
 {
-       func_emit_wrapper_part1_arg1=no
-       if test -n "$1" ; then
-         func_emit_wrapper_part1_arg1=$1
-       fi
+       func_emit_wrapper_arg1=${1-no}
 
        $ECHO "\
 #! $SHELL
@@ -2718,7 +2961,6 @@ func_emit_wrapper_part1 ()
 
 # Sed substitution that helps us do robust quoting.  It backslashifies
 # metacharacters that are still active within double-quoted strings.
-Xsed='${SED} -e 1s/^X//'
 sed_quote_subst='$sed_quote_subst'
 
 # Be Bourne compatible
@@ -2749,31 +2991,132 @@ if test \"\$libtool_install_magic\" = \"$magic\"; then
 else
   # When we are sourced in execute mode, \$file and \$ECHO are already set.
   if test \"\$libtool_execute_magic\" != \"$magic\"; then
-    ECHO=\"$qecho\"
-    file=\"\$0\"
-    # Make sure echo works.
-    if test \"X\$1\" = X--no-reexec; then
-      # Discard the --no-reexec flag, and continue.
-      shift
-    elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
-      # Yippee, \$ECHO works!
-      :
-    else
-      # Restart under the correct shell, and then maybe \$ECHO will work.
-      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
-    fi
-  fi\
+    file=\"\$0\""
+
+    qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
+    $ECHO "\
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
+}
+    ECHO=\"$qECHO\"
+  fi
+
+# Very basic option parsing. These options are (a) specific to
+# the libtool wrapper, (b) are identical between the wrapper
+# /script/ and the wrapper /executable/ which is used only on
+# windows platforms, and (c) all begin with the string "--lt-"
+# (application programs are unlikely to have options which match
+# this pattern).
+#
+# There are only two supported options: --lt-debug and
+# --lt-dump-script. There is, deliberately, no --lt-help.
+#
+# The first argument to this parsing function should be the
+# script's $0 value, followed by "$@".
+lt_option_debug=
+func_parse_lt_options ()
+{
+  lt_script_arg0=\$0
+  shift
+  for lt_opt
+  do
+    case \"\$lt_opt\" in
+    --lt-debug) lt_option_debug=1 ;;
+    --lt-dump-script)
+        lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
+        test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
+        lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
+        cat \"\$lt_dump_D/\$lt_dump_F\"
+        exit 0
+      ;;
+    --lt-*)
+        \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
+        exit 1
+      ;;
+    esac
+  done
+
+  # Print the debug banner immediately:
+  if test -n \"\$lt_option_debug\"; then
+    echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
+  fi
+}
+
+# Used when --lt-debug. Prints its arguments to stdout
+# (redirection is the responsibility of the caller)
+func_lt_dump_args ()
+{
+  lt_dump_args_N=1;
+  for lt_arg
+  do
+    \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
+    lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
+  done
+}
+
+# Core function for launching the target application
+func_exec_program_core ()
+{
 "
-       $ECHO "\
+  case $host in
+  # Backslashes separate directories on plain windows
+  *-*-mingw | *-*-os2* | *-cegcc*)
+    $ECHO "\
+      if test -n \"\$lt_option_debug\"; then
+        \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
+        func_lt_dump_args \${1+\"\$@\"} 1>&2
+      fi
+      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
+"
+    ;;
+
+  *)
+    $ECHO "\
+      if test -n \"\$lt_option_debug\"; then
+        \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
+        func_lt_dump_args \${1+\"\$@\"} 1>&2
+      fi
+      exec \"\$progdir/\$program\" \${1+\"\$@\"}
+"
+    ;;
+  esac
+  $ECHO "\
+      \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
+      exit 1
+}
+
+# A function to encapsulate launching the target application
+# Strips options in the --lt-* namespace from \$@ and
+# launches target application with the remaining arguments.
+func_exec_program ()
+{
+  for lt_wr_arg
+  do
+    case \$lt_wr_arg in
+    --lt-*) ;;
+    *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
+    esac
+    shift
+  done
+  func_exec_program_core \${1+\"\$@\"}
+}
+
+  # Parse options
+  func_parse_lt_options \"\$0\" \${1+\"\$@\"}
 
   # Find the directory that this script lives in.
-  thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
+  thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
   test \"x\$thisdir\" = \"x\$file\" && thisdir=.
 
   # Follow symbolic links until we get to the real thisdir.
-  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
+  file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
   while test -n \"\$file\"; do
-    destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
+    destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
 
     # If there was a directory component, then change thisdir.
     if test \"x\$destdir\" != \"x\$file\"; then
@@ -2783,30 +3126,13 @@ else
       esac
     fi
 
-    file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
-    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
+    file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
+    file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
   done
-"
-}
-# end: func_emit_wrapper_part1
-
-# func_emit_wrapper_part2 [arg=no]
-#
-# Emit the second part of a libtool wrapper script on stdout.
-# For more information, see the description associated with
-# func_emit_wrapper(), below.
-func_emit_wrapper_part2 ()
-{
-       func_emit_wrapper_part2_arg1=no
-       if test -n "$1" ; then
-         func_emit_wrapper_part2_arg1=$1
-       fi
-
-       $ECHO "\
 
   # Usually 'no', except on cygwin/mingw when embedded into
   # the cwrapper.
-  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1
+  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
   if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
     # special case for '.'
     if test \"\$thisdir\" = \".\"; then
@@ -2814,7 +3140,7 @@ func_emit_wrapper_part2 ()
     fi
     # remove .libs from thisdir
     case \"\$thisdir\" in
-    *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
+    *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
     $objdir )   thisdir=. ;;
     esac
   fi
@@ -2877,7 +3203,7 @@ func_emit_wrapper_part2 ()
 
     # Some systems cannot cope with colon-terminated $shlibpath_var
     # The second colon is a workaround for a bug in BeOS R4 sed
-    $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
+    $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
 
     export $shlibpath_var
 "
@@ -2894,64 +3220,18 @@ func_emit_wrapper_part2 ()
        $ECHO "\
     if test \"\$libtool_execute_magic\" != \"$magic\"; then
       # Run the actual program with our arguments.
-"
-       case $host in
-       # Backslashes separate directories on plain windows
-       *-*-mingw | *-*-os2* | *-cegcc*)
-         $ECHO "\
-      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
-"
-         ;;
-
-       *)
-         $ECHO "\
-      exec \"\$progdir/\$program\" \${1+\"\$@\"}
-"
-         ;;
-       esac
-       $ECHO "\
-      \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
-      exit 1
+      func_exec_program \${1+\"\$@\"}
     fi
   else
     # The program doesn't exist.
     \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
     \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
-    $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
+    \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
     exit 1
   fi
 fi\
 "
 }
-# end: func_emit_wrapper_part2
-
-
-# func_emit_wrapper [arg=no]
-#
-# Emit a libtool wrapper script on stdout.
-# Don't directly open a file because we may want to
-# incorporate the script contents within a cygwin/mingw
-# wrapper executable.  Must ONLY be called from within
-# func_mode_link because it depends on a number of variables
-# set therein.
-#
-# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
-# variable will take.  If 'yes', then the emitted script
-# will assume that the directory in which it is stored is
-# the $objdir directory.  This is a cygwin/mingw-specific
-# behavior.
-func_emit_wrapper ()
-{
-       func_emit_wrapper_arg1=no
-       if test -n "$1" ; then
-         func_emit_wrapper_arg1=$1
-       fi
-
-       # split this up so that func_emit_cwrapperexe_src
-       # can call each part independently.
-       func_emit_wrapper_part1 "${func_emit_wrapper_arg1}"
-       func_emit_wrapper_part2 "${func_emit_wrapper_arg1}"
-}
 
 
 # func_to_host_path arg
@@ -2978,23 +3258,19 @@ func_emit_wrapper ()
 func_to_host_path ()
 {
   func_to_host_path_result="$1"
-  if test -n "$1" ; then
+  if test -n "$1"; then
     case $host in
       *mingw* )
         lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
         case $build in
           *mingw* ) # actually, msys
             # awkward: cmd appends spaces to result
-            lt_sed_strip_trailing_spaces="s/[ ]*\$//"
-            func_to_host_path_tmp1=`( cmd //c echo "$1" |\
-              $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
-            func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
-              $SED -e "$lt_sed_naive_backslashify"`
+            func_to_host_path_result=`( cmd //c echo "$1" ) 2>/dev/null |
+              $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
             ;;
           *cygwin* )
-            func_to_host_path_tmp1=`cygpath -w "$1"`
-            func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
-              $SED -e "$lt_sed_naive_backslashify"`
+            func_to_host_path_result=`cygpath -w "$1" |
+             $SED -e "$lt_sed_naive_backslashify"`
             ;;
           * )
             # Unfortunately, winepath does not exit with a non-zero
@@ -3006,17 +3282,17 @@ func_to_host_path ()
             # the odd construction:
             func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
             if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
-              func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
+              func_to_host_path_result=`$ECHO "$func_to_host_path_tmp1" |
                 $SED -e "$lt_sed_naive_backslashify"`
             else
               # Allow warning below.
-              func_to_host_path_result=""
+              func_to_host_path_result=
             fi
             ;;
         esac
         if test -z "$func_to_host_path_result" ; then
           func_error "Could not determine host path corresponding to"
-          func_error "  '$1'"
+          func_error "  \`$1'"
           func_error "Continuing, but uninstalled executables may not work."
           # Fallback:
           func_to_host_path_result="$1"
@@ -3049,30 +3325,24 @@ func_to_host_path ()
 func_to_host_pathlist ()
 {
   func_to_host_pathlist_result="$1"
-  if test -n "$1" ; then
+  if test -n "$1"; then
     case $host in
       *mingw* )
         lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
         # Remove leading and trailing path separator characters from
         # ARG. msys behavior is inconsistent here, cygpath turns them
         # into '.;' and ';.', and winepath ignores them completely.
-        func_to_host_pathlist_tmp2="$1"
-        # Once set for this call, this variable should not be
-        # reassigned. It is used in tha fallback case.
-        func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\
-          $SED -e 's|^:*||' -e 's|:*$||'`
+       func_stripname : : "$1"
+        func_to_host_pathlist_tmp1=$func_stripname_result
         case $build in
           *mingw* ) # Actually, msys.
             # Awkward: cmd appends spaces to result.
-            lt_sed_strip_trailing_spaces="s/[ ]*\$//"
-            func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\
-              $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
-            func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
-              $SED -e "$lt_sed_naive_backslashify"`
+            func_to_host_pathlist_result=`
+             ( cmd //c echo "$func_to_host_pathlist_tmp1" ) 2>/dev/null |
+             $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
             ;;
           *cygwin* )
-            func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"`
-            func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
+            func_to_host_pathlist_result=`cygpath -w -p "$func_to_host_pathlist_tmp1" |
               $SED -e "$lt_sed_naive_backslashify"`
             ;;
           * )
@@ -3088,18 +3358,17 @@ func_to_host_pathlist ()
                   if test -z "$func_to_host_pathlist_result" ; then
                     func_to_host_pathlist_result="$func_to_host_path_result"
                   else
-                    func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result"
+                    func_append func_to_host_pathlist_result ";$func_to_host_path_result"
                   fi
                 fi
               fi
-              IFS=:
             done
             IFS=$func_to_host_pathlist_oldIFS
             ;;
         esac
-        if test -z "$func_to_host_pathlist_result" ; then
+        if test -z "$func_to_host_pathlist_result"; then
           func_error "Could not determine the host path(s) corresponding to"
-          func_error "  '$1'"
+          func_error "  \`$1'"
           func_error "Continuing, but uninstalled executables may not work."
           # Fallback. This may break if $1 contains DOS-style drive
           # specifications. The fix is not to complicate the expression
@@ -3116,7 +3385,7 @@ func_to_host_pathlist ()
             ;;
         esac
         case "$1" in
-          *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;"
+          *: ) func_append func_to_host_pathlist_result ";"
             ;;
         esac
         ;;
@@ -3141,31 +3410,23 @@ func_emit_cwrapperexe_src ()
 
    This wrapper executable should never be moved out of the build directory.
    If it is, it will not operate correctly.
-
-   Currently, it simply execs the wrapper *script* "$SHELL $output",
-   but could eventually absorb all of the scripts functionality and
-   exec $objdir/$outputname directly.
 */
 EOF
            cat <<"EOF"
+#ifdef _MSC_VER
+# define _CRT_SECURE_NO_DEPRECATE 1
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #ifdef _MSC_VER
 # include <direct.h>
 # include <process.h>
 # include <io.h>
-# define setmode _setmode
 #else
 # include <unistd.h>
 # include <stdint.h>
 # ifdef __CYGWIN__
 #  include <io.h>
-#  define HAVE_SETENV
-#  ifdef __STRICT_ANSI__
-char *realpath (const char *, char *);
-int putenv (char *);
-int setenv (const char *, const char *, int);
-#  endif
 # endif
 #endif
 #include <malloc.h>
@@ -3177,6 +3438,44 @@ int setenv (const char *, const char *, int);
 #include <fcntl.h>
 #include <sys/stat.h>
 
+/* declarations of non-ANSI functions */
+#if defined(__MINGW32__)
+# ifdef __STRICT_ANSI__
+int _putenv (const char *);
+# endif
+#elif defined(__CYGWIN__)
+# ifdef __STRICT_ANSI__
+char *realpath (const char *, char *);
+int putenv (char *);
+int setenv (const char *, const char *, int);
+# endif
+/* #elif defined (other platforms) ... */
+#endif
+
+/* portability defines, excluding path handling macros */
+#if defined(_MSC_VER)
+# define setmode _setmode
+# define stat    _stat
+# define chmod   _chmod
+# define getcwd  _getcwd
+# define putenv  _putenv
+# define S_IXUSR _S_IEXEC
+# ifndef _INTPTR_T_DEFINED
+#  define _INTPTR_T_DEFINED
+#  define intptr_t int
+# endif
+#elif defined(__MINGW32__)
+# define setmode _setmode
+# define stat    _stat
+# define chmod   _chmod
+# define getcwd  _getcwd
+# define putenv  _putenv
+#elif defined(__CYGWIN__)
+# define HAVE_SETENV
+# define FOPEN_WB "wb"
+/* #elif defined (other platforms) ... */
+#endif
+
 #if defined(PATH_MAX)
 # define LT_PATHMAX PATH_MAX
 #elif defined(MAXPATHLEN)
@@ -3192,14 +3491,7 @@ int setenv (const char *, const char *, int);
 # define S_IXGRP 0
 #endif
 
-#ifdef _MSC_VER
-# define S_IXUSR _S_IEXEC
-# define stat _stat
-# ifndef _INTPTR_T_DEFINED
-#  define intptr_t int
-# endif
-#endif
-
+/* path handling portability macros */
 #ifndef DIR_SEPARATOR
 # define DIR_SEPARATOR '/'
 # define PATH_SEPARATOR ':'
@@ -3230,10 +3522,6 @@ int setenv (const char *, const char *, int);
 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
 #endif /* PATH_SEPARATOR_2 */
 
-#ifdef __CYGWIN__
-# define FOPEN_WB "wb"
-#endif
-
 #ifndef FOPEN_WB
 # define FOPEN_WB "w"
 #endif
@@ -3246,22 +3534,13 @@ int setenv (const char *, const char *, int);
   if (stale) { free ((void *) stale); stale = 0; } \
 } while (0)
 
-#undef LTWRAPPER_DEBUGPRINTF
-#if defined DEBUGWRAPPER
-# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
-static void
-ltwrapper_debugprintf (const char *fmt, ...)
-{
-    va_list args;
-    va_start (args, fmt);
-    (void) vfprintf (stderr, fmt, args);
-    va_end (args);
-}
+#if defined(LT_DEBUGWRAPPER)
+static int lt_debug = 1;
 #else
-# define LTWRAPPER_DEBUGPRINTF(args)
+static int lt_debug = 0;
 #endif
 
-const char *program_name = NULL;
+const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
 
 void *xmalloc (size_t num);
 char *xstrdup (const char *string);
@@ -3271,31 +3550,17 @@ char *chase_symlinks (const char *pathspec);
 int make_executable (const char *path);
 int check_executable (const char *path);
 char *strendzap (char *str, const char *pat);
-void lt_fatal (const char *message, ...);
+void lt_debugprintf (const char *file, int line, const char *fmt, ...);
+void lt_fatal (const char *file, int line, const char *message, ...);
+static const char *nonnull (const char *s);
+static const char *nonempty (const char *s);
 void lt_setenv (const char *name, const char *value);
 char *lt_extend_str (const char *orig_value, const char *add, int to_end);
-void lt_opt_process_env_set (const char *arg);
-void lt_opt_process_env_prepend (const char *arg);
-void lt_opt_process_env_append (const char *arg);
-int lt_split_name_value (const char *arg, char** name, char** value);
 void lt_update_exe_path (const char *name, const char *value);
 void lt_update_lib_path (const char *name, const char *value);
-
-static const char *script_text_part1 =
-EOF
-
-           func_emit_wrapper_part1 yes |
-               $SED -e 's/\([\\"]\)/\\\1/g' \
-                    -e 's/^/  "/' -e 's/$/\\n"/'
-           echo ";"
-           cat <<EOF
-
-static const char *script_text_part2 =
+char **prepare_spawn (char **argv);
+void lt_dump_script (FILE *f);
 EOF
-           func_emit_wrapper_part2 yes |
-               $SED -e 's/\([\\"]\)/\\\1/g' \
-                    -e 's/^/  "/' -e 's/$/\\n"/'
-           echo ";"
 
            cat <<EOF
 const char * MAGIC_EXE = "$magic_exe";
@@ -3340,24 +3605,10 @@ EOF
            cat <<"EOF"
 
 #define LTWRAPPER_OPTION_PREFIX         "--lt-"
-#define LTWRAPPER_OPTION_PREFIX_LENGTH  5
 
-static const size_t opt_prefix_len         = LTWRAPPER_OPTION_PREFIX_LENGTH;
 static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
-
 static const char *dumpscript_opt       = LTWRAPPER_OPTION_PREFIX "dump-script";
-
-static const size_t env_set_opt_len     = LTWRAPPER_OPTION_PREFIX_LENGTH + 7;
-static const char *env_set_opt          = LTWRAPPER_OPTION_PREFIX "env-set";
-  /* argument is putenv-style "foo=bar", value of foo is set to bar */
-
-static const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11;
-static const char *env_prepend_opt      = LTWRAPPER_OPTION_PREFIX "env-prepend";
-  /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */
-
-static const size_t env_append_opt_len  = LTWRAPPER_OPTION_PREFIX_LENGTH + 10;
-static const char *env_append_opt       = LTWRAPPER_OPTION_PREFIX "env-append";
-  /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */
+static const char *debug_opt            = LTWRAPPER_OPTION_PREFIX "debug";
 
 int
 main (int argc, char *argv[])
@@ -3374,10 +3625,13 @@ main (int argc, char *argv[])
   int i;
 
   program_name = (char *) xstrdup (base_name (argv[0]));
-  LTWRAPPER_DEBUGPRINTF (("(main) argv[0]      : %s\n", argv[0]));
-  LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
+  newargz = XMALLOC (char *, argc + 1);
 
-  /* very simple arg parsing; don't want to rely on getopt */
+  /* very simple arg parsing; don't want to rely on getopt
+   * also, copy all non cwrapper options to newargz, except
+   * argz[0], which is handled differently
+   */
+  newargc=0;
   for (i = 1; i < argc; i++)
     {
       if (strcmp (argv[i], dumpscript_opt) == 0)
@@ -3391,25 +3645,57 @@ EOF
              esac
 
            cat <<"EOF"
-         printf ("%s", script_text_part1);
-         printf ("%s", script_text_part2);
+         lt_dump_script (stdout);
          return 0;
        }
+      if (strcmp (argv[i], debug_opt) == 0)
+       {
+          lt_debug = 1;
+          continue;
+       }
+      if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
+        {
+          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
+             namespace, but it is not one of the ones we know about and
+             have already dealt with, above (inluding dump-script), then
+             report an error. Otherwise, targets might begin to believe
+             they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
+             namespace. The first time any user complains about this, we'll
+             need to make LTWRAPPER_OPTION_PREFIX a configure-time option
+             or a configure.ac-settable value.
+           */
+          lt_fatal (__FILE__, __LINE__,
+                   "unrecognized %s option: '%s'",
+                    ltwrapper_option_prefix, argv[i]);
+        }
+      /* otherwise ... */
+      newargz[++newargc] = xstrdup (argv[i]);
     }
+  newargz[++newargc] = NULL;
+
+EOF
+           cat <<EOF
+  /* The GNU banner must be the first non-error debug message */
+  lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
+EOF
+           cat <<"EOF"
+  lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
+  lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
 
-  newargz = XMALLOC (char *, argc + 1);
   tmp_pathspec = find_executable (argv[0]);
   if (tmp_pathspec == NULL)
-    lt_fatal ("Couldn't find %s", argv[0]);
-  LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
-                         tmp_pathspec));
+    lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
+  lt_debugprintf (__FILE__, __LINE__,
+                  "(main) found exe (before symlink chase) at: %s\n",
+                 tmp_pathspec);
 
   actual_cwrapper_path = chase_symlinks (tmp_pathspec);
-  LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
-                         actual_cwrapper_path));
+  lt_debugprintf (__FILE__, __LINE__,
+                  "(main) found exe (after symlink chase) at: %s\n",
+                 actual_cwrapper_path);
   XFREE (tmp_pathspec);
 
-  actual_cwrapper_name = xstrdupbase_name (actual_cwrapper_path));
+  actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
   strendzap (actual_cwrapper_path, actual_cwrapper_name);
 
   /* wrapper name transforms */
@@ -3427,8 +3713,9 @@ EOF
   target_name = tmp_pathspec;
   tmp_pathspec = 0;
 
-  LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n",
-                         target_name));
+  lt_debugprintf (__FILE__, __LINE__,
+                 "(main) libtool target name: %s\n",
+                 target_name);
 EOF
 
            cat <<EOF
@@ -3481,77 +3768,12 @@ EOF
   lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
   lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
 
-  newargc=0;
-  for (i = 1; i < argc; i++)
-    {
-      if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0)
-        {
-          if (argv[i][env_set_opt_len] == '=')
-            {
-              const char *p = argv[i] + env_set_opt_len + 1;
-              lt_opt_process_env_set (p);
-            }
-          else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc)
-            {
-              lt_opt_process_env_set (argv[++i]); /* don't copy */
-            }
-          else
-            lt_fatal ("%s missing required argument", env_set_opt);
-          continue;
-        }
-      if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0)
-        {
-          if (argv[i][env_prepend_opt_len] == '=')
-            {
-              const char *p = argv[i] + env_prepend_opt_len + 1;
-              lt_opt_process_env_prepend (p);
-            }
-          else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc)
-            {
-              lt_opt_process_env_prepend (argv[++i]); /* don't copy */
-            }
-          else
-            lt_fatal ("%s missing required argument", env_prepend_opt);
-          continue;
-        }
-      if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0)
-        {
-          if (argv[i][env_append_opt_len] == '=')
-            {
-              const char *p = argv[i] + env_append_opt_len + 1;
-              lt_opt_process_env_append (p);
-            }
-          else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc)
-            {
-              lt_opt_process_env_append (argv[++i]); /* don't copy */
-            }
-          else
-            lt_fatal ("%s missing required argument", env_append_opt);
-          continue;
-        }
-      if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
-        {
-          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
-             namespace, but it is not one of the ones we know about and
-             have already dealt with, above (inluding dump-script), then
-             report an error. Otherwise, targets might begin to believe
-             they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
-             namespace. The first time any user complains about this, we'll
-             need to make LTWRAPPER_OPTION_PREFIX a configure-time option
-             or a configure.ac-settable value.
-           */
-          lt_fatal ("Unrecognized option in %s namespace: '%s'",
-                    ltwrapper_option_prefix, argv[i]);
-        }
-      /* otherwise ... */
-      newargz[++newargc] = xstrdup (argv[i]);
-    }
-  newargz[++newargc] = NULL;
-
-  LTWRAPPER_DEBUGPRINTF     (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>")));
+  lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
+                 nonnull (lt_argv_zero));
   for (i = 0; i < newargc; i++)
     {
-      LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d]   : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>")));
+      lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
+                     i, nonnull (newargz[i]));
     }
 
 EOF
@@ -3560,11 +3782,14 @@ EOF
              mingw*)
                cat <<"EOF"
   /* execv doesn't actually work on mingw as expected on unix */
+  newargz = prepare_spawn (newargz);
   rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
   if (rval == -1)
     {
       /* failed to start process */
-      LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno));
+      lt_debugprintf (__FILE__, __LINE__,
+                     "(main) failed to launch target \"%s\": %s\n",
+                     lt_argv_zero, nonnull (strerror (errno)));
       return 127;
     }
   return rval;
@@ -3586,7 +3811,7 @@ xmalloc (size_t num)
 {
   void *p = (void *) malloc (num);
   if (!p)
-    lt_fatal ("Memory exhausted");
+    lt_fatal (__FILE__, __LINE__, "memory exhausted");
 
   return p;
 }
@@ -3620,8 +3845,8 @@ check_executable (const char *path)
 {
   struct stat st;
 
-  LTWRAPPER_DEBUGPRINTF (("(check_executable)  : %s\n",
-                         path ? (*path ? path : "EMPTY!") : "NULL!"));
+  lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
+                  nonempty (path));
   if ((!path) || (!*path))
     return 0;
 
@@ -3638,8 +3863,8 @@ make_executable (const char *path)
   int rval = 0;
   struct stat st;
 
-  LTWRAPPER_DEBUGPRINTF (("(make_executable)   : %s\n",
-                         path ? (*path ? path : "EMPTY!") : "NULL!"));
+  lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
+                  nonempty (path));
   if ((!path) || (!*path))
     return 0;
 
@@ -3665,8 +3890,8 @@ find_executable (const char *wrapper)
   int tmp_len;
   char *concat_name;
 
-  LTWRAPPER_DEBUGPRINTF (("(find_executable)   : %s\n",
-                         wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
+  lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
+                  nonempty (wrapper));
 
   if ((wrapper == NULL) || (*wrapper == '\0'))
     return NULL;
@@ -3719,7 +3944,8 @@ find_executable (const char *wrapper)
                {
                  /* empty path: current directory */
                  if (getcwd (tmp, LT_PATHMAX) == NULL)
-                   lt_fatal ("getcwd failed");
+                   lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
+                              nonnull (strerror (errno)));
                  tmp_len = strlen (tmp);
                  concat_name =
                    XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
@@ -3744,7 +3970,8 @@ find_executable (const char *wrapper)
     }
   /* Relative path | not found in path: prepend cwd */
   if (getcwd (tmp, LT_PATHMAX) == NULL)
-    lt_fatal ("getcwd failed");
+    lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
+              nonnull (strerror (errno)));
   tmp_len = strlen (tmp);
   concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
   memcpy (concat_name, tmp, tmp_len);
@@ -3770,8 +3997,9 @@ chase_symlinks (const char *pathspec)
   int has_symlinks = 0;
   while (strlen (tmp_pathspec) && !has_symlinks)
     {
-      LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
-                             tmp_pathspec));
+      lt_debugprintf (__FILE__, __LINE__,
+                     "checking path component for symlinks: %s\n",
+                     tmp_pathspec);
       if (lstat (tmp_pathspec, &s) == 0)
        {
          if (S_ISLNK (s.st_mode) != 0)
@@ -3793,8 +4021,9 @@ chase_symlinks (const char *pathspec)
        }
       else
        {
-         char *errstr = strerror (errno);
-         lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
+         lt_fatal (__FILE__, __LINE__,
+                   "error accessing file \"%s\": %s",
+                   tmp_pathspec, nonnull (strerror (errno)));
        }
     }
   XFREE (tmp_pathspec);
@@ -3807,7 +4036,8 @@ chase_symlinks (const char *pathspec)
   tmp_pathspec = realpath (pathspec, buf);
   if (tmp_pathspec == 0)
     {
-      lt_fatal ("Could not follow symlinks for %s", pathspec);
+      lt_fatal (__FILE__, __LINE__,
+               "could not follow symlinks for %s", pathspec);
     }
   return xstrdup (tmp_pathspec);
 #endif
@@ -3833,11 +4063,25 @@ strendzap (char *str, const char *pat)
   return str;
 }
 
+void
+lt_debugprintf (const char *file, int line, const char *fmt, ...)
+{
+  va_list args;
+  if (lt_debug)
+    {
+      (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
+      va_start (args, fmt);
+      (void) vfprintf (stderr, fmt, args);
+      va_end (args);
+    }
+}
+
 static void
-lt_error_core (int exit_status, const char *mode,
+lt_error_core (int exit_status, const char *file,
+              int line, const char *mode,
               const char *message, va_list ap)
 {
-  fprintf (stderr, "%s: %s: ", program_name, mode);
+  fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
   vfprintf (stderr, message, ap);
   fprintf (stderr, ".\n");
 
@@ -3846,20 +4090,32 @@ lt_error_core (int exit_status, const char *mode,
 }
 
 void
-lt_fatal (const char *message, ...)
+lt_fatal (const char *file, int line, const char *message, ...)
 {
   va_list ap;
   va_start (ap, message);
-  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
+  lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
   va_end (ap);
 }
 
+static const char *
+nonnull (const char *s)
+{
+  return s ? s : "(null)";
+}
+
+static const char *
+nonempty (const char *s)
+{
+  return (s && !*s) ? "(empty)" : nonnull (s);
+}
+
 void
 lt_setenv (const char *name, const char *value)
 {
-  LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
-                          (name ? name : "<NULL>"),
-                          (value ? value : "<NULL>")));
+  lt_debugprintf (__FILE__, __LINE__,
+                 "(lt_setenv) setting '%s' to '%s'\n",
+                  nonnull (name), nonnull (value));
   {
 #ifdef HAVE_SETENV
     /* always make a copy, for consistency with !HAVE_SETENV */
@@ -3904,95 +4160,12 @@ lt_extend_str (const char *orig_value, const char *add, int to_end)
   return new_value;
 }
 
-int
-lt_split_name_value (const char *arg, char** name, char** value)
-{
-  const char *p;
-  int len;
-  if (!arg || !*arg)
-    return 1;
-
-  p = strchr (arg, (int)'=');
-
-  if (!p)
-    return 1;
-
-  *value = xstrdup (++p);
-
-  len = strlen (arg) - strlen (*value);
-  *name = XMALLOC (char, len);
-  strncpy (*name, arg, len-1);
-  (*name)[len - 1] = '\0';
-
-  return 0;
-}
-
-void
-lt_opt_process_env_set (const char *arg)
-{
-  char *name = NULL;
-  char *value = NULL;
-
-  if (lt_split_name_value (arg, &name, &value) != 0)
-    {
-      XFREE (name);
-      XFREE (value);
-      lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg);
-    }
-
-  lt_setenv (name, value);
-  XFREE (name);
-  XFREE (value);
-}
-
-void
-lt_opt_process_env_prepend (const char *arg)
-{
-  char *name = NULL;
-  char *value = NULL;
-  char *new_value = NULL;
-
-  if (lt_split_name_value (arg, &name, &value) != 0)
-    {
-      XFREE (name);
-      XFREE (value);
-      lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg);
-    }
-
-  new_value = lt_extend_str (getenv (name), value, 0);
-  lt_setenv (name, new_value);
-  XFREE (new_value);
-  XFREE (name);
-  XFREE (value);
-}
-
-void
-lt_opt_process_env_append (const char *arg)
-{
-  char *name = NULL;
-  char *value = NULL;
-  char *new_value = NULL;
-
-  if (lt_split_name_value (arg, &name, &value) != 0)
-    {
-      XFREE (name);
-      XFREE (value);
-      lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg);
-    }
-
-  new_value = lt_extend_str (getenv (name), value, 1);
-  lt_setenv (name, new_value);
-  XFREE (new_value);
-  XFREE (name);
-  XFREE (value);
-}
-
 void
 lt_update_exe_path (const char *name, const char *value)
 {
-  LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
-                          (name ? name : "<NULL>"),
-                          (value ? value : "<NULL>")));
+  lt_debugprintf (__FILE__, __LINE__,
+                 "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
+                  nonnull (name), nonnull (value));
 
   if (name && *name && value && *value)
     {
@@ -4011,9 +4184,9 @@ lt_update_exe_path (const char *name, const char *value)
 void
 lt_update_lib_path (const char *name, const char *value)
 {
-  LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
-                          (name ? name : "<NULL>"),
-                          (value ? value : "<NULL>")));
+  lt_debugprintf (__FILE__, __LINE__,
+                 "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
+                  nonnull (name), nonnull (value));
 
   if (name && *name && value && *value)
     {
@@ -4023,11 +4196,152 @@ lt_update_lib_path (const char *name, const char *value)
     }
 }
 
+EOF
+           case $host_os in
+             mingw*)
+               cat <<"EOF"
+
+/* Prepares an argument vector before calling spawn().
+   Note that spawn() does not by itself call the command interpreter
+     (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
+      ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+         GetVersionEx(&v);
+         v.dwPlatformId == VER_PLATFORM_WIN32_NT;
+      }) ? "cmd.exe" : "command.com").
+   Instead it simply concatenates the arguments, separated by ' ', and calls
+   CreateProcess().  We must quote the arguments since Win32 CreateProcess()
+   interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
+   special way:
+   - Space and tab are interpreted as delimiters. They are not treated as
+     delimiters if they are surrounded by double quotes: "...".
+   - Unescaped double quotes are removed from the input. Their only effect is
+     that within double quotes, space and tab are treated like normal
+     characters.
+   - Backslashes not followed by double quotes are not special.
+   - But 2*n+1 backslashes followed by a double quote become
+     n backslashes followed by a double quote (n >= 0):
+       \" -> "
+       \\\" -> \"
+       \\\\\" -> \\"
+ */
+#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
+#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
+char **
+prepare_spawn (char **argv)
+{
+  size_t argc;
+  char **new_argv;
+  size_t i;
+
+  /* Count number of arguments.  */
+  for (argc = 0; argv[argc] != NULL; argc++)
+    ;
+
+  /* Allocate new argument vector.  */
+  new_argv = XMALLOC (char *, argc + 1);
+
+  /* Put quoted arguments into the new argument vector.  */
+  for (i = 0; i < argc; i++)
+    {
+      const char *string = argv[i];
+
+      if (string[0] == '\0')
+       new_argv[i] = xstrdup ("\"\"");
+      else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
+       {
+         int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
+         size_t length;
+         unsigned int backslashes;
+         const char *s;
+         char *quoted_string;
+         char *p;
+
+         length = 0;
+         backslashes = 0;
+         if (quote_around)
+           length++;
+         for (s = string; *s != '\0'; s++)
+           {
+             char c = *s;
+             if (c == '"')
+               length += backslashes + 1;
+             length++;
+             if (c == '\\')
+               backslashes++;
+             else
+               backslashes = 0;
+           }
+         if (quote_around)
+           length += backslashes + 1;
+
+         quoted_string = XMALLOC (char, length + 1);
+
+         p = quoted_string;
+         backslashes = 0;
+         if (quote_around)
+           *p++ = '"';
+         for (s = string; *s != '\0'; s++)
+           {
+             char c = *s;
+             if (c == '"')
+               {
+                 unsigned int j;
+                 for (j = backslashes + 1; j > 0; j--)
+                   *p++ = '\\';
+               }
+             *p++ = c;
+             if (c == '\\')
+               backslashes++;
+             else
+               backslashes = 0;
+           }
+         if (quote_around)
+           {
+             unsigned int j;
+             for (j = backslashes; j > 0; j--)
+               *p++ = '\\';
+             *p++ = '"';
+           }
+         *p = '\0';
+
+         new_argv[i] = quoted_string;
+       }
+      else
+       new_argv[i] = (char *) string;
+    }
+  new_argv[argc] = NULL;
+
+  return new_argv;
+}
+EOF
+               ;;
+           esac
+
+            cat <<"EOF"
+void lt_dump_script (FILE* f)
+{
+EOF
+           func_emit_wrapper yes |
+              $SED -e 's/\([\\"]\)/\\\1/g' \
+                  -e 's/^/  fputs ("/' -e 's/$/\\n", f);/'
 
+            cat <<"EOF"
+}
 EOF
 }
 # end: func_emit_cwrapperexe_src
 
+# func_win32_import_lib_p ARG
+# True if ARG is an import lib, as indicated by $file_magic_cmd
+func_win32_import_lib_p ()
+{
+    $opt_debug
+    case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
+    *import*) : ;;
+    *) false ;;
+    esac
+}
+
 # func_mode_link arg...
 func_mode_link ()
 {
@@ -4072,6 +4386,7 @@ func_mode_link ()
     new_inherited_linker_flags=
 
     avoid_version=no
+    bindir=
     dlfiles=
     dlprefiles=
     dlself=no
@@ -4164,6 +4479,11 @@ func_mode_link ()
        esac
 
        case $prev in
+       bindir)
+         bindir="$arg"
+         prev=
+         continue
+         ;;
        dlfiles|dlprefiles)
          if test "$preload" = no; then
            # Add the symbol object into the linking commands.
@@ -4425,6 +4745,11 @@ func_mode_link ()
        continue
        ;;
 
+      -bindir)
+       prev=bindir
+       continue
+       ;;
+
       -dlopen)
        prev=dlfiles
        continue
@@ -4503,7 +4828,7 @@ func_mode_link ()
        esac
        case $host in
        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
-         testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
+         testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
          case :$dllsearchpath: in
          *":$dir:"*) ;;
          ::) dllsearchpath=$dir;;
@@ -4522,7 +4847,7 @@ func_mode_link ()
       -l*)
        if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
          case $host in
-         *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*)
+         *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
            # These systems don't actually have a C or math library (as such)
            continue
            ;;
@@ -4708,7 +5033,7 @@ func_mode_link ()
        for flag in $args; do
          IFS="$save_ifs"
           func_quote_for_eval "$flag"
-         arg="$arg $wl$func_quote_for_eval_result"
+         arg="$arg $func_quote_for_eval_result"
          compiler_flags="$compiler_flags $func_quote_for_eval_result"
        done
        IFS="$save_ifs"
@@ -4754,18 +5079,19 @@ func_mode_link ()
        arg="$func_quote_for_eval_result"
        ;;
 
-      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
-      # -r[0-9][0-9]* specifies the processor on the SGI compiler
-      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
-      # +DA*, +DD* enable 64-bit mode on the HP compiler
-      # -q* pass through compiler args for the IBM compiler
-      # -m*, -t[45]*, -txscale* pass through architecture-specific
-      # compiler args for GCC
-      # -F/path gives path to uninstalled frameworks, gcc on darwin
-      # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
-      # @file GCC response files
+      # Flags to be passed through unchanged, with rationale:
+      # -64, -mips[0-9]      enable 64-bit mode for the SGI compiler
+      # -r[0-9][0-9]*        specify processor for the SGI compiler
+      # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
+      # +DA*, +DD*           enable 64-bit mode for the HP compiler
+      # -q*                  compiler args for the IBM compiler
+      # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
+      # -F/path              path to uninstalled frameworks, gcc on darwin
+      # -p, -pg, --coverage, -fprofile-*  profiling flags for GCC
+      # @file                GCC response files
+      # -tp=*                Portland pgcc target processor selection
       -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
-      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
+      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*)
         func_quote_for_eval "$arg"
        arg="$func_quote_for_eval_result"
         func_append compile_command " $arg"
@@ -4925,7 +5251,7 @@ func_mode_link ()
 
     if test -n "$shlibpath_var"; then
       # get the directories listed in $shlibpath_var
-      eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
+      eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
     else
       shlib_search_path=
     fi
@@ -5033,10 +5359,7 @@ func_mode_link ()
        case $pass in
        dlopen) libs="$dlfiles" ;;
        dlpreopen) libs="$dlprefiles" ;;
-       link)
-         libs="$deplibs %DEPLIBS%"
-         test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
-         ;;
+       link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
        esac
       fi
       if test "$linkmode,$pass" = "lib,dlpreopen"; then
@@ -5051,7 +5374,8 @@ func_mode_link ()
          # Collect preopened libtool deplibs, except any this library
          # has declared as weak libs
          for deplib in $dependency_libs; do
-            deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
+           func_basename "$deplib"
+            deplib_base=$func_basename_result
            case " $weak_libs " in
            *" $deplib_base "*) ;;
            *) deplibs="$deplibs $deplib" ;;
@@ -5230,7 +5554,7 @@ func_mode_link ()
                match_pattern*)
                  set dummy $deplibs_check_method; shift
                  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
-                 if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
+                 if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
                    | $EGREP "$match_pattern_regex" > /dev/null; then
                    valid_a_lib=yes
                  fi
@@ -5240,15 +5564,15 @@ func_mode_link ()
                ;;
              esac
              if test "$valid_a_lib" != yes; then
-               $ECHO
+               echo
                $ECHO "*** Warning: Trying to link with static lib archive $deplib."
-               $ECHO "*** I have the capability to make that library automatically link in when"
-               $ECHO "*** you link to this library.  But I can only do this if you have a"
-               $ECHO "*** shared version of the library, which you do not appear to have"
-               $ECHO "*** because the file extensions .$libext of this argument makes me believe"
-               $ECHO "*** that it is just a static archive that I should not use here."
+               echo "*** I have the capability to make that library automatically link in when"
+               echo "*** you link to this library.  But I can only do this if you have a"
+               echo "*** shared version of the library, which you do not appear to have"
+               echo "*** because the file extensions .$libext of this argument makes me believe"
+               echo "*** that it is just a static archive that I should not use here."
              else
-               $ECHO
+               echo
                $ECHO "*** Warning: Linking the shared library $output against the"
                $ECHO "*** static library $deplib is not portable!"
                deplibs="$deplib $deplibs"
@@ -5321,7 +5645,7 @@ func_mode_link ()
 
        # Convert "-framework foo" to "foo.ltframework"
        if test -n "$inherited_linker_flags"; then
-         tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
+         tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
          for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
            case " $new_inherited_linker_flags " in
              *" $tmp_inherited_linker_flag "*) ;;
@@ -5329,7 +5653,7 @@ func_mode_link ()
            esac
          done
        fi
-       dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+       dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
        if test "$linkmode,$pass" = "lib,link" ||
           test "$linkmode,$pass" = "prog,scan" ||
           { test "$linkmode" != prog && test "$linkmode" != lib; }; then
@@ -5347,19 +5671,19 @@ func_mode_link ()
            # It is a libtool convenience library, so add in its objects.
            convenience="$convenience $ladir/$objdir/$old_library"
            old_convenience="$old_convenience $ladir/$objdir/$old_library"
-           tmp_libs=
-           for deplib in $dependency_libs; do
-             deplibs="$deplib $deplibs"
-             if $opt_duplicate_deps ; then
-               case "$tmp_libs " in
-               *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
-               esac
-             fi
-             tmp_libs="$tmp_libs $deplib"
-           done
          elif test "$linkmode" != prog && test "$linkmode" != lib; then
            func_fatal_error "\`$lib' is not a convenience library"
          fi
+         tmp_libs=
+         for deplib in $dependency_libs; do
+           deplibs="$deplib $deplibs"
+           if $opt_duplicate_deps ; then
+             case "$tmp_libs " in
+             *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+             esac
+           fi
+           tmp_libs="$tmp_libs $deplib"
+         done
          continue
        fi # $pass = conv
 
@@ -5583,7 +5907,7 @@ func_mode_link ()
            fi
          done
          if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
-           $ECHO
+           echo
            if test "$linkmode" = prog; then
              $ECHO "*** Warning: Linking the executable $output against the loadable module"
            else
@@ -5686,9 +6010,9 @@ func_mode_link ()
                      if test "X$dlopenmodule" != "X$lib"; then
                        $ECHO "*** Warning: lib $linklib is a module, not a shared library"
                        if test -z "$old_library" ; then
-                         $ECHO
-                         $ECHO "*** And there doesn't seem to be a static archive available"
-                         $ECHO "*** The link will probably fail, sorry"
+                         echo
+                         echo "*** And there doesn't seem to be a static archive available"
+                         echo "*** The link will probably fail, sorry"
                        else
                          add="$dir/$old_library"
                        fi
@@ -5828,21 +6152,21 @@ func_mode_link ()
 
            # Just print a warning and add the library to dependency_libs so
            # that the program can be linked against the static library.
-           $ECHO
+           echo
            $ECHO "*** Warning: This system can not link to static lib archive $lib."
-           $ECHO "*** I have the capability to make that library automatically link in when"
-           $ECHO "*** you link to this library.  But I can only do this if you have a"
-           $ECHO "*** shared version of the library, which you do not appear to have."
+           echo "*** I have the capability to make that library automatically link in when"
+           echo "*** you link to this library.  But I can only do this if you have a"
+           echo "*** shared version of the library, which you do not appear to have."
            if test "$module" = yes; then
-             $ECHO "*** But as you try to build a module library, libtool will still create "
-             $ECHO "*** a static module, that should work as long as the dlopening application"
-             $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
+             echo "*** But as you try to build a module library, libtool will still create "
+             echo "*** a static module, that should work as long as the dlopening application"
+             echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
              if test -z "$global_symbol_pipe"; then
-               $ECHO
-               $ECHO "*** However, this would only work if libtool was able to extract symbol"
-               $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
-               $ECHO "*** not find such a program.  So, this module is probably useless."
-               $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
+               echo
+               echo "*** However, this would only work if libtool was able to extract symbol"
+               echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+               echo "*** not find such a program.  So, this module is probably useless."
+               echo "*** \`nm' from GNU binutils and a full rebuild may help."
              fi
              if test "$build_old_libs" = no; then
                build_libtool_libs=module
@@ -5962,7 +6286,7 @@ func_mode_link ()
          compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
          finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
        else
-         compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+         compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
        fi
       fi
       dependency_libs="$newdependency_libs"
@@ -6130,7 +6454,7 @@ func_mode_link ()
        if test "$deplibs_check_method" != pass_all; then
          func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
        else
-         $ECHO
+         echo
          $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
          $ECHO "*** objects $objs is not portable!"
          libobjs="$libobjs $objs"
@@ -6198,7 +6522,7 @@ func_mode_link ()
            age="$number_minor"
            revision="$number_revision"
            ;;
-         freebsd-aout|freebsd-elf|sunos)
+         freebsd-aout|freebsd-elf|qnx|sunos)
            current="$number_major"
            revision="$number_minor"
            age="0"
@@ -6210,9 +6534,6 @@ func_mode_link ()
            revision="$number_minor"
            lt_irix_increment=no
            ;;
-         *)
-           func_fatal_configuration "$modename: unknown library version type \`$version_type'"
-           ;;
          esac
          ;;
        no)
@@ -6435,14 +6756,14 @@ func_mode_link ()
        oldlibs="$oldlibs $output_objdir/$libname.$libext"
 
        # Transform .lo files to .o files.
-       oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
+       oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
       fi
 
       # Eliminate all temporary directories.
       #for path in $notinst_path; do
-      #        lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
-      #        deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
-      #        dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
+      #        lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
+      #        deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
+      #        dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
       #done
 
       if test -n "$xrpath"; then
@@ -6483,7 +6804,7 @@ func_mode_link ()
       if test "$build_libtool_libs" = yes; then
        if test -n "$rpath"; then
          case $host in
-         *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*)
+         *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
            # these systems don't actually have a c library (as such)!
            ;;
          *-*-rhapsody* | *-*-darwin1.[012])
@@ -6568,13 +6889,13 @@ EOF
                    newdeplibs="$newdeplibs $i"
                  else
                    droppeddeps=yes
-                   $ECHO
+                   echo
                    $ECHO "*** Warning: dynamic linker does not accept needed library $i."
-                   $ECHO "*** I have the capability to make that library automatically link in when"
-                   $ECHO "*** you link to this library.  But I can only do this if you have a"
-                   $ECHO "*** shared version of the library, which I believe you do not have"
-                   $ECHO "*** because a test_compile did reveal that the linker did not use it for"
-                   $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
+                   echo "*** I have the capability to make that library automatically link in when"
+                   echo "*** you link to this library.  But I can only do this if you have a"
+                   echo "*** shared version of the library, which I believe you do not have"
+                   echo "*** because a test_compile did reveal that the linker did not use it for"
+                   echo "*** its dynamic dependency list that programs get resolved with at runtime."
                  fi
                fi
                ;;
@@ -6611,22 +6932,22 @@ EOF
                      newdeplibs="$newdeplibs $i"
                    else
                      droppeddeps=yes
-                     $ECHO
+                     echo
                      $ECHO "*** Warning: dynamic linker does not accept needed library $i."
-                     $ECHO "*** I have the capability to make that library automatically link in when"
-                     $ECHO "*** you link to this library.  But I can only do this if you have a"
-                     $ECHO "*** shared version of the library, which you do not appear to have"
-                     $ECHO "*** because a test_compile did reveal that the linker did not use this one"
-                     $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
+                     echo "*** I have the capability to make that library automatically link in when"
+                     echo "*** you link to this library.  But I can only do this if you have a"
+                     echo "*** shared version of the library, which you do not appear to have"
+                     echo "*** because a test_compile did reveal that the linker did not use this one"
+                     echo "*** as a dynamic dependency that programs can get resolved with at runtime."
                    fi
                  fi
                else
                  droppeddeps=yes
-                 $ECHO
+                 echo
                  $ECHO "*** Warning!  Library $i is needed by this library but I was not able to"
-                 $ECHO "*** make it link in!  You will probably need to install it or some"
-                 $ECHO "*** library that it depends on before this library will be fully"
-                 $ECHO "*** functional.  Installing it before continuing would be even better."
+                 echo "*** make it link in!  You will probably need to install it or some"
+                 echo "*** library that it depends on before this library will be fully"
+                 echo "*** functional.  Installing it before continuing would be even better."
                fi
                ;;
              *)
@@ -6672,7 +6993,7 @@ EOF
                        potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
                        case $potliblink in
                        [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
-                       *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
+                       *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
                        esac
                      done
                      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
@@ -6687,12 +7008,12 @@ EOF
              fi
              if test -n "$a_deplib" ; then
                droppeddeps=yes
-               $ECHO
+               echo
                $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
-               $ECHO "*** I have the capability to make that library automatically link in when"
-               $ECHO "*** you link to this library.  But I can only do this if you have a"
-               $ECHO "*** shared version of the library, which you do not appear to have"
-               $ECHO "*** because I did check the linker path looking for a file starting"
+               echo "*** I have the capability to make that library automatically link in when"
+               echo "*** you link to this library.  But I can only do this if you have a"
+               echo "*** shared version of the library, which you do not appear to have"
+               echo "*** because I did check the linker path looking for a file starting"
                if test -z "$potlib" ; then
                  $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
                else
@@ -6730,7 +7051,7 @@ EOF
                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
                  for potent_lib in $potential_libs; do
                    potlib="$potent_lib" # see symlink-check above in file_magic test
-                   if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
+                   if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
                       $EGREP "$match_pattern_regex" > /dev/null; then
                      newdeplibs="$newdeplibs $a_deplib"
                      a_deplib=""
@@ -6741,12 +7062,12 @@ EOF
              fi
              if test -n "$a_deplib" ; then
                droppeddeps=yes
-               $ECHO
+               echo
                $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
-               $ECHO "*** I have the capability to make that library automatically link in when"
-               $ECHO "*** you link to this library.  But I can only do this if you have a"
-               $ECHO "*** shared version of the library, which you do not appear to have"
-               $ECHO "*** because I did check the linker path looking for a file starting"
+               echo "*** I have the capability to make that library automatically link in when"
+               echo "*** you link to this library.  But I can only do this if you have a"
+               echo "*** shared version of the library, which you do not appear to have"
+               echo "*** because I did check the linker path looking for a file starting"
                if test -z "$potlib" ; then
                  $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
                else
@@ -6764,25 +7085,25 @@ EOF
          ;;
        none | unknown | *)
          newdeplibs=""
-         tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
-             -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
+         tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
          if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
            for i in $predeps $postdeps ; do
              # can't use Xsed below, because $i might contain '/'
-             tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
+             tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
            done
          fi
-         if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[      ]//g' |
-            $GREP . >/dev/null; then
-           $ECHO
+         case $tmp_deplibs in
+         *[!\  \ ]*)
+           echo
            if test "X$deplibs_check_method" = "Xnone"; then
-             $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
+             echo "*** Warning: inter-library dependencies are not supported in this platform."
            else
-             $ECHO "*** Warning: inter-library dependencies are not known to be supported."
+             echo "*** Warning: inter-library dependencies are not known to be supported."
            fi
-           $ECHO "*** All declared inter-library dependencies are being dropped."
+           echo "*** All declared inter-library dependencies are being dropped."
            droppeddeps=yes
-         fi
+           ;;
+         esac
          ;;
        esac
        versuffix=$versuffix_save
@@ -6794,23 +7115,23 @@ EOF
        case $host in
        *-*-rhapsody* | *-*-darwin1.[012])
          # On Rhapsody replace the C library with the System framework
-         newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
+         newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
          ;;
        esac
 
        if test "$droppeddeps" = yes; then
          if test "$module" = yes; then
-           $ECHO
-           $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
+           echo
+           echo "*** Warning: libtool could not satisfy all declared inter-library"
            $ECHO "*** dependencies of module $libname.  Therefore, libtool will create"
-           $ECHO "*** a static module, that should work as long as the dlopening"
-           $ECHO "*** application is linked with the -dlopen flag."
+           echo "*** a static module, that should work as long as the dlopening"
+           echo "*** application is linked with the -dlopen flag."
            if test -z "$global_symbol_pipe"; then
-             $ECHO
-             $ECHO "*** However, this would only work if libtool was able to extract symbol"
-             $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
-             $ECHO "*** not find such a program.  So, this module is probably useless."
-             $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
+             echo
+             echo "*** However, this would only work if libtool was able to extract symbol"
+             echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+             echo "*** not find such a program.  So, this module is probably useless."
+             echo "*** \`nm' from GNU binutils and a full rebuild may help."
            fi
            if test "$build_old_libs" = no; then
              oldlibs="$output_objdir/$libname.$libext"
@@ -6820,16 +7141,16 @@ EOF
              build_libtool_libs=no
            fi
          else
-           $ECHO "*** The inter-library dependencies that have been dropped here will be"
-           $ECHO "*** automatically added whenever a program is linked with this library"
-           $ECHO "*** or is declared to -dlopen it."
+           echo "*** The inter-library dependencies that have been dropped here will be"
+           echo "*** automatically added whenever a program is linked with this library"
+           echo "*** or is declared to -dlopen it."
 
            if test "$allow_undefined" = no; then
-             $ECHO
-             $ECHO "*** Since this library must not contain undefined symbols,"
-             $ECHO "*** because either the platform does not support them or"
-             $ECHO "*** it was explicitly requested with -no-undefined,"
-             $ECHO "*** libtool will only create a static version of it."
+             echo
+             echo "*** Since this library must not contain undefined symbols,"
+             echo "*** because either the platform does not support them or"
+             echo "*** it was explicitly requested with -no-undefined,"
+             echo "*** libtool will only create a static version of it."
              if test "$build_old_libs" = no; then
                oldlibs="$output_objdir/$libname.$libext"
                build_libtool_libs=module
@@ -6846,9 +7167,9 @@ EOF
       # Time to change all our "foo.ltframework" stuff back to "-framework foo"
       case $host in
        *-*-darwin*)
-         newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
-         new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
-         deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+         newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+         new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+         deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
          ;;
       esac
 
@@ -6970,7 +7291,7 @@ EOF
        done
 
        # Use standard objects if they are pic
-       test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+       test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
        test "X$libobjs" = "X " && libobjs=
 
        delfiles=
@@ -7036,7 +7357,7 @@ EOF
        if test -n "$export_symbols" && test -n "$include_expsyms"; then
          tmp_export_symbols="$export_symbols"
          test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
-         $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
+         $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
        fi
 
        if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
@@ -7137,7 +7458,8 @@ EOF
            save_libobjs=$libobjs
          fi
          save_output=$output
-         output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
+         func_basename "$output"
+         output_la=$func_basename_result
 
          # Clear the reloadable object creation command queue and
          # initialize k to one.
@@ -7150,12 +7472,12 @@ EOF
          if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
            output=${output_objdir}/${output_la}.lnkscript
            func_verbose "creating GNU ld script: $output"
-           $ECHO 'INPUT (' > $output
+           echo 'INPUT (' > $output
            for obj in $save_libobjs
            do
              $ECHO "$obj" >> $output
            done
-           $ECHO ')' >> $output
+           echo ')' >> $output
            delfiles="$delfiles $output"
          elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
            output=${output_objdir}/${output_la}.lnk
@@ -7197,17 +7519,19 @@ EOF
                  # command to the queue.
                  if test "$k" -eq 1 ; then
                    # The first file doesn't have a previous command to add.
-                   eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
+                   reload_objs=$objlist
+                   eval concat_cmds=\"$reload_cmds\"
                  else
                    # All subsequent reloadable object files will link in
                    # the last one created.
-                   eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\"
+                   reload_objs="$objlist $last_robj"
+                   eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
                  fi
                  last_robj=$output_objdir/$output_la-${k}.$objext
                  func_arith $k + 1
                  k=$func_arith_result
                  output=$output_objdir/$output_la-${k}.$objext
-                 objlist=$obj
+                 objlist=" $obj"
                  func_len " $last_robj"
                  func_arith $len0 + $func_len_result
                  len=$func_arith_result
@@ -7217,7 +7541,8 @@ EOF
              # reloadable object file.  All subsequent reloadable object
              # files will link in the last one created.
              test -z "$concat_cmds" || concat_cmds=$concat_cmds~
-             eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
+             reload_objs="$objlist $last_robj"
+             eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
              if test -n "$last_robj"; then
                eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
              fi
@@ -7276,7 +7601,7 @@ EOF
            if test -n "$export_symbols" && test -n "$include_expsyms"; then
              tmp_export_symbols="$export_symbols"
              test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
-             $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
+             $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
            fi
 
            if test -n "$orig_export_symbols"; then
@@ -7441,7 +7766,7 @@ EOF
       if test -n "$convenience"; then
        if test -n "$whole_archive_flag_spec"; then
          eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
-         reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
+         reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
        else
          gentop="$output_objdir/${obj}x"
          generated="$generated $gentop"
@@ -7452,7 +7777,7 @@ EOF
       fi
 
       # Create the old-style object.
-      reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+      reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
 
       output="$obj"
       func_execute_cmds "$reload_cmds" 'exit $?'
@@ -7512,8 +7837,8 @@ EOF
       case $host in
       *-*-rhapsody* | *-*-darwin1.[012])
        # On Rhapsody replace the C library is the System framework
-       compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
-       finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
+       compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
+       finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
        ;;
       esac
 
@@ -7530,8 +7855,8 @@ EOF
          esac
        fi
        # Time to change all our "foo.ltframework" stuff back to "-framework foo"
-       compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
-       finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+       compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+       finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
        ;;
       esac
 
@@ -7668,8 +7993,8 @@ EOF
 
       if test -n "$libobjs" && test "$build_old_libs" = yes; then
        # Transform all the library objects into standard objects.
-       compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
-       finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+       compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
+       finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
       fi
 
       func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
@@ -7681,15 +8006,15 @@ EOF
 
       wrappers_required=yes
       case $host in
+      *cegcc* | *mingw32ce*)
+        # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
+        wrappers_required=no
+        ;;
       *cygwin* | *mingw* )
         if test "$build_libtool_libs" != yes; then
           wrappers_required=no
         fi
         ;;
-      *cegcc)
-        # Disable wrappers for cegcc, we are cross compiling anyway.
-        wrappers_required=no
-        ;;
       *)
         if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
           wrappers_required=no
@@ -7698,7 +8023,7 @@ EOF
       esac
       if test "$wrappers_required" = no; then
        # Replace the output file specification.
-       compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+       compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
        link_command="$compile_command$compile_rpath"
 
        # We have no uninstalled library dependencies, so finalize right now.
@@ -7745,7 +8070,7 @@ EOF
        # We don't need to create a wrapper script.
        link_command="$compile_var$compile_command$compile_rpath"
        # Replace the output file specification.
-       link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+       link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
        # Delete the old output file.
        $opt_dry_run || $RM $output
        # Link the executable and exit
@@ -7764,7 +8089,7 @@ EOF
        if test "$fast_install" != no; then
          link_command="$finalize_var$compile_command$finalize_rpath"
          if test "$fast_install" = yes; then
-           relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
+           relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
          else
            # fast_install is set to needless
            relink_command=
@@ -7776,7 +8101,7 @@ EOF
       fi
 
       # Replace the output file specification.
-      link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+      link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
 
       # Delete the old output files.
       $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
@@ -7800,18 +8125,7 @@ EOF
          fi
        done
        relink_command="(cd `pwd`; $relink_command)"
-       relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
-      fi
-
-      # Quote $ECHO for shipping.
-      if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
-       case $progpath in
-       [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
-       *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
-       esac
-       qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
-      else
-       qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
+       relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
       fi
 
       # Only actually do things if not in dry run mode.
@@ -7932,7 +8246,7 @@ EOF
            done | sort | sort -uc >/dev/null 2>&1); then
          :
        else
-         $ECHO "copying selected object files to avoid basename conflicts..."
+         echo "copying selected object files to avoid basename conflicts..."
          gentop="$output_objdir/${outputname}x"
          generated="$generated $gentop"
          func_mkdir_p "$gentop"
@@ -8043,7 +8357,7 @@ EOF
       done
       # Quote the link command for shipping.
       relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
-      relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+      relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
       if test "$hardcode_automatic" = yes ; then
        relink_command=
       fi
@@ -8128,9 +8442,27 @@ EOF
          fi
          $RM $output
          # place dlname in correct position for cygwin
+         # In fact, it would be nice if we could use this code for all target
+         # systems that can't hard-code library paths into their executables
+         # and that have no shared library path variable independent of PATH,
+         # but it turns out we can't easily determine that from inspecting
+         # libtool variables, so we have to hard-code the OSs to which it
+         # applies here; at the moment, that means platforms that use the PE
+         # object format with DLL files.  See the long comment at the top of
+         # tests/bindir.at for full details.
          tdlname=$dlname
          case $host,$output,$installed,$module,$dlname in
-           *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
+           *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
+             # If a -bindir argument was supplied, place the dll there.
+             if test "x$bindir" != x ;
+             then
+               func_relative_path "$install_libdir" "$bindir"
+               tdlname=$func_relative_path_result$dlname
+             else
+               # Otherwise fall back on heuristic.
+               tdlname=../bin/$dlname
+             fi
+             ;;
          esac
          $ECHO > $output "\
 # $outputname - a libtool library file
index 28055d2..ac3d51c 100755 (executable)
@@ -18,7 +18,9 @@ scriptversion=2009-04-28.21; # UTC
 # GNU General Public License for more details.
 
 # You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
 
 # As a special exception to the GNU General Public License, if you
 # distribute this file as part of a program that contains a
index 83c2e4b..f5d1b2b 100644 (file)
@@ -6,6 +6,7 @@
 #endif
 
 #include <confuse.h>
+#include <stdlib.h>
 #include <string.h>
 #include <radsec/radsec.h>
 #include <radsec/radsec-impl.h>
index 9a618f8..086a4fe 100644 (file)
@@ -17,8 +17,6 @@ AC_CHECK_LIB([confuse], [cfg_init],,
     AC_MSG_ERROR([required library libconfuse not found]))
 AC_CHECK_LIB([event_core], [event_get_version],,
     AC_MSG_ERROR([required library libevent_core not found]))
-AC_CHECK_LIB([freeradius-radius], [rad_alloc],,
-    AC_MSG_ERROR([required library libfreeradius-radius not found]))
 
 # Enable-knobs.
 AH_TEMPLATE([RS_ENABLE_TLS], [TLS (RadSec) enabled])
@@ -43,6 +41,7 @@ AC_TYPE_UINT8_T
 AC_CHECK_FUNCS([memset socket strdup strerror strrchr])
 
 AC_CONFIG_FILES([Makefile
+                radius/Makefile
                 include/Makefile
                  examples/Makefile
                  tests/Makefile])
index 36893bc..7d0a794 100644 (file)
@@ -6,6 +6,8 @@
 #endif
 
 #include <string.h>
+#include <stdlib.h>
+#include <errno.h>
 #include <assert.h>
 #include <event2/event.h>
 #include <event2/bufferevent.h>
index 3d3a2b9..2c399a1 100644 (file)
@@ -7,7 +7,7 @@
 
 #include <stdio.h>
 #include <assert.h>
-#include <freeradius/libradius.h>
+#include <radius/client.h>
 #include <radsec/radsec.h>
 #include <radsec/radsec-impl.h>
 #include "debug.h"
@@ -21,10 +21,10 @@ rs_dump_packet (const struct rs_packet *pkt)
     return;
   p = pkt->rpkt;
 
-  fprintf (stderr, "\tCode: %u, Identifier: %u, Lenght: %u\n",
+  fprintf (stderr, "\tCode: %u, Identifier: %u, Lenght: %zu\n",
           p->code,
           p->id,
-          p->data_len);
+          p->sizeof_data);
   fflush (stderr);
 }
 
index 4a90019..e318047 100644 (file)
--- a/lib/err.c
+++ b/lib/err.c
@@ -6,33 +6,56 @@
 #endif
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <assert.h>
 #include <radsec/radsec.h>
 #include <radsec/radsec-impl.h>
 
 static const char *_errtxt[] = {
-  "SUCCESS",                   /* 0 RSE_OK */
-  "out of memory",             /* 1 RSE_NOMEM */
-  "not yet implemented",       /* 2 RSE_NOSYS */
-  "invalid handle",            /* 3 RSE_INVALID_CTX */
-  "invalid connection",                /* 4 RSE_INVALID_CONN */
-  "connection type mismatch",  /* 5 RSE_CONN_TYPE_MISMATCH */
-  "FreeRadius error",          /* 6 RSE_FR */
-  "bad hostname or port",      /* 7 RSE_BADADDR */
-  "no peer configured",                /* 8 RSE_NOPEER */
-  "libevent error",            /* 9 RSE_EVENT */
-  "socket error",              /* 10 RSE_SOCKERR */
-  "invalid configuration file",        /* 11 RSE_CONFIG */
-  "authentication failed",     /* 12 RSE_BADAUTH */
-  "internal error",            /* 13 RSE_INTERNAL */
-  "SSL error",                 /* 14 RSE_SSLERR */
-  "invalid packet",            /* 15 RSE_INVALID_PKT */
-  "connect timeout",           /* 16 RSE_TIMEOUT_CONN */
-  "invalid argument",          /* 17 RSE_INVAL */
-  "I/O timeout",               /* 18 RSE_TIMEOUT_IO */
-  "timeout",                   /* 19 RSE_TIMEOUT */
-  "peer disconnected",         /* 20 RSE_DISCO */
+  "SUCCESS",                                   /* 0 RSE_OK */
+  "out of memory",                             /* 1 RSE_NOMEM */
+  "not yet implemented",                       /* 2 RSE_NOSYS */
+  "invalid handle",                            /* 3 RSE_INVALID_CTX */
+  "invalid connection",                                /* 4 RSE_INVALID_CONN */
+  "connection type mismatch",                  /* 5 RSE_CONN_TYPE_MISMATCH */
+  "FreeRadius error",                          /* 6 RSE_FR */
+  "bad hostname or port",                      /* 7 RSE_BADADDR */
+  "no peer configured",                                /* 8 RSE_NOPEER */
+  "libevent error",                            /* 9 RSE_EVENT */
+  "socket error",                              /* 10 RSE_SOCKERR */
+  "invalid configuration file",                        /* 11 RSE_CONFIG */
+  "authentication failed",                     /* 12 RSE_BADAUTH */
+  "internal error",                            /* 13 RSE_INTERNAL */
+  "SSL error",                                 /* 14 RSE_SSLERR */
+  "invalid packet",                            /* 15 RSE_INVALID_PKT */
+  "connect timeout",                           /* 16 RSE_TIMEOUT_CONN */
+  "invalid argument",                          /* 17 RSE_INVAL */
+  "I/O timeout",                               /* 18 RSE_TIMEOUT_IO */
+  "timeout",                                   /* 19 RSE_TIMEOUT */
+  "peer disconnected",                         /* 20 RSE_DISCO */
+  "resource is in use",                                /* 21 RSE_INUSE */
+  "packet is too small",                       /* 22 RSE_PACKET_TOO_SMALL */
+  "packet is too large",                       /* 23 RSE_PACKET_TOO_LARGE */
+  "attribute overflows packet",                        /* 24 RSE_ATTR_OVERFLOW */
+  "attribute is too small",                    /* 25 RSE_ATTR_TOO_SMALL */
+  "attribute is too large",                    /* 26 RSE_ATTR_TOO_LARGE */
+  "unknown attribute",                         /* 27 RSE_ATTR_UNKNOWN */
+  "invalid name for attribute",                        /* 28 RSE_ATTR_BAD_NAME */
+  "invalid value for attribute",               /* 29 RSE_ATTR_VALUE_MALFORMED */
+  "invalid attribute",                         /* 30 RSE_ATTR_INVALID */
+  "too many attributes in the packet",         /* 31 RSE_TOO_MANY_ATTRS */
+  "attribute type unknown",                    /* 32 RSE_ATTR_TYPE_UNKNOWN */
+  "invalid message authenticator",             /* 33 RSE_MSG_AUTH_LEN */
+  "incorrect message authenticator",           /* 34 RSE_MSG_AUTH_WRONG */
+  "request is required",                       /* 35 RSE_REQUEST_REQUIRED */
+  "invalid request code",                      /* 36 RSE_REQUEST_CODE_INVALID */
+  "incorrect request authenticator",           /* 37 RSE_AUTH_VECTOR_WRONG */
+  "response code is unsupported",              /* 38 RSE_INVALID_RESPONSE_CODE */
+  "response ID is invalid",                    /* 39 RSE_INVALID_RESPONSE_ID */
+  "response from the wrong source address",    /* 40 RSE_INVALID_RESPONSE_SRC */
+  "no packet data",                            /* 41 RSE_NO_PACKET_DATA */
+  "vendor is unknown",                         /* 42 RSE_VENDOR_UNKNOWN */
 };
 #define ERRTXT_SIZE (sizeof(_errtxt) / sizeof(*_errtxt))
 
index ff05012..b2096bc 100644 (file)
@@ -6,6 +6,9 @@
 #endif
 
 #include <assert.h>
+#include <string.h>
+#include <errno.h>
+
 #include <event2/event.h>
 #include <event2/bufferevent.h>
 #if defined (RS_ENABLE_TLS)
index 23cd674..419be8c 100644 (file)
@@ -7,6 +7,7 @@
 #include <event2/event.h>
 #include <freeradius/libradius.h>
 #include <radsec/radsec.h>
+#include <radsec/radsec-impl.h>
 #include <radsec/request.h>
 #include "debug.h"             /* For rs_dump_packet().  */
 
@@ -73,7 +74,7 @@ blocking_client (const char *av1, const char *av2, int use_request_object_flag)
   if (resp)
     {
       rs_dump_packet (resp);
-      if (rs_packet_frpkt (resp)->code == PW_AUTHENTICATION_ACK)
+      if (rs_packet_frpkt (resp)->code == PW_ACCESS_ACCEPT)
        printf ("Good auth.\n");
       else
        printf ("Bad auth: %d\n", rs_packet_frpkt (resp)->code);
index 5b02eb2..33b898c 100644 (file)
@@ -2,6 +2,11 @@ RADSEC_EXPORT = \
        radsec/radsec.h \
        radsec/radsec-impl.h \
        radsec/request.h \
-       radsec/request-impl.h
+       radsec/request-impl.h \
+       radsec/radius.h
 EXTRA_SRC = $(RADSEC_EXPORT)
 nobase_include_HEADERS = $(RADSEC_EXPORT)
+
+clean-local:
+       rm -f radsec/radius.h
+
diff --git a/lib/include/radsec/.gitignore b/lib/include/radsec/.gitignore
new file mode 100644 (file)
index 0000000..c20d18b
--- /dev/null
@@ -0,0 +1 @@
+radius.h
index f8891ee..2df632a 100644 (file)
@@ -3,7 +3,9 @@
 
 /* See the file COPYING for licensing information.  */
 
-#include <freeradius/libradius.h>
+#ifndef _RADSEC_RADSEC_IMPL_H_
+#define _RADSEC_RADSEC_IMPL_H_ 1
+
 #include <event2/util.h>
 #include <confuse.h>
 #if defined(RS_ENABLE_TLS)
@@ -69,7 +71,6 @@ struct rs_context {
     struct rs_config *config;
     struct rs_alloc_scheme alloc_scheme;
     struct rs_error *err;
-    fr_randctx fr_randctx;
 };
 
 struct rs_connection {
@@ -108,11 +109,13 @@ enum rs_packet_flags {
     rs_packet_sent_flag,
 };
 
+struct radius_packet;
+
 struct rs_packet {
     struct rs_connection *conn;
     unsigned int flags;
     uint8_t hdr[RS_HEADER_LEN];
-    RADIUS_PACKET *rpkt;       /* FreeRADIUS object.  */
+    struct radius_packet *rpkt;        /* FreeRADIUS object.  */
     struct rs_packet *next;    /* Used for UDP output queue.  */
 };
 
@@ -121,6 +124,10 @@ struct rs_error *rs_resolv (struct evutil_addrinfo **addr,
                            rs_conn_type_t type,
                            const char *hostname,
                            const char *service);
+
+/** Return the internal packet associated with packet \a pkt.  */
+struct radius_packet *rs_packet_frpkt(struct rs_packet *pkt);
+
 #if defined (__cplusplus)
 }
 #endif
@@ -137,6 +144,8 @@ struct rs_error *rs_resolv (struct evutil_addrinfo **addr,
 #define min(a, b) ((a) < (b) ? (a) : (b))
 #define max(a, b) ((a) > (b) ? (a) : (b))
 
+#endif /* _RADSEC_RADSEC_IMPL_H_ */
+
 /* Local Variables: */
 /* c-file-style: "stroustrup" */
 /* End: */
index 2744cd2..1aef6bb 100644 (file)
@@ -3,14 +3,14 @@
 
 /* See the file COPYING for licensing information.  */
 
+#ifndef _RADSEC_RADSEC_H_
+#define _RADSEC_RADSEC_H_ 1
+
 #include <unistd.h>
-#include <sys/time.h>
+#include <stdint.h>
 
-#ifdef SYSCONFDIR
-#define RS_FREERADIUS_DICT SYSCONFDIR "/raddb/dictionary"
-#else  /* !SYSCONFDIR */
-#define RS_FREERADIUS_DICT "/usr/local/raddb/dictionary"
-#endif  /* !SYSCONFDIR */
+#include <arpa/inet.h>
+#include <sys/time.h>
 
 enum rs_error_code {
     RSE_OK = 0,
@@ -19,7 +19,7 @@ enum rs_error_code {
     RSE_INVALID_CTX = 3,
     RSE_INVALID_CONN = 4,
     RSE_CONN_TYPE_MISMATCH = 5,
-    RSE_FR = 6,                        /* FreeRADIUS error.  */
+    RSE_FR = 6,
     RSE_BADADDR = 7,
     RSE_NOPEER = 8,
     RSE_EVENT = 9,             /* libevent error.  */
@@ -32,8 +32,31 @@ enum rs_error_code {
     RSE_TIMEOUT_CONN = 16,     /* Connection timeout.  */
     RSE_INVAL = 17,            /* Invalid argument.  */
     RSE_TIMEOUT_IO = 18,       /* I/O timeout.  */
-    RSE_TIMEOUT = 19,          /* High level timeout.  */
+    RSE_TIMEOUT= 19,           /* High level timeout.  */
     RSE_DISCO = 20,
+    RSE_INUSE = 21,
+    RSE_PACKET_TOO_SMALL = 22,
+    RSE_PACKET_TOO_LARGE = 23,
+    RSE_ATTR_OVERFLOW = 24,
+    RSE_ATTR_TOO_SMALL = 25,
+    RSE_ATTR_TOO_LARGE = 26,
+    RSE_ATTR_UNKNOWN = 27,
+    RSE_ATTR_BAD_NAME = 28,
+    RSE_ATTR_VALUE_MALFORMED = 29,
+    RSE_ATTR_INVALID = 30,
+    RSE_TOO_MANY_ATTRS = 31,
+    RSE_ATTR_TYPE_UNKNOWN = 32,
+    RSE_MSG_AUTH_LEN = 33,
+    RSE_MSG_AUTH_WRONG = 34,
+    RSE_REQUEST_REQUIRED = 35,
+    RSE_INVALID_REQUEST_CODE = 36,
+    RSE_AUTH_VECTOR_WRONG = 37,
+    RSE_INVALID_RESPONSE_CODE = 38,
+    RSE_INVALID_RESPONSE_ID = 39,
+    RSE_INVALID_RESPONSE_SRC = 40,
+    RSE_NO_PACKET_DATA = 41,
+    RSE_VENDOR_UNKNOWN = 42,
+    RSE_MAX = RSE_VENDOR_UNKNOWN
 };
 
 enum rs_conn_type {
@@ -45,6 +68,39 @@ enum rs_conn_type {
 };
 typedef unsigned int rs_conn_type_t;
 
+typedef enum rs_attr_type_t {
+    RS_TYPE_INVALID = 0,               /**< Invalid data type */
+    RS_TYPE_STRING,                    /**< printable-text */
+    RS_TYPE_INTEGER,                   /**< a 32-bit unsigned integer */
+    RS_TYPE_IPADDR,                    /**< an IPv4 address */
+    RS_TYPE_DATE,                      /**< a 32-bit date, of seconds since January 1, 1970 */
+    RS_TYPE_OCTETS,                    /**< a sequence of binary octets */
+    RS_TYPE_IFID,                      /**< an Interface Id */
+    RS_TYPE_IPV6ADDR,                  /**< an IPv6 address */
+    RS_TYPE_IPV6PREFIX,                        /**< an IPv6 prefix */
+    RS_TYPE_BYTE,                      /**< an 8-bit integer */
+    RS_TYPE_SHORT,                     /**< a 16-bit integer */
+} rs_attr_type_t;
+
+#define        PW_ACCESS_REQUEST               1
+#define        PW_ACCESS_ACCEPT                2
+#define        PW_ACCESS_REJECT                3
+#define        PW_ACCOUNTING_REQUEST           4
+#define        PW_ACCOUNTING_RESPONSE          5
+#define        PW_ACCOUNTING_STATUS            6
+#define PW_PASSWORD_REQUEST            7
+#define PW_PASSWORD_ACK                        8
+#define PW_PASSWORD_REJECT             9
+#define        PW_ACCOUNTING_MESSAGE           10
+#define PW_ACCESS_CHALLENGE            11
+#define PW_STATUS_SERVER               12
+#define PW_STATUS_CLIENT               13
+#define PW_DISCONNECT_REQUEST          40
+#define PW_DISCONNECT_ACK              41
+#define PW_DISCONNECT_NAK              42
+#define PW_COA_REQUEST                 43
+#define PW_COA_ACK                     44
+#define PW_COA_NAK                     45
 
 #if defined (__cplusplus)
 extern "C" {
@@ -57,7 +113,8 @@ struct rs_packet;            /* radsec-impl.h */
 struct rs_conn;                        /* radsec-impl.h */
 struct rs_error;               /* radsec-impl.h */
 struct rs_peer;                        /* radsec-impl.h */
-struct radius_packet;          /* <freeradius/libradius.h> */
+struct radius_packet;          /* <radius/client.h> */
+struct value_pair;             /* <radius/client.h> */
 struct event_base;             /* <event2/event-internal.h> */
 
 typedef void *(*rs_calloc_fp) (size_t nmemb, size_t size);
@@ -87,6 +144,8 @@ struct rs_conn_callbacks {
     rs_conn_packet_sent_cb sent_cb;
 };
 
+typedef struct value_pair rs_avp;
+typedef const struct value_pair rs_const_avp;
 
 /* Function prototypes.  */
 
@@ -251,9 +310,6 @@ void rs_packet_destroy(struct rs_packet *pkt);
     rs_err_conn_pop.  */
 int rs_packet_send(struct rs_packet *pkt, void *user_data);
 
-/** Return the FreeRADIUS packet associated with packet \a pkt.  */
-struct radius_packet *rs_packet_frpkt(struct rs_packet *pkt);
-
 /** Create a RADIUS authentication request packet associated with
     connection \a conn.  Optionally, User-Name and User-Password
     attributes are added to the packet using the data in \a user_name
@@ -263,6 +319,28 @@ int rs_packet_create_authn_request(struct rs_connection *conn,
                                   const char *user_name,
                                   const char *user_pw);
 
+/*** Append \a tail to packet \a pkt.  */
+int
+rs_packet_append_avp(struct rs_packet *pkt,
+                    unsigned int attribute, unsigned int vendor,
+                    const void *data, size_t data_len);
+
+/*** Get pointer to \a pkt attribute value pairs. */
+void
+rs_packet_avps(struct rs_packet *pkt, rs_avp ***vps);
+
+/*** Get RADIUS packet type of \a pkt. */
+unsigned int
+rs_packet_code(struct rs_packet *pkt);
+
+/*** Get RADIUS AVP from \a pkt. */
+rs_const_avp *
+rs_packet_find_avp(struct rs_packet *pkt, unsigned int attr, unsigned int vendor);
+
+/*** Set packet identifier in \a pkt; returns old identifier */
+int
+rs_packet_set_id (struct rs_packet *pkt, int id);
+
 /************/
 /* Config.  */
 /************/
@@ -309,10 +387,154 @@ void rs_err_free(struct rs_error *err);
 char *rs_err_msg(struct rs_error *err);
 int rs_err_code(struct rs_error *err, int dofree_flag);
 
+/************/
+/* AVPs.    */
+/************/
+#define rs_avp_is_string(vp)     (rs_avp_typeof(vp) == RS_TYPE_STRING)
+#define rs_avp_is_integer(vp)    (rs_avp_typeof(vp) == RS_TYPE_INTEGER)
+#define rs_avp_is_ipaddr(vp)     (rs_avp_typeof(vp) == RS_TYPE_IPADDR)
+#define rs_avp_is_date(vp)       (rs_avp_typeof(vp) == RS_TYPE_DATE)
+#define rs_avp_is_octets(vp)     (rs_avp_typeof(vp) == RS_TYPE_OCTETS)
+#define rs_avp_is_ifid(vp)       (rs_avp_typeof(vp) == RS_TYPE_IFID)
+#define rs_avp_is_ipv6addr(vp)   (rs_avp_typeof(vp) == RS_TYPE_IPV6ADDR)
+#define rs_avp_is_ipv6prefix(vp)  (rs_avp_typeof(vp) == RS_TYPE_IPV6PREFIX)
+#define rs_avp_is_byte(vp)       (rs_avp_typeof(vp) == RS_TYPE_BYTE)
+#define rs_avp_is_short(vp)      (rs_avp_typeof(vp) == RS_TYPE_SHORT)
+#define rs_avp_is_tlv(vp)        (rs_avp_typeof(vp) == RS_TYPE_TLV)
+
+/**  The maximum length of a RADIUS attribute.
+ *
+ *  The RFCs require that a RADIUS attribute transport no more than
+ *  253 octets of data.  We add an extra byte for a trailing NUL, so
+ *  that the VALUE_PAIR::vp_strvalue field can be handled as a C
+ *  string.
+ */
+#define RS_MAX_STRING_LEN         254
+
+void
+rs_avp_free(rs_avp **vps);
+
+size_t
+rs_avp_length(rs_const_avp *vp);
+
+rs_attr_type_t
+rs_avp_typeof(rs_const_avp *vp);
+
+void
+rs_avp_attrid(rs_const_avp *vp, unsigned int *attr, unsigned int *vendor);
+
+
+void
+rs_avp_append(rs_avp **head, rs_avp *tail);
+
+rs_avp *
+rs_avp_find(rs_avp *vp, unsigned int attr, unsigned int vendor);
+
+rs_const_avp *
+rs_avp_find_const(rs_const_avp *vp, unsigned int attr, unsigned int vendor);
+
+rs_avp *
+rs_avp_alloc(unsigned int attr, unsigned int vendor);
+
+rs_avp *
+rs_avp_dup(rs_const_avp *vp);
+
+int
+rs_avp_delete(rs_avp **first, unsigned int attr, unsigned int vendor);
+
+rs_avp *
+rs_avp_next(rs_avp *avp);
+
+rs_const_avp *
+rs_avp_next_const(rs_const_avp *avp);
+
+const char *
+rs_avp_string_value(rs_const_avp *vp);
+
+int
+rs_avp_string_set(rs_avp *vp, const char *str);
+
+uint32_t
+rs_avp_integer_value(rs_const_avp *vp);
+
+int
+rs_avp_integer_set(rs_avp *vp, uint32_t val);
+
+uint32_t
+rs_avp_ipaddr_value(rs_const_avp *vp);
+
+int
+rs_avp_ipaddr_set(rs_avp *vp, struct in_addr in);
+
+time_t
+rs_avp_date_value(rs_const_avp *vp);
+
+int
+rs_avp_date_set(rs_avp *vp, time_t date);
+
+const unsigned char *
+rs_avp_octets_value_const_ptr(rs_const_avp *vp);
+
+unsigned char *
+rs_avp_octets_value_ptr(rs_avp *vp);
+
+int
+rs_avp_octets_value_byref(rs_avp *vp,
+                         unsigned char **p,
+                         size_t *len);
+
+int
+rs_avp_octets_value(rs_const_avp *vp,
+                   unsigned char *buf,
+                   size_t *len);
+
+int
+rs_avp_fragmented_value(rs_const_avp *vps,
+                       unsigned char *buf,
+                       size_t *len);
+
+int
+rs_avp_octets_set(rs_avp *vp,
+                 const unsigned char *buf,
+                 size_t len);
+
+int
+rs_avp_ifid_value(rs_const_avp *vp, uint8_t val[8]);
+
+int
+rs_avp_ifid_set(rs_avp *vp, const uint8_t val[8]);
+
+uint8_t
+rs_avp_byte_value(rs_const_avp *vp);
+
+int
+rs_avp_byte_set(rs_avp *vp, uint8_t val);
+
+uint16_t
+rs_avp_short_value(rs_const_avp *vp);
+
+int
+rs_avp_short_set(rs_avp *vp, uint16_t val);
+
+size_t
+rs_avp_display_value(rs_const_avp *vp,
+                     char *buffer,
+                     size_t buflen);
+
+int
+rs_attr_find(const char *name,
+             unsigned int *attr,
+             unsigned int *vendor);
+
+const char *
+rs_avp_name(rs_const_avp *vp);
+
 #if defined (__cplusplus)
 }
 #endif
 
+#endif /* _RADSEC_RADSEC_H_ */
+
 /* Local Variables: */
 /* c-file-style: "stroustrup" */
 /* End: */
index 8bcac60..d2c14dd 100644 (file)
@@ -1,5 +1,8 @@
 /* See the file COPYING for licensing information.  */
 
+#ifndef _RADSEC_REQUEST_IMPL_H_
+#define _RADSEC_REQUEST_IMPL_H_ 1
+
 #if defined (__cplusplus)
 extern "C" {
 #endif
@@ -16,3 +19,5 @@ struct rs_request
 #if defined (__cplusplus)
 }
 #endif
+
+#endif /* _RADSEC_REQUEST_IMPL_H_ */
index e914164..f124373 100644 (file)
@@ -3,6 +3,9 @@
 
 /* See the file COPYING for licensing information.  */
 
+#ifndef _RADSEC_REQUEST_H_
+#define _RADSEC_REQUEST_H_ 1
+
 struct rs_request;
 
 #if defined (__cplusplus)
@@ -42,3 +45,5 @@ struct rs_packet *rs_request_get_reqmsg(const struct rs_request *req);
 #if defined (__cplusplus)
 }
 #endif
+
+#endif /* _RADSEC_REQUEST_H_ */
index a3fee53..22924a8 100644 (file)
@@ -1,7 +1,8 @@
 # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
 #
 #   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008 Free Software Foundation, Inc.
+#                 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
+#                 Inc.
 #   Written by Gordon Matzigkeit, 1996
 #
 # This file is free software; the Free Software Foundation gives
@@ -10,7 +11,8 @@
 
 m4_define([_LT_COPYING], [dnl
 #   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008 Free Software Foundation, Inc.
+#                 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
+#                 Inc.
 #   Written by Gordon Matzigkeit, 1996
 #
 #   This file is part of GNU Libtool.
@@ -37,7 +39,7 @@ m4_define([_LT_COPYING], [dnl
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 ])
 
-# serial 56 LT_INIT
+# serial 57 LT_INIT
 
 
 # LT_PREREQ(VERSION)
@@ -66,6 +68,7 @@ esac
 # ------------------
 AC_DEFUN([LT_INIT],
 [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
+AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
 AC_BEFORE([$0], [LT_LANG])dnl
 AC_BEFORE([$0], [LT_OUTPUT])dnl
 AC_BEFORE([$0], [LTDL_INIT])dnl
@@ -82,6 +85,8 @@ AC_REQUIRE([LTVERSION_VERSION])dnl
 AC_REQUIRE([LTOBSOLETE_VERSION])dnl
 m4_require([_LT_PROG_LTMAIN])dnl
 
+_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}])
+
 dnl Parse OPTIONS
 _LT_SET_OPTIONS([$0], [$1])
 
@@ -118,7 +123,7 @@ m4_defun([_LT_CC_BASENAME],
     *) break;;
   esac
 done
-cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
 ])
 
 
@@ -138,6 +143,9 @@ m4_defun([_LT_FILEUTILS_DEFAULTS],
 m4_defun([_LT_SETUP],
 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
+
 _LT_DECL([], [host_alias], [0], [The host system])dnl
 _LT_DECL([], [host], [0])dnl
 _LT_DECL([], [host_os], [0])dnl
@@ -179,7 +187,6 @@ fi
 _LT_CHECK_OBJDIR
 
 m4_require([_LT_TAG_COMPILER])dnl
-_LT_PROG_ECHO_BACKSLASH
 
 case $host_os in
 aix3*)
@@ -193,23 +200,6 @@ aix3*)
   ;;
 esac
 
-# Sed substitution that helps us do robust quoting.  It backslashifies
-# metacharacters that are still active within double-quoted strings.
-sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
-
-# Same as above, but do not quote variable references.
-double_quote_subst='s/\([["`\\]]\)/\\\1/g'
-
-# Sed substitution to delay expansion of an escaped shell variable in a
-# double_quote_subst'ed string.
-delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
-
-# Sed substitution to delay expansion of an escaped single quote.
-delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
-
-# Sed substitution to avoid accidental globbing in evaled expressions
-no_glob_subst='s/\*/\\\*/g'
-
 # Global variables:
 ofile=libtool
 can_build_shared=yes
@@ -250,6 +240,28 @@ _LT_CONFIG_COMMANDS
 ])# _LT_SETUP
 
 
+# _LT_PREPARE_SED_QUOTE_VARS
+# --------------------------
+# Define a few sed substitution that help us do robust quoting.
+m4_defun([_LT_PREPARE_SED_QUOTE_VARS],
+[# Backslashify metacharacters that are still active within
+# double-quoted strings.
+sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([["`\\]]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+])
+
 # _LT_PROG_LTMAIN
 # ---------------
 # Note that this code is called both from `configure', and `config.status'
@@ -408,7 +420,7 @@ m4_define([_lt_decl_all_varnames],
 # declaration there will have the same value as in `configure'.  VARNAME
 # must have a single quote delimited value for this to work.
 m4_define([_LT_CONFIG_STATUS_DECLARE],
-[$1='`$ECHO "X$][$1" | $Xsed -e "$delay_single_quote_subst"`'])
+[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`'])
 
 
 # _LT_CONFIG_STATUS_DECLARATIONS
@@ -418,7 +430,7 @@ m4_define([_LT_CONFIG_STATUS_DECLARE],
 # embedded single quotes properly.  In configure, this macro expands
 # each variable declared with _LT_DECL (and _LT_TAGDECL) into:
 #
-#    <var>='`$ECHO "X$<var>" | $Xsed -e "$delay_single_quote_subst"`'
+#    <var>='`$ECHO "$<var>" | $SED "$delay_single_quote_subst"`'
 m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
 [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),
     [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])
@@ -517,12 +529,20 @@ LTCC='$LTCC'
 LTCFLAGS='$LTCFLAGS'
 compiler='$compiler_DEFAULT'
 
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+\$[]1
+_LTECHO_EOF'
+}
+
 # Quote evaled strings.
 for var in lt_decl_all_varnames([[ \
 ]], lt_decl_quote_varnames); do
-    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
     *[[\\\\\\\`\\"\\\$]]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -533,9 +553,9 @@ done
 # Double-quote double-evaled strings.
 for var in lt_decl_all_varnames([[ \
 ]], lt_decl_dquote_varnames); do
-    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
     *[[\\\\\\\`\\"\\\$]]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -543,16 +563,38 @@ for var in lt_decl_all_varnames([[ \
     esac
 done
 
-# Fix-up fallback echo if it was mangled by the above quoting rules.
-case \$lt_ECHO in
-*'\\\[$]0 --fallback-echo"')dnl "
-  lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\[$]0 --fallback-echo"\[$]/\[$]0 --fallback-echo"/'\`
-  ;;
-esac
-
 _LT_OUTPUT_LIBTOOL_INIT
 ])
 
+# _LT_GENERATED_FILE_INIT(FILE, [COMMENT])
+# ------------------------------------
+# Generate a child script FILE with all initialization necessary to
+# reuse the environment learned by the parent script, and make the
+# file executable.  If COMMENT is supplied, it is inserted after the
+# `#!' sequence but before initialization text begins.  After this
+# macro, additional text can be appended to FILE to form the body of
+# the child script.  The macro ends with non-zero status if the
+# file could not be fully written (such as if the disk is full).
+m4_ifdef([AS_INIT_GENERATED],
+[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])],
+[m4_defun([_LT_GENERATED_FILE_INIT],
+[m4_require([AS_PREPARE])]dnl
+[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl
+[lt_write_fail=0
+cat >$1 <<_ASEOF || lt_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+$2
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$1 <<\_ASEOF || lt_write_fail=1
+AS_SHELL_SANITIZE
+_AS_PREPARE
+exec AS_MESSAGE_FD>&1
+_ASEOF
+test $lt_write_fail = 0 && chmod +x $1[]dnl
+m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT
 
 # LT_OUTPUT
 # ---------
@@ -562,20 +604,11 @@ _LT_OUTPUT_LIBTOOL_INIT
 AC_DEFUN([LT_OUTPUT],
 [: ${CONFIG_LT=./config.lt}
 AC_MSG_NOTICE([creating $CONFIG_LT])
-cat >"$CONFIG_LT" <<_LTEOF
-#! $SHELL
-# Generated by $as_me.
-# Run this file to recreate a libtool stub with the current configuration.
-
-lt_cl_silent=false
-SHELL=\${CONFIG_SHELL-$SHELL}
-_LTEOF
+_LT_GENERATED_FILE_INIT(["$CONFIG_LT"],
+[# Run this file to recreate a libtool stub with the current configuration.])
 
 cat >>"$CONFIG_LT" <<\_LTEOF
-AS_SHELL_SANITIZE
-_AS_PREPARE
-
-exec AS_MESSAGE_FD>&1
+lt_cl_silent=false
 exec AS_MESSAGE_LOG_FD>>config.log
 {
   echo
@@ -601,7 +634,7 @@ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
 m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
 configured by $[0], generated by m4_PACKAGE_STRING.
 
-Copyright (C) 2008 Free Software Foundation, Inc.
+Copyright (C) 2010 Free Software Foundation, Inc.
 This config.lt script is free software; the Free Software Foundation
 gives unlimited permision to copy, distribute and modify it."
 
@@ -646,15 +679,13 @@ chmod +x "$CONFIG_LT"
 # appending to config.log, which fails on DOS, as config.log is still kept
 # open by configure.  Here we exec the FD to /dev/null, effectively closing
 # config.log, so it can be properly (re)opened and appended to by config.lt.
-if test "$no_create" != yes; then
-  lt_cl_success=:
-  test "$silent" = yes &&
-    lt_config_lt_args="$lt_config_lt_args --quiet"
-  exec AS_MESSAGE_LOG_FD>/dev/null
-  $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
-  exec AS_MESSAGE_LOG_FD>>config.log
-  $lt_cl_success || AS_EXIT(1)
-fi
+lt_cl_success=:
+test "$silent" = yes &&
+  lt_config_lt_args="$lt_config_lt_args --quiet"
+exec AS_MESSAGE_LOG_FD>/dev/null
+$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
+exec AS_MESSAGE_LOG_FD>>config.log
+$lt_cl_success || AS_EXIT(1)
 ])# LT_OUTPUT
 
 
@@ -831,11 +862,13 @@ AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
 AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
 AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
 AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
+AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)])
 dnl aclocal-1.4 backwards compatibility:
 dnl AC_DEFUN([AC_LIBTOOL_CXX], [])
 dnl AC_DEFUN([AC_LIBTOOL_F77], [])
 dnl AC_DEFUN([AC_LIBTOOL_FC], [])
 dnl AC_DEFUN([AC_LIBTOOL_GCJ], [])
+dnl AC_DEFUN([AC_LIBTOOL_RC], [])
 
 
 # _LT_TAG_COMPILER
@@ -940,6 +973,31 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
        [lt_cv_ld_exported_symbols_list=no])
        LDFLAGS="$save_LDFLAGS"
     ])
+    AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],
+      [lt_cv_ld_force_load=no
+      cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD
+      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD
+      echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD
+      $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD
+      echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD
+      $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD
+      cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
+      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+      _lt_result=$?
+      if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then
+       lt_cv_ld_force_load=yes
+      else
+       cat conftest.err >&AS_MESSAGE_LOG_FD
+      fi
+        rm -f conftest.err libconftest.a conftest conftest.c
+        rm -rf conftest.dSYM
+    ])
     case $host_os in
     rhapsody* | darwin1.[[012]])
       _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
@@ -967,7 +1025,7 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
     else
       _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
     fi
-    if test "$DSYMUTIL" != ":"; then
+    if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
       _lt_dsymutil='~$DSYMUTIL $lib || :'
     else
       _lt_dsymutil=
@@ -987,7 +1045,11 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
   _LT_TAGVAR(hardcode_direct, $1)=no
   _LT_TAGVAR(hardcode_automatic, $1)=yes
   _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
-  _LT_TAGVAR(whole_archive_flag_spec, $1)=''
+  if test "$lt_cv_ld_force_load" = "yes"; then
+    _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+  else
+    _LT_TAGVAR(whole_archive_flag_spec, $1)=''
+  fi
   _LT_TAGVAR(link_all_deplibs, $1)=yes
   _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
   case $cc_basename in
@@ -995,7 +1057,7 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
      *) _lt_dar_can_shared=$GCC ;;
   esac
   if test "$_lt_dar_can_shared" = "yes"; then
-    output_verbose_link_cmd=echo
+    output_verbose_link_cmd=func_echo_all
     _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
     _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
     _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
@@ -1041,170 +1103,65 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 # _LT_SHELL_INIT(ARG)
 # -------------------
 m4_define([_LT_SHELL_INIT],
-[ifdef([AC_DIVERSION_NOTICE],
-            [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
-        [AC_DIVERT_PUSH(NOTICE)])
-$1
-AC_DIVERT_POP
-])# _LT_SHELL_INIT
+[m4_divert_text([M4SH-INIT], [$1
+])])# _LT_SHELL_INIT
+
 
 
 # _LT_PROG_ECHO_BACKSLASH
 # -----------------------
-# Add some code to the start of the generated configure script which
-# will find an echo command which doesn't interpret backslashes.
+# Find how we can fake an echo command that does not interpret backslash.
+# In particular, with Autoconf 2.60 or later we add some code to the start
+# of the generated configure script which will find a shell with a builtin
+# printf (which we can use as an echo command).
 m4_defun([_LT_PROG_ECHO_BACKSLASH],
-[_LT_SHELL_INIT([
-# Check that we are running under the correct shell.
-SHELL=${CONFIG_SHELL-/bin/sh}
-
-case X$lt_ECHO in
-X*--fallback-echo)
-  # Remove one level of quotation (which was required for Make).
-  ECHO=`echo "$lt_ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
-  ;;
-esac
-
-ECHO=${lt_ECHO-echo}
-if test "X[$]1" = X--no-reexec; then
-  # Discard the --no-reexec flag, and continue.
-  shift
-elif test "X[$]1" = X--fallback-echo; then
-  # Avoid inline document here, it may be left over
-  :
-elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then
-  # Yippee, $ECHO works!
-  :
+[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+AC_MSG_CHECKING([how to print strings])
+# Test print first, because it will be a builtin if present.
+if test "X`print -r -- -n 2>/dev/null`" = X-n && \
+   test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='printf %s\n'
 else
-  # Restart under the correct shell.
-  exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
-fi
-
-if test "X[$]1" = X--fallback-echo; then
-  # used as fallback echo
-  shift
-  cat <<_LT_EOF
-[$]*
-_LT_EOF
-  exit 0
+  # Use this function as a fallback that always works.
+  func_fallback_echo ()
+  {
+    eval 'cat <<_LTECHO_EOF
+$[]1
+_LTECHO_EOF'
+  }
+  ECHO='func_fallback_echo'
 fi
 
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-if test -z "$lt_ECHO"; then
-  if test "X${echo_test_string+set}" != Xset; then
-    # find a string as large as possible, as long as the shell can cope with it
-    for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
-      # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
-      if { echo_test_string=`eval $cmd`; } 2>/dev/null &&
-        { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null
-      then
-        break
-      fi
-    done
-  fi
-
-  if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
-     echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
-     test "X$echo_testing_string" = "X$echo_test_string"; then
-    :
-  else
-    # The Solaris, AIX, and Digital Unix default echo programs unquote
-    # backslashes.  This makes it impossible to quote backslashes using
-    #   echo "$something" | sed 's/\\/\\\\/g'
-    #
-    # So, first we look for a working echo in the user's PATH.
-
-    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-    for dir in $PATH /usr/ucb; do
-      IFS="$lt_save_ifs"
-      if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
-         test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
-         echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
-         test "X$echo_testing_string" = "X$echo_test_string"; then
-        ECHO="$dir/echo"
-        break
-      fi
-    done
-    IFS="$lt_save_ifs"
-
-    if test "X$ECHO" = Xecho; then
-      # We didn't find a better echo, so look for alternatives.
-      if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' &&
-         echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` &&
-         test "X$echo_testing_string" = "X$echo_test_string"; then
-        # This shell has a builtin print -r that does the trick.
-        ECHO='print -r'
-      elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } &&
-          test "X$CONFIG_SHELL" != X/bin/ksh; then
-        # If we have ksh, try running configure again with it.
-        ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-        export ORIGINAL_CONFIG_SHELL
-        CONFIG_SHELL=/bin/ksh
-        export CONFIG_SHELL
-        exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
-      else
-        # Try using printf.
-        ECHO='printf %s\n'
-        if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
-          echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
-          test "X$echo_testing_string" = "X$echo_test_string"; then
-         # Cool, printf works
-         :
-        elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
-            test "X$echo_testing_string" = 'X\t' &&
-            echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
-            test "X$echo_testing_string" = "X$echo_test_string"; then
-         CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
-         export CONFIG_SHELL
-         SHELL="$CONFIG_SHELL"
-         export SHELL
-         ECHO="$CONFIG_SHELL [$]0 --fallback-echo"
-        elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
-            test "X$echo_testing_string" = 'X\t' &&
-            echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
-            test "X$echo_testing_string" = "X$echo_test_string"; then
-         ECHO="$CONFIG_SHELL [$]0 --fallback-echo"
-        else
-         # maybe with a smaller string...
-         prev=:
-
-         for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
-           if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null
-           then
-             break
-           fi
-           prev="$cmd"
-         done
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO "$*" 
+}
 
-         if test "$prev" != 'sed 50q "[$]0"'; then
-           echo_test_string=`eval $prev`
-           export echo_test_string
-           exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
-         else
-           # Oops.  We lost completely, so just stick with echo.
-           ECHO=echo
-         fi
-        fi
-      fi
-    fi
-  fi
-fi
+case "$ECHO" in
+  printf*) AC_MSG_RESULT([printf]) ;;
+  print*) AC_MSG_RESULT([print -r]) ;;
+  *) AC_MSG_RESULT([cat]) ;;
+esac
 
-# Copy echo and quote the copy suitably for passing to libtool from
-# the Makefile, instead of quoting the original, which is used later.
-lt_ECHO=$ECHO
-if test "X$lt_ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
-   lt_ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
-fi
+m4_ifdef([_AS_DETECT_SUGGESTED],
+[_AS_DETECT_SUGGESTED([
+  test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || (
+    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+    PATH=/empty FPATH=/empty; export PATH FPATH
+    test "X`printf %s $ECHO`" = "X$ECHO" \
+      || test "X`print -r -- $ECHO`" = "X$ECHO" )])])
 
-AC_SUBST(lt_ECHO)
-])
 _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
-_LT_DECL([], [ECHO], [1],
-    [An echo program that does not interpret backslashes])
+_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])
 ])# _LT_PROG_ECHO_BACKSLASH
 
 
@@ -1236,7 +1193,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+  echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext
   if AC_TRY_EVAL(ac_compile); then
     if test "$lt_cv_prog_gnu_ld" = yes; then
       case `/usr/bin/file conftest.$ac_objext` in
@@ -1388,10 +1345,19 @@ if test -n "$RANLIB"; then
   esac
   old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
 fi
+
+case $host_os in
+  darwin*)
+    lock_old_archive_extraction=yes ;;
+  *)
+    lock_old_archive_extraction=no ;;
+esac
 _LT_DECL([], [old_postinstall_cmds], [2])
 _LT_DECL([], [old_postuninstall_cmds], [2])
 _LT_TAGDECL([], [old_archive_cmds], [2],
     [Commands used to build an old-style archive])
+_LT_DECL([], [lock_old_archive_extraction], [0],
+    [Whether to use a lock for old archive extraction])
 ])# _LT_CMD_OLD_ARCHIVE
 
 
@@ -1416,15 +1382,15 @@ AC_CACHE_CHECK([$1], [$2],
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&AS_MESSAGE_LOG_FD
-   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
      $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
      if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
        $2=yes
@@ -1464,7 +1430,7 @@ AC_CACHE_CHECK([$1], [$2],
      if test -s conftest.err; then
        # Append any errors to the config.log.
        cat conftest.err 1>&AS_MESSAGE_LOG_FD
-       $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
        $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
        if diff conftest.exp conftest.er2 >/dev/null; then
          $2=yes
@@ -1527,6 +1493,11 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
     lt_cv_sys_max_cmd_len=8192;
     ;;
 
+  mint*)
+    # On MiNT this can take a long time and run out of memory.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
   amigaos*)
     # On AmigaOS with pdksh, this test takes hours, literally.
     # So we just punt and use a minimum line length of 8192.
@@ -1591,8 +1562,8 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
       # If test is not a shell built-in, we'll probably end up computing a
       # maximum length that is only half of the actual maximum length, but
       # we can't tell.
-      while { test "X"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
-                = "XX$teststring$teststring"; } >/dev/null 2>&1 &&
+      while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \
+                = "X$teststring$teststring"; } >/dev/null 2>&1 &&
              test $i != 17 # 1/2 MB should be enough
       do
         i=`expr $i + 1`
@@ -1643,7 +1614,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-[#line __oline__ "configure"
+[#line $LINENO "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -1684,7 +1655,13 @@ else
 #  endif
 #endif
 
-void fnord() { int i=42;}
+/* When -fvisbility=hidden is used, assume the code has been annotated
+   correspondingly for the symbols needed.  */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+void fnord () __attribute__((visibility("default")));
+#endif
+
+void fnord () { int i=42; }
 int main ()
 {
   void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
@@ -1693,7 +1670,11 @@ int main ()
   if (self)
     {
       if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
-      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      else
+        {
+         if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
+          else puts (dlerror ());
+       }
       /* dlclose (self); */
     }
   else
@@ -1869,16 +1850,16 @@ AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&AS_MESSAGE_LOG_FD
-   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
-     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
      $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
      if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
        _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
@@ -2037,6 +2018,7 @@ m4_require([_LT_DECL_EGREP])dnl
 m4_require([_LT_FILEUTILS_DEFAULTS])dnl
 m4_require([_LT_DECL_OBJDUMP])dnl
 m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_CHECK_SHELL_FEATURES])dnl
 AC_MSG_CHECKING([dynamic linker characteristics])
 m4_if([$1],
        [], [
@@ -2045,16 +2027,23 @@ if test "$GCC" = yes; then
     darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
     *) lt_awk_arg="/^libraries:/" ;;
   esac
-  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-  if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then
+  case $host_os in
+    mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;;
+    *) lt_sed_strip_eq="s,=/,/,g" ;;
+  esac
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+  case $lt_search_path_spec in
+  *\;*)
     # if the path contains ";" then we assume it to be the separator
     # otherwise default to the standard path separator (i.e. ":") - it is
     # assumed that no part of a normal pathname contains ";" but that should
     # okay in the real world where ";" in dirpaths is itself problematic.
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'`
-  else
-    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-  fi
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+    ;;
+  *)
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+    ;;
+  esac
   # Ok, now we have the path, separated by spaces, we can step through it
   # and add multilib dir if necessary.
   lt_tmp_lt_search_path_spec=
@@ -2067,7 +2056,7 @@ if test "$GCC" = yes; then
        lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
     fi
   done
-  lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk '
+  lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
 BEGIN {RS=" "; FS="/|\n";} {
   lt_foo="";
   lt_count=0;
@@ -2087,7 +2076,13 @@ BEGIN {RS=" "; FS="/|\n";} {
   if (lt_foo != "") { lt_freq[[lt_foo]]++; }
   if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
 }'`
-  sys_lib_search_path_spec=`$ECHO $lt_search_path_spec`
+  # AWK program above erroneously prepends '/' to C:/dos/paths
+  # for these hosts.
+  case $host_os in
+    mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+      $SED 's,/\([[A-Za-z]]:\),\1,g'` ;;
+  esac
+  sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
 else
   sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
 fi])
@@ -2175,7 +2170,7 @@ amigaos*)
   m68k)
     library_names_spec='$libname.ixlibrary $libname.a'
     # Create ${libname}_ixlibrary.a entries in /sys/libs.
-    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
     ;;
   esac
   ;;
@@ -2228,23 +2223,12 @@ cygwin* | mingw* | pw32* | cegcc*)
     cygwin*)
       # Cygwin DLLs use 'cyg' prefix rather than 'lib'
       soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+m4_if([$1], [],[
+      sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
       ;;
     mingw* | cegcc*)
       # MinGW DLLs use traditional 'lib' prefix
       soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-      if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
-        # It is most probably a Windows format PATH printed by
-        # mingw gcc, but we are running on Cygwin. Gcc prints its search
-        # path with ; separators, and with drive letters. We can handle the
-        # drive letters (cygwin fileutils understands them), so leave them,
-        # especially as we might pass files found there to a mingw objdump,
-        # which wouldn't understand a cygwinified path. Ahh.
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
-      else
-        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-      fi
       ;;
     pw32*)
       # pw32 DLLs use 'pw' prefix rather than 'lib'
@@ -2344,6 +2328,19 @@ gnu*)
   hardcode_into_libs=yes
   ;;
 
+haiku*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  dynamic_linker="$host_os runtime_loader"
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
+  hardcode_into_libs=yes
+  ;;
+
 hpux9* | hpux10* | hpux11*)
   # Give a soname corresponding to the major version so that dld.sl refuses to
   # link against other versions.
@@ -2386,8 +2383,10 @@ hpux9* | hpux10* | hpux11*)
     soname_spec='${libname}${release}${shared_ext}$major'
     ;;
   esac
-  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
   postinstall_cmds='chmod 555 $lib'
+  # or fails outright, so override atomically:
+  install_override_mode=555
   ;;
 
 interix[[3-9]]*)
@@ -2454,16 +2453,21 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
   finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
+
   # Some binutils ld are patched to set DT_RUNPATH
-  save_LDFLAGS=$LDFLAGS
-  save_libdir=$libdir
-  eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
-       LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
-  AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
-    [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
-       [shlibpath_overrides_runpath=yes])])
-  LDFLAGS=$save_LDFLAGS
-  libdir=$save_libdir
+  AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath],
+    [lt_cv_shlibpath_overrides_runpath=no
+    save_LDFLAGS=$LDFLAGS
+    save_libdir=$libdir
+    eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
+        LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+      [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
+        [lt_cv_shlibpath_overrides_runpath=yes])])
+    LDFLAGS=$save_LDFLAGS
+    libdir=$save_libdir
+    ])
+  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
 
   # This implies no fast_install, which is unacceptable.
   # Some rework will be needed to allow for fast_install
@@ -2472,7 +2476,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
 
   # Append ld.so.conf contents to the search path
   if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[  ]*hwcap[        ]/d;s/[:,      ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[  ]*hwcap[        ]/d;s/[:,      ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
     sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
   fi
 
@@ -2485,18 +2489,6 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
   dynamic_linker='GNU/Linux ld.so'
   ;;
 
-netbsdelf*-gnu)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  dynamic_linker='NetBSD ld.elf_so'
-  ;;
-
 netbsd*)
   version_type=sunos
   need_lib_prefix=no
@@ -2717,6 +2709,8 @@ _LT_DECL([], [library_names_spec], [1],
     The last name is the one that the linker finds with -lNAME]])
 _LT_DECL([], [soname_spec], [1],
     [[The coded name of the library, if different from the real name]])
+_LT_DECL([], [install_override_mode], [1],
+    [Permission mode override for installation of shared libraries])
 _LT_DECL([], [postinstall_cmds], [2],
     [Command to use after installation of a shared archive])
 _LT_DECL([], [postuninstall_cmds], [2],
@@ -2829,6 +2823,7 @@ AC_REQUIRE([AC_CANONICAL_HOST])dnl
 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
 m4_require([_LT_DECL_SED])dnl
 m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_PROG_ECHO_BACKSLASH])dnl
 
 AC_ARG_WITH([gnu-ld],
     [AS_HELP_STRING([--with-gnu-ld],
@@ -2958,8 +2953,8 @@ case $host_os in
     fi
     ;;
 esac
-_LT_DECL([], [reload_flag], [1], [How to create reloadable object files])dnl
-_LT_DECL([], [reload_cmds], [2])dnl
+_LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl
+_LT_TAGDECL([], [reload_cmds], [2])dnl
 ])# _LT_CMD_RELOAD
 
 
@@ -3011,16 +3006,18 @@ mingw* | pw32*)
   # Base MSYS/MinGW do not provide the 'file' command needed by
   # func_win32_libid shell function, so use a weaker test based on 'objdump',
   # unless we find 'file', for example because we are cross-compiling.
-  if ( file / ) >/dev/null 2>&1; then
+  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+  if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
     lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
     lt_cv_file_magic_cmd='func_win32_libid'
   else
-    lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+    # Keep this pattern in sync with the one in func_win32_libid.
+    lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
     lt_cv_file_magic_cmd='$OBJDUMP -f'
   fi
   ;;
 
-cegcc)
+cegcc*)
   # use the weaker test based on 'objdump'. See mingw*.
   lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
   lt_cv_file_magic_cmd='$OBJDUMP -f'
@@ -3050,6 +3047,10 @@ gnu*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
+haiku*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
 hpux10.20* | hpux11*)
   lt_cv_file_magic_cmd=/usr/bin/file
   case $host_cpu in
@@ -3058,11 +3059,11 @@ hpux10.20* | hpux11*)
     lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
     ;;
   hppa*64*)
-    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]']
+    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]']
     lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
     ;;
   *)
-    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library'
     lt_cv_file_magic_test_file=/usr/lib/libc.sl
     ;;
   esac
@@ -3088,7 +3089,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-netbsd* | netbsdelf*-gnu)
+netbsd*)
   if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
     lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
   else
@@ -3226,7 +3227,19 @@ if test "$lt_cv_path_NM" != "no"; then
   NM="$lt_cv_path_NM"
 else
   # Didn't find any BSD compatible name lister, look for dumpbin.
-  AC_CHECK_TOOLS(DUMPBIN, ["dumpbin -symbols" "link -dump -symbols"], :)
+  if test -n "$DUMPBIN"; then :
+    # Let the user override the test.
+  else
+    AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :)
+    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+    *COFF*)
+      DUMPBIN="$DUMPBIN -symbols"
+      ;;
+    *)
+      DUMPBIN=:
+      ;;
+    esac
+  fi
   AC_SUBST([DUMPBIN])
   if test "$DUMPBIN" != ":"; then
     NM="$DUMPBIN"
@@ -3239,13 +3252,13 @@ _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
 AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
   [lt_cv_nm_interface="BSD nm"
   echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
+  (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
   (eval "$ac_compile" 2>conftest.err)
   cat conftest.err >&AS_MESSAGE_LOG_FD
-  (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
+  (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
   cat conftest.err >&AS_MESSAGE_LOG_FD
-  (eval echo "\"\$as_me:__oline__: output\"" >&AS_MESSAGE_LOG_FD)
+  (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD)
   cat conftest.out >&AS_MESSAGE_LOG_FD
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
     lt_cv_nm_interface="MS dumpbin"
@@ -3268,7 +3281,7 @@ AC_DEFUN([LT_LIB_M],
 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
 LIBM=
 case $host in
-*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
+*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
   # These system don't have libm, or don't need it
   ;;
 *-ncr-sysv4.3*)
@@ -3296,7 +3309,12 @@ m4_defun([_LT_COMPILER_NO_RTTI],
 _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
 
 if test "$GCC" = yes; then
-  _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+  case $cc_basename in
+  nvcc*)
+    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;;
+  *)
+    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;;
+  esac
 
   _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
     lt_cv_prog_compiler_rtti_exceptions,
@@ -3313,6 +3331,7 @@ _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],
 m4_defun([_LT_CMD_GLOBAL_SYMBOLS],
 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
 AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_AWK])dnl
 AC_REQUIRE([LT_PATH_NM])dnl
 AC_REQUIRE([LT_PATH_LD])dnl
 m4_require([_LT_DECL_SED])dnl
@@ -3438,7 +3457,7 @@ _LT_EOF
   if AC_TRY_EVAL(ac_compile); then
     # Now try to grab the symbols.
     nlist=conftest.nm
-    if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
+    if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then
       # Try sorting and uniquifying the output.
       if sort "$nlist" | uniq > "$nlist"T; then
        mv -f "$nlist"T "$nlist"
@@ -3600,6 +3619,11 @@ m4_if([$1], [CXX], [
       # DJGPP does not support shared libraries at all
       _LT_TAGVAR(lt_prog_compiler_pic, $1)=
       ;;
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)=
+      ;;
     interix[[3-9]]*)
       # Interix 3.x gcc -fpic/-fPIC options generate broken code.
       # Instead, we relocate shared libraries at runtime.
@@ -3738,8 +3762,8 @@ m4_if([$1], [CXX], [
            _LT_TAGVAR(lt_prog_compiler_pic, $1)=
            _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
            ;;
-         xlc* | xlC*)
-           # IBM XL 8.0 on PPC
+         xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*)
+           # IBM XL 8.0, 9.0 on PPC and BlueGene
            _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
            _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
@@ -3769,7 +3793,7 @@ m4_if([$1], [CXX], [
            ;;
        esac
        ;;
-      netbsd* | netbsdelf*-gnu)
+      netbsd*)
        ;;
       *qnx* | *nto*)
         # QNX uses GNU C++, but need to define -shared option too, otherwise
@@ -3801,7 +3825,7 @@ m4_if([$1], [CXX], [
        ;;
       solaris*)
        case $cc_basename in
-         CC*)
+         CC* | sunCC*)
            # Sun C++ 4.2, 5.x and Centerline C++
            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
            _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
@@ -3905,6 +3929,12 @@ m4_if([$1], [CXX], [
       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
       ;;
 
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)=
+      ;;
+
     hpux*)
       # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
       # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
@@ -3947,6 +3977,13 @@ m4_if([$1], [CXX], [
       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
       ;;
     esac
+
+    case $cc_basename in
+    nvcc*) # Cuda Compiler Driver 2.2
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker '
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Xcompiler -fPIC'
+      ;;
+    esac
   else
     # PORTME Check for flag to pass linker flags through the system compiler.
     case $host_os in
@@ -4010,7 +4047,7 @@ m4_if([$1], [CXX], [
        _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
        _LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
        ;;
-      pgcc* | pgf77* | pgf90* | pgf95*)
+      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
         # Portland Group compilers (*not* the Pentium gcc compiler,
        # which looks to be a dead project)
        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
@@ -4022,25 +4059,25 @@ m4_if([$1], [CXX], [
         # All Alpha code is PIC.
         _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
         ;;
-      xl*)
-       # IBM XL C 8.0/Fortran 10.1 on PPC
+      xl* | bgxl* | bgf* | mpixl*)
+       # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
        _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
        ;;
       *)
        case `$CC -V 2>&1 | sed 5q` in
-       *Sun\ C*)
-         # Sun C 5.9
+       *Sun\ F* | *Sun*Fortran*)
+         # Sun Fortran 8.3 passes all unrecognized flags to the linker
          _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
          _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-         _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+         _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
          ;;
-       *Sun\ F*)
-         # Sun Fortran 8.3 passes all unrecognized flags to the linker
+       *Sun\ C*)
+         # Sun C 5.9
          _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
          _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-         _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
+         _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
          ;;
        esac
        ;;
@@ -4072,7 +4109,7 @@ m4_if([$1], [CXX], [
       _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
       _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
       case $cc_basename in
-      f77* | f90* | f95*)
+      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
       *)
        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
@@ -4182,8 +4219,10 @@ m4_if([$1], [CXX], [
   aix[[4-9]]*)
     # If we're using GNU nm, then we don't want the "-C" option.
     # -C means demangle to AIX nm, but means don't demangle with GNU nm
+    # Also, AIX nm treats weak defined symbols like other global defined
+    # symbols, whereas GNU nm marks them as "W".
     if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
     else
       _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
     fi
@@ -4194,9 +4233,6 @@ m4_if([$1], [CXX], [
   cygwin* | mingw* | cegcc*)
     _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
   ;;
-  linux* | k*bsd*-gnu)
-    _LT_TAGVAR(link_all_deplibs, $1)=no
-  ;;
   *)
     _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
   ;;
@@ -4261,13 +4297,36 @@ dnl Note also adjust exclude_expsyms for C++ above.
   openbsd*)
     with_gnu_ld=no
     ;;
-  linux* | k*bsd*-gnu)
-    _LT_TAGVAR(link_all_deplibs, $1)=no
-    ;;
   esac
 
   _LT_TAGVAR(ld_shlibs, $1)=yes
+
+  # On some targets, GNU ld is compatible enough with the native linker
+  # that we're better off using the native interface for both.
+  lt_use_gnu_ld_interface=no
   if test "$with_gnu_ld" = yes; then
+    case $host_os in
+      aix*)
+       # The AIX port of GNU ld has always aspired to compatibility
+       # with the native linker.  However, as the warning in the GNU ld
+       # block says, versions before 2.19.5* couldn't really create working
+       # shared libraries, regardless of the interface used.
+       case `$LD -v 2>&1` in
+         *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+         *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;;
+         *\ \(GNU\ Binutils\)\ [[3-9]]*) ;;
+         *)
+           lt_use_gnu_ld_interface=yes
+           ;;
+       esac
+       ;;
+      *)
+       lt_use_gnu_ld_interface=yes
+       ;;
+    esac
+  fi
+
+  if test "$lt_use_gnu_ld_interface" = yes; then
     # If archive_cmds runs LD, not CC, wlarc should be empty
     wlarc='${wl}'
 
@@ -4301,11 +4360,12 @@ dnl Note also adjust exclude_expsyms for C++ above.
        _LT_TAGVAR(ld_shlibs, $1)=no
        cat <<_LT_EOF 1>&2
 
-*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** Warning: the GNU linker, at least up to release 2.19, is reported
 *** to be unable to reliably create shared libraries on AIX.
 *** Therefore, libtool is disabling shared libraries support.  If you
-*** really care for shared libraries, you may want to modify your PATH
-*** so that a non-GNU linker is found, and then restart.
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
 
 _LT_EOF
       fi
@@ -4341,6 +4401,7 @@ _LT_EOF
       # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
       # as there is no search path for DLLs.
       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
       _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
       _LT_TAGVAR(always_export_symbols, $1)=no
       _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
@@ -4362,6 +4423,11 @@ _LT_EOF
       fi
       ;;
 
+    haiku*)
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
     interix[[3-9]]*)
       _LT_TAGVAR(hardcode_direct, $1)=no
       _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
@@ -4391,11 +4457,12 @@ _LT_EOF
        tmp_sharedflag='-shared'
        case $cc_basename,$host_cpu in
         pgcc*)                         # Portland Group C compiler
-         _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+         _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
          tmp_addflag=' $pic_flag'
          ;;
-       pgf77* | pgf90* | pgf95*)       # Portland Group f77 and f90 compilers
-         _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+       pgf77* | pgf90* | pgf95* | pgfortran*)
+                                       # Portland Group f77 and f90 compilers
+         _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
          tmp_addflag=' $pic_flag -Mnomain' ;;
        ecc*,ia64* | icc*,ia64*)        # Intel C compiler on ia64
          tmp_addflag=' -i_dynamic' ;;
@@ -4406,13 +4473,17 @@ _LT_EOF
        lf95*)                          # Lahey Fortran 8.1
          _LT_TAGVAR(whole_archive_flag_spec, $1)=
          tmp_sharedflag='--shared' ;;
-       xl[[cC]]*)                      # IBM XL C 8.0 on PPC (deal with xlf below)
+       xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
          tmp_sharedflag='-qmkshrobj'
          tmp_addflag= ;;
+       nvcc*)  # Cuda Compiler Driver 2.2
+         _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+         _LT_TAGVAR(compiler_needs_object, $1)=yes
+         ;;
        esac
        case `$CC -V 2>&1 | sed 5q` in
        *Sun\ C*)                       # Sun C 5.9
-         _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+         _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
          _LT_TAGVAR(compiler_needs_object, $1)=yes
          tmp_sharedflag='-G' ;;
        *Sun\ F*)                       # Sun Fortran 8.3
@@ -4428,17 +4499,17 @@ _LT_EOF
         fi
 
        case $cc_basename in
-       xlf*)
+       xlf* | bgf* | bgxlf* | mpixlf*)
          # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
          _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
          _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
          _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
-         _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
+         _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
          if test "x$supports_anon_versioning" = xyes; then
            _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
              cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
              echo "local: *; };" >> $output_objdir/$libname.ver~
-             $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+             $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
          fi
          ;;
        esac
@@ -4447,7 +4518,7 @@ _LT_EOF
       fi
       ;;
 
-    netbsd* | netbsdelf*-gnu)
+    netbsd*)
       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
        _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
        wlarc=
@@ -4559,8 +4630,10 @@ _LT_EOF
       else
        # If we're using GNU nm, then we don't want the "-C" option.
        # -C means demangle to AIX nm, but means don't demangle with GNU nm
+       # Also, AIX nm treats weak defined symbols like other global
+       # defined symbols, whereas GNU nm marks them as "W".
        if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-         _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+         _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
        else
          _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
        fi
@@ -4622,7 +4695,6 @@ _LT_EOF
        if test "$aix_use_runtimelinking" = yes; then
          shared_flag="$shared_flag "'${wl}-G'
        fi
-       _LT_TAGVAR(link_all_deplibs, $1)=no
       else
        # not using gcc
        if test "$host_cpu" = ia64; then
@@ -4650,7 +4722,7 @@ _LT_EOF
         # empty executable.
         _LT_SYS_MODULE_PATH_AIX
         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
-        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
       else
        if test "$host_cpu" = ia64; then
          _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
@@ -4665,8 +4737,13 @@ _LT_EOF
          # -berok will link without error, but may produce a broken library.
          _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
          _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
-         # Exported symbols can be pulled into shared objects from archives
-         _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+         if test "$with_gnu_ld" = yes; then
+           # We only use this code for GNU lds that support --whole-archive.
+           _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+         else
+           # Exported symbols can be pulled into shared objects from archives
+           _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+         fi
          _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
          # This is similar to how AIX traditionally builds its shared libraries.
          _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
@@ -4705,7 +4782,7 @@ _LT_EOF
       # Tell ltmain to make .dll files, not .so files.
       shrext_cmds=".dll"
       # FIXME: Setting linknames here is a bad hack.
-      _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
       # The linker will automatically build a .lib file if we build a DLL.
       _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
       # FIXME: Should let the user specify the lib program.
@@ -4772,7 +4849,7 @@ _LT_EOF
       ;;
 
     hpux10*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
       else
        _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
@@ -4791,7 +4868,7 @@ _LT_EOF
       ;;
 
     hpux11*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
        case $host_cpu in
        hppa*64*)
          _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
@@ -4812,7 +4889,14 @@ _LT_EOF
          _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
          ;;
        *)
-         _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+       m4_if($1, [], [
+         # Older versions of the 11.00 compiler do not understand -b yet
+         # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+         _LT_LINKER_OPTION([if $CC understands -b],
+           _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b],
+           [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],
+           [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])],
+         [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])
          ;;
        esac
       fi
@@ -4840,19 +4924,19 @@ _LT_EOF
 
     irix5* | irix6* | nonstopux*)
       if test "$GCC" = yes; then
-       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
        # Try to use the -exported_symbol ld option, if it does not
        # work, assume that -exports_file does not work either and
        # implicitly export all symbols.
         save_LDFLAGS="$LDFLAGS"
         LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
         AC_LINK_IFELSE(int foo(void) {},
-          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
         )
         LDFLAGS="$save_LDFLAGS"
       else
-       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
-       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+       _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
       fi
       _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
@@ -4861,7 +4945,7 @@ _LT_EOF
       _LT_TAGVAR(link_all_deplibs, $1)=yes
       ;;
 
-    netbsd* | netbsdelf*-gnu)
+    netbsd*)
       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
        _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
       else
@@ -4914,17 +4998,17 @@ _LT_EOF
       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
       _LT_TAGVAR(hardcode_minus_L, $1)=yes
       _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-      _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
       _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
       ;;
 
     osf3*)
       if test "$GCC" = yes; then
        _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-       _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
       else
        _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-       _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
       fi
       _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
@@ -4934,13 +5018,13 @@ _LT_EOF
     osf4* | osf5*)     # as osf3* with the addition of -msym flag
       if test "$GCC" = yes; then
        _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-       _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
       else
        _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-       _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+       _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
        _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
-       $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+       $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
 
        # Both c and cxx compiler support -rpath directly
        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
@@ -5131,36 +5215,38 @@ x|xyes)
       # Test whether the compiler implicitly links with -lc since on some
       # systems, -lgcc has to come before -lc. If gcc already passes -lc
       # to ld, don't add -lc before -lgcc.
-      AC_MSG_CHECKING([whether -lc should be explicitly linked in])
-      $RM conftest*
-      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-
-      if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
-        soname=conftest
-        lib=conftest
-        libobjs=conftest.$ac_objext
-        deplibs=
-        wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
-       pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
-        compiler_flags=-v
-        linker_flags=-v
-        verstring=
-        output_objdir=.
-        libname=conftest
-        lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
-        _LT_TAGVAR(allow_undefined_flag, $1)=
-        if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
-        then
-         _LT_TAGVAR(archive_cmds_need_lc, $1)=no
-        else
-         _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
-        fi
-        _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
-      else
-        cat conftest.err 1>&5
-      fi
-      $RM conftest*
-      AC_MSG_RESULT([$_LT_TAGVAR(archive_cmds_need_lc, $1)])
+      AC_CACHE_CHECK([whether -lc should be explicitly linked in],
+       [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1),
+       [$RM conftest*
+       echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+       if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+         soname=conftest
+         lib=conftest
+         libobjs=conftest.$ac_objext
+         deplibs=
+         wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
+         pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
+         compiler_flags=-v
+         linker_flags=-v
+         verstring=
+         output_objdir=.
+         libname=conftest
+         lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
+         _LT_TAGVAR(allow_undefined_flag, $1)=
+         if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
+         then
+           lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+         else
+           lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+         fi
+         _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+       else
+         cat conftest.err 1>&5
+       fi
+       $RM conftest*
+       ])
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)
       ;;
     esac
   fi
@@ -5330,37 +5416,21 @@ CC="$lt_save_CC"
 ])# _LT_LANG_C_CONFIG
 
 
-# _LT_PROG_CXX
-# ------------
-# Since AC_PROG_CXX is broken, in that it returns g++ if there is no c++
-# compiler, we have our own version here.
-m4_defun([_LT_PROG_CXX],
-[
-pushdef([AC_MSG_ERROR], [_lt_caught_CXX_error=yes])
-AC_PROG_CXX
-if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
-    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
-    (test "X$CXX" != "Xg++"))) ; then
-  AC_PROG_CXXCPP
-else
-  _lt_caught_CXX_error=yes
-fi
-popdef([AC_MSG_ERROR])
-])# _LT_PROG_CXX
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([_LT_PROG_CXX], [])
-
-
 # _LT_LANG_CXX_CONFIG([TAG])
 # --------------------------
 # Ensure that the configuration variables for a C++ compiler are suitably
 # defined.  These variables are subsequently used by _LT_CONFIG to write
 # the compiler configuration to `libtool'.
 m4_defun([_LT_LANG_CXX_CONFIG],
-[AC_REQUIRE([_LT_PROG_CXX])dnl
-m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
 m4_require([_LT_DECL_EGREP])dnl
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+    (test "X$CXX" != "Xg++"))) ; then
+  AC_PROG_CXXCPP
+else
+  _lt_caught_CXX_error=yes
+fi
 
 AC_LANG_PUSH(C++)
 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
@@ -5382,6 +5452,8 @@ _LT_TAGVAR(module_cmds, $1)=
 _LT_TAGVAR(module_expsym_cmds, $1)=
 _LT_TAGVAR(link_all_deplibs, $1)=unknown
 _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
 _LT_TAGVAR(no_undefined_flag, $1)=
 _LT_TAGVAR(whole_archive_flag_spec, $1)=
 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
@@ -5484,7 +5556,7 @@ if test "$_lt_caught_CXX_error" != yes; then
       # Commands to make compiler produce verbose output that lists
       # what "hidden" libraries, object files and flags are used when
       # linking a shared library.
-      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
 
     else
       GXX=no
@@ -5596,7 +5668,7 @@ if test "$_lt_caught_CXX_error" != yes; then
           _LT_SYS_MODULE_PATH_AIX
           _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
 
-          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
         else
           if test "$host_cpu" = ia64; then
            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
@@ -5611,8 +5683,13 @@ if test "$_lt_caught_CXX_error" != yes; then
            # -berok will link without error, but may produce a broken library.
            _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
            _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
-           # Exported symbols can be pulled into shared objects from archives
-           _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+           if test "$with_gnu_ld" = yes; then
+             # We only use this code for GNU lds that support --whole-archive.
+             _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+           else
+             # Exported symbols can be pulled into shared objects from archives
+             _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+           fi
            _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
            # This is similar to how AIX traditionally builds its shared
            # libraries.
@@ -5645,6 +5722,7 @@ if test "$_lt_caught_CXX_error" != yes; then
         # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
         # as there is no search path for DLLs.
         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
         _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
         _LT_TAGVAR(always_export_symbols, $1)=no
         _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
@@ -5705,6 +5783,11 @@ if test "$_lt_caught_CXX_error" != yes; then
       gnu*)
         ;;
 
+      haiku*)
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        _LT_TAGVAR(link_all_deplibs, $1)=yes
+        ;;
+
       hpux9*)
         _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
         _LT_TAGVAR(hardcode_libdir_separator, $1)=:
@@ -5729,7 +5812,7 @@ if test "$_lt_caught_CXX_error" != yes; then
             # explicitly linking system object files so we need to strip them
             # from the output so that they don't get included in the library
             # dependencies.
-            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
             ;;
           *)
             if test "$GXX" = yes; then
@@ -5794,7 +5877,7 @@ if test "$_lt_caught_CXX_error" != yes; then
            # explicitly linking system object files so we need to strip them
            # from the output so that they don't get included in the library
            # dependencies.
-           output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+           output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
            ;;
           *)
            if test "$GXX" = yes; then
@@ -5837,7 +5920,7 @@ if test "$_lt_caught_CXX_error" != yes; then
         case $cc_basename in
           CC*)
            # SGI C++
-           _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+           _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
 
            # Archives containing C++ object files must be created using
            # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
@@ -5848,9 +5931,9 @@ if test "$_lt_caught_CXX_error" != yes; then
           *)
            if test "$GXX" = yes; then
              if test "$with_gnu_ld" = no; then
-               _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+               _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
              else
-               _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib'
+               _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
              fi
            fi
            _LT_TAGVAR(link_all_deplibs, $1)=yes
@@ -5879,7 +5962,7 @@ if test "$_lt_caught_CXX_error" != yes; then
            # explicitly linking system object files so we need to strip them
            # from the output so that they don't get included in the library
            # dependencies.
-           output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+           output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
 
            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
            _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
@@ -5916,26 +5999,26 @@ if test "$_lt_caught_CXX_error" != yes; then
           pgCC* | pgcpp*)
             # Portland Group C++ compiler
            case `$CC -V` in
-           *pgCC\ [[1-5]]* | *pgcpp\ [[1-5]]*)
+           *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*)
              _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
                rm -rf $tpldir~
                $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
-               compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"'
+               compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
              _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
                rm -rf $tpldir~
                $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
-               $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~
+               $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
                $RANLIB $oldlib'
              _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
                rm -rf $tpldir~
                $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
-               $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+               $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
              _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
                rm -rf $tpldir~
                $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
-               $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+               $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
              ;;
-           *) # Version 6 will use weak symbols
+           *) # Version 6 and above use weak symbols
              _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
              _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
              ;;
@@ -5943,7 +6026,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 
            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
            _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-           _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+           _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
             ;;
          cxx*)
            # Compaq C++
@@ -5962,9 +6045,9 @@ if test "$_lt_caught_CXX_error" != yes; then
            # explicitly linking system object files so we need to strip them
            # from the output so that they don't get included in the library
            # dependencies.
-           output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+           output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
            ;;
-         xl*)
+         xl* | mpixl* | bgxl*)
            # IBM XL 8.0 on PPC, with GNU ld
            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
            _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
@@ -5984,13 +6067,13 @@ if test "$_lt_caught_CXX_error" != yes; then
              _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
              _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
              _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-             _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+             _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
              _LT_TAGVAR(compiler_needs_object, $1)=yes
 
              # Not sure whether something based on
              # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
              # would be better.
-             output_verbose_link_cmd='echo'
+             output_verbose_link_cmd='func_echo_all'
 
              # Archives containing C++ object files must be created using
              # "CC -xar", where "CC" is the Sun C++ compiler.  This is
@@ -6059,7 +6142,7 @@ if test "$_lt_caught_CXX_error" != yes; then
            _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
            _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
          fi
-         output_verbose_link_cmd=echo
+         output_verbose_link_cmd=func_echo_all
        else
          _LT_TAGVAR(ld_shlibs, $1)=no
        fi
@@ -6094,15 +6177,15 @@ if test "$_lt_caught_CXX_error" != yes; then
            case $host in
              osf3*)
                _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-               _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+               _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
                _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
                ;;
              *)
                _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-               _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+               _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
                _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
                  echo "-hidden">> $lib.exp~
-                 $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~
+                 $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~
                  $RM $lib.exp'
                _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
                ;;
@@ -6118,17 +6201,17 @@ if test "$_lt_caught_CXX_error" != yes; then
            # explicitly linking system object files so we need to strip them
            # from the output so that they don't get included in the library
            # dependencies.
-           output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+           output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
            ;;
          *)
            if test "$GXX" = yes && test "$with_gnu_ld" = no; then
              _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
              case $host in
                osf3*)
-                 _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+                 _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
                  ;;
                *)
-                 _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+                 _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
                  ;;
              esac
 
@@ -6138,7 +6221,7 @@ if test "$_lt_caught_CXX_error" != yes; then
              # Commands to make compiler produce verbose output that lists
              # what "hidden" libraries, object files and flags are used when
              # linking a shared library.
-             output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+             output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
 
            else
              # FIXME: insert proper C++ library support
@@ -6174,7 +6257,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 
       solaris*)
         case $cc_basename in
-          CC*)
+          CC* | sunCC*)
            # Sun C++ 4.2, 5.x and Centerline C++
             _LT_TAGVAR(archive_cmds_need_lc,$1)=yes
            _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
@@ -6195,7 +6278,7 @@ if test "$_lt_caught_CXX_error" != yes; then
            esac
            _LT_TAGVAR(link_all_deplibs, $1)=yes
 
-           output_verbose_link_cmd='echo'
+           output_verbose_link_cmd='func_echo_all'
 
            # Archives containing C++ object files must be created using
            # "CC -xar", where "CC" is the Sun C++ compiler.  This is
@@ -6222,7 +6305,7 @@ if test "$_lt_caught_CXX_error" != yes; then
                # Commands to make compiler produce verbose output that lists
                # what "hidden" libraries, object files and flags are used when
                # linking a shared library.
-               output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+               output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
              else
                # g++ 2.7 appears to require `-G' NOT `-shared' on this
                # platform.
@@ -6233,7 +6316,7 @@ if test "$_lt_caught_CXX_error" != yes; then
                # Commands to make compiler produce verbose output that lists
                # what "hidden" libraries, object files and flags are used when
                # linking a shared library.
-               output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+               output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
              fi
 
              _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
@@ -6287,6 +6370,10 @@ if test "$_lt_caught_CXX_error" != yes; then
           CC*)
            _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
            _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+           _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~
+             '"$_LT_TAGVAR(old_archive_cmds, $1)"
+           _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~
+             '"$_LT_TAGVAR(reload_cmds, $1)"
            ;;
          *)
            _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
@@ -6533,7 +6620,7 @@ linux*)
 
 solaris*)
   case $cc_basename in
-  CC*)
+  CC* | sunCC*)
     # The more standards-conforming stlport4 library is
     # incompatible with the Cstd library. Avoid specifying
     # it if it's in CXXFLAGS. Ignore libCrun as
@@ -6577,32 +6664,16 @@ _LT_TAGDECL([], [compiler_lib_search_path], [1],
 ])# _LT_SYS_HIDDEN_LIBDEPS
 
 
-# _LT_PROG_F77
-# ------------
-# Since AC_PROG_F77 is broken, in that it returns the empty string
-# if there is no fortran compiler, we have our own version here.
-m4_defun([_LT_PROG_F77],
-[
-pushdef([AC_MSG_ERROR], [_lt_disable_F77=yes])
-AC_PROG_F77
-if test -z "$F77" || test "X$F77" = "Xno"; then
-  _lt_disable_F77=yes
-fi
-popdef([AC_MSG_ERROR])
-])# _LT_PROG_F77
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([_LT_PROG_F77], [])
-
-
 # _LT_LANG_F77_CONFIG([TAG])
 # --------------------------
 # Ensure that the configuration variables for a Fortran 77 compiler are
 # suitably defined.  These variables are subsequently used by _LT_CONFIG
 # to write the compiler configuration to `libtool'.
 m4_defun([_LT_LANG_F77_CONFIG],
-[AC_REQUIRE([_LT_PROG_F77])dnl
-AC_LANG_PUSH(Fortran 77)
+[AC_LANG_PUSH(Fortran 77)
+if test -z "$F77" || test "X$F77" = "Xno"; then
+  _lt_disable_F77=yes
+fi
 
 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
 _LT_TAGVAR(allow_undefined_flag, $1)=
@@ -6621,6 +6692,8 @@ _LT_TAGVAR(module_cmds, $1)=
 _LT_TAGVAR(module_expsym_cmds, $1)=
 _LT_TAGVAR(link_all_deplibs, $1)=unknown
 _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
 _LT_TAGVAR(no_undefined_flag, $1)=
 _LT_TAGVAR(whole_archive_flag_spec, $1)=
 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
@@ -6720,32 +6793,17 @@ AC_LANG_POP
 ])# _LT_LANG_F77_CONFIG
 
 
-# _LT_PROG_FC
-# -----------
-# Since AC_PROG_FC is broken, in that it returns the empty string
-# if there is no fortran compiler, we have our own version here.
-m4_defun([_LT_PROG_FC],
-[
-pushdef([AC_MSG_ERROR], [_lt_disable_FC=yes])
-AC_PROG_FC
-if test -z "$FC" || test "X$FC" = "Xno"; then
-  _lt_disable_FC=yes
-fi
-popdef([AC_MSG_ERROR])
-])# _LT_PROG_FC
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([_LT_PROG_FC], [])
-
-
 # _LT_LANG_FC_CONFIG([TAG])
 # -------------------------
 # Ensure that the configuration variables for a Fortran compiler are
 # suitably defined.  These variables are subsequently used by _LT_CONFIG
 # to write the compiler configuration to `libtool'.
 m4_defun([_LT_LANG_FC_CONFIG],
-[AC_REQUIRE([_LT_PROG_FC])dnl
-AC_LANG_PUSH(Fortran)
+[AC_LANG_PUSH(Fortran)
+
+if test -z "$FC" || test "X$FC" = "Xno"; then
+  _lt_disable_FC=yes
+fi
 
 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
 _LT_TAGVAR(allow_undefined_flag, $1)=
@@ -6764,6 +6822,8 @@ _LT_TAGVAR(module_cmds, $1)=
 _LT_TAGVAR(module_expsym_cmds, $1)=
 _LT_TAGVAR(link_all_deplibs, $1)=unknown
 _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
 _LT_TAGVAR(no_undefined_flag, $1)=
 _LT_TAGVAR(whole_archive_flag_spec, $1)=
 _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
@@ -6909,6 +6969,8 @@ _LT_CC_BASENAME([$compiler])
 _LT_TAGVAR(archive_cmds_need_lc, $1)=no
 
 _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
 
 ## CAVEAT EMPTOR:
 ## There is no encapsulation within the following macros, do not change
@@ -7276,7 +7338,7 @@ _LT_EOF
 func_dirname ()
 {
   # Extract subdirectory from the argument.
-  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
+  func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
   if test "X$func_dirname_result" = "X${1}"; then
     func_dirname_result="${3}"
   else
@@ -7287,7 +7349,7 @@ func_dirname ()
 # func_basename file
 func_basename ()
 {
-  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
+  func_basename_result=`$ECHO "${1}" | $SED "$basename"`
 }
 
 dnl func_dirname_and_basename
@@ -7303,10 +7365,8 @@ dnl so there is no need for it here.
 func_stripname ()
 {
   case ${2} in
-    .*) func_stripname_result=`$ECHO "X${3}" \
-           | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;;
-    *)  func_stripname_result=`$ECHO "X${3}" \
-           | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;;
+    .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+    *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
   esac
 }
 
@@ -7317,20 +7377,20 @@ my_sed_long_arg='1s/^-[[^=]]*=//'
 # func_opt_split
 func_opt_split ()
 {
-  func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"`
-  func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"`
+  func_opt_split_opt=`$ECHO "${1}" | $SED "$my_sed_long_opt"`
+  func_opt_split_arg=`$ECHO "${1}" | $SED "$my_sed_long_arg"`
 }
 
 # func_lo2o object
 func_lo2o ()
 {
-  func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"`
+  func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
 }
 
 # func_xform libobj-or-source
 func_xform ()
 {
-  func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[[^.]]*$/.lo/'`
+  func_xform_result=`$ECHO "${1}" | $SED 's/\.[[^.]]*$/.lo/'`
 }
 
 # func_arith arithmetic-term...
index 34151a3..17cfd51 100644 (file)
@@ -1,13 +1,14 @@
 # Helper functions for option handling.                    -*- Autoconf -*-
 #
-#   Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+#   Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
+#   Inc.
 #   Written by Gary V. Vaughan, 2004
 #
 # This file is free software; the Free Software Foundation gives
 # unlimited permission to copy and/or distribute it, with or without
 # modifications, as long as this notice is preserved.
 
-# serial 6 ltoptions.m4
+# serial 7 ltoptions.m4
 
 # This is to help aclocal find these macros, as it can't see m4_define.
 AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
@@ -125,7 +126,7 @@ LT_OPTION_DEFINE([LT_INIT], [win32-dll],
 [enable_win32_dll=yes
 
 case $host in
-*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*)
+*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
   AC_CHECK_TOOL(AS, as, false)
   AC_CHECK_TOOL(DLLTOOL, dlltool, false)
   AC_CHECK_TOOL(OBJDUMP, objdump, false)
@@ -133,13 +134,13 @@ case $host in
 esac
 
 test -z "$AS" && AS=as
-_LT_DECL([], [AS],      [0], [Assembler program])dnl
+_LT_DECL([], [AS],      [1], [Assembler program])dnl
 
 test -z "$DLLTOOL" && DLLTOOL=dlltool
-_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl
+_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
 
 test -z "$OBJDUMP" && OBJDUMP=objdump
-_LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl
+_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
 ])# win32-dll
 
 AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
index f3c5309..93fc771 100644 (file)
@@ -9,15 +9,15 @@
 
 # Generated from ltversion.in.
 
-# serial 3017 ltversion.m4
+# serial 3175 ltversion.m4
 # This file is part of GNU Libtool
 
-m4_define([LT_PACKAGE_VERSION], [2.2.6b])
-m4_define([LT_PACKAGE_REVISION], [1.3017])
+m4_define([LT_PACKAGE_VERSION], [2.2.10])
+m4_define([LT_PACKAGE_REVISION], [1.3175])
 
 AC_DEFUN([LTVERSION_VERSION],
-[macro_version='2.2.6b'
-macro_revision='1.3017'
+[macro_version='2.2.10'
+macro_revision='1.3175'
 _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
 _LT_DECL(, macro_revision, 0)
 ])
index 637bb20..c573da9 100644 (file)
@@ -1,13 +1,13 @@
 # lt~obsolete.m4 -- aclocal satisfying obsolete definitions.    -*-Autoconf-*-
 #
-#   Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
+#   Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
 #   Written by Scott James Remnant, 2004.
 #
 # This file is free software; the Free Software Foundation gives
 # unlimited permission to copy and/or distribute it, with or without
 # modifications, as long as this notice is preserved.
 
-# serial 4 lt~obsolete.m4
+# serial 5 lt~obsolete.m4
 
 # These exist entirely to fool aclocal when bootstrapping libtool.
 #
@@ -77,7 +77,6 @@ m4_ifndef([AC_DISABLE_FAST_INSTALL],  [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
 m4_ifndef([_LT_AC_LANG_CXX],           [AC_DEFUN([_LT_AC_LANG_CXX])])
 m4_ifndef([_LT_AC_LANG_F77],           [AC_DEFUN([_LT_AC_LANG_F77])])
 m4_ifndef([_LT_AC_LANG_GCJ],           [AC_DEFUN([_LT_AC_LANG_GCJ])])
-m4_ifndef([AC_LIBTOOL_RC],             [AC_DEFUN([AC_LIBTOOL_RC])])
 m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG],  [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
 m4_ifndef([_LT_AC_LANG_C_CONFIG],      [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
 m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG],        [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
@@ -90,3 +89,10 @@ m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG],       [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
 m4_ifndef([_LT_AC_LANG_RC_CONFIG],     [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
 m4_ifndef([AC_LIBTOOL_CONFIG],         [AC_DEFUN([AC_LIBTOOL_CONFIG])])
 m4_ifndef([_LT_AC_FILE_LTDLL_C],       [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
+m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS],        [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
+m4_ifndef([_LT_AC_PROG_CXXCPP],                [AC_DEFUN([_LT_AC_PROG_CXXCPP])])
+m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS],        [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
+m4_ifndef([_LT_PROG_ECHO_BACKSLASH],   [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_PROG_F77],              [AC_DEFUN([_LT_PROG_F77])])
+m4_ifndef([_LT_PROG_FC],               [AC_DEFUN([_LT_PROG_FC])])
+m4_ifndef([_LT_PROG_CXX],              [AC_DEFUN([_LT_PROG_CXX])])
index a7e09f6..4a29b5f 100644 (file)
@@ -6,6 +6,7 @@
 #endif
 
 #include <assert.h>
+#include <radius/client.h>
 #include <event2/bufferevent.h>
 #include <radsec/radsec.h>
 #include <radsec/radsec-impl.h>
@@ -24,6 +25,8 @@ packet_verify_response (struct rs_connection *conn,
                        struct rs_packet *response,
                        struct rs_packet *request)
 {
+  int err;
+
   assert (conn);
   assert (conn->active_peer);
   assert (conn->active_peer->secret);
@@ -32,20 +35,27 @@ packet_verify_response (struct rs_connection *conn,
   assert (request);
   assert (request->rpkt);
 
+  response->rpkt->secret = conn->active_peer->secret;
+  response->rpkt->sizeof_secret = strlen (conn->active_peer->secret);
+
   /* Verify header and message authenticator.  */
-  if (rad_verify (response->rpkt, request->rpkt, conn->active_peer->secret))
+  err = nr_packet_verify (response->rpkt, request->rpkt);
+  if (err)
     {
-      conn_close (&conn);
-      return rs_err_conn_push_fl (conn, RSE_FR, __FILE__, __LINE__,
-                                 "rad_verify: %s", fr_strerror ());
+      if (conn->is_connected)
+       rs_conn_disconnect(conn);
+      return rs_err_conn_push_fl (conn, -err, __FILE__, __LINE__,
+                                 "nr_packet_verify");
     }
 
   /* Decode and decrypt.  */
-  if (rad_decode (response->rpkt, request->rpkt, conn->active_peer->secret))
+  err = nr_packet_decode (response->rpkt, request->rpkt);
+  if (err)
     {
-      conn_close (&conn);
-      return rs_err_conn_push_fl (conn, RSE_FR, __FILE__, __LINE__,
-                                 "rad_decode: %s", fr_strerror ());
+      if (conn->is_connected)
+       rs_conn_disconnect(conn);
+      return rs_err_conn_push_fl (conn, -err, __FILE__, __LINE__,
+                                 "nr_packet_decode");
     }
 
   return RSE_OK;
@@ -57,7 +67,7 @@ packet_verify_response (struct rs_connection *conn,
 int
 packet_do_send (struct rs_packet *pkt)
 {
-  VALUE_PAIR *vp = NULL;
+  int err;
 
   assert (pkt);
   assert (pkt->conn);
@@ -65,22 +75,19 @@ packet_do_send (struct rs_packet *pkt)
   assert (pkt->conn->active_peer->secret);
   assert (pkt->rpkt);
 
-  /* Add a Message-Authenticator, RFC 2869, if not already present.  */
-  /* FIXME: Make Message-Authenticator optional?  */
-  vp = paircreate (PW_MESSAGE_AUTHENTICATOR, PW_TYPE_OCTETS);
-  if (!vp)
-    return rs_err_conn_push_fl (pkt->conn, RSE_FR, __FILE__, __LINE__,
-                               "paircreate: %s", fr_strerror ());
-  pairreplace (&pkt->rpkt->vps, vp);
+  pkt->rpkt->secret = pkt->conn->active_peer->secret;
+  pkt->rpkt->sizeof_secret = strlen (pkt->rpkt->secret);
 
   /* Encode message.  */
-  if (rad_encode (pkt->rpkt, NULL, pkt->conn->active_peer->secret))
-    return rs_err_conn_push_fl (pkt->conn, RSE_FR, __FILE__, __LINE__,
-                               "rad_encode: %s", fr_strerror ());
+  err = nr_packet_encode (pkt->rpkt, NULL);
+  if (err < 0)
+    return rs_err_conn_push_fl (pkt->conn, -err, __FILE__, __LINE__,
+                               "nr_packet_encode");
   /* Sign message.  */
-  if (rad_sign (pkt->rpkt, NULL, pkt->conn->active_peer->secret))
-    return rs_err_conn_push_fl (pkt->conn, RSE_FR, __FILE__, __LINE__,
-                               "rad_sign: %s", fr_strerror ());
+  err = nr_packet_sign (pkt->rpkt, NULL);
+  if (err < 0)
+    return rs_err_conn_push_fl (pkt->conn, -err, __FILE__, __LINE__,
+                               "nr_packet_sign");
 #if defined (DEBUG)
   {
     char host[80], serv[80];
@@ -98,7 +105,7 @@ packet_do_send (struct rs_packet *pkt)
   if (pkt->conn->bev)          /* TCP.  */
     {
       int err = bufferevent_write (pkt->conn->bev, pkt->rpkt->data,
-                                  pkt->rpkt->data_len);
+                                  pkt->rpkt->length);
       if (err < 0)
        return rs_err_conn_push_fl (pkt->conn, RSE_EVENT, __FILE__, __LINE__,
                                    "bufferevent_write: %s",
@@ -122,21 +129,36 @@ rs_packet_create (struct rs_connection *conn, struct rs_packet **pkt_out)
 {
   struct rs_packet *p;
   RADIUS_PACKET *rpkt;
+  int err;
 
   *pkt_out = NULL;
 
-  rpkt = rad_alloc (1);
-  if (!rpkt)
+  rpkt = rs_malloc (conn->ctx, sizeof(*rpkt) + RS_MAX_PACKET_LEN);
+  if (rpkt == NULL)
     return rs_err_conn_push (conn, RSE_NOMEM, __func__);
-  rpkt->id = conn->nextid++;
 
-  p = (struct rs_packet *) malloc (sizeof (struct rs_packet));
-  if (!p)
+  /*
+   * This doesn't make sense; the packet identifier is constant for
+   * an entire conversation. A separate API should be provided to
+   * allow the application to set the packet ID, or a conversation
+   * object should group related packets together.
+   */
+#if 0
+  rpkt->id = conn->nextid++
+#endif
+
+  err = nr_packet_init (rpkt, NULL, NULL,
+                       PW_ACCESS_REQUEST,
+                       rpkt + 1, RS_MAX_PACKET_LEN);
+  if (err < 0)
+    return rs_err_conn_push (conn, -err, __func__);
+
+  p = (struct rs_packet *) rs_calloc (conn->ctx, 1, sizeof (*p));
+  if (p == NULL)
     {
-      rad_free (&rpkt);
+      rs_free (conn->ctx, rpkt);
       return rs_err_conn_push (conn, RSE_NOMEM, __func__);
     }
-  memset (p, 0, sizeof (struct rs_packet));
   p->conn = conn;
   p->rpkt = rpkt;
 
@@ -150,29 +172,26 @@ rs_packet_create_authn_request (struct rs_connection *conn,
                                const char *user_name, const char *user_pw)
 {
   struct rs_packet *pkt;
-  VALUE_PAIR *vp = NULL;
+  int err;
 
   if (rs_packet_create (conn, pkt_out))
     return -1;
+
   pkt = *pkt_out;
-  pkt->rpkt->code = PW_AUTHENTICATION_REQUEST;
+  pkt->rpkt->code = PW_ACCESS_REQUEST;
 
   if (user_name)
     {
-      vp = pairmake ("User-Name", user_name, T_OP_EQ);
-      if (vp == NULL)
-       return rs_err_conn_push_fl (conn, RSE_FR, __FILE__, __LINE__,
-                                   "pairmake: %s", fr_strerror ());
-      pairadd (&pkt->rpkt->vps, vp);
+      err = rs_packet_append_avp (pkt, PW_USER_NAME, 0, user_name, 0);
+      if (err)
+       return err;
     }
 
   if (user_pw)
     {
-      vp = pairmake ("User-Password", user_pw, T_OP_EQ);
-      if (vp == NULL)
-       return rs_err_conn_push_fl (conn, RSE_FR, __FILE__, __LINE__,
-                                   "pairmake: %s", fr_strerror ());
-      pairadd (&pkt->rpkt->vps, vp);
+      err = rs_packet_append_avp (pkt, PW_USER_PASSWORD, 0, user_pw, 0);
+      if (err)
+       return err;
     }
 
   return RSE_OK;
@@ -192,6 +211,59 @@ rs_packet_destroy (struct rs_packet *pkt)
   assert (pkt->conn);
   assert (pkt->conn->ctx);
 
-  rad_free (&pkt->rpkt); /* Note: This frees the VALUE_PAIR's too.  */
+  rs_avp_free (&pkt->rpkt->vps);
+  rs_free (pkt->conn->ctx, pkt->rpkt);
   rs_free (pkt->conn->ctx, pkt);
 }
+
+int
+rs_packet_append_avp (struct rs_packet *pkt, 
+                      unsigned int attr, unsigned int vendor,
+                      const void *data, size_t data_len)
+{
+  const DICT_ATTR *da;
+  int err;
+
+  assert (pkt);
+
+  da = nr_dict_attr_byvalue (attr, vendor);
+  if (da == NULL)
+    return RSE_ATTR_TYPE_UNKNOWN;
+
+  err = nr_packet_attr_append (pkt->rpkt, NULL, da, data, data_len);
+  if (err < 0)
+    return rs_err_conn_push (pkt->conn, -err, __func__);
+
+  return RSE_OK;
+}
+
+void
+rs_packet_avps (struct rs_packet *pkt, rs_avp ***vps)
+{
+  assert (pkt);
+  *vps = &pkt->rpkt->vps;
+}
+
+unsigned int
+rs_packet_code (struct rs_packet *pkt)
+{
+  assert (pkt);
+  return pkt->rpkt->code;
+}
+
+rs_const_avp *
+rs_packet_find_avp (struct rs_packet *pkt, unsigned int attr, unsigned int vendor)
+{
+  assert (pkt);
+  return rs_avp_find_const (pkt->rpkt->vps, attr, vendor);
+}
+
+int
+rs_packet_set_id (struct rs_packet *pkt, int id)
+{
+  int old = pkt->rpkt->id;
+
+  pkt->rpkt->id = id;
+
+  return old;
+}
index bcd5c97..256ff76 100644 (file)
@@ -6,6 +6,9 @@
 #endif
 
 #include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+
 #include <radsec/radsec.h>
 #include <radsec/radsec-impl.h>
 #include "err.h"
diff --git a/lib/radius/.gitignore b/lib/radius/.gitignore
new file mode 100644 (file)
index 0000000..1af03df
--- /dev/null
@@ -0,0 +1 @@
+dictionaries.c
diff --git a/lib/radius/Makefile b/lib/radius/Makefile
deleted file mode 100644 (file)
index 63eff89..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-#
-#  GNU Makefile
-#
-.PHONY: all clean install
-all: libnetworkradius-client.a
-
-SRCS           := dict.c attrs.c packet.c valuepair.c static.c id.c \
-                  crypto.c custom.c print.c parse.c
-
-OBJS           := ${SRCS:.c=.o}
-
-HEADERS                := client.h radius.h
-
-CFLAGS         := -I. -g -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -W -Wredundant-decls -Wundef
-
-VERSION := 1.0
-NAME := networkradius-client-$(VERSION)
-
-
-#
-#  The DICTIONARIES variable can be used to point to the FreeRADIUS
-#  dictionaries.
-#
-ifeq "${DICTIONARIES}" ""
-DICTIONARIES   := $(filter-out %~,$(wildcard share/dictionary*))
-endif
-
-${OBJS}: ${HEADERS}
-
-radius.h dictionaries.c: ${DICTIONARIES} convert.pl common.pl
-       ./convert.pl ${DICTIONARIES}
-
-static.o: static.c dictionaries.c
-
-%.o : %.c
-       $(CC) $(CFLAGS) -c $<
-
-%.o: ${HEADERS}
-
-.PHONY: networkradius-devel
-networkradius-devel:
-       @[ -e $@ ] || ln -s . $@
-
-libnetworkradius-client.a: ${OBJS}
-       ${AR} ${ARFLAGS} $@ $^
-
-LIBS   := -lcrypto -lssl
-LDFLAGS = -L. -lnetworkradius-client
-
-.PHONY: html
-html:
-       doxygen doxygen.conf
-
-clean:
-       @rm -rf *.o *.a *~ html
-
-install: libnetworkradius-client.a
-
-.PHONY: publish
-publish:
-       @scp -r html/* networkradius.com@liberty:www.new/site/clientapi/
-
-$(NAME).tar.gz: $(wildcard Makefile *.pl *.txt *.[ch] \
-       examples/*.[ch] doc/*.txt share/dictionary*)
-       git archive --format=tar --prefix=$(NAME)/ bsd | gzip > $@
-
-.PHONY: tar
-tar: $(NAME).tar.gz
diff --git a/lib/radius/Makefile.am b/lib/radius/Makefile.am
new file mode 100644 (file)
index 0000000..1b66ca6
--- /dev/null
@@ -0,0 +1,37 @@
+AUTOMAKE_OPTIONS = foreign
+ACLOCAL_AMFLAGS = -I m4
+
+INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)
+AM_CFLAGS = -Wall -g
+
+noinst_LTLIBRARIES = libradsec-radius.la
+
+libradsec_radius_la_SOURCES = \
+       attrs.c \
+       crypto.c \
+       custom.c \
+       dict.c \
+       id.c \
+       packet.c \
+       parse.c \
+       print.c \
+       static.c \
+       valuepair.c
+
+libradsec_radius_la_CFLAGS = $(AM_CFLAGS)
+
+DICTIONARIES = \
+       share/dictionary.txt \
+       share/dictionary.microsoft \
+       share/dictionary.ukerna
+
+$(top_srcdir)/include/radsec/radius.h dictionaries.c: ${DICTIONARIES} convert.pl common.pl
+       $(srcdir)/convert.pl ${DICTIONARIES}
+
+static.$(OBJEXT): static.c dictionaries.c
+
+clean-local:
+       rm -f dictionaries.c
+
+$(libradsec_radius_la_SOURCES): $(top_srcdir)/include/radsec/radius.h
+
index 4fd2bf4..d096cc2 100644 (file)
@@ -29,7 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *  \brief Attribute encoding and decoding routines.
  */
 
-#include <networkradius-devel/client.h>
+#include "client.h"
 
 /*
  *     Encodes the data portion of an attribute.
@@ -48,7 +48,7 @@ static ssize_t vp2data_any(const RADIUS_PACKET *packet,
        uint8_t array[4];
        const VALUE_PAIR *vp = *pvp;
 
-#ifdef NR_TYPE_TLV
+#ifdef RS_TYPE_TLV
        /*
         *      See if we need to encode a TLV.  The low portion of
         *      the attribute has already been placed into the packer.
@@ -73,41 +73,41 @@ static ssize_t vp2data_any(const RADIUS_PACKET *packet,
        len = vp->length;
 
        switch(vp->da->type) {
-       case NR_TYPE_IPV6PREFIX:
+       case RS_TYPE_IPV6PREFIX:
                len = sizeof(vp->vp_ipv6prefix);
                break;
 
-       case NR_TYPE_STRING:
-       case NR_TYPE_OCTETS:
-       case NR_TYPE_IFID:
-       case NR_TYPE_IPV6ADDR:
-#ifdef NR_TYPE_ABINARY
-       case NR_TYPE_ABINARY:
+       case RS_TYPE_STRING:
+       case RS_TYPE_OCTETS:
+       case RS_TYPE_IFID:
+       case RS_TYPE_IPV6ADDR:
+#ifdef RS_TYPE_ABINARY
+       case RS_TYPE_ABINARY:
 #endif
                /* nothing more to do */
                break;
 
-       case NR_TYPE_BYTE:
+       case RS_TYPE_BYTE:
                len = 1;        /* just in case */
                array[0] = vp->vp_integer & 0xff;
                data = array;
                break;
 
-       case NR_TYPE_SHORT:
+       case RS_TYPE_SHORT:
                len = 2;        /* just in case */
                array[0] = (vp->vp_integer >> 8) & 0xff;
                array[1] = vp->vp_integer & 0xff;
                data = array;
                break;
 
-       case NR_TYPE_INTEGER:
+       case RS_TYPE_INTEGER:
                len = 4;        /* just in case */
                lvalue = htonl(vp->vp_integer);
                memcpy(array, &lvalue, sizeof(lvalue));
                data = array;
                break;
 
-       case NR_TYPE_IPADDR:
+       case RS_TYPE_IPADDR:
                data = (const uint8_t *) &vp->vp_ipaddr;
                len = 4;        /* just in case */
                break;
@@ -115,14 +115,14 @@ static ssize_t vp2data_any(const RADIUS_PACKET *packet,
                /*
                 *  There are no tagged date attributes.
                 */
-       case NR_TYPE_DATE:
+       case RS_TYPE_DATE:
                lvalue = htonl(vp->vp_date);
                data = (const uint8_t *) &lvalue;
                len = 4;        /* just in case */
                break;
 
 #ifdef VENDORPEC_WIMAX
-       case NR_TYPE_SIGNED:
+       case RS_TYPE_SIGNED:
        {
                int32_t slvalue;
 
@@ -133,12 +133,12 @@ static ssize_t vp2data_any(const RADIUS_PACKET *packet,
        }
 #endif
 
-#ifdef NR_TYPE_TLV
-       case NR_TYPE_TLV:
+#ifdef RS_TYPE_TLV
+       case RS_TYPE_TLV:
                data = vp->vp_tlv;
                if (!data) {
                        nr_debug_error("ERROR: Cannot encode NULL TLV");
-                       return -NR_ERR_INVALID_ARG;
+                       return -RSE_INVAL;
                }
                len = vp->length;
                break;
@@ -146,7 +146,7 @@ static ssize_t vp2data_any(const RADIUS_PACKET *packet,
 
        default:                /* unknown type: ignore it */
                nr_debug_error("ERROR: Unknown attribute type %d", vp->da->type);
-               return -NR_ERR_ATTR_TYPE_UNKNOWN;
+               return -RSE_ATTR_TYPE_UNKNOWN;
        }
 
        /*
@@ -194,7 +194,7 @@ static ssize_t vp2data_any(const RADIUS_PACKET *packet,
                default:
                        if (!original) {
                                nr_debug_error("ERROR: No request packet, cannot encrypt %s attribute in the vp.", vp->da->name);
-                               return -NR_ERR_REQUEST_REQUIRED;
+                               return -RSE_REQUEST_REQUIRED;
                        }
 
                        if (lvalue) ptr[0] = vp->tag;
@@ -230,11 +230,11 @@ static ssize_t vp2data_any(const RADIUS_PACKET *packet,
 
        default:
                if (vp->da->flags.has_tag && TAG_VALID(vp->tag)) {
-                       if (vp->da->type == NR_TYPE_STRING) {
+                       if (vp->da->type == RS_TYPE_STRING) {
                                if (len > ((ssize_t) (room - 1))) len = room - 1;
                                ptr[0] = vp->tag;
                                ptr++;
-                       } else if (vp->da->type == NR_TYPE_INTEGER) {
+                       } else if (vp->da->type == RS_TYPE_INTEGER) {
                                array[0] = vp->tag;
                        } /* else it can't be any other type */
                }
@@ -300,7 +300,7 @@ static ssize_t vp2attr_vsa(const RADIUS_PACKET *packet,
        dv = nr_dict_vendor_byvalue(vendor);
        if (!dv ||
            (
-#ifdef NR_TYPE_TLV
+#ifdef RS_TYPE_TLV
                    !(*pvp)->flags.is_tlv &&
 #endif
                    (dv->type == 1) && (dv->length == 1))) {
@@ -308,7 +308,7 @@ static ssize_t vp2attr_vsa(const RADIUS_PACKET *packet,
                                   attribute, ptr, room);
        }
 
-#ifdef NR_TYPE_TLV
+#ifdef RS_TYPE_TLV
        if ((*pvp)->flags.is_tlv) {
                return data2vp_tlvs(packet, original, 0, pvp,
                                    ptr, room);
@@ -319,7 +319,7 @@ static ssize_t vp2attr_vsa(const RADIUS_PACKET *packet,
        default:
                nr_debug_error("vp2attr_vsa: Internal sanity check failed,"
                                   " type %u", (unsigned) dv->type);
-               return -NR_ERR_INTERNAL_FAILURE;
+               return -RSE_INTERNAL;
 
        case 4:
                ptr[0] = 0;     /* attr must be 24-bit */
@@ -342,7 +342,7 @@ static ssize_t vp2attr_vsa(const RADIUS_PACKET *packet,
        default:
                nr_debug_error("vp2attr_vsa: Internal sanity check failed,"
                                   " length %u", (unsigned) dv->length);
-               return -NR_ERR_INTERNAL_FAILURE;
+               return -RSE_INTERNAL;
 
        case 0:
                break;
@@ -392,9 +392,9 @@ ssize_t nr_vp2vsa(const RADIUS_PACKET *packet, const RADIUS_PACKET *original,
        }
 #endif
 
-       if (vp->da->vendor > NR_MAX_VENDOR) {
+       if (vp->da->vendor > RS_MAX_VENDOR) {
                nr_debug_error("nr_vp2vsa: Invalid arguments");
-               return -NR_ERR_INVALID_ARG;
+               return -RSE_INVAL;
        }
 
        /*
@@ -440,17 +440,17 @@ ssize_t nr_vp2rfc(const RADIUS_PACKET *packet,
 
        if (vp->da->vendor != 0) {
                nr_debug_error("nr_vp2rfc called with VSA");
-               return -NR_ERR_INVALID_ARG;
+               return -RSE_INVAL;
        }
 
        if ((vp->da->attr == 0) || (vp->da->attr > 255)) {
                nr_debug_error("nr_vp2rfc called with non-standard attribute %u", vp->da->attr);
-               return -NR_ERR_INVALID_ARG;
+               return -RSE_INVAL;
        }
 
 #ifdef PW_CHARGEABLE_USER_IDENTITY
        if ((vp->length == 0) &&
-           (vp->da != NR_DA_CHARGEABLE_USER_IDENTITY)) {
+           (vp->da != RS_DA_CHARGEABLE_USER_IDENTITY)) {
                *pvp = vp->next;
                return 0;
        }
@@ -471,10 +471,10 @@ static ssize_t nr_chap2rfc(const RADIUS_PACKET *packet,
 {
        ssize_t rcode;
        const VALUE_PAIR *vp = *pvp;
-       NR_MD5_CTX      ctx;
-       uint8_t         buffer[MAX_STRING_LEN*2 + 1], *p;
+       RS_MD5_CTX      ctx;
+       uint8_t         buffer[RS_MAX_STRING_LEN*2 + 1], *p;
        VALUE_PAIR chap = {
-               NR_DA_CHAP_PASSWORD,
+               RS_DA_CHAP_PASSWORD,
                17,
                0,
                NULL,
@@ -485,9 +485,9 @@ static ssize_t nr_chap2rfc(const RADIUS_PACKET *packet,
                },
        };
 
-       if ((vp->da->vendor != 0) || (vp->da != NR_DA_CHAP_PASSWORD)) {
+       if ((vp->da->vendor != 0) || (vp->da != RS_DA_CHAP_PASSWORD)) {
                nr_debug_error("nr_chap2rfc called with non-CHAP");
-               return -NR_ERR_INVALID_ARG;
+               return -RSE_INVAL;
        }
 
        p = buffer;
@@ -505,9 +505,9 @@ static ssize_t nr_chap2rfc(const RADIUS_PACKET *packet,
                p += sizeof(packet->vector);
        }
 
-       nr_MD5Init(&ctx);
-       nr_MD5Update(&ctx, buffer, p - buffer);
-       nr_MD5Final(&chap.vp_octets[1], &ctx);
+       RS_MD5Init(&ctx);
+       RS_MD5Update(&ctx, buffer, p - buffer);
+       RS_MD5Final(&chap.vp_octets[1], &ctx);
 
        chap.vp_octets[0] = buffer[0];
        vp = &chap;
@@ -531,7 +531,7 @@ static ssize_t nr_chap2rfc(const RADIUS_PACKET *packet,
  *  instead use this one, which has the correct length and data.
  */
 static const VALUE_PAIR fake_ma = {
-       NR_DA_MESSAGE_AUTHENTICATOR,
+       RS_DA_MESSAGE_AUTHENTICATOR,
        16,
        0,
        NULL,
@@ -557,7 +557,7 @@ ssize_t nr_vp2attr(const RADIUS_PACKET *packet, const RADIUS_PACKET *original,
         */
        if (vp->da->vendor != 0) {
 #ifdef VENDORPEC_EXTENDED
-               if (vp->da->vendor > NR_MAX_VENDOR) {
+               if (vp->da->vendor > RS_MAX_VENDOR) {
                        return nr_vp2attr_extended(packet, original,
                                                   pvp, start, room);
                                                    
@@ -575,7 +575,7 @@ ssize_t nr_vp2attr(const RADIUS_PACKET *packet, const RADIUS_PACKET *original,
                return nr_vp2vsa(packet, original, pvp, start, room);
 #else
                nr_debug_error("VSAs are not supported");
-               return -NR_ERR_UNSUPPORTED;
+               return -RSE_UNSUPPORTED;
 #endif
        }
 
@@ -593,7 +593,7 @@ ssize_t nr_vp2attr(const RADIUS_PACKET *packet, const RADIUS_PACKET *original,
         *      know how to calculate it, or what the correct values
         *      are.  So... create one for him.
         */
-       if (vp->da == NR_DA_MESSAGE_AUTHENTICATOR) {
+       if (vp->da == RS_DA_MESSAGE_AUTHENTICATOR) {
                ssize_t rcode;
 
                vp = &fake_ma;
@@ -610,7 +610,7 @@ ssize_t nr_vp2attr(const RADIUS_PACKET *packet, const RADIUS_PACKET *original,
         *      to calculate it, or what the correct values are.  To
         *      help, we calculate it for him.
         */
-       if (vp->da == NR_DA_CHAP_PASSWORD) {
+       if (vp->da == RS_DA_CHAP_PASSWORD) {
                int encoded = 0;
 
                /*
@@ -667,10 +667,10 @@ static ssize_t data2vp_raw(UNUSED const RADIUS_PACKET *packet,
 {
        VALUE_PAIR *vp;
 
-       if (length > sizeof(vp->vp_octets)) return -NR_ERR_ATTR_OVERFLOW;
+       if (length > sizeof(vp->vp_octets)) return -RSE_ATTR_OVERFLOW;
 
        vp = nr_vp_alloc_raw(attribute, vendor);
-       if (!vp) return -NR_ERR_NO_MEM;
+       if (!vp) return -RSE_NOMEM;
        
        memcpy(vp->vp_octets, data, length);
        vp->length = length;
@@ -685,9 +685,9 @@ ssize_t nr_attr2vp_raw(const RADIUS_PACKET *packet,
                       VALUE_PAIR **pvp)
 {
 
-       if (length < 2) return -NR_ERR_PACKET_TOO_SMALL;
-       if (data[1] < 2) return -NR_ERR_ATTR_TOO_SMALL;
-       if (data[1] > length) return -NR_ERR_ATTR_OVERFLOW;
+       if (length < 2) return -RSE_PACKET_TOO_SMALL;
+       if (data[1] < 2) return -RSE_ATTR_TOO_SMALL;
+       if (data[1] > length) return -RSE_ATTR_OVERFLOW;
 
        return data2vp_raw(packet, original, data[0], 0,
                           data + 2, data[1] - 2, pvp);
@@ -741,12 +741,12 @@ static ssize_t data2vp_any(const RADIUS_PACKET *packet,
                                   attribute, vendor, data, length, pvp);
        }
 
-#ifdef NR_TYPE_TLV
+#ifdef RS_TYPE_TLV
        /*
         *      TLVs are handled first.  They can't be tagged, and
         *      they can't be encrypted.
         */
-       if (da->da->type == NR_TYPE_TLV) {
+       if (da->da->type == RS_TYPE_TLV) {
                return data2vp_tlvs(packet, original,
                                    attribute, vendor, nest,
                                    data, length, pvp);
@@ -761,7 +761,7 @@ static ssize_t data2vp_any(const RADIUS_PACKET *packet,
         *      out of memory.
         */
        vp = nr_vp_alloc(da);
-       if (!vp) return -NR_ERR_NO_MEM;
+       if (!vp) return -RSE_NOMEM;
 
        /*
         *      Handle tags.
@@ -778,8 +778,8 @@ static ssize_t data2vp_any(const RADIUS_PACKET *packet,
                         */
                        vp->tag = data[0];
 
-                       if ((vp->da->type == NR_TYPE_STRING) ||
-                           (vp->da->type == NR_TYPE_OCTETS)) {
+                       if ((vp->da->type == RS_TYPE_STRING) ||
+                           (vp->da->type == RS_TYPE_OCTETS)) {
                                if (length == 0) goto raw;
                                data_offset = 1;
                        }
@@ -870,51 +870,51 @@ static ssize_t data2vp_any(const RADIUS_PACKET *packet,
        }
 
        switch (vp->da->type) {
-       case NR_TYPE_STRING:
-       case NR_TYPE_OCTETS:
-#ifdef NR_TYPE_ABINARY
-       case NR_TYPE_ABINARY:
+       case RS_TYPE_STRING:
+       case RS_TYPE_OCTETS:
+#ifdef RS_TYPE_ABINARY
+       case RS_TYPE_ABINARY:
 #endif
                /* nothing more to do */
                break;
 
-       case NR_TYPE_BYTE:
+       case RS_TYPE_BYTE:
                vp->vp_integer = vp->vp_octets[0];
                break;
 
 
-       case NR_TYPE_SHORT:
+       case RS_TYPE_SHORT:
                vp->vp_integer = (vp->vp_octets[0] << 8) | vp->vp_octets[1];
                break;
 
-       case NR_TYPE_INTEGER:
+       case RS_TYPE_INTEGER:
                memcpy(&vp->vp_integer, vp->vp_octets, 4);
                vp->vp_integer = ntohl(vp->vp_integer);
 
                if (vp->da->flags.has_tag) vp->vp_integer &= 0x00ffffff;
                break;
 
-       case NR_TYPE_DATE:
+       case RS_TYPE_DATE:
                memcpy(&vp->vp_date, vp->vp_octets, 4);
                vp->vp_date = ntohl(vp->vp_date);
                break;
 
 
-       case NR_TYPE_IPADDR:
+       case RS_TYPE_IPADDR:
                memcpy(&vp->vp_ipaddr, vp->vp_octets, 4);
                break;
 
                /*
                 *      IPv6 interface ID is 8 octets long.
                 */
-       case NR_TYPE_IFID:
+       case RS_TYPE_IFID:
                /* vp->vp_ifid == vp->vp_octets */
                break;
 
                /*
                 *      IPv6 addresses are 16 octets long
                 */
-       case NR_TYPE_IPV6ADDR:
+       case RS_TYPE_IPV6ADDR:
                /* vp->vp_ipv6addr == vp->vp_octets */
                break;
 
@@ -927,7 +927,7 @@ static ssize_t data2vp_any(const RADIUS_PACKET *packet,
                 *
                 *      The prefix length can have value 0 to 128.
                 */
-       case NR_TYPE_IPV6PREFIX:
+       case RS_TYPE_IPV6PREFIX:
                if (vp->length < 2 || vp->length > 18) goto raw;
                if (vp->vp_octets[1] > 128) goto raw;
 
@@ -942,7 +942,7 @@ static ssize_t data2vp_any(const RADIUS_PACKET *packet,
                break;
 
 #ifdef VENDORPEC_WIMAX
-       case NR_TYPE_SIGNED:
+       case RS_TYPE_SIGNED:
                if (vp->length != 4) goto raw;
 
                /*
@@ -955,22 +955,22 @@ static ssize_t data2vp_any(const RADIUS_PACKET *packet,
                break;
 #endif
 
-#ifdef NR_TYPE_TLV
-       case NR_TYPE_TLV:
+#ifdef RS_TYPE_TLV
+       case RS_TYPE_TLV:
                nr_vp_free(&vp);
                nr_debug_error("data2vp_any: Internal sanity check failed");
-               return -NR_ERR_ATTR_TYPE_UNKNOWN;
+               return -RSE_ATTR_TYPE_UNKNOWN;
 #endif
 
 #ifdef VENDORPEC_WIMAX
-       case NR_TYPE_COMBO_IP:
+       case RS_TYPE_COMBO_IP:
                if (vp->length == 4) {
-                       vp->da->type = NR_TYPE_IPADDR;
+                       vp->da->type = RS_TYPE_IPADDR;
                        memcpy(&vp->vp_ipaddr, vp->vp_octets, 4);
                        break;
 
                } else if (vp->length == 16) {
-                       vp->da->type = NR_TYPE_IPV6ADDR;
+                       vp->da->type = RS_TYPE_IPV6ADDR;
                        /* vp->vp_ipv6addr == vp->vp_octets */
                        break;
 
@@ -998,9 +998,9 @@ ssize_t nr_attr2vp_rfc(const RADIUS_PACKET *packet,
 {
        ssize_t rcode;
 
-       if (length < 2) return -NR_ERR_PACKET_TOO_SMALL;
-       if (data[1] < 2) return -NR_ERR_ATTR_TOO_SMALL;
-       if (data[1] > length) return -NR_ERR_ATTR_OVERFLOW;
+       if (length < 2) return -RSE_PACKET_TOO_SMALL;
+       if (data[1] < 2) return -RSE_ATTR_TOO_SMALL;
+       if (data[1] > length) return -RSE_ATTR_OVERFLOW;
        
        rcode = data2vp_any(packet, original, 0,
                            data[0], 0, data + 2, data[1] - 2, pvp);
@@ -1020,7 +1020,7 @@ int nr_tlv_ok(const uint8_t *data, size_t length,
 
        if ((dv_length > 2) || (dv_type == 0) || (dv_type > 4)) {
                nr_debug_error("nr_tlv_ok: Invalid arguments");
-               return -NR_ERR_INVALID_ARG;
+               return -RSE_INVAL;
        }
 
        while (data < end) {
@@ -1028,7 +1028,7 @@ int nr_tlv_ok(const uint8_t *data, size_t length,
 
                if ((data + dv_type + dv_length) > end) {
                        nr_debug_error("Attribute header overflow");
-                       return -NR_ERR_ATTR_TOO_SMALL;
+                       return -RSE_ATTR_TOO_SMALL;
                }
 
                switch (dv_type) {
@@ -1037,12 +1037,12 @@ int nr_tlv_ok(const uint8_t *data, size_t length,
                            (data[2] == 0) && (data[3] == 0)) {
                        zero:
                                nr_debug_error("Invalid attribute 0");
-                               return -NR_ERR_ATTR_INVALID;
+                               return -RSE_ATTR_INVALID;
                        }
 
                        if (data[0] != 0) {
                                nr_debug_error("Invalid attribute > 2^24");
-                               return -NR_ERR_ATTR_INVALID;
+                               return -RSE_ATTR_INVALID;
                        }
                        break;
 
@@ -1056,7 +1056,7 @@ int nr_tlv_ok(const uint8_t *data, size_t length,
 
                default:
                        nr_debug_error("Internal sanity check failed");
-                       return -NR_ERR_INTERNAL_FAILURE;
+                       return -RSE_INTERNAL;
                }
 
                switch (dv_length) {
@@ -1066,7 +1066,7 @@ int nr_tlv_ok(const uint8_t *data, size_t length,
                case 2:
                        if (data[dv_type + 1] != 0) {
                                nr_debug_error("Attribute is longer than 256 octets");
-                               return -NR_ERR_ATTR_TOO_LARGE;
+                               return -RSE_ATTR_TOO_LARGE;
                        }
                        /* FALL-THROUGH */
                case 1:
@@ -1076,17 +1076,17 @@ int nr_tlv_ok(const uint8_t *data, size_t length,
 
                default:
                        nr_debug_error("Internal sanity check failed");
-                       return -NR_ERR_INTERNAL_FAILURE;
+                       return -RSE_INTERNAL;
                }
 
                if (attrlen < (dv_type + dv_length)) {
                        nr_debug_error("Attribute header has invalid length");
-                       return -NR_ERR_PACKET_TOO_SMALL;
+                       return -RSE_PACKET_TOO_SMALL;
                }
 
                if (attrlen > length) {
                        nr_debug_error("Attribute overflows container");
-                       return -NR_ERR_ATTR_OVERFLOW;
+                       return -RSE_ATTR_OVERFLOW;
                }
 
                data += attrlen;
@@ -1113,7 +1113,7 @@ static ssize_t attr2vp_vsa(const RADIUS_PACKET *packet,
 #ifndef NDEBUG
        if (length <= (dv_type + dv_length)) {
                nr_debug_error("attr2vp_vsa: Failure to call nr_tlv_ok");
-               return -NR_ERR_PACKET_TOO_SMALL;
+               return -RSE_PACKET_TOO_SMALL;
        }
 #endif 
 
@@ -1136,7 +1136,7 @@ static ssize_t attr2vp_vsa(const RADIUS_PACKET *packet,
 
        default:
                nr_debug_error("attr2vp_vsa: Internal sanity check failed");
-               return -NR_ERR_INTERNAL_FAILURE;
+               return -RSE_INTERNAL;
        }
 
        switch (dv_length) {
@@ -1155,13 +1155,13 @@ static ssize_t attr2vp_vsa(const RADIUS_PACKET *packet,
 
        default:
                nr_debug_error("attr2vp_vsa: Internal sanity check failed");
-               return -NR_ERR_INTERNAL_FAILURE;
+               return -RSE_INTERNAL;
        }
 
 #ifndef NDEBUG
        if (attrlen <= (ssize_t) (dv_type + dv_length)) {
                nr_debug_error("attr2vp_vsa: Failure to call nr_tlv_ok");
-               return -NR_ERR_PACKET_TOO_SMALL;
+               return -RSE_PACKET_TOO_SMALL;
        }
 #endif
 
@@ -1177,7 +1177,7 @@ static ssize_t attr2vp_vsa(const RADIUS_PACKET *packet,
                nr_vp_free(pvp);
                nr_debug_error("attr2vp_vsa: Incomplete decode %d != %d",
                                   (int) my_len, (int) attrlen);
-               return -NR_ERR_INTERNAL_FAILURE;
+               return -RSE_INTERNAL;
        }
 #endif
 
@@ -1198,13 +1198,13 @@ ssize_t nr_attr2vp_vsa(const RADIUS_PACKET *packet,
        uint32_t lvalue;
        const DICT_VENDOR *dv;
 
-       if (length < 2) return -NR_ERR_PACKET_TOO_SMALL;
-       if (data[1] < 2) return -NR_ERR_ATTR_TOO_SMALL;
-       if (data[1] > length) return -NR_ERR_ATTR_OVERFLOW;
+       if (length < 2) return -RSE_PACKET_TOO_SMALL;
+       if (data[1] < 2) return -RSE_ATTR_TOO_SMALL;
+       if (data[1] > length) return -RSE_ATTR_OVERFLOW;
 
        if (data[0] != PW_VENDOR_SPECIFIC) {
                nr_debug_error("nr_attr2vp_vsa: Invalid attribute");
-               return -NR_ERR_INVALID_ARG;
+               return -RSE_INVAL;
        }
 
        /*
@@ -1256,7 +1256,7 @@ ssize_t nr_attr2vp_vsa(const RADIUS_PACKET *packet,
        if (my_len != (data[1] - 6)) {
                nr_vp_free(pvp);
                nr_debug_error("nr_attr2vp_vsa: Incomplete decode");
-               return -NR_ERR_INTERNAL_FAILURE;
+               return -RSE_INTERNAL;
        }
 #endif
 
@@ -1273,9 +1273,9 @@ ssize_t nr_attr2vp(const RADIUS_PACKET *packet,
                    const uint8_t *data, size_t length,
                    VALUE_PAIR **pvp)
 {
-       if (length < 2) return -NR_ERR_PACKET_TOO_SMALL;
-       if (data[1] < 2) return -NR_ERR_ATTR_TOO_SMALL;
-       if (data[1] > length) return -NR_ERR_ATTR_OVERFLOW;
+       if (length < 2) return -RSE_PACKET_TOO_SMALL;
+       if (data[1] < 2) return -RSE_ATTR_TOO_SMALL;
+       if (data[1] > length) return -RSE_ATTR_OVERFLOW;
 
 #ifndef WITHOUT_VSAS
        /*
@@ -1307,18 +1307,18 @@ ssize_t nr_attr2data(const RADIUS_PACKET *packet, ssize_t start,
        uint8_t *data, *attr;
        const uint8_t *end;
 
-       if (!packet || !pdata || !plength) return -NR_ERR_INVALID_ARG;
+       if (!packet || !pdata || !plength) return -RSE_INVAL;
 
-       if (!packet->data) return -NR_ERR_INVALID_ARG;
-       if (packet->length < 20) return -NR_ERR_INVALID_ARG;
+       if (!packet->data) return -RSE_INVAL;
+       if (packet->length < 20) return -RSE_INVAL;
 
        /*
         *      Too long or short, not good.
         */
        if ((start < 0) ||
-           ((start > 0) && (start < 20))) return -NR_ERR_INVALID_ARG;
+           ((start > 0) && (start < 20))) return -RSE_INVAL;
 
-       if ((size_t) start >= (packet->length - 2)) return -NR_ERR_INVALID_ARG;
+       if ((size_t) start >= (packet->length - 2)) return -RSE_INVAL;
 
        end = packet->data + packet->length;
 
@@ -1343,17 +1343,17 @@ ssize_t nr_attr2data(const RADIUS_PACKET *packet, ssize_t start,
                 */
                if ((attr + 2) > end) {
                        nr_debug_error("Attribute overflows packet");
-                       return -NR_ERR_ATTR_OVERFLOW;
+                       return -RSE_ATTR_OVERFLOW;
                }
 
                if (attr[1] < 2) {
                        nr_debug_error("Attribute length is too small");
-                       return -NR_ERR_ATTR_TOO_SMALL;
+                       return -RSE_ATTR_TOO_SMALL;
                }
 
                if ((attr + attr[1]) > end) {
                        nr_debug_error("Attribute length is too large");
-                       return -NR_ERR_ATTR_TOO_LARGE;
+                       return -RSE_ATTR_TOO_LARGE;
                }
 #endif
 
@@ -1379,7 +1379,7 @@ ssize_t nr_attr2data(const RADIUS_PACKET *packet, ssize_t start,
                                dv = nr_dict_vendor_byvalue(vendor);
                                if (dv &&
                                    ((dv->type != 1) || (dv->length != 1))) {
-                                       return -NR_ERR_VENDOR_UNKNOWN;
+                                       return -RSE_VENDOR_UNKNOWN;
                                }
                        }
 
index 591884f..df9f834 100644 (file)
@@ -29,6 +29,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *  \brief Main header file.
  */
 
+#ifndef _RADIUS_CLIENT_H_
+#define _RADIUS_CLIENT_H_ 1
+
 /*
  *  System-specific header files.
  */
@@ -42,10 +45,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <netinet/in.h>
 #include <sys/time.h>
 
+#include <radsec/radsec.h>
+
 /*
  *  Definitions of attributes.
  */
-#include <networkradius-devel/radius.h>
+#include <radsec/radius.h>
 
 /** \defgroup build Build Helpers
  *
@@ -135,38 +140,38 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #endif
 
 #ifdef WITHOUT_OPENSSL
-#ifndef NR_MD5_CTX
-#error NR_MD5_CTX must be defined
+#ifndef RS_MD5_CTX
+#error RS_MD5_CTX must be defined
 #endif
-#ifndef nr_MD5Init
+#ifndef RS_MD5Init
 #error n_rMD5Init must be defined
 #endif
-#ifndef nr_MD5Update
-#error nr_MD5Updyae must be defined
+#ifndef RS_MD5Update
+#error RS_MD5Updyae must be defined
 #endif
-#ifndef nr_MD5Final
-#error nr_MD5Final must be defined
+#ifndef RS_MD5Final
+#error RS_MD5Final must be defined
 #endif
-#ifndef nr_MD5Transform
-#error nr_MD5Transform must be defined
+#ifndef RS_MD5Transform
+#error RS_MD5Transform must be defined
 #endif
 
 #else  /* WITHOUT_OPENSSL */
 
 #include <openssl/md5.h>
 /** Define for compile-time selection of the MD5 functions.  Defaults to using the OpenSSL functions.  \ingroup custom */
-#define NR_MD5_CTX     MD5_CTX
+#define RS_MD5_CTX     MD5_CTX
 /** Define for compile-time selection of the MD5 functions.  Defaults to using the OpenSSL functions. \ingroup custom */
-#define nr_MD5Init     MD5_Init
+#define RS_MD5Init     MD5_Init
 /** Define for compile-time selection of the MD5 functions.  Defaults to using the OpenSSL functions. \ingroup custom */
-#define nr_MD5Update   MD5_Update
+#define RS_MD5Update   MD5_Update
 /** Define for compile-time selection of the MD5 functions.  Defaults to using the OpenSSL functions. \ingroup custom */
-#define nr_MD5Final    MD5_Final
+#define RS_MD5Final    MD5_Final
 /** Define for compile-time selection of the MD5 functions.  Defaults to using the OpenSSL functions. \ingroup custom */
-#define nr_MD5Transform MD5_Transform
+#define RS_MD5Transform MD5_Transform
 #endif
 
-#ifndef NR_MAX_PACKET_LEN
+#ifndef RS_MAX_PACKET_LEN
 /** The maximum size of a packet that the library will send or receive.  \ingroup custom
  *
  *  The RFC requirement is to handle at least 4K packets.  However, if
@@ -176,144 +181,39 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *  Be warned that any packets larger than this value will be ignored
  *  and silently discarded.
  */
-#define NR_MAX_PACKET_LEN (4096)
+#define RS_MAX_PACKET_LEN (4096)
 #endif
 
-#ifndef NR_MAX_ATTRIBUTES
+#ifndef RS_MAX_ATTRIBUTES
 /** The maximum number of attributes that the library will allow in a packet.  \ingroup custom
  *
- *  Packets which contain more than ::NR_MAX_ATTRIBUTES will generate
+ *  Packets which contain more than ::RS_MAX_ATTRIBUTES will generate
  *  an error.  This value is configurable because there may be a need
  *  to accept a large mumber of attributes.
  *
  *  This value is ignored when packets are sent.  The library will
  *  send as many attributes as it is told to send.
  */
-#define NR_MAX_ATTRIBUTES (200)
+#define RS_MAX_ATTRIBUTES (200)
 #endif
 
-#undef NR_MAX_PACKET_CODE
+#undef RS_MAX_PACKET_CODE
 /** The maximum RADIUS_PACKET::code which we can accept. \ingroup dict
  *
  *  \attention This should not be changed, as it is used by other
  *  structures such as ::nr_packet_codes.
  */
-#define NR_MAX_PACKET_CODE PW_COA_NAK
+#define RS_MAX_PACKET_CODE PW_COA_NAK
 
 /**  The maximum vendor number which is permitted. \ingroup dict
  *
  *  The RFCs require that the Vendor Id or Private Enterprise Number
  *  be encoded as 32 bits, with the upper 8 bits being zero.
  */
-#define NR_MAX_VENDOR          (1 << 24)
-
-/**  The maximum length of a RADIUS attribute.
- *
- *  The RFCs require that a RADIUS attribute transport no more than
- *  253 octets of data.  We add an extra byte for a trailing NUL, so
- *  that the VALUE_PAIR::vp_strvalue field can be handled as a C
- *  string.
- */
-#define MAX_STRING_LEN         (254)
+#define RS_MAX_VENDOR          (1 << 24)
 
 /** Data Type Definitions. \ingroup dict
  */
-typedef enum nr_attr_type_t {
-  NR_TYPE_INVALID = 0,         /**< Invalid data type */
-  NR_TYPE_STRING,                      /**< printable-text */
-  NR_TYPE_INTEGER,                     /**< a 32-bit unsigned integer */
-  NR_TYPE_IPADDR,                      /**< an IPv4 address */
-  NR_TYPE_DATE,                        /**< a 32-bit date, of seconds since January 1, 1970 */
-  NR_TYPE_OCTETS,               /**< a sequence of binary octets */
-  NR_TYPE_IFID,                        /**< an Interface Id */
-  NR_TYPE_IPV6ADDR,            /**< an IPv6 address */
-  NR_TYPE_IPV6PREFIX,          /**< an IPv6 prefix */
-  NR_TYPE_BYTE,                        /**< an 8-bit integer */
-  NR_TYPE_SHORT,               /**< a 16-bit integer */
-} nr_attr_type_t;
-
-#define        PW_ACCESS_REQUEST               1
-#define        PW_ACCESS_ACCEPT                2
-#define        PW_ACCESS_REJECT                3
-#define        PW_ACCOUNTING_REQUEST           4
-#define        PW_ACCOUNTING_RESPONSE          5
-#define        PW_ACCOUNTING_STATUS            6
-#define PW_PASSWORD_REQUEST            7
-#define PW_PASSWORD_ACK                        8
-#define PW_PASSWORD_REJECT             9
-#define        PW_ACCOUNTING_MESSAGE           10
-#define PW_ACCESS_CHALLENGE            11
-#define PW_STATUS_SERVER               12
-#define PW_STATUS_CLIENT               13
-#define PW_DISCONNECT_REQUEST          40
-#define PW_DISCONNECT_ACK              41
-#define PW_DISCONNECT_NAK              42
-#define PW_COA_REQUEST                 43
-#define PW_COA_ACK                     44
-#define PW_COA_NAK                     45
-
-/** Error codes \ingroup error
- *
- *  The numerical value of these definitions may change from version
- *  to version of the library.
- */
-typedef enum nr_error_t {
-       /** Invalid argument */
-       NR_ERR_INVALID_ARG = 1,
-       /** Insufficient data to decode the packet */
-       NR_ERR_PACKET_TOO_SMALL,
-       /** The packet header says it is larger than the received data */
-       NR_ERR_PACKET_TOO_LARGE,
-       /** the attribute overflows the packet */
-       NR_ERR_ATTR_OVERFLOW,
-       /** the attribute header "length" field is too small */
-       NR_ERR_ATTR_TOO_SMALL,
-       /** the attribute is more than 256 octets long */
-       NR_ERR_ATTR_TOO_LARGE,
-       /** the attribute is unknown */
-       NR_ERR_ATTR_UNKNOWN,
-       /** the attribute name is improperly formatted */
-       NR_ERR_ATTR_BAD_NAME,
-       /** the attribute value could not be parsed */
-       NR_ERR_ATTR_VALUE_MALFORMED,
-       /** the attribute "type" is invalid */
-       NR_ERR_ATTR_INVALID,
-       /** the packet has too many attributes */
-       NR_ERR_TOO_MANY_ATTRS,
-       /** the attribute has an unsupported data type */
-       NR_ERR_ATTR_TYPE_UNKNOWN,
-       /** the Message-Authenticator has the wrong length */
-       NR_ERR_MSG_AUTH_LEN,
-       /** the Message-Authenticator is wrong */
-       NR_ERR_MSG_AUTH_WRONG,
-       /** we need a request packet to calculate something in the response */
-       NR_ERR_REQUEST_REQUIRED,
-       /** the request code is unsupported */
-       NR_ERR_REQUEST_CODE_INVALID,
-       /** the Authentication Vector is wrong */
-       NR_ERR_AUTH_VECTOR_WRONG,
-       /** the response code is unsupported */
-       NR_ERR_RESPONSE_CODE_INVALID,
-       /** the response ID field is invalid */
-       NR_ERR_RESPONSE_ID_INVALID,
-       /** the response is not from the correct source IP/port */
-       NR_ERR_RESPONSE_SRC_INVALID,
-       /** Look at "errno" for the error */
-       NR_ERR_SYSTEM,
-       /** We cannot encode the packet because of invalid arguments */
-       NR_ERR_NO_PACKET_DATA,
-       /** the vendor is unknown */
-       NR_ERR_VENDOR_UNKNOWN,
-       /** an internal sanity check failed */
-       NR_ERR_INTERNAL_FAILURE,
-       /** the caller requested an unsupported featuer */
-       NR_ERR_UNSUPPORTED,
-       /** we were unable to allocate memory */
-       NR_ERR_NO_MEM,
-       /** Resource is in use */
-       NR_ERR_IN_USE,
-} nr_error_t;
-
 #define TAG_VALID(x)          ((x) < 0x20)
 
 /** The attribute is not encrypted. */
@@ -335,7 +235,7 @@ typedef enum nr_error_t {
 typedef struct attr_flags {
        unsigned int            has_tag : 1; /**< Attribute has an RFC 2868 tag */
        unsigned int            unknown : 1; /**< Attribute is unknown */
-#ifdef NR_TYPE_TLV
+#ifdef RS_TYPE_TLV
        unsigned int            has_tlv : 1; /* has sub attributes */
        unsigned int            is_tlv : 1; /* is a sub attribute */
 #endif
@@ -358,7 +258,7 @@ typedef struct attr_flags {
  */
 typedef struct nr_dict_attr {
        unsigned int            attr;           /**< Attribute number  */
-       nr_attr_type_t          type;           /**< Data type */
+       rs_attr_type_t          type;           /**< Data type */
        unsigned int            vendor;         /**< Vendor-Id number  */
         ATTR_FLAGS              flags;
        const char              *name;          /**< Printable name  */
@@ -392,21 +292,21 @@ typedef struct nr_dict_vendor {
  *
  */
 typedef union value_pair_data {
-       char                    strvalue[MAX_STRING_LEN]; /* +1 for NUL */
+       char                    strvalue[RS_MAX_STRING_LEN]; /* +1 for NUL */
        uint8_t                 octets[253];
        struct in_addr          ipaddr;
        struct in6_addr         ipv6addr;
        uint32_t                date;
        uint32_t                integer;
-#ifdef NR_TYPE_SIGNED
+#ifdef RS_TYPE_SIGNED
        int32_t                 sinteger;
 #endif
-#ifdef NR_TYPE_ABINARY
+#ifdef RS_TYPE_ABINARY
        uint8_t                 filter[32];
 #endif
        uint8_t                 ifid[8]; /* struct? */
        uint8_t                 ipv6prefix[18]; /* struct? */
-#ifdef NR_TYPE_TLV
+#ifdef RS_TYPE_TLV
        uint8_t                 *tlv;
 #endif
 } VALUE_PAIR_DATA;
@@ -432,23 +332,23 @@ typedef struct value_pair {
 #define vp_ipaddr     data.ipaddr.s_addr
 #define vp_date       data.integer
 #define vp_integer    data.integer
-#ifdef NR_TYPE_ABINARY
+#ifdef RS_TYPE_ABINARY
 #define vp_filter     data.filter
 #endif
-#ifdef NR_TYPE_ETHER
+#ifdef RS_TYPE_ETHER
 #define vp_ether      data.ether
 #endif
-#ifdef NR_TYPE_SIGNED
+#ifdef RS_TYPE_SIGNED
 #define vp_signed     data.sinteger
 #endif
-#ifdef NR_TYPE_TLV
+#ifdef RS_TYPE_TLV
 #define vp_tlv       data.tlv
 #endif
 
-#ifdef NR_TYPE_TLV
-#define NR_ATTR_MAX_TLV (4)
-extern const int nr_attr_shift[NR_ATTR_MAX_TLV];
-extern const int nr_attr_mask[NR_ATTR_MAX_TLV];
+#ifdef RS_TYPE_TLV
+#define RS_ATTR_MAX_TLV (4)
+extern const int nr_attr_shift[RS_ATTR_MAX_TLV];
+extern const int nr_attr_mask[RS_ATTR_MAX_TLV];
 extern const unsigned int nr_attr_max_tlv;
 #endif
 
@@ -474,12 +374,12 @@ typedef struct radius_packet {
        VALUE_PAIR              *vps;   /**< linked list of ::VALUE_PAIR */
 } RADIUS_PACKET;
 
-#define NR_PACKET_ENCODED  (1 << 0)
-#define NR_PACKET_HEADER   (1 << 1)
-#define NR_PACKET_SIGNED   (1 << 2)
-#define NR_PACKET_OK      (1 << 3)
-#define NR_PACKET_VERIFIED (1 << 4)
-#define NR_PACKET_DECODED  (1 << 5)
+#define RS_PACKET_ENCODED  (1 << 0)
+#define RS_PACKET_HEADER   (1 << 1)
+#define RS_PACKET_SIGNED   (1 << 2)
+#define RS_PACKET_OK      (1 << 3)
+#define RS_PACKET_VERIFIED (1 << 4)
+#define RS_PACKET_DECODED  (1 << 5)
 
 
 /** Track packets sent to a server. \ingroup id
@@ -634,7 +534,7 @@ extern VALUE_PAIR *nr_vps_find(VALUE_PAIR *head,
  *  packet.
  *
  *  \attention There is usually no need to call this function.  Use
- *  the NR_DA_* definitions instead.
+ *  the RS_DA_* definitions instead.
  *
  * @param[in] attr    Value of the attribute
  * @param[in] vendor  Value of the vendor
@@ -773,7 +673,7 @@ extern const DICT_ATTR const *nr_dict_attr_names[];
  *  application.  Packet codes which are not handled by the library
  *  have NULL for their names.
  */
-extern const char *nr_packet_codes[NR_MAX_PACKET_CODE + 1];
+extern const char *nr_packet_codes[RS_MAX_PACKET_CODE + 1];
 
 /** Verifies that a packet is "well formed".  \ingroup packet
  *
@@ -1406,3 +1306,5 @@ extern ssize_t nr_vp_sscanf_value(VALUE_PAIR *vp, const char *value);
  */
 # define BLANK_FORMAT ""
 #endif
+
+#endif /* _RADIUS_CLIENT_H_ */
index c08489a..7042fe5 100644 (file)
@@ -124,7 +124,7 @@ sub do_file()
            }
 
            $type =~ tr/a-z/A-Z/;
-           $attributes{$index}{'type'} = "NR_TYPE_$type";
+           $attributes{$index}{'type'} = "RS_TYPE_$type";
 
            $stuff =~ s/^\s*//;
 
index ce7cccd..9cf8731 100755 (executable)
@@ -134,7 +134,7 @@ foreach $attr_val (sort {lc($attributes{$a}{'name'}) cmp lc($attributes{$b}{'nam
 print DICT "};\n\n";
 close DICT;
 
-open HDR, ">radius.h" or die "Failed creating radius.c: $!\n";
+open HDR, ">../include/radsec/radius.h" or die "Failed creating radius.c: $!\n";
 
 print HDR "/* Automatically generated file.  Do not edit */\n\n";
 
@@ -174,7 +174,7 @@ foreach $attr_val (sort {$a <=> $b} keys %attributes) {
     $name =~ tr/a-z/A-Z/;
     $name =~ tr/-/_/;
 
-    print HDR "#define NR_DA_$name (&nr_dict_attrs[$attributes{$attr_val}{'offset'}])\n";
+    print HDR "#define RS_DA_$name (&nr_dict_attrs[$attributes{$attr_val}{'offset'}])\n";
 }
 
 print HDR "/* Automatically generated file.  Do not edit */\n";
index 02a223d..21cc7d0 100644 (file)
@@ -36,7 +36,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 /** \cond PRIVATE */
 
-#include       <networkradius-devel/client.h>
+#include       "client.h"
 
 
 ssize_t nr_password_encrypt(uint8_t *output, size_t outlen,
@@ -45,35 +45,35 @@ ssize_t nr_password_encrypt(uint8_t *output, size_t outlen,
 {
        size_t i, j, len;
        uint8_t digest[16];
-       NR_MD5_CTX ctx, secret_ctx;
+       RS_MD5_CTX ctx, secret_ctx;
 
        if (!output || (outlen < 16) || !input || (inlen == 0) ||
            !secret || !vector) {
-               return -NR_ERR_INVALID_ARG;
+               return -RSE_INVAL;
        }
 
        len = inlen;
-       if (len > 128) return -NR_ERR_ATTR_OVERFLOW;
+       if (len > 128) return -RSE_ATTR_OVERFLOW;
 
        len = (len + 0x0f) & ~0x0f; /* round up to 16 byte boundary */
 
-       if (outlen < len) return -NR_ERR_ATTR_OVERFLOW;
+       if (outlen < len) return -RSE_ATTR_OVERFLOW;
 
        memcpy(output, input, len);
        memset(output + len, 0, 128 - len);
 
-       nr_MD5Init(&secret_ctx);
-       nr_MD5Update(&secret_ctx, (const uint8_t *) secret, strlen(secret));
+       RS_MD5Init(&secret_ctx);
+       RS_MD5Update(&secret_ctx, (const uint8_t *) secret, strlen(secret));
 
        for (j = 0; j < len; j += 16) {
                ctx = secret_ctx;
 
                if (j == 0) {
-                       nr_MD5Update(&ctx, vector, 16);
-                       nr_MD5Final(digest, &ctx);
+                       RS_MD5Update(&ctx, vector, 16);
+                       RS_MD5Final(digest, &ctx);
                } else {
-                       nr_MD5Update(&ctx, &output[j - 16], 16);
-                       nr_MD5Final(digest, &ctx);
+                       RS_MD5Update(&ctx, &output[j - 16], 16);
+                       RS_MD5Final(digest, &ctx);
                }
 
                for (i = 0; i < 16; i++) {
@@ -90,16 +90,16 @@ ssize_t nr_tunnelpw_encrypt(uint8_t *output, size_t outlen,
                            const char *secret, const uint8_t *vector)
 {
        size_t i, j, len;
-       NR_MD5_CTX ctx, secret_ctx;
+       RS_MD5_CTX ctx, secret_ctx;
        uint8_t digest[16];
 
        if (!output || (outlen < 18) || !input || (inlen == 0) ||
            !secret || !vector) {
-               return -NR_ERR_INVALID_ARG;
+               return -RSE_INVAL;
        }
 
        len = ((inlen + 1) + 0x0f) & ~0x0f;
-       if (len > 251) return -NR_ERR_ATTR_OVERFLOW;
+       if (len > 251) return -RSE_ATTR_OVERFLOW;
 
        output[0] = (nr_rand() & 0xff) | 0x80;
        output[1] = nr_rand() & 0xff;
@@ -108,19 +108,19 @@ ssize_t nr_tunnelpw_encrypt(uint8_t *output, size_t outlen,
        memcpy(output + 3, input, inlen);
        memset(output + 3 + inlen, 0, len - inlen - 1);
 
-       nr_MD5Init(&secret_ctx);
-       nr_MD5Update(&secret_ctx, (const uint8_t *) secret, strlen(secret));
+       RS_MD5Init(&secret_ctx);
+       RS_MD5Update(&secret_ctx, (const uint8_t *) secret, strlen(secret));
 
        for (j = 0; j < len; j += 16) {
                ctx = secret_ctx;
 
                if (j == 0) {
-                       nr_MD5Update(&ctx, vector, 16);
-                       nr_MD5Update(&ctx, output, 2);
-                       nr_MD5Final(digest, &ctx);
+                       RS_MD5Update(&ctx, vector, 16);
+                       RS_MD5Update(&ctx, output, 2);
+                       RS_MD5Final(digest, &ctx);
                } else {
-                       nr_MD5Update(&ctx, &output[j + 2 - 16], 16);
-                       nr_MD5Final(digest, &ctx);
+                       RS_MD5Update(&ctx, &output[j + 2 - 16], 16);
+                       RS_MD5Final(digest, &ctx);
                }
 
                for (i = 0; i < 16; i++) {
@@ -136,12 +136,12 @@ ssize_t nr_tunnelpw_decrypt(uint8_t *output, size_t outlen,
                            const char *secret, const uint8_t *vector)
 {
        size_t i, j, len, encoded_len;
-       NR_MD5_CTX ctx, secret_ctx;
+       RS_MD5_CTX ctx, secret_ctx;
        uint8_t digest[16];
 
        if (!output || (outlen < 1) || !input || (inlen < 2) ||
            !secret || !vector) {
-               return -NR_ERR_INVALID_ARG;
+               return -RSE_INVAL;
        }
 
        if (inlen <= 3) {
@@ -151,20 +151,20 @@ ssize_t nr_tunnelpw_decrypt(uint8_t *output, size_t outlen,
 
        len = inlen - 2;
 
-       if (outlen < (len - 1)) return -NR_ERR_ATTR_OVERFLOW;
+       if (outlen < (len - 1)) return -RSE_ATTR_OVERFLOW;
 
-       nr_MD5Init(&secret_ctx);
-       nr_MD5Update(&secret_ctx, (const uint8_t *) secret, strlen(secret));
+       RS_MD5Init(&secret_ctx);
+       RS_MD5Update(&secret_ctx, (const uint8_t *) secret, strlen(secret));
 
        ctx = secret_ctx;
 
-       nr_MD5Update(&ctx, vector, 16); /* MD5(secret + vector + salt) */
-       nr_MD5Update(&ctx, input, 2);
-       nr_MD5Final(digest, &ctx);
+       RS_MD5Update(&ctx, vector, 16); /* MD5(secret + vector + salt) */
+       RS_MD5Update(&ctx, input, 2);
+       RS_MD5Final(digest, &ctx);
 
        encoded_len = input[2] ^ digest[0];
        if (encoded_len >= len) {
-               return -NR_ERR_ATTR_TOO_LARGE;
+               return -RSE_ATTR_TOO_LARGE;
        }
 
        for (i = 0; i < 15; i++) {
@@ -174,8 +174,8 @@ ssize_t nr_tunnelpw_decrypt(uint8_t *output, size_t outlen,
        for (j = 16; j < len; j += 16) {
                ctx = secret_ctx;
 
-               nr_MD5Update(&ctx, input + j - 16 + 2, 16);
-               nr_MD5Final(digest, &ctx);
+               RS_MD5Update(&ctx, input + j - 16 + 2, 16);
+               RS_MD5Final(digest, &ctx);
 
                for (i = 0; i < 16; i++) {
                        output[i + j - 1] = input[i + j + 2] ^ digest[i];
@@ -198,12 +198,12 @@ nr_hmac_md5(const uint8_t *data, size_t data_len,
         uint8_t k_ipad[64];
         uint8_t k_opad[64];
         uint8_t tk[16];
-        NR_MD5_CTX ctx;
+        RS_MD5_CTX ctx;
 
         if (key_len > 64) {
-                nr_MD5Init(&ctx);
-                nr_MD5Update(&ctx, key, key_len);
-                nr_MD5Final(tk, &ctx);
+                RS_MD5Init(&ctx);
+                RS_MD5Update(&ctx, key, key_len);
+                RS_MD5Final(tk, &ctx);
 
                 key = tk;
                 key_len = 16;
@@ -219,15 +219,15 @@ nr_hmac_md5(const uint8_t *data, size_t data_len,
                 k_opad[i] ^= 0x5c;
         }
 
-        nr_MD5Init(&ctx); 
-        nr_MD5Update(&ctx, k_ipad, sizeof(k_ipad));
-        nr_MD5Update(&ctx, data, data_len);
-        nr_MD5Final(digest, &ctx);
+        RS_MD5Init(&ctx); 
+        RS_MD5Update(&ctx, k_ipad, sizeof(k_ipad));
+        RS_MD5Update(&ctx, data, data_len);
+        RS_MD5Final(digest, &ctx);
 
-        nr_MD5Init(&ctx);
-        nr_MD5Update(&ctx, k_opad, sizeof(k_opad));
-        nr_MD5Update(&ctx, digest, 16);
-        nr_MD5Final(digest, &ctx);
+        RS_MD5Init(&ctx);
+        RS_MD5Update(&ctx, k_opad, sizeof(k_opad));
+        RS_MD5Update(&ctx, digest, 16);
+        RS_MD5Final(digest, &ctx);
 }
 
 /** \endcond */
index e33cf5a..02e2463 100644 (file)
@@ -29,7 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *  \brief Functions which should be customized for your local system.
  */
 
-#include <networkradius-devel/client.h>
+#include "client.h"
 
 #include       <unistd.h>
 #include       <fcntl.h>
index 26fe7d0..fc04ee2 100644 (file)
@@ -25,7 +25,7 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include <networkradius-devel/client.h>
+#include "client.h"
 #include <ctype.h>
 
 /** \file dict.c
@@ -56,7 +56,7 @@ const DICT_ATTR *nr_dict_attr_byvalue(unsigned int attr, unsigned int vendor)
                        return &nr_dict_attrs[half];
                }
 
-               if ((vendor > nr_dict_attrs[half].vendor) &&
+               if ((vendor >= nr_dict_attrs[half].vendor) &&
                    (attr > nr_dict_attrs[half].attr)) {
                        start = half + 1;
                } else {
@@ -100,19 +100,19 @@ const DICT_ATTR *nr_dict_attr_byname(const char *name)
 int nr_dict_attr_2struct(DICT_ATTR *da, unsigned int attr, unsigned int vendor,
                         char *buffer, size_t bufsize)
 {
-       if (!da || !buffer) return -NR_ERR_INVALID_ARG;
+       if (!da || !buffer) return -RSE_INVAL;
 
        if (!vendor) {
-               if (attr > 256) return -NR_ERR_INVALID_ARG;
+               if (attr > 256) return -RSE_INVAL;
 
        } else if (vendor > (1 << 24)) {
-               return -NR_ERR_INVALID_ARG;
+               return -RSE_INVAL;
        }
 
        memset(da, 0, sizeof(*da));
        da->attr = attr;
        da->flags.unknown = 1;
-       da->type = NR_TYPE_OCTETS;
+       da->type = RS_TYPE_OCTETS;
        da->vendor = vendor;
 
        if (da->vendor) {
diff --git a/lib/radius/dictionaries.c b/lib/radius/dictionaries.c
deleted file mode 100644 (file)
index d1f4b6f..0000000
+++ /dev/null
@@ -1,1515 +0,0 @@
-const DICT_VENDOR nr_dict_vendors[] = {
-  { 
-    .name = "Microsoft", 
-    .vendor = 311, 
-    .type = 1,
-    .length = 1,
-  },
-  { 
-    .name = "example", 
-    .vendor = 65535, 
-    .type = 1,
-    .length = 1,
-  },
-
-  { .name = NULL, }
-};
-
-const DICT_ATTR nr_dict_attrs[] = {
-  { /* 0 */ 
-    .name = NULL, 
-  },
-  { /* 1 */ 
-    .name = "User-Name", 
-    .attr = 1, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 2 */ 
-    .name = "User-Password", 
-    .attr = 2, 
-    .type = NR_TYPE_STRING, 
-    .flags = {
-      .encrypt = FLAG_ENCRYPT_USER_PASSWORD,
-    },
-  },
-  { /* 3 */ 
-    .name = "CHAP-Password", 
-    .attr = 3, 
-    .type = NR_TYPE_OCTETS, 
-  },
-  { /* 4 */ 
-    .name = "NAS-IP-Address", 
-    .attr = 4, 
-    .type = NR_TYPE_IPADDR, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 5 */ 
-    .name = "NAS-Port", 
-    .attr = 5, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 6 */ 
-    .name = "Service-Type", 
-    .attr = 6, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 7 */ 
-    .name = "Framed-Protocol", 
-    .attr = 7, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 8 */ 
-    .name = "Framed-IP-Address", 
-    .attr = 8, 
-    .type = NR_TYPE_IPADDR, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 9 */ 
-    .name = "Framed-IP-Netmask", 
-    .attr = 9, 
-    .type = NR_TYPE_IPADDR, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 10 */ 
-    .name = "Framed-Routing", 
-    .attr = 10, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 11 */ 
-    .name = "Filter-Id", 
-    .attr = 11, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 12 */ 
-    .name = "Framed-MTU", 
-    .attr = 12, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 13 */ 
-    .name = "Framed-Compression", 
-    .attr = 13, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 14 */ 
-    .name = "Login-IP-Host", 
-    .attr = 14, 
-    .type = NR_TYPE_IPADDR, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 15 */ 
-    .name = "Login-Service", 
-    .attr = 15, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 16 */ 
-    .name = "Login-TCP-Port", 
-    .attr = 16, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 17 */ 
-    .name = NULL, 
-  },
-  { /* 18 */ 
-    .name = "Reply-Message", 
-    .attr = 18, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 19 */ 
-    .name = "Callback-Number", 
-    .attr = 19, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 20 */ 
-    .name = "Callback-Id", 
-    .attr = 20, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 21 */ 
-    .name = NULL, 
-  },
-  { /* 22 */ 
-    .name = "Framed-Route", 
-    .attr = 22, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 23 */ 
-    .name = "Framed-IPX-Network", 
-    .attr = 23, 
-    .type = NR_TYPE_IPADDR, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 24 */ 
-    .name = "State", 
-    .attr = 24, 
-    .type = NR_TYPE_OCTETS, 
-  },
-  { /* 25 */ 
-    .name = "Class", 
-    .attr = 25, 
-    .type = NR_TYPE_OCTETS, 
-  },
-  { /* 26 */ 
-    .name = "Vendor-Specific", 
-    .attr = 26, 
-    .type = NR_TYPE_OCTETS, 
-  },
-  { /* 27 */ 
-    .name = "Session-Timeout", 
-    .attr = 27, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 28 */ 
-    .name = "Idle-Timeout", 
-    .attr = 28, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 29 */ 
-    .name = "Termination-Action", 
-    .attr = 29, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 30 */ 
-    .name = "Called-Station-Id", 
-    .attr = 30, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 31 */ 
-    .name = "Calling-Station-Id", 
-    .attr = 31, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 32 */ 
-    .name = "NAS-Identifier", 
-    .attr = 32, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 33 */ 
-    .name = "Proxy-State", 
-    .attr = 33, 
-    .type = NR_TYPE_OCTETS, 
-  },
-  { /* 34 */ 
-    .name = "Login-LAT-Service", 
-    .attr = 34, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 35 */ 
-    .name = "Login-LAT-Node", 
-    .attr = 35, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 36 */ 
-    .name = "Login-LAT-Group", 
-    .attr = 36, 
-    .type = NR_TYPE_OCTETS, 
-  },
-  { /* 37 */ 
-    .name = "Framed-AppleTalk-Link", 
-    .attr = 37, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 38 */ 
-    .name = "Framed-AppleTalk-Network", 
-    .attr = 38, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 39 */ 
-    .name = "Framed-AppleTalk-Zone", 
-    .attr = 39, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 40 */ 
-    .name = "Acct-Status-Type", 
-    .attr = 40, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 41 */ 
-    .name = "Acct-Delay-Time", 
-    .attr = 41, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 42 */ 
-    .name = "Acct-Input-Octets", 
-    .attr = 42, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 43 */ 
-    .name = "Acct-Output-Octets", 
-    .attr = 43, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 44 */ 
-    .name = "Acct-Session-Id", 
-    .attr = 44, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 45 */ 
-    .name = "Acct-Authentic", 
-    .attr = 45, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 46 */ 
-    .name = "Acct-Session-Time", 
-    .attr = 46, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 47 */ 
-    .name = "Acct-Input-Packets", 
-    .attr = 47, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 48 */ 
-    .name = "Acct-Output-Packets", 
-    .attr = 48, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 49 */ 
-    .name = "Acct-Terminate-Cause", 
-    .attr = 49, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 50 */ 
-    .name = "Acct-Multi-Session-Id", 
-    .attr = 50, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 51 */ 
-    .name = "Acct-Link-Count", 
-    .attr = 51, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 52 */ 
-    .name = "Acct-Input-Gigawords", 
-    .attr = 52, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 53 */ 
-    .name = "Acct-Output-Gigawords", 
-    .attr = 53, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 54 */ 
-    .name = NULL, 
-  },
-  { /* 55 */ 
-    .name = "Event-Timestamp", 
-    .attr = 55, 
-    .type = NR_TYPE_DATE, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 56 */ 
-    .name = "Egress-VLANID", 
-    .attr = 56, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 57 */ 
-    .name = "Ingress-Filters", 
-    .attr = 57, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 58 */ 
-    .name = "Egress-VLAN-Name", 
-    .attr = 58, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 59 */ 
-    .name = "User-Priority-Table", 
-    .attr = 59, 
-    .type = NR_TYPE_OCTETS, 
-  },
-  { /* 60 */ 
-    .name = "CHAP-Challenge", 
-    .attr = 60, 
-    .type = NR_TYPE_OCTETS, 
-  },
-  { /* 61 */ 
-    .name = "NAS-Port-Type", 
-    .attr = 61, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 62 */ 
-    .name = "Port-Limit", 
-    .attr = 62, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 63 */ 
-    .name = "Login-LAT-Port", 
-    .attr = 63, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 64 */ 
-    .name = "Tunnel-Type", 
-    .attr = 64, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-      .has_tag = 1,
-    },
-  },
-  { /* 65 */ 
-    .name = "Tunnel-Medium-Type", 
-    .attr = 65, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-      .has_tag = 1,
-    },
-  },
-  { /* 66 */ 
-    .name = "Tunnel-Client-Endpoint", 
-    .attr = 66, 
-    .type = NR_TYPE_STRING, 
-    .flags = {
-      .has_tag = 1,
-    },
-  },
-  { /* 67 */ 
-    .name = "Tunnel-Server-Endpoint", 
-    .attr = 67, 
-    .type = NR_TYPE_STRING, 
-    .flags = {
-      .has_tag = 1,
-    },
-  },
-  { /* 68 */ 
-    .name = "Acct-Tunnel-Connection", 
-    .attr = 68, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 69 */ 
-    .name = "Tunnel-Password", 
-    .attr = 69, 
-    .type = NR_TYPE_STRING, 
-    .flags = {
-      .encrypt = FLAG_ENCRYPT_TUNNEL_PASSWORD,
-      .has_tag = 1,
-    },
-  },
-  { /* 70 */ 
-    .name = "ARAP-Password", 
-    .attr = 70, 
-    .type = NR_TYPE_OCTETS, 
-    .flags = {
-      .length = 16,
-    },
-  },
-  { /* 71 */ 
-    .name = "ARAP-Features", 
-    .attr = 71, 
-    .type = NR_TYPE_OCTETS, 
-    .flags = {
-      .length = 14,
-    },
-  },
-  { /* 72 */ 
-    .name = "ARAP-Zone-Access", 
-    .attr = 72, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 73 */ 
-    .name = "ARAP-Security", 
-    .attr = 73, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 74 */ 
-    .name = "ARAP-Security-Data", 
-    .attr = 74, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 75 */ 
-    .name = "Password-Retry", 
-    .attr = 75, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 76 */ 
-    .name = "Prompt", 
-    .attr = 76, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 77 */ 
-    .name = "Connect-Info", 
-    .attr = 77, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 78 */ 
-    .name = "Configuration-Token", 
-    .attr = 78, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 79 */ 
-    .name = "EAP-Message", 
-    .attr = 79, 
-    .type = NR_TYPE_OCTETS, 
-  },
-  { /* 80 */ 
-    .name = "Message-Authenticator", 
-    .attr = 80, 
-    .type = NR_TYPE_OCTETS, 
-  },
-  { /* 81 */ 
-    .name = "Tunnel-Private-Group-Id", 
-    .attr = 81, 
-    .type = NR_TYPE_STRING, 
-    .flags = {
-      .has_tag = 1,
-    },
-  },
-  { /* 82 */ 
-    .name = "Tunnel-Assignment-Id", 
-    .attr = 82, 
-    .type = NR_TYPE_STRING, 
-    .flags = {
-      .has_tag = 1,
-    },
-  },
-  { /* 83 */ 
-    .name = "Tunnel-Preference", 
-    .attr = 83, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-      .has_tag = 1,
-    },
-  },
-  { /* 84 */ 
-    .name = "ARAP-Challenge-Response", 
-    .attr = 84, 
-    .type = NR_TYPE_OCTETS, 
-    .flags = {
-      .length = 8,
-    },
-  },
-  { /* 85 */ 
-    .name = "Acct-Interim-Interval", 
-    .attr = 85, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 86 */ 
-    .name = "Acct-Tunnel-Packets-Lost", 
-    .attr = 86, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 87 */ 
-    .name = "NAS-Port-Id", 
-    .attr = 87, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 88 */ 
-    .name = "Framed-Pool", 
-    .attr = 88, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 89 */ 
-    .name = "Chargeable-User-Identity", 
-    .attr = 89, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 90 */ 
-    .name = "Tunnel-Client-Auth-Id", 
-    .attr = 90, 
-    .type = NR_TYPE_STRING, 
-    .flags = {
-      .has_tag = 1,
-    },
-  },
-  { /* 91 */ 
-    .name = "Tunnel-Server-Auth-Id", 
-    .attr = 91, 
-    .type = NR_TYPE_STRING, 
-    .flags = {
-      .has_tag = 1,
-    },
-  },
-  { /* 92 */ 
-    .name = "NAS-Filter-Rule", 
-    .attr = 92, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 93 */ 
-    .name = NULL, 
-  },
-  { /* 94 */ 
-    .name = NULL, 
-  },
-  { /* 95 */ 
-    .name = "NAS-IPv6-Address", 
-    .attr = 95, 
-    .type = NR_TYPE_IPV6ADDR, 
-    .flags = {
-      .length = 16,
-    },
-  },
-  { /* 96 */ 
-    .name = "Framed-Interface-Id", 
-    .attr = 96, 
-    .type = NR_TYPE_IFID, 
-    .flags = {
-      .length = 8,
-    },
-  },
-  { /* 97 */ 
-    .name = "Framed-IPv6-Prefix", 
-    .attr = 97, 
-    .type = NR_TYPE_IPV6PREFIX, 
-  },
-  { /* 98 */ 
-    .name = "Login-IPv6-Host", 
-    .attr = 98, 
-    .type = NR_TYPE_IPV6ADDR, 
-    .flags = {
-      .length = 16,
-    },
-  },
-  { /* 99 */ 
-    .name = "Framed-IPv6-Route", 
-    .attr = 99, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 100 */ 
-    .name = "Framed-IPv6-Pool", 
-    .attr = 100, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 101 */ 
-    .name = "Error-Cause", 
-    .attr = 101, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 102 */ 
-    .name = "EAP-Key-Name", 
-    .attr = 102, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 103 */ 
-    .name = "Digest-Response", 
-    .attr = 103, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 104 */ 
-    .name = "Digest-Realm", 
-    .attr = 104, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 105 */ 
-    .name = "Digest-Nonce", 
-    .attr = 105, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 106 */ 
-    .name = "Digest-Response-Auth", 
-    .attr = 106, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 107 */ 
-    .name = "Digest-Nextnonce", 
-    .attr = 107, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 108 */ 
-    .name = "Digest-Method", 
-    .attr = 108, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 109 */ 
-    .name = "Digest-URI", 
-    .attr = 109, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 110 */ 
-    .name = "Digest-Qop", 
-    .attr = 110, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 111 */ 
-    .name = "Digest-Algorithm", 
-    .attr = 111, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 112 */ 
-    .name = "Digest-Entity-Body-Hash", 
-    .attr = 112, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 113 */ 
-    .name = "Digest-CNonce", 
-    .attr = 113, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 114 */ 
-    .name = "Digest-Nonce-Count", 
-    .attr = 114, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 115 */ 
-    .name = "Digest-Username", 
-    .attr = 115, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 116 */ 
-    .name = "Digest-Opaque", 
-    .attr = 116, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 117 */ 
-    .name = "Digest-Auth-Param", 
-    .attr = 117, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 118 */ 
-    .name = "Digest-AKA-Auts", 
-    .attr = 118, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 119 */ 
-    .name = "Digest-Domain", 
-    .attr = 119, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 120 */ 
-    .name = "Digest-Stale", 
-    .attr = 120, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 121 */ 
-    .name = "Digest-HA1", 
-    .attr = 121, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 122 */ 
-    .name = "SIP-AOR", 
-    .attr = 122, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 123 */ 
-    .name = "Delegated-IPv6-Prefix", 
-    .attr = 123, 
-    .type = NR_TYPE_IPV6PREFIX, 
-  },
-  { /* 124 */ 
-    .name = NULL, 
-  },
-  { /* 125 */ 
-    .name = NULL, 
-  },
-  { /* 126 */ 
-    .name = "Operator-Name", 
-    .attr = 126, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 127 */ 
-    .name = "Location-Information", 
-    .attr = 127, 
-    .type = NR_TYPE_OCTETS, 
-  },
-  { /* 128 */ 
-    .name = "Location-Data", 
-    .attr = 128, 
-    .type = NR_TYPE_OCTETS, 
-  },
-  { /* 129 */ 
-    .name = "Basic-Location-Policy-Rules", 
-    .attr = 129, 
-    .type = NR_TYPE_OCTETS, 
-  },
-  { /* 130 */ 
-    .name = "Extended-Location-Policy-Rules", 
-    .attr = 130, 
-    .type = NR_TYPE_OCTETS, 
-  },
-  { /* 131 */ 
-    .name = "Location-Capable", 
-    .attr = 131, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 132 */ 
-    .name = "Requested-Location-Info", 
-    .attr = 132, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 133 */ 
-    .name = "Framed-Management", 
-    .attr = 133, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 134 */ 
-    .name = "Management-Transport-Protection", 
-    .attr = 134, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 135 */ 
-    .name = "Management-Policy-Id", 
-    .attr = 135, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 136 */ 
-    .name = "Management-Privilege-Level", 
-    .attr = 136, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 137 */ 
-    .name = "PKM-SS-Cert", 
-    .attr = 137, 
-    .type = NR_TYPE_OCTETS, 
-  },
-  { /* 138 */ 
-    .name = "PKM-CA-Cert", 
-    .attr = 138, 
-    .type = NR_TYPE_OCTETS, 
-  },
-  { /* 139 */ 
-    .name = "PKM-Config-Settings", 
-    .attr = 139, 
-    .type = NR_TYPE_OCTETS, 
-  },
-  { /* 140 */ 
-    .name = "PKM-Cryptosuite-List", 
-    .attr = 140, 
-    .type = NR_TYPE_OCTETS, 
-  },
-  { /* 141 */ 
-    .name = "PKM-SAID", 
-    .attr = 141, 
-    .type = NR_TYPE_SHORT, 
-    .flags = {
-      .length = 2,
-    },
-  },
-  { /* 142 */ 
-    .name = "PKM-SA-Descriptor", 
-    .attr = 142, 
-    .type = NR_TYPE_OCTETS, 
-  },
-  { /* 143 */ 
-    .name = "PKM-Auth-Key", 
-    .attr = 143, 
-    .type = NR_TYPE_OCTETS, 
-  },
-  { /* 144 */ 
-    .name = NULL, 
-  },
-  { /* 145 */ 
-    .name = NULL, 
-  },
-  { /* 146 */ 
-    .name = NULL, 
-  },
-  { /* 147 */ 
-    .name = NULL, 
-  },
-  { /* 148 */ 
-    .name = NULL, 
-  },
-  { /* 149 */ 
-    .name = NULL, 
-  },
-  { /* 150 */ 
-    .name = NULL, 
-  },
-  { /* 151 */ 
-    .name = NULL, 
-  },
-  { /* 152 */ 
-    .name = NULL, 
-  },
-  { /* 153 */ 
-    .name = NULL, 
-  },
-  { /* 154 */ 
-    .name = NULL, 
-  },
-  { /* 155 */ 
-    .name = NULL, 
-  },
-  { /* 156 */ 
-    .name = NULL, 
-  },
-  { /* 157 */ 
-    .name = NULL, 
-  },
-  { /* 158 */ 
-    .name = NULL, 
-  },
-  { /* 159 */ 
-    .name = NULL, 
-  },
-  { /* 160 */ 
-    .name = NULL, 
-  },
-  { /* 161 */ 
-    .name = NULL, 
-  },
-  { /* 162 */ 
-    .name = NULL, 
-  },
-  { /* 163 */ 
-    .name = NULL, 
-  },
-  { /* 164 */ 
-    .name = NULL, 
-  },
-  { /* 165 */ 
-    .name = NULL, 
-  },
-  { /* 166 */ 
-    .name = NULL, 
-  },
-  { /* 167 */ 
-    .name = NULL, 
-  },
-  { /* 168 */ 
-    .name = NULL, 
-  },
-  { /* 169 */ 
-    .name = NULL, 
-  },
-  { /* 170 */ 
-    .name = NULL, 
-  },
-  { /* 171 */ 
-    .name = NULL, 
-  },
-  { /* 172 */ 
-    .name = NULL, 
-  },
-  { /* 173 */ 
-    .name = NULL, 
-  },
-  { /* 174 */ 
-    .name = NULL, 
-  },
-  { /* 175 */ 
-    .name = NULL, 
-  },
-  { /* 176 */ 
-    .name = NULL, 
-  },
-  { /* 177 */ 
-    .name = NULL, 
-  },
-  { /* 178 */ 
-    .name = NULL, 
-  },
-  { /* 179 */ 
-    .name = NULL, 
-  },
-  { /* 180 */ 
-    .name = NULL, 
-  },
-  { /* 181 */ 
-    .name = NULL, 
-  },
-  { /* 182 */ 
-    .name = NULL, 
-  },
-  { /* 183 */ 
-    .name = NULL, 
-  },
-  { /* 184 */ 
-    .name = NULL, 
-  },
-  { /* 185 */ 
-    .name = NULL, 
-  },
-  { /* 186 */ 
-    .name = NULL, 
-  },
-  { /* 187 */ 
-    .name = NULL, 
-  },
-  { /* 188 */ 
-    .name = NULL, 
-  },
-  { /* 189 */ 
-    .name = NULL, 
-  },
-  { /* 190 */ 
-    .name = NULL, 
-  },
-  { /* 191 */ 
-    .name = NULL, 
-  },
-  { /* 192 */ 
-    .name = NULL, 
-  },
-  { /* 193 */ 
-    .name = NULL, 
-  },
-  { /* 194 */ 
-    .name = NULL, 
-  },
-  { /* 195 */ 
-    .name = NULL, 
-  },
-  { /* 196 */ 
-    .name = NULL, 
-  },
-  { /* 197 */ 
-    .name = NULL, 
-  },
-  { /* 198 */ 
-    .name = NULL, 
-  },
-  { /* 199 */ 
-    .name = NULL, 
-  },
-  { /* 200 */ 
-    .name = NULL, 
-  },
-  { /* 201 */ 
-    .name = NULL, 
-  },
-  { /* 202 */ 
-    .name = NULL, 
-  },
-  { /* 203 */ 
-    .name = NULL, 
-  },
-  { /* 204 */ 
-    .name = NULL, 
-  },
-  { /* 205 */ 
-    .name = NULL, 
-  },
-  { /* 206 */ 
-    .name = NULL, 
-  },
-  { /* 207 */ 
-    .name = NULL, 
-  },
-  { /* 208 */ 
-    .name = NULL, 
-  },
-  { /* 209 */ 
-    .name = NULL, 
-  },
-  { /* 210 */ 
-    .name = NULL, 
-  },
-  { /* 211 */ 
-    .name = NULL, 
-  },
-  { /* 212 */ 
-    .name = NULL, 
-  },
-  { /* 213 */ 
-    .name = NULL, 
-  },
-  { /* 214 */ 
-    .name = NULL, 
-  },
-  { /* 215 */ 
-    .name = NULL, 
-  },
-  { /* 216 */ 
-    .name = NULL, 
-  },
-  { /* 217 */ 
-    .name = NULL, 
-  },
-  { /* 218 */ 
-    .name = NULL, 
-  },
-  { /* 219 */ 
-    .name = NULL, 
-  },
-  { /* 220 */ 
-    .name = NULL, 
-  },
-  { /* 221 */ 
-    .name = NULL, 
-  },
-  { /* 222 */ 
-    .name = NULL, 
-  },
-  { /* 223 */ 
-    .name = NULL, 
-  },
-  { /* 224 */ 
-    .name = NULL, 
-  },
-  { /* 225 */ 
-    .name = NULL, 
-  },
-  { /* 226 */ 
-    .name = NULL, 
-  },
-  { /* 227 */ 
-    .name = NULL, 
-  },
-  { /* 228 */ 
-    .name = NULL, 
-  },
-  { /* 229 */ 
-    .name = NULL, 
-  },
-  { /* 230 */ 
-    .name = NULL, 
-  },
-  { /* 231 */ 
-    .name = NULL, 
-  },
-  { /* 232 */ 
-    .name = NULL, 
-  },
-  { /* 233 */ 
-    .name = NULL, 
-  },
-  { /* 234 */ 
-    .name = NULL, 
-  },
-  { /* 235 */ 
-    .name = NULL, 
-  },
-  { /* 236 */ 
-    .name = NULL, 
-  },
-  { /* 237 */ 
-    .name = NULL, 
-  },
-  { /* 238 */ 
-    .name = NULL, 
-  },
-  { /* 239 */ 
-    .name = NULL, 
-  },
-  { /* 240 */ 
-    .name = NULL, 
-  },
-  { /* 241 */ 
-    .name = NULL, 
-  },
-  { /* 242 */ 
-    .name = NULL, 
-  },
-  { /* 243 */ 
-    .name = NULL, 
-  },
-  { /* 244 */ 
-    .name = NULL, 
-  },
-  { /* 245 */ 
-    .name = NULL, 
-  },
-  { /* 246 */ 
-    .name = NULL, 
-  },
-  { /* 247 */ 
-    .name = NULL, 
-  },
-  { /* 248 */ 
-    .name = NULL, 
-  },
-  { /* 249 */ 
-    .name = NULL, 
-  },
-  { /* 250 */ 
-    .name = NULL, 
-  },
-  { /* 251 */ 
-    .name = NULL, 
-  },
-  { /* 252 */ 
-    .name = NULL, 
-  },
-  { /* 253 */ 
-    .name = NULL, 
-  },
-  { /* 254 */ 
-    .name = NULL, 
-  },
-  { /* 255 */ 
-    .name = NULL, 
-  },
-  { /* 256 */ 
-    .name = "MS-CHAP-Response", 
-    .vendor = 311, 
-    .attr = 1, 
-    .type = NR_TYPE_OCTETS, 
-  },
-  { /* 257 */ 
-    .name = "MS-CHAP-Error", 
-    .vendor = 311, 
-    .attr = 2, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 258 */ 
-    .name = "MS-MPPE-Encryption-Policy", 
-    .vendor = 311, 
-    .attr = 7, 
-    .type = NR_TYPE_OCTETS, 
-  },
-  { /* 259 */ 
-    .name = "MS-MPPE-Encryption-Types", 
-    .vendor = 311, 
-    .attr = 8, 
-    .type = NR_TYPE_OCTETS, 
-  },
-  { /* 260 */ 
-    .name = "MS-CHAP-Domain", 
-    .vendor = 311, 
-    .attr = 10, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 261 */ 
-    .name = "MS-CHAP-Challenge", 
-    .vendor = 311, 
-    .attr = 11, 
-    .type = NR_TYPE_OCTETS, 
-  },
-  { /* 262 */ 
-    .name = "MS-CHAP-MPPE-Keys", 
-    .vendor = 311, 
-    .attr = 12, 
-    .type = NR_TYPE_OCTETS, 
-    .flags = {
-      .encrypt = FLAG_ENCRYPT_USER_PASSWORD,
-    },
-  },
-  { /* 263 */ 
-    .name = "MS-MPPE-Send-Key", 
-    .vendor = 311, 
-    .attr = 16, 
-    .type = NR_TYPE_OCTETS, 
-    .flags = {
-      .encrypt = FLAG_ENCRYPT_TUNNEL_PASSWORD,
-    },
-  },
-  { /* 264 */ 
-    .name = "MS-MPPE-Recv-Key", 
-    .vendor = 311, 
-    .attr = 17, 
-    .type = NR_TYPE_OCTETS, 
-    .flags = {
-      .encrypt = FLAG_ENCRYPT_TUNNEL_PASSWORD,
-    },
-  },
-  { /* 265 */ 
-    .name = "MS-CHAP2-Response", 
-    .vendor = 311, 
-    .attr = 25, 
-    .type = NR_TYPE_OCTETS, 
-  },
-  { /* 266 */ 
-    .name = "MS-CHAP2-Success", 
-    .vendor = 311, 
-    .attr = 26, 
-    .type = NR_TYPE_OCTETS, 
-  },
-  { /* 267 */ 
-    .name = "Example-Integer", 
-    .vendor = 65535, 
-    .attr = 1, 
-    .type = NR_TYPE_INTEGER, 
-    .flags = {
-      .length = 4,
-    },
-  },
-  { /* 268 */ 
-    .name = "Example-String", 
-    .vendor = 65535, 
-    .attr = 2, 
-    .type = NR_TYPE_STRING, 
-  },
-  { /* 269 */ 
-    .name = "Example-IP-Address", 
-    .vendor = 65535, 
-    .attr = 3, 
-    .type = NR_TYPE_IPADDR, 
-    .flags = {
-      .length = 4,
-    },
-  },
-};
-
-const int nr_dict_num_attrs = 269;
-
-const int nr_dict_num_names = 149;
-
-const DICT_ATTR *nr_dict_attr_names[] = {
-    &nr_dict_attrs[45], /* Acct-Authentic */
-    &nr_dict_attrs[41], /* Acct-Delay-Time */
-    &nr_dict_attrs[52], /* Acct-Input-Gigawords */
-    &nr_dict_attrs[42], /* Acct-Input-Octets */
-    &nr_dict_attrs[47], /* Acct-Input-Packets */
-    &nr_dict_attrs[85], /* Acct-Interim-Interval */
-    &nr_dict_attrs[51], /* Acct-Link-Count */
-    &nr_dict_attrs[50], /* Acct-Multi-Session-Id */
-    &nr_dict_attrs[53], /* Acct-Output-Gigawords */
-    &nr_dict_attrs[43], /* Acct-Output-Octets */
-    &nr_dict_attrs[48], /* Acct-Output-Packets */
-    &nr_dict_attrs[44], /* Acct-Session-Id */
-    &nr_dict_attrs[46], /* Acct-Session-Time */
-    &nr_dict_attrs[40], /* Acct-Status-Type */
-    &nr_dict_attrs[49], /* Acct-Terminate-Cause */
-    &nr_dict_attrs[68], /* Acct-Tunnel-Connection */
-    &nr_dict_attrs[86], /* Acct-Tunnel-Packets-Lost */
-    &nr_dict_attrs[84], /* ARAP-Challenge-Response */
-    &nr_dict_attrs[71], /* ARAP-Features */
-    &nr_dict_attrs[70], /* ARAP-Password */
-    &nr_dict_attrs[73], /* ARAP-Security */
-    &nr_dict_attrs[74], /* ARAP-Security-Data */
-    &nr_dict_attrs[72], /* ARAP-Zone-Access */
-    &nr_dict_attrs[129], /* Basic-Location-Policy-Rules */
-    &nr_dict_attrs[20], /* Callback-Id */
-    &nr_dict_attrs[19], /* Callback-Number */
-    &nr_dict_attrs[30], /* Called-Station-Id */
-    &nr_dict_attrs[31], /* Calling-Station-Id */
-    &nr_dict_attrs[60], /* CHAP-Challenge */
-    &nr_dict_attrs[3], /* CHAP-Password */
-    &nr_dict_attrs[89], /* Chargeable-User-Identity */
-    &nr_dict_attrs[25], /* Class */
-    &nr_dict_attrs[78], /* Configuration-Token */
-    &nr_dict_attrs[77], /* Connect-Info */
-    &nr_dict_attrs[123], /* Delegated-IPv6-Prefix */
-    &nr_dict_attrs[118], /* Digest-AKA-Auts */
-    &nr_dict_attrs[111], /* Digest-Algorithm */
-    &nr_dict_attrs[117], /* Digest-Auth-Param */
-    &nr_dict_attrs[113], /* Digest-CNonce */
-    &nr_dict_attrs[119], /* Digest-Domain */
-    &nr_dict_attrs[112], /* Digest-Entity-Body-Hash */
-    &nr_dict_attrs[121], /* Digest-HA1 */
-    &nr_dict_attrs[108], /* Digest-Method */
-    &nr_dict_attrs[107], /* Digest-Nextnonce */
-    &nr_dict_attrs[105], /* Digest-Nonce */
-    &nr_dict_attrs[114], /* Digest-Nonce-Count */
-    &nr_dict_attrs[116], /* Digest-Opaque */
-    &nr_dict_attrs[110], /* Digest-Qop */
-    &nr_dict_attrs[104], /* Digest-Realm */
-    &nr_dict_attrs[103], /* Digest-Response */
-    &nr_dict_attrs[106], /* Digest-Response-Auth */
-    &nr_dict_attrs[120], /* Digest-Stale */
-    &nr_dict_attrs[109], /* Digest-URI */
-    &nr_dict_attrs[115], /* Digest-Username */
-    &nr_dict_attrs[102], /* EAP-Key-Name */
-    &nr_dict_attrs[79], /* EAP-Message */
-    &nr_dict_attrs[58], /* Egress-VLAN-Name */
-    &nr_dict_attrs[56], /* Egress-VLANID */
-    &nr_dict_attrs[101], /* Error-Cause */
-    &nr_dict_attrs[55], /* Event-Timestamp */
-    &nr_dict_attrs[267], /* Example-Integer */
-    &nr_dict_attrs[269], /* Example-IP-Address */
-    &nr_dict_attrs[268], /* Example-String */
-    &nr_dict_attrs[130], /* Extended-Location-Policy-Rules */
-    &nr_dict_attrs[11], /* Filter-Id */
-    &nr_dict_attrs[37], /* Framed-AppleTalk-Link */
-    &nr_dict_attrs[38], /* Framed-AppleTalk-Network */
-    &nr_dict_attrs[39], /* Framed-AppleTalk-Zone */
-    &nr_dict_attrs[13], /* Framed-Compression */
-    &nr_dict_attrs[96], /* Framed-Interface-Id */
-    &nr_dict_attrs[8], /* Framed-IP-Address */
-    &nr_dict_attrs[9], /* Framed-IP-Netmask */
-    &nr_dict_attrs[100], /* Framed-IPv6-Pool */
-    &nr_dict_attrs[97], /* Framed-IPv6-Prefix */
-    &nr_dict_attrs[99], /* Framed-IPv6-Route */
-    &nr_dict_attrs[23], /* Framed-IPX-Network */
-    &nr_dict_attrs[133], /* Framed-Management */
-    &nr_dict_attrs[12], /* Framed-MTU */
-    &nr_dict_attrs[88], /* Framed-Pool */
-    &nr_dict_attrs[7], /* Framed-Protocol */
-    &nr_dict_attrs[22], /* Framed-Route */
-    &nr_dict_attrs[10], /* Framed-Routing */
-    &nr_dict_attrs[28], /* Idle-Timeout */
-    &nr_dict_attrs[57], /* Ingress-Filters */
-    &nr_dict_attrs[131], /* Location-Capable */
-    &nr_dict_attrs[128], /* Location-Data */
-    &nr_dict_attrs[127], /* Location-Information */
-    &nr_dict_attrs[14], /* Login-IP-Host */
-    &nr_dict_attrs[98], /* Login-IPv6-Host */
-    &nr_dict_attrs[36], /* Login-LAT-Group */
-    &nr_dict_attrs[35], /* Login-LAT-Node */
-    &nr_dict_attrs[63], /* Login-LAT-Port */
-    &nr_dict_attrs[34], /* Login-LAT-Service */
-    &nr_dict_attrs[15], /* Login-Service */
-    &nr_dict_attrs[16], /* Login-TCP-Port */
-    &nr_dict_attrs[135], /* Management-Policy-Id */
-    &nr_dict_attrs[136], /* Management-Privilege-Level */
-    &nr_dict_attrs[134], /* Management-Transport-Protection */
-    &nr_dict_attrs[80], /* Message-Authenticator */
-    &nr_dict_attrs[261], /* MS-CHAP-Challenge */
-    &nr_dict_attrs[260], /* MS-CHAP-Domain */
-    &nr_dict_attrs[257], /* MS-CHAP-Error */
-    &nr_dict_attrs[262], /* MS-CHAP-MPPE-Keys */
-    &nr_dict_attrs[256], /* MS-CHAP-Response */
-    &nr_dict_attrs[265], /* MS-CHAP2-Response */
-    &nr_dict_attrs[266], /* MS-CHAP2-Success */
-    &nr_dict_attrs[258], /* MS-MPPE-Encryption-Policy */
-    &nr_dict_attrs[259], /* MS-MPPE-Encryption-Types */
-    &nr_dict_attrs[264], /* MS-MPPE-Recv-Key */
-    &nr_dict_attrs[263], /* MS-MPPE-Send-Key */
-    &nr_dict_attrs[92], /* NAS-Filter-Rule */
-    &nr_dict_attrs[32], /* NAS-Identifier */
-    &nr_dict_attrs[4], /* NAS-IP-Address */
-    &nr_dict_attrs[95], /* NAS-IPv6-Address */
-    &nr_dict_attrs[5], /* NAS-Port */
-    &nr_dict_attrs[87], /* NAS-Port-Id */
-    &nr_dict_attrs[61], /* NAS-Port-Type */
-    &nr_dict_attrs[126], /* Operator-Name */
-    &nr_dict_attrs[75], /* Password-Retry */
-    &nr_dict_attrs[143], /* PKM-Auth-Key */
-    &nr_dict_attrs[138], /* PKM-CA-Cert */
-    &nr_dict_attrs[139], /* PKM-Config-Settings */
-    &nr_dict_attrs[140], /* PKM-Cryptosuite-List */
-    &nr_dict_attrs[142], /* PKM-SA-Descriptor */
-    &nr_dict_attrs[141], /* PKM-SAID */
-    &nr_dict_attrs[137], /* PKM-SS-Cert */
-    &nr_dict_attrs[62], /* Port-Limit */
-    &nr_dict_attrs[76], /* Prompt */
-    &nr_dict_attrs[33], /* Proxy-State */
-    &nr_dict_attrs[18], /* Reply-Message */
-    &nr_dict_attrs[132], /* Requested-Location-Info */
-    &nr_dict_attrs[6], /* Service-Type */
-    &nr_dict_attrs[27], /* Session-Timeout */
-    &nr_dict_attrs[122], /* SIP-AOR */
-    &nr_dict_attrs[24], /* State */
-    &nr_dict_attrs[29], /* Termination-Action */
-    &nr_dict_attrs[82], /* Tunnel-Assignment-Id */
-    &nr_dict_attrs[90], /* Tunnel-Client-Auth-Id */
-    &nr_dict_attrs[66], /* Tunnel-Client-Endpoint */
-    &nr_dict_attrs[65], /* Tunnel-Medium-Type */
-    &nr_dict_attrs[69], /* Tunnel-Password */
-    &nr_dict_attrs[83], /* Tunnel-Preference */
-    &nr_dict_attrs[81], /* Tunnel-Private-Group-Id */
-    &nr_dict_attrs[91], /* Tunnel-Server-Auth-Id */
-    &nr_dict_attrs[67], /* Tunnel-Server-Endpoint */
-    &nr_dict_attrs[64], /* Tunnel-Type */
-    &nr_dict_attrs[1], /* User-Name */
-    &nr_dict_attrs[2], /* User-Password */
-    &nr_dict_attrs[59], /* User-Priority-Table */
-    &nr_dict_attrs[26], /* Vendor-Specific */
-};
-
index 503d927..265c880 100644 (file)
@@ -36,8 +36,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 static const char *secret = "testing123";
-static uint8_t request_buffer[NR_MAX_PACKET_LEN];
-static uint8_t response_buffer[NR_MAX_PACKET_LEN];
+static uint8_t request_buffer[RS_MAX_PACKET_LEN];
+static uint8_t response_buffer[RS_MAX_PACKET_LEN];
 static RADIUS_PACKET request, response;
 
 int main(int argc, const char *argv[])
@@ -58,12 +58,12 @@ int main(int argc, const char *argv[])
        if (argc > 2) password = argv[2];
 
        rcode = nr_packet_attr_append(&request, NULL,
-                                     NR_DA_USER_NAME,
+                                     RS_DA_USER_NAME,
                                      user, 0);
        if (rcode < 0) goto error;
        
        rcode = nr_packet_attr_append(&request, NULL,
-                                     NR_DA_USER_PASSWORD,
+                                     RS_DA_USER_PASSWORD,
                                      password, 0);
        if (rcode < 0) goto error;
 
index 1065c8e..0a58523 100644 (file)
@@ -36,8 +36,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 static const char *secret = "testing123";
-static uint8_t request_buffer[NR_MAX_PACKET_LEN];
-static uint8_t response_buffer[NR_MAX_PACKET_LEN];
+static uint8_t request_buffer[RS_MAX_PACKET_LEN];
+static uint8_t response_buffer[RS_MAX_PACKET_LEN];
 static RADIUS_PACKET request, response;
 
 int main(int argc, const char *argv[])
@@ -58,12 +58,12 @@ int main(int argc, const char *argv[])
        if (argc > 2) password = argv[2];
 
        rcode = nr_packet_attr_append(&request, NULL,
-                                     NR_DA_USER_NAME,
+                                     RS_DA_USER_NAME,
                                      user, 0);
        if (rcode < 0) goto error;
        
        rcode = nr_packet_attr_append(&request, NULL,
-                                     NR_DA_CHAP_PASSWORD,
+                                     RS_DA_CHAP_PASSWORD,
                                      password, strlen(password));
        if (rcode < 0) goto error;
 
index 6104f6f..33fc671 100644 (file)
@@ -39,8 +39,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 static const char *secret = "testing123";
-static uint8_t request_buffer[NR_MAX_PACKET_LEN];
-static uint8_t response_buffer[NR_MAX_PACKET_LEN];
+static uint8_t request_buffer[RS_MAX_PACKET_LEN];
+static uint8_t response_buffer[RS_MAX_PACKET_LEN];
 static RADIUS_PACKET request, response;
 
 int main(int argc, const char *argv[])
@@ -61,12 +61,12 @@ int main(int argc, const char *argv[])
        if (argc > 2) password = argv[2];
 
        rcode = nr_packet_attr_append(&request, NULL,
-                                     NR_DA_USER_NAME,
+                                     RS_DA_USER_NAME,
                                      user, 0);
        if (rcode < 0) goto error;
        
        rcode = nr_packet_attr_append(&request, NULL,
-                                     NR_DA_USER_PASSWORD,
+                                     RS_DA_USER_PASSWORD,
                                      password, 0);
        if (rcode < 0) goto error;
 
@@ -84,12 +84,12 @@ int main(int argc, const char *argv[])
        if (rcode < 0) goto error;
 
        rcode = nr_packet_attr_append(&response, &request,
-                                     NR_DA_REPLY_MESSAGE,
+                                     RS_DA_REPLY_MESSAGE,
                                      "Success!", 0);
        if (rcode < 0) goto error;
 
        rcode = nr_packet_attr_append(&response, &request,
-                                     NR_DA_TUNNEL_PASSWORD,
+                                     RS_DA_TUNNEL_PASSWORD,
                                      password, 0);
        if (rcode < 0) goto error;
        rcode = nr_packet_sign(&response, &request);
index f93764c..2dadc89 100644 (file)
@@ -52,12 +52,12 @@ int main(int argc, const char *argv[])
        if (argc > 2) password = argv[2];
 
        rcode = nr_packet_attr_append(&request, NULL,
-                                     NR_DA_USER_NAME,
+                                     RS_DA_USER_NAME,
                                      user, 0);
        if (rcode < 0) goto error;
        
        rcode = nr_packet_attr_append(&request, NULL,
-                                     NR_DA_USER_PASSWORD,
+                                     RS_DA_USER_PASSWORD,
                                      password, 0);
        if (rcode < 0) goto error;
 
@@ -75,7 +75,7 @@ int main(int argc, const char *argv[])
        if (rcode < 0) goto error;
 
        rcode = nr_packet_attr_append(&response, &request,
-                                     NR_DA_REPLY_MESSAGE,
+                                     RS_DA_REPLY_MESSAGE,
                                      "Success!", 0);
        if (rcode < 0) goto error;
 
index 4fbe631..2b956f2 100644 (file)
@@ -25,7 +25,7 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include       <networkradius-devel/client.h>
+#include       "client.h"
 #include       <unistd.h>
 
 /** \file id.c
@@ -38,7 +38,7 @@ static int find_id(nr_server_t *s)
        int i;
        uint32_t lvalue;
 
-       if ((s->used < 0) || (s->used > 256)) return -NR_ERR_INTERNAL_FAILURE;
+       if ((s->used < 0) || (s->used > 256)) return -RSE_INTERNAL;
 
        /*
         *      Ensure that the ID allocation is random.
@@ -59,7 +59,7 @@ int nr_server_id_alloc(nr_server_t *s, RADIUS_PACKET *packet)
 {
        int new_id;
 
-       if (!s || !packet) return -NR_ERR_INVALID_ARG;
+       if (!s || !packet) return -RSE_INVAL;
 
        new_id = find_id(s);
        if (new_id < 0) return -new_id;
@@ -77,13 +77,13 @@ int nr_server_id_alloc(nr_server_t *s, RADIUS_PACKET *packet)
 
 int nr_server_id_free(nr_server_t *s, RADIUS_PACKET *packet)
 {
-       if (!s || !packet) return -NR_ERR_INVALID_ARG;
+       if (!s || !packet) return -RSE_INVAL;
 
        if ((packet->id < 0) || (packet->id > 255) || !s->ids[packet->id]) {
-               return -NR_ERR_INVALID_ARG;
+               return -RSE_INVAL;
        }
 
-       if (s->ids[packet->id] != packet) return -NR_ERR_INTERNAL_FAILURE;
+       if (s->ids[packet->id] != packet) return -RSE_INTERNAL;
 
        s->ids[packet->id] = NULL;
        s->used--;
@@ -96,13 +96,13 @@ int nr_server_id_realloc(nr_server_t *s, RADIUS_PACKET *packet)
 {
        int new_id;
 
-       if (!s || !packet) return -NR_ERR_INVALID_ARG;
+       if (!s || !packet) return -RSE_INVAL;
 
        if ((packet->id < 0) || (packet->id > 255) || !s->ids[packet->id]) {
-               return -NR_ERR_INVALID_ARG;
+               return -RSE_INVAL;
        }
 
-       if (s->ids[packet->id] != packet) return -NR_ERR_INTERNAL_FAILURE;
+       if (s->ids[packet->id] != packet) return -RSE_INTERNAL;
 
        new_id = find_id(s);
        if (new_id < 0) return new_id;
@@ -118,8 +118,8 @@ int nr_server_id_realloc(nr_server_t *s, RADIUS_PACKET *packet)
 int nr_server_init(nr_server_t *s, int code, const char *secret)
 {
        if (!s || !secret || !*secret ||
-           (code == 0) || (code > NR_MAX_PACKET_CODE)) {
-               return -NR_ERR_INVALID_ARG;
+           (code == 0) || (code > RS_MAX_PACKET_CODE)) {
+               return -RSE_INVAL;
        }
 
        memset(s, 0, sizeof(*s));
@@ -137,9 +137,9 @@ int nr_server_init(nr_server_t *s, int code, const char *secret)
 
 int nr_server_close(const nr_server_t *s)
 {
-       if (!s) return -NR_ERR_INVALID_ARG;
+       if (!s) return -RSE_INVAL;
 
-       if (s->used > 0) return -NR_ERR_IN_USE;
+       if (s->used > 0) return -RSE_INUSE;
 
        if (s->sockfd >= 0) close(s->sockfd);
 
@@ -151,23 +151,23 @@ int nr_server_packet_alloc(const nr_server_t *s, RADIUS_PACKET **packet_p)
        int rcode;
        RADIUS_PACKET *packet;
 
-       if (!packet_p) return -NR_ERR_INVALID_ARG;
+       if (!packet_p) return -RSE_INVAL;
 
-       packet = malloc(sizeof(*packet) + NR_MAX_PACKET_LEN);
-       if (!packet) return -NR_ERR_NO_MEM;
+       packet = malloc(sizeof(*packet) + RS_MAX_PACKET_LEN);
+       if (!packet) return -RSE_NOMEM;
 
        memset(packet, 0, sizeof(*packet));
 
        if (!s) {
                packet->data = (uint8_t *)(packet + 1);
-               packet->sizeof_data = NR_MAX_PACKET_LEN;
+               packet->sizeof_data = RS_MAX_PACKET_LEN;
 
                *packet_p = packet;
                return 0;
        }
 
        rcode = nr_packet_init(packet, NULL, s->secret, s->code,
-                              (uint8_t *)(packet + 1), NR_MAX_PACKET_LEN);
+                              (uint8_t *)(packet + 1), RS_MAX_PACKET_LEN);
        if (rcode < 0) {
                free(packet);
                return rcode;
index 77e3d14..c5d3bc4 100644 (file)
@@ -29,17 +29,17 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *  \brief Encoding and decoding packets
  */
 
-#include       <networkradius-devel/client.h>
+#include       "client.h"
 
-#if NR_MAX_PACKET_LEN < 64
-#error NR_MAX_PACKET_LEN is too small.  It should be at least 64.
+#if RS_MAX_PACKET_LEN < 64
+#error RS_MAX_PACKET_LEN is too small.  It should be at least 64.
 #endif
 
-#if NR_MAX_PACKET_LEN > 16384
-#error NR_MAX_PACKET_LEN is too large.  It should be smaller than 16K.
+#if RS_MAX_PACKET_LEN > 16384
+#error RS_MAX_PACKET_LEN is too large.  It should be smaller than 16K.
 #endif
 
-const char *nr_packet_codes[NR_MAX_PACKET_CODE + 1] = {
+const char *nr_packet_codes[RS_MAX_PACKET_CODE + 1] = {
   NULL,
   "Access-Request",
   "Access-Accept",
@@ -61,7 +61,7 @@ const char *nr_packet_codes[NR_MAX_PACKET_CODE + 1] = {
 };
 
 
-static uint64_t allowed_responses[NR_MAX_PACKET_CODE + 1] = {
+static uint64_t allowed_responses[RS_MAX_PACKET_CODE + 1] = {
        0,
        (1 << PW_ACCESS_ACCEPT) | (1 << PW_ACCESS_REJECT) | (1 << PW_ACCESS_CHALLENGE),
        0, 0,
@@ -89,18 +89,18 @@ int nr_packet_ok_raw(const uint8_t *data, size_t sizeof_data)
 
        if (!data || (sizeof_data < 20)) {
                nr_debug_error("Invalid argument");
-               return -NR_ERR_INVALID_ARG;
+               return -RSE_INVAL;
        }
 
        packet_len = (data[2] << 8) | data[3];
        if (packet_len < 20) {
                nr_debug_error("Packet length is too small");
-               return -NR_ERR_PACKET_TOO_SMALL;
+               return -RSE_PACKET_TOO_SMALL;
        }
 
        if (packet_len > sizeof_data) {
                nr_debug_error("Packet length overflows received data");
-               return -NR_ERR_PACKET_TOO_LARGE;
+               return -RSE_PACKET_TOO_LARGE;
        }
 
        /*
@@ -112,17 +112,17 @@ int nr_packet_ok_raw(const uint8_t *data, size_t sizeof_data)
        for (attr = data + 20; attr < end; attr += attr[1]) {
                if ((attr + 2) > end) {
                        nr_debug_error("Attribute overflows packet");
-                       return -NR_ERR_ATTR_OVERFLOW;
+                       return -RSE_ATTR_OVERFLOW;
                }
 
                if (attr[1] < 2) {
                        nr_debug_error("Attribute length is too small");
-                       return -NR_ERR_ATTR_TOO_SMALL;
+                       return -RSE_ATTR_TOO_SMALL;
                }
 
                if ((attr + attr[1]) > end) {
                        nr_debug_error("Attribute length is too large");
-                       return -NR_ERR_ATTR_TOO_LARGE;
+                       return -RSE_ATTR_TOO_LARGE;
                }
        }
 
@@ -133,14 +133,14 @@ int nr_packet_ok(RADIUS_PACKET *packet)
 {
        int rcode;
 
-       if (!packet) return -NR_ERR_INVALID_ARG;
+       if (!packet) return -RSE_INVAL;
 
-       if ((packet->flags & NR_PACKET_OK) != 0) return 0;
+       if ((packet->flags & RS_PACKET_OK) != 0) return 0;
 
        rcode = nr_packet_ok_raw(packet->data, packet->length);
        if (rcode < 0) return rcode;
 
-       packet->flags |= NR_PACKET_OK;
+       packet->flags |= RS_PACKET_OK;
        return 0;
 }
 
@@ -176,7 +176,7 @@ static int msg_auth_ok(const RADIUS_PACKET *original,
        
        if (ma[1] != 18) {
                nr_debug_error("Message-Authenticator has invalid length");
-               return -NR_ERR_MSG_AUTH_LEN;
+               return -RSE_MSG_AUTH_LEN;
        }
 
        memcpy(packet_vector, data + 4, sizeof(packet_vector));
@@ -203,7 +203,7 @@ static int msg_auth_ok(const RADIUS_PACKET *original,
        case PW_ACCESS_CHALLENGE:
                if (!original) {
                        nr_debug_error("Cannot validate response without request");
-                       return -NR_ERR_REQUEST_REQUIRED;
+                       return -RSE_REQUEST_REQUIRED;
                }
                memcpy(data + 4, original->vector, sizeof(original->vector));
                break;
@@ -219,7 +219,7 @@ static int msg_auth_ok(const RADIUS_PACKET *original,
        if (digest_cmp(calc_auth_vector, msg_auth_vector,
                       sizeof(calc_auth_vector)) != 0) {
                nr_debug_error("Invalid Message-Authenticator");
-               return -NR_ERR_MSG_AUTH_WRONG;
+               return -RSE_MSG_AUTH_WRONG;
        }
 
        return 1;
@@ -234,7 +234,7 @@ static int packet_auth_ok(const RADIUS_PACKET *original,
 {
        uint8_t packet_vector[sizeof(original->vector)];
        uint8_t calc_digest[sizeof(original->vector)];
-       NR_MD5_CTX ctx;
+       RS_MD5_CTX ctx;
 
        if ((data[0] == PW_ACCESS_REQUEST) ||
            (data[0] == PW_STATUS_SERVER)) return 1;
@@ -247,17 +247,17 @@ static int packet_auth_ok(const RADIUS_PACKET *original,
                memcpy(data + 4, original->vector, sizeof(original->vector));
        }
 
-       nr_MD5Init(&ctx);
-       nr_MD5Update(&ctx, data, length);
-       nr_MD5Update(&ctx, original->secret, original->sizeof_secret);
-       nr_MD5Final(calc_digest, &ctx);
+       RS_MD5Init(&ctx);
+       RS_MD5Update(&ctx, data, length);
+       RS_MD5Update(&ctx, original->secret, original->sizeof_secret);
+       RS_MD5Final(calc_digest, &ctx);
 
        memcpy(data + 4, packet_vector, sizeof(packet_vector));
 
        if (digest_cmp(calc_digest, packet_vector,
                       sizeof(packet_vector)) != 0) {
                nr_debug_error("Invalid authentication vector");
-               return -NR_ERR_AUTH_VECTOR_WRONG;
+               return -RSE_AUTH_VECTOR_WRONG;
        }
 
        return 0;
@@ -274,10 +274,10 @@ int nr_packet_verify(RADIUS_PACKET *packet, const RADIUS_PACKET *original)
 
        if (!packet || !packet->data || !packet->secret) {
                nr_debug_error("Invalid argument");
-               return -NR_ERR_INVALID_ARG;
+               return -RSE_INVAL;
        }
 
-       if ((packet->flags & NR_PACKET_VERIFIED) != 0) return 0;
+       if ((packet->flags & RS_PACKET_VERIFIED) != 0) return 0;
 
        /*
         *      Packet isn't well formed.  Ignore it.
@@ -291,16 +291,16 @@ int nr_packet_verify(RADIUS_PACKET *packet, const RADIUS_PACKET *original)
        if (original) {
                uint64_t mask;
 
-               if (original->code > NR_MAX_PACKET_CODE) {
+               if (original->code > RS_MAX_PACKET_CODE) {
                        nr_debug_error("Invalid original code %u",
                                           original->code);
-                       return -NR_ERR_REQUEST_CODE_INVALID;
+                       return -RSE_INVALID_REQUEST_CODE;
                }
 
                if (packet->data[1] != original->id) {
                        nr_debug_error("Ignoring response with wrong ID %u",
                                           packet->data[1]);
-                       return -NR_ERR_RESPONSE_ID_INVALID;
+                       return -RSE_INVALID_RESPONSE_CODE;
                }
 
                mask = 1;
@@ -309,18 +309,18 @@ int nr_packet_verify(RADIUS_PACKET *packet, const RADIUS_PACKET *original)
                if ((allowed_responses[original->code] & mask) == 0) {
                        nr_debug_error("Ignoring response with wrong code %u",
                                           packet->data[0]);
-                       return -NR_ERR_RESPONSE_CODE_INVALID;
+                       return -RSE_INVALID_RESPONSE_CODE;
                }
 
                if ((memcmp(&packet->src, &original->dst, sizeof(packet->src)) != 0) &&
-                   (sockaddr_cmp(&(packet->src), &(original->dst)) != 0)) {
+                   (evutil_sockaddr_cmp(&(packet->src), &(original->dst)) != 0)) {
                        nr_debug_error("Ignoring response from wrong IP/port");
-                       return -NR_ERR_RESPONSE_SRC_INVALID;
+                       return -RSE_INVALID_RESPONSE_SRC;
                }
 
        } else if (allowed_responses[packet->data[0]] != 0) {
                nr_debug_error("Ignoring response without original");
-               return -NR_ERR_RESPONSE_CODE_INVALID;
+               return -RSE_INVALID_RESPONSE_CODE;
        }
 
 #ifdef PW_MESSAGE_AUTHENTICATOR
@@ -344,7 +344,7 @@ int nr_packet_verify(RADIUS_PACKET *packet, const RADIUS_PACKET *original)
        rcode = packet_auth_ok(original, packet->data, packet->length);
        if (rcode < 0) return rcode;
 
-       packet->flags |= NR_PACKET_VERIFIED;
+       packet->flags |= RS_PACKET_VERIFIED;
 
        return 0;
 }
@@ -357,9 +357,9 @@ int nr_packet_decode(RADIUS_PACKET *packet, const RADIUS_PACKET *original)
        const uint8_t   *end;
        VALUE_PAIR      **tail, *vp;
 
-       if (!packet) return -NR_ERR_INVALID_ARG;
+       if (!packet) return -RSE_INVAL;
 
-       if ((packet->flags & NR_PACKET_DECODED) != 0) return 0;
+       if ((packet->flags & RS_PACKET_DECODED) != 0) return 0;
       
        rcode = nr_packet_ok(packet);
        if (rcode < 0) return rcode;
@@ -387,10 +387,10 @@ int nr_packet_decode(RADIUS_PACKET *packet, const RADIUS_PACKET *original)
                        vp = vp->next;
                }
 
-               if (num_attributes > NR_MAX_ATTRIBUTES) {
+               if (num_attributes > RS_MAX_ATTRIBUTES) {
                        nr_debug_error("Too many attributes");
                        nr_vp_free(&packet->vps);
-                       return -NR_ERR_TOO_MANY_ATTRS;
+                       return -RSE_TOO_MANY_ATTRS;
                }
        }
 
@@ -398,7 +398,7 @@ int nr_packet_decode(RADIUS_PACKET *packet, const RADIUS_PACKET *original)
        packet->id = data[1];
        memcpy(packet->vector, data + 4, sizeof(packet->vector));
 
-       packet->flags |= NR_PACKET_DECODED;
+       packet->flags |= RS_PACKET_DECODED;
 
        return 0;
 }
@@ -411,9 +411,9 @@ int nr_packet_sign(RADIUS_PACKET *packet, const RADIUS_PACKET *original)
        const uint8_t *attr, *end;
 #endif
 
-       if ((packet->flags & NR_PACKET_SIGNED) != 0) return 0;
+       if ((packet->flags & RS_PACKET_SIGNED) != 0) return 0;
 
-       if ((packet->flags & NR_PACKET_ENCODED) == 0) {
+       if ((packet->flags & RS_PACKET_ENCODED) == 0) {
                int rcode;
 
                rcode = nr_packet_encode(packet, original);
@@ -426,7 +426,7 @@ int nr_packet_sign(RADIUS_PACKET *packet, const RADIUS_PACKET *original)
 #ifdef PW_MESSAGE_AUTHENTICATOR
                if (!original) {
                        nr_debug_error("Original packet is required to create the  Message-Authenticator");
-                       return -NR_ERR_REQUEST_REQUIRED;
+                       return -RSE_REQUEST_REQUIRED;
                }
 #endif
                
@@ -483,18 +483,18 @@ int nr_packet_sign(RADIUS_PACKET *packet, const RADIUS_PACKET *original)
         */
        if (!((packet->code == PW_ACCESS_REQUEST) ||
              (packet->code == PW_STATUS_SERVER))) {
-               NR_MD5_CTX      ctx;
+               RS_MD5_CTX      ctx;
 
-               nr_MD5Init(&ctx);
-               nr_MD5Update(&ctx, packet->data, packet->length);
-               nr_MD5Update(&ctx, packet->secret, packet->sizeof_secret);
-               nr_MD5Final(packet->vector, &ctx);
+               RS_MD5Init(&ctx);
+               RS_MD5Update(&ctx, packet->data, packet->length);
+               RS_MD5Update(&ctx, packet->secret, packet->sizeof_secret);
+               RS_MD5Final(packet->vector, &ctx);
        }
 
        memcpy(packet->data + 4, packet->vector, sizeof(packet->vector));
 
        packet->attempts = 0;
-       packet->flags |= NR_PACKET_SIGNED;
+       packet->flags |= RS_PACKET_SIGNED;
 
        return 0;
 }
@@ -504,28 +504,28 @@ static int can_encode_packet(RADIUS_PACKET *packet,
                             const RADIUS_PACKET *original)
 {
        if ((packet->code == 0) ||
-           (packet->code > NR_MAX_PACKET_CODE) ||
-           (original && (original->code > NR_MAX_PACKET_CODE))) {
+           (packet->code > RS_MAX_PACKET_CODE) ||
+           (original && (original->code > RS_MAX_PACKET_CODE))) {
                nr_debug_error("Cannot send unknown packet code");
-               return -NR_ERR_REQUEST_CODE_INVALID;
+               return -RSE_INVALID_REQUEST_CODE;
        }
 
        if (!nr_packet_codes[packet->code]) {
                nr_debug_error("Cannot handle packet code %u",
                                   packet->code);
-               return -NR_ERR_REQUEST_CODE_INVALID;
+               return -RSE_INVALID_REQUEST_CODE;
        }
 
 #ifdef NR_NO_MALLOC
        if (!packet->data) {
                nr_debug_error("No place to put packet");
-               return -NR_ERR_NO_PACKET_DATA;
+               return -RSE_NO_PACKET_DATA;
        }
 #endif
 
        if (packet->sizeof_data < 20) {
                nr_debug_error("The buffer is too small to encode the packet");
-               return -NR_ERR_PACKET_TOO_SMALL;
+               return -RSE_PACKET_TOO_SMALL;
        }
 
        /*
@@ -540,14 +540,14 @@ static int can_encode_packet(RADIUS_PACKET *packet,
                if ((allowed_responses[original->code] & mask) == 0) {
                        nr_debug_error("Cannot encode response %u to packet %u",
                                           packet->code, original->code);
-                       return -NR_ERR_RESPONSE_CODE_INVALID;
+                       return -RSE_INVALID_RESPONSE_CODE;
                }
                packet->id = original->id;
 
        } else if (allowed_responses[packet->code] == 0) {
                nr_debug_error("Cannot encode response %u without original",
                                   packet->code);
-               return -NR_ERR_REQUEST_REQUIRED;
+               return -RSE_REQUEST_REQUIRED;
        }
 
        return 0;
@@ -555,7 +555,7 @@ static int can_encode_packet(RADIUS_PACKET *packet,
 
 static void encode_header(RADIUS_PACKET *packet)
 {
-       if ((packet->flags & NR_PACKET_HEADER) != 0) return;
+       if ((packet->flags & RS_PACKET_HEADER) != 0) return;
 
        memset(packet->data, 0, 20);
        packet->data[0] = packet->code;
@@ -576,7 +576,7 @@ static void encode_header(RADIUS_PACKET *packet)
 
        memcpy(packet->data + 4, packet->vector, sizeof(packet->vector));
 
-       packet->flags |= NR_PACKET_HEADER;
+       packet->flags |= RS_PACKET_HEADER;
 }
 
 int nr_packet_encode(RADIUS_PACKET *packet, const RADIUS_PACKET *original)
@@ -589,7 +589,7 @@ int nr_packet_encode(RADIUS_PACKET *packet, const RADIUS_PACKET *original)
        const VALUE_PAIR *vp;
        uint8_t *data, *end;
 
-       if ((packet->flags & NR_PACKET_ENCODED) != 0) return 0;
+       if ((packet->flags & RS_PACKET_ENCODED) != 0) return 0;
 
        rcode = can_encode_packet(packet, original);
        if (rcode < 0) return rcode;
@@ -642,7 +642,7 @@ int nr_packet_encode(RADIUS_PACKET *packet, const RADIUS_PACKET *original)
        packet->data[2] = (packet->length >> 8) & 0xff;
        packet->data[3] = packet->length & 0xff;
 
-       packet->flags |= NR_PACKET_ENCODED;
+       packet->flags |= RS_PACKET_ENCODED;
 
        return packet->length;
 }
@@ -696,7 +696,7 @@ int nr_packet_walk(RADIUS_PACKET *packet, void *ctx,
        uint8_t *attr;
        const uint8_t *end;
 
-       if (!packet || !callback) return -NR_ERR_INVALID_ARG;
+       if (!packet || !callback) return -RSE_INVAL;
 
        rcode = nr_packet_ok(packet);
        if (rcode < 0) return rcode;
@@ -760,7 +760,7 @@ int nr_packet_walk(RADIUS_PACKET *packet, void *ctx,
                                break;
 
                        default:
-                               return -NR_ERR_INTERNAL_FAILURE;
+                               return -RSE_INTERNAL;
                        }
 
                        switch (dv_length) {
@@ -774,7 +774,7 @@ int nr_packet_walk(RADIUS_PACKET *packet, void *ctx,
                                break;
 
                        default:
-                               return -NR_ERR_INTERNAL_FAILURE;
+                               return -RSE_INTERNAL;
                        }
 
                        rcode = do_callback(ctx, callback,
@@ -794,17 +794,15 @@ int nr_packet_init(RADIUS_PACKET *packet, const RADIUS_PACKET *original,
 {
        int rcode;
 
-       if ((code < 0) || (code > NR_MAX_PACKET_CODE)) {
-               return -NR_ERR_REQUEST_CODE_INVALID;
+       if ((code < 0) || (code > RS_MAX_PACKET_CODE)) {
+               return -RSE_INVALID_REQUEST_CODE;
        }
 
-       if (!data || (sizeof_data < 20)) return -NR_ERR_INVALID_ARG;
-
-       if (!secret || !*secret) return -NR_ERR_INVALID_ARG;
+       if (!data || (sizeof_data < 20)) return -RSE_INVAL;
 
        memset(packet, 0, sizeof(*packet));
        packet->secret = secret;
-       packet->sizeof_secret = strlen(secret);
+       packet->sizeof_secret = secret ? strlen(secret) : 0;
        packet->code = code;
        packet->id = 0;
        packet->data = data;
@@ -832,7 +830,7 @@ static int pack_eap(RADIUS_PACKET *packet,
        end = attr + packet->sizeof_data;
        
        while (left > 253) {
-               if ((attr + 255) > end) return -NR_ERR_ATTR_OVERFLOW;
+               if ((attr + 255) > end) return -RSE_ATTR_OVERFLOW;
                
                attr[0] = PW_EAP_MESSAGE;
                attr[1] = 255;
@@ -842,7 +840,7 @@ static int pack_eap(RADIUS_PACKET *packet,
                left -= 253;
        }
        
-       if ((attr + (2 + left)) > end) return -NR_ERR_ATTR_OVERFLOW;
+       if ((attr + (2 + left)) > end) return -RSE_ATTR_OVERFLOW;
        
        attr[0] = PW_EAP_MESSAGE;
        attr[1] = 2 + left;
@@ -864,27 +862,27 @@ ssize_t nr_packet_attr_append(RADIUS_PACKET *packet,
        const VALUE_PAIR *vp;
 
        if (!packet || !da || !data) {
-               return -NR_ERR_INVALID_ARG;
+               return -RSE_INVAL;
        }
 
        if (data_len == 0) {
-               if (da->type != NR_TYPE_STRING) return -NR_ERR_ATTR_TOO_SMALL;
+               if (da->type != RS_TYPE_STRING) return -RSE_ATTR_TOO_SMALL;
 
                data_len = strlen(data);
        }
 
-       packet->flags |= NR_PACKET_ENCODED; /* ignore any VPs */
+       packet->flags |= RS_PACKET_ENCODED; /* ignore any VPs */
 
        attr = packet->data + packet->length;
        end = attr + packet->sizeof_data;
 
        if ((attr + 2 + data_len) > end) {
-               return -NR_ERR_ATTR_OVERFLOW;
+               return -RSE_ATTR_OVERFLOW;
        }
 
        if ((da->flags.length != 0) &&
            (data_len != da->flags.length)) {
-               return -NR_ERR_ATTR_VALUE_MALFORMED;
+               return -RSE_ATTR_VALUE_MALFORMED;
        }
 
 #ifdef PW_EAP_MESSAGE
@@ -897,7 +895,7 @@ ssize_t nr_packet_attr_append(RADIUS_PACKET *packet,
        }
 #endif
 
-       if (data_len > 253) return -NR_ERR_ATTR_TOO_LARGE;
+       if (data_len > 253) return -RSE_ATTR_TOO_LARGE;
 
        vp = nr_vp_init(&my_vp, da);
        rcode = nr_vp_set_data(&my_vp, data, data_len);
index 6b593a8..cd7491a 100644 (file)
@@ -29,7 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *  \brief Routines to parse strings into internal data structures
  */
 
-#include <networkradius-devel/client.h>
+#include "client.h"
 #include <arpa/inet.h>
 
 ssize_t nr_vp_sscanf_value(VALUE_PAIR *vp, const char *value)
@@ -37,43 +37,43 @@ ssize_t nr_vp_sscanf_value(VALUE_PAIR *vp, const char *value)
        char *end;
 
        switch (vp->da->type) {
-       case NR_TYPE_STRING:
+       case RS_TYPE_STRING:
                strlcpy(vp->vp_strvalue, value, sizeof(vp->vp_strvalue));
                vp->length = strlen(vp->vp_strvalue);
                return vp->length;
 
-       case NR_TYPE_DATE:
-       case NR_TYPE_INTEGER:
+       case RS_TYPE_DATE:
+       case RS_TYPE_INTEGER:
                vp->vp_integer = strtoul(value, &end, 10);
                if ((value == end) || (*end != '\0')) {
                        nr_debug_error("Invalid value");
-                       return -NR_ERR_ATTR_VALUE_MALFORMED;
+                       return -RSE_ATTR_VALUE_MALFORMED;
                }
                return (end - value);
 
-       case NR_TYPE_IPADDR:
+       case RS_TYPE_IPADDR:
                if (inet_pton(AF_INET, value, &vp->vp_ipaddr) < 0) {
-                       return -NR_ERR_SYSTEM;
+                       return -RSE_NOSYS;
                }
                return strlen(value);
                
-#ifdef NR_TYPE_IPV6ADDR
-       case NR_TYPE_IPV6ADDR:
+#ifdef RS_TYPE_IPV6ADDR
+       case RS_TYPE_IPV6ADDR:
                if (inet_pton(AF_INET6, value, &vp-vp>ipv6addr) < 0) {
-                       return -NR_ERR_SYSTEM;
+                       return -RSE_NOSYS;
                }
                return strlen(value);
 #endif
 
-#ifdef NR_TYPE_IFID
-       case NR_TYPE_IFID:
+#ifdef RS_TYPE_IFID
+       case RS_TYPE_IFID:
        {
                int i, array[8];
 
                if (sscanf(value, "%02x%02x%02x%02x%02x%02x%02x%02x",
                           &array[0], &array[1], &array[2], &array[3],
                           &array[4], &array[5], &array[6], &array[7]) != 8) {
-                       return -NR_ERR_SYSTEM;
+                       return -RSE_SYSTEM;
                }
 
                for (i = 0; i < 8; i++) vp->vp_ifid[i] = array[i] & 0xff;
@@ -84,7 +84,7 @@ ssize_t nr_vp_sscanf_value(VALUE_PAIR *vp, const char *value)
 
        default:
                nr_debug_error("Invalid type");
-               return -NR_ERR_ATTR_TYPE_UNKNOWN;
+               return -RSE_ATTR_TYPE_UNKNOWN;
        }
 
        return 0;
@@ -99,7 +99,7 @@ int nr_vp_sscanf(const char *string, VALUE_PAIR **pvp)
        VALUE_PAIR *vp;
        char buffer[256];
 
-       if (!string || !pvp) return -NR_ERR_INVALID_ARG;
+       if (!string || !pvp) return -RSE_INVAL;
 
        p = string;
        q = buffer;
@@ -110,26 +110,26 @@ int nr_vp_sscanf(const char *string, VALUE_PAIR **pvp)
 
        if (q == buffer) {
                nr_debug_error("No Attribute name");
-               return -NR_ERR_ATTR_BAD_NAME;
+               return -RSE_ATTR_BAD_NAME;
        }
 
        da = nr_dict_attr_byname(buffer);
        if (!da) {
                nr_debug_error("Unknown attribute \"%s\"", buffer);
-               return -NR_ERR_ATTR_UNKNOWN;
+               return -RSE_ATTR_UNKNOWN;
        }
 
        while (*p == ' ') p++;
        if (*p != '=') {
                nr_debug_error("Unexpected text after attribute name");
-               return -NR_ERR_ATTR_BAD_NAME;
+               return -RSE_ATTR_BAD_NAME;
        }
 
        p++;
        while (*p == ' ') p++;
 
        vp = nr_vp_alloc(da);
-       if (!vp) return -NR_ERR_NO_MEM;
+       if (!vp) return -RSE_NOMEM;
 
        rcode = nr_vp_sscanf_value(vp, p);
        if (rcode < 0) {
index abe4255..28dd0a6 100644 (file)
@@ -29,9 +29,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *  \brief Functions to print things.
  */
 
-#include <networkradius-devel/client.h>
+#include "client.h"
 #include <string.h>
-#ifdef NR_TYPE_IPV6ADDR
+#ifdef RS_TYPE_IPV6ADDR
 #include <arpa/inet.h>
 #endif
 
@@ -51,7 +51,7 @@ void nr_packet_print_hex(RADIUS_PACKET *packet)
                printf("%02x", packet->data[i]);
        }
        printf("\n");
-       if ((packet->flags & NR_PACKET_SIGNED) == 0) printf("\t\tWARNING: nr_packet_sign() was not called!\n");
+       if ((packet->flags & RS_PACKET_SIGNED) == 0) printf("\t\tWARNING: nr_packet_sign() was not called!\n");
 
        if (packet->length > 20) {
                int total;
@@ -106,21 +106,21 @@ size_t nr_vp_snprintf_value(char *buffer, size_t buflen, const VALUE_PAIR *vp)
        char *p = buffer;
 
        switch (vp->da->type) {
-       case NR_TYPE_STRING:
+       case RS_TYPE_STRING:
                /*
                 *      FIXME: escape backslash && quotes!
                 */
-               len = snprintf(p, buflen, "\"%s\"", vp->vp_strvalue);
+               len = snprintf(p, buflen, "%s", vp->vp_strvalue);
                break;
 
-       case NR_TYPE_DATE:
-       case NR_TYPE_INTEGER:
-       case NR_TYPE_SHORT:
-       case NR_TYPE_BYTE:
+       case RS_TYPE_DATE:
+       case RS_TYPE_INTEGER:
+       case RS_TYPE_SHORT:
+       case RS_TYPE_BYTE:
                len = snprintf(p, buflen, "%u", vp->vp_integer);
                break;
 
-       case NR_TYPE_IPADDR:
+       case RS_TYPE_IPADDR:
                len = snprintf(p, buflen, "%u.%u.%u.%u",
                               (vp->vp_ipaddr >> 24) & 0xff,
                               (vp->vp_ipaddr >> 16) & 0xff,
@@ -128,16 +128,16 @@ size_t nr_vp_snprintf_value(char *buffer, size_t buflen, const VALUE_PAIR *vp)
                               vp->vp_ipaddr & 0xff);
                break;
 
-#ifdef NR_TYPE_IPV6ADDR
-       case NR_TYPE_IPV6ADDR:
+#ifdef RS_TYPE_IPV6ADDR
+       case RS_TYPE_IPV6ADDR:
                if (!inet_ntop(AF_INET6, &vp->vp_ipv6addr, buffer, buflen)) {
-                       return -NR_ERR_SYSTEM;
+                       return -RSE_SYSTEM;
                }
                break;
 #endif
 
-#ifdef NR_TYPE_IFID
-       case NR_TYPE_IFID:
+#ifdef RS_TYPE_IFID
+       case RS_TYPE_IFID:
                len = snprintf(p, buflen, "%02x%02x%02x%02x%02x%02x%02x%02x",
                               vp->vp_ifid[0], vp->vp_ifid[1],
                               vp->vp_ifid[2], vp->vp_ifid[3],
@@ -146,7 +146,7 @@ size_t nr_vp_snprintf_value(char *buffer, size_t buflen, const VALUE_PAIR *vp)
                break;
 #endif
 
-       case NR_TYPE_OCTETS:
+       case RS_TYPE_OCTETS:
                len = snprintf(p, buflen, "0x");
                if (len >= buflen) return 0;
 
@@ -224,42 +224,3 @@ void nr_strerror_printf(const char *fmt, ...)
 }
 /** \endcond */
 
-const char *nr_strerror(int error)
-{
-       if (error == 0) return nr_strerror_buffer;
-
-       if (error < 0) error = -error;
-
-       switch (error) {
-       default: return "Unknown error";
-       case NR_ERR_SYSTEM: return strerror(errno);
-
-       case NR_ERR_INVALID_ARG: return "Invalid argument";
-       case NR_ERR_PACKET_TOO_SMALL: return "Packet is too small";
-       case NR_ERR_PACKET_TOO_LARGE: return "Packet is too large";
-       case NR_ERR_ATTR_OVERFLOW: return "Attribute overflows packet";
-       case NR_ERR_ATTR_TOO_SMALL: return "Attribute is too small";
-       case NR_ERR_ATTR_TOO_LARGE: return "Attribute is too large";
-       case NR_ERR_ATTR_UNKNOWN: return "Unknown attribute";
-       case NR_ERR_ATTR_BAD_NAME: return "Invalid name for attribute";
-       case NR_ERR_ATTR_VALUE_MALFORMED: return "Invalid value for attribute";
-       case NR_ERR_ATTR_INVALID: return "Invalid attribute";
-       case NR_ERR_TOO_MANY_ATTRS: return "Too many attributes in the packet";
-       case NR_ERR_ATTR_TYPE_UNKNOWN: return "Attribute type unknown";
-       case NR_ERR_MSG_AUTH_LEN: return "Invalid Message-Authenticator";
-       case NR_ERR_MSG_AUTH_WRONG: return "Incorrect Message-Authenticator";
-       case NR_ERR_REQUEST_REQUIRED: return "Request is required";
-       case NR_ERR_REQUEST_CODE_INVALID: return "Invalid request code";
-       case NR_ERR_AUTH_VECTOR_WRONG: return "Incorrect Request Authenticator";
-       case NR_ERR_RESPONSE_CODE_INVALID: return "Response code is unsupported";
-       case NR_ERR_RESPONSE_ID_INVALID: return "Response ID is invalid";
-       case NR_ERR_RESPONSE_SRC_INVALID: return "Response from the wrong src ip/port";
-       case NR_ERR_NO_PACKET_DATA: return "Cannot encode the packet";
-       case NR_ERR_VENDOR_UNKNOWN: return "Vendor is unknown";
-       case NR_ERR_INTERNAL_FAILURE: return "Internal failure";
-       case NR_ERR_UNSUPPORTED: return "Unsupported feature";
-       case NR_ERR_NO_MEM: return "Out of memory";
-       case NR_ERR_IN_USE: return "Resource is in use";
-               
-       }
-}
diff --git a/lib/radius/radius.h b/lib/radius/radius.h
deleted file mode 100644 (file)
index cfc16b7..0000000
+++ /dev/null
@@ -1,314 +0,0 @@
-/* Automatically generated file.  Do not edit */
-
-#define VENDORPEC_MICROSOFT 311
-#define VENDORPEC_EXAMPLE 65535
-
-
-/* IETF */
-#define PW_USER_NAME 1
-#define PW_USER_PASSWORD 2
-#define PW_CHAP_PASSWORD 3
-#define PW_NAS_IP_ADDRESS 4
-#define PW_NAS_PORT 5
-#define PW_SERVICE_TYPE 6
-#define PW_FRAMED_PROTOCOL 7
-#define PW_FRAMED_IP_ADDRESS 8
-#define PW_FRAMED_IP_NETMASK 9
-#define PW_FRAMED_ROUTING 10
-#define PW_FILTER_ID 11
-#define PW_FRAMED_MTU 12
-#define PW_FRAMED_COMPRESSION 13
-#define PW_LOGIN_IP_HOST 14
-#define PW_LOGIN_SERVICE 15
-#define PW_LOGIN_TCP_PORT 16
-#define PW_REPLY_MESSAGE 18
-#define PW_CALLBACK_NUMBER 19
-#define PW_CALLBACK_ID 20
-#define PW_FRAMED_ROUTE 22
-#define PW_FRAMED_IPX_NETWORK 23
-#define PW_STATE 24
-#define PW_CLASS 25
-#define PW_VENDOR_SPECIFIC 26
-#define PW_SESSION_TIMEOUT 27
-#define PW_IDLE_TIMEOUT 28
-#define PW_TERMINATION_ACTION 29
-#define PW_CALLED_STATION_ID 30
-#define PW_CALLING_STATION_ID 31
-#define PW_NAS_IDENTIFIER 32
-#define PW_PROXY_STATE 33
-#define PW_LOGIN_LAT_SERVICE 34
-#define PW_LOGIN_LAT_NODE 35
-#define PW_LOGIN_LAT_GROUP 36
-#define PW_FRAMED_APPLETALK_LINK 37
-#define PW_FRAMED_APPLETALK_NETWORK 38
-#define PW_FRAMED_APPLETALK_ZONE 39
-#define PW_ACCT_STATUS_TYPE 40
-#define PW_ACCT_DELAY_TIME 41
-#define PW_ACCT_INPUT_OCTETS 42
-#define PW_ACCT_OUTPUT_OCTETS 43
-#define PW_ACCT_SESSION_ID 44
-#define PW_ACCT_AUTHENTIC 45
-#define PW_ACCT_SESSION_TIME 46
-#define PW_ACCT_INPUT_PACKETS 47
-#define PW_ACCT_OUTPUT_PACKETS 48
-#define PW_ACCT_TERMINATE_CAUSE 49
-#define PW_ACCT_MULTI_SESSION_ID 50
-#define PW_ACCT_LINK_COUNT 51
-#define PW_ACCT_INPUT_GIGAWORDS 52
-#define PW_ACCT_OUTPUT_GIGAWORDS 53
-#define PW_EVENT_TIMESTAMP 55
-#define PW_EGRESS_VLANID 56
-#define PW_INGRESS_FILTERS 57
-#define PW_EGRESS_VLAN_NAME 58
-#define PW_USER_PRIORITY_TABLE 59
-#define PW_CHAP_CHALLENGE 60
-#define PW_NAS_PORT_TYPE 61
-#define PW_PORT_LIMIT 62
-#define PW_LOGIN_LAT_PORT 63
-#define PW_TUNNEL_TYPE 64
-#define PW_TUNNEL_MEDIUM_TYPE 65
-#define PW_TUNNEL_CLIENT_ENDPOINT 66
-#define PW_TUNNEL_SERVER_ENDPOINT 67
-#define PW_ACCT_TUNNEL_CONNECTION 68
-#define PW_TUNNEL_PASSWORD 69
-#define PW_ARAP_PASSWORD 70
-#define PW_ARAP_FEATURES 71
-#define PW_ARAP_ZONE_ACCESS 72
-#define PW_ARAP_SECURITY 73
-#define PW_ARAP_SECURITY_DATA 74
-#define PW_PASSWORD_RETRY 75
-#define PW_PROMPT 76
-#define PW_CONNECT_INFO 77
-#define PW_CONFIGURATION_TOKEN 78
-#define PW_EAP_MESSAGE 79
-#define PW_MESSAGE_AUTHENTICATOR 80
-#define PW_TUNNEL_PRIVATE_GROUP_ID 81
-#define PW_TUNNEL_ASSIGNMENT_ID 82
-#define PW_TUNNEL_PREFERENCE 83
-#define PW_ARAP_CHALLENGE_RESPONSE 84
-#define PW_ACCT_INTERIM_INTERVAL 85
-#define PW_ACCT_TUNNEL_PACKETS_LOST 86
-#define PW_NAS_PORT_ID 87
-#define PW_FRAMED_POOL 88
-#define PW_CHARGEABLE_USER_IDENTITY 89
-#define PW_TUNNEL_CLIENT_AUTH_ID 90
-#define PW_TUNNEL_SERVER_AUTH_ID 91
-#define PW_NAS_FILTER_RULE 92
-#define PW_NAS_IPV6_ADDRESS 95
-#define PW_FRAMED_INTERFACE_ID 96
-#define PW_FRAMED_IPV6_PREFIX 97
-#define PW_LOGIN_IPV6_HOST 98
-#define PW_FRAMED_IPV6_ROUTE 99
-#define PW_FRAMED_IPV6_POOL 100
-#define PW_ERROR_CAUSE 101
-#define PW_EAP_KEY_NAME 102
-#define PW_DIGEST_RESPONSE 103
-#define PW_DIGEST_REALM 104
-#define PW_DIGEST_NONCE 105
-#define PW_DIGEST_RESPONSE_AUTH 106
-#define PW_DIGEST_NEXTNONCE 107
-#define PW_DIGEST_METHOD 108
-#define PW_DIGEST_URI 109
-#define PW_DIGEST_QOP 110
-#define PW_DIGEST_ALGORITHM 111
-#define PW_DIGEST_ENTITY_BODY_HASH 112
-#define PW_DIGEST_CNONCE 113
-#define PW_DIGEST_NONCE_COUNT 114
-#define PW_DIGEST_USERNAME 115
-#define PW_DIGEST_OPAQUE 116
-#define PW_DIGEST_AUTH_PARAM 117
-#define PW_DIGEST_AKA_AUTS 118
-#define PW_DIGEST_DOMAIN 119
-#define PW_DIGEST_STALE 120
-#define PW_DIGEST_HA1 121
-#define PW_SIP_AOR 122
-#define PW_DELEGATED_IPV6_PREFIX 123
-#define PW_OPERATOR_NAME 126
-#define PW_LOCATION_INFORMATION 127
-#define PW_LOCATION_DATA 128
-#define PW_BASIC_LOCATION_POLICY_RULES 129
-#define PW_EXTENDED_LOCATION_POLICY_RULES 130
-#define PW_LOCATION_CAPABLE 131
-#define PW_REQUESTED_LOCATION_INFO 132
-#define PW_FRAMED_MANAGEMENT 133
-#define PW_MANAGEMENT_TRANSPORT_PROTECTION 134
-#define PW_MANAGEMENT_POLICY_ID 135
-#define PW_MANAGEMENT_PRIVILEGE_LEVEL 136
-#define PW_PKM_SS_CERT 137
-#define PW_PKM_CA_CERT 138
-#define PW_PKM_CONFIG_SETTINGS 139
-#define PW_PKM_CRYPTOSUITE_LIST 140
-#define PW_PKM_SAID 141
-#define PW_PKM_SA_DESCRIPTOR 142
-#define PW_PKM_AUTH_KEY 143
-
-/* Microsoft */
-#define PW_MS_CHAP_RESPONSE 1
-#define PW_MS_CHAP_ERROR 2
-#define PW_MS_MPPE_ENCRYPTION_POLICY 7
-#define PW_MS_MPPE_ENCRYPTION_TYPES 8
-#define PW_MS_CHAP_DOMAIN 10
-#define PW_MS_CHAP_CHALLENGE 11
-#define PW_MS_CHAP_MPPE_KEYS 12
-#define PW_MS_MPPE_SEND_KEY 16
-#define PW_MS_MPPE_RECV_KEY 17
-#define PW_MS_CHAP2_RESPONSE 25
-#define PW_MS_CHAP2_SUCCESS 26
-
-/* example */
-#define PW_EXAMPLE_INTEGER 1
-#define PW_EXAMPLE_STRING 2
-#define PW_EXAMPLE_IP_ADDRESS 3
-
-/* Fixed offsets to dictionary definitions of attributes */
-#define NR_DA_USER_NAME (&nr_dict_attrs[1])
-#define NR_DA_USER_PASSWORD (&nr_dict_attrs[2])
-#define NR_DA_CHAP_PASSWORD (&nr_dict_attrs[3])
-#define NR_DA_NAS_IP_ADDRESS (&nr_dict_attrs[4])
-#define NR_DA_NAS_PORT (&nr_dict_attrs[5])
-#define NR_DA_SERVICE_TYPE (&nr_dict_attrs[6])
-#define NR_DA_FRAMED_PROTOCOL (&nr_dict_attrs[7])
-#define NR_DA_FRAMED_IP_ADDRESS (&nr_dict_attrs[8])
-#define NR_DA_FRAMED_IP_NETMASK (&nr_dict_attrs[9])
-#define NR_DA_FRAMED_ROUTING (&nr_dict_attrs[10])
-#define NR_DA_FILTER_ID (&nr_dict_attrs[11])
-#define NR_DA_FRAMED_MTU (&nr_dict_attrs[12])
-#define NR_DA_FRAMED_COMPRESSION (&nr_dict_attrs[13])
-#define NR_DA_LOGIN_IP_HOST (&nr_dict_attrs[14])
-#define NR_DA_LOGIN_SERVICE (&nr_dict_attrs[15])
-#define NR_DA_LOGIN_TCP_PORT (&nr_dict_attrs[16])
-#define NR_DA_REPLY_MESSAGE (&nr_dict_attrs[18])
-#define NR_DA_CALLBACK_NUMBER (&nr_dict_attrs[19])
-#define NR_DA_CALLBACK_ID (&nr_dict_attrs[20])
-#define NR_DA_FRAMED_ROUTE (&nr_dict_attrs[22])
-#define NR_DA_FRAMED_IPX_NETWORK (&nr_dict_attrs[23])
-#define NR_DA_STATE (&nr_dict_attrs[24])
-#define NR_DA_CLASS (&nr_dict_attrs[25])
-#define NR_DA_VENDOR_SPECIFIC (&nr_dict_attrs[26])
-#define NR_DA_SESSION_TIMEOUT (&nr_dict_attrs[27])
-#define NR_DA_IDLE_TIMEOUT (&nr_dict_attrs[28])
-#define NR_DA_TERMINATION_ACTION (&nr_dict_attrs[29])
-#define NR_DA_CALLED_STATION_ID (&nr_dict_attrs[30])
-#define NR_DA_CALLING_STATION_ID (&nr_dict_attrs[31])
-#define NR_DA_NAS_IDENTIFIER (&nr_dict_attrs[32])
-#define NR_DA_PROXY_STATE (&nr_dict_attrs[33])
-#define NR_DA_LOGIN_LAT_SERVICE (&nr_dict_attrs[34])
-#define NR_DA_LOGIN_LAT_NODE (&nr_dict_attrs[35])
-#define NR_DA_LOGIN_LAT_GROUP (&nr_dict_attrs[36])
-#define NR_DA_FRAMED_APPLETALK_LINK (&nr_dict_attrs[37])
-#define NR_DA_FRAMED_APPLETALK_NETWORK (&nr_dict_attrs[38])
-#define NR_DA_FRAMED_APPLETALK_ZONE (&nr_dict_attrs[39])
-#define NR_DA_ACCT_STATUS_TYPE (&nr_dict_attrs[40])
-#define NR_DA_ACCT_DELAY_TIME (&nr_dict_attrs[41])
-#define NR_DA_ACCT_INPUT_OCTETS (&nr_dict_attrs[42])
-#define NR_DA_ACCT_OUTPUT_OCTETS (&nr_dict_attrs[43])
-#define NR_DA_ACCT_SESSION_ID (&nr_dict_attrs[44])
-#define NR_DA_ACCT_AUTHENTIC (&nr_dict_attrs[45])
-#define NR_DA_ACCT_SESSION_TIME (&nr_dict_attrs[46])
-#define NR_DA_ACCT_INPUT_PACKETS (&nr_dict_attrs[47])
-#define NR_DA_ACCT_OUTPUT_PACKETS (&nr_dict_attrs[48])
-#define NR_DA_ACCT_TERMINATE_CAUSE (&nr_dict_attrs[49])
-#define NR_DA_ACCT_MULTI_SESSION_ID (&nr_dict_attrs[50])
-#define NR_DA_ACCT_LINK_COUNT (&nr_dict_attrs[51])
-#define NR_DA_ACCT_INPUT_GIGAWORDS (&nr_dict_attrs[52])
-#define NR_DA_ACCT_OUTPUT_GIGAWORDS (&nr_dict_attrs[53])
-#define NR_DA_EVENT_TIMESTAMP (&nr_dict_attrs[55])
-#define NR_DA_EGRESS_VLANID (&nr_dict_attrs[56])
-#define NR_DA_INGRESS_FILTERS (&nr_dict_attrs[57])
-#define NR_DA_EGRESS_VLAN_NAME (&nr_dict_attrs[58])
-#define NR_DA_USER_PRIORITY_TABLE (&nr_dict_attrs[59])
-#define NR_DA_CHAP_CHALLENGE (&nr_dict_attrs[60])
-#define NR_DA_NAS_PORT_TYPE (&nr_dict_attrs[61])
-#define NR_DA_PORT_LIMIT (&nr_dict_attrs[62])
-#define NR_DA_LOGIN_LAT_PORT (&nr_dict_attrs[63])
-#define NR_DA_TUNNEL_TYPE (&nr_dict_attrs[64])
-#define NR_DA_TUNNEL_MEDIUM_TYPE (&nr_dict_attrs[65])
-#define NR_DA_TUNNEL_CLIENT_ENDPOINT (&nr_dict_attrs[66])
-#define NR_DA_TUNNEL_SERVER_ENDPOINT (&nr_dict_attrs[67])
-#define NR_DA_ACCT_TUNNEL_CONNECTION (&nr_dict_attrs[68])
-#define NR_DA_TUNNEL_PASSWORD (&nr_dict_attrs[69])
-#define NR_DA_ARAP_PASSWORD (&nr_dict_attrs[70])
-#define NR_DA_ARAP_FEATURES (&nr_dict_attrs[71])
-#define NR_DA_ARAP_ZONE_ACCESS (&nr_dict_attrs[72])
-#define NR_DA_ARAP_SECURITY (&nr_dict_attrs[73])
-#define NR_DA_ARAP_SECURITY_DATA (&nr_dict_attrs[74])
-#define NR_DA_PASSWORD_RETRY (&nr_dict_attrs[75])
-#define NR_DA_PROMPT (&nr_dict_attrs[76])
-#define NR_DA_CONNECT_INFO (&nr_dict_attrs[77])
-#define NR_DA_CONFIGURATION_TOKEN (&nr_dict_attrs[78])
-#define NR_DA_EAP_MESSAGE (&nr_dict_attrs[79])
-#define NR_DA_MESSAGE_AUTHENTICATOR (&nr_dict_attrs[80])
-#define NR_DA_TUNNEL_PRIVATE_GROUP_ID (&nr_dict_attrs[81])
-#define NR_DA_TUNNEL_ASSIGNMENT_ID (&nr_dict_attrs[82])
-#define NR_DA_TUNNEL_PREFERENCE (&nr_dict_attrs[83])
-#define NR_DA_ARAP_CHALLENGE_RESPONSE (&nr_dict_attrs[84])
-#define NR_DA_ACCT_INTERIM_INTERVAL (&nr_dict_attrs[85])
-#define NR_DA_ACCT_TUNNEL_PACKETS_LOST (&nr_dict_attrs[86])
-#define NR_DA_NAS_PORT_ID (&nr_dict_attrs[87])
-#define NR_DA_FRAMED_POOL (&nr_dict_attrs[88])
-#define NR_DA_CHARGEABLE_USER_IDENTITY (&nr_dict_attrs[89])
-#define NR_DA_TUNNEL_CLIENT_AUTH_ID (&nr_dict_attrs[90])
-#define NR_DA_TUNNEL_SERVER_AUTH_ID (&nr_dict_attrs[91])
-#define NR_DA_NAS_FILTER_RULE (&nr_dict_attrs[92])
-#define NR_DA_NAS_IPV6_ADDRESS (&nr_dict_attrs[95])
-#define NR_DA_FRAMED_INTERFACE_ID (&nr_dict_attrs[96])
-#define NR_DA_FRAMED_IPV6_PREFIX (&nr_dict_attrs[97])
-#define NR_DA_LOGIN_IPV6_HOST (&nr_dict_attrs[98])
-#define NR_DA_FRAMED_IPV6_ROUTE (&nr_dict_attrs[99])
-#define NR_DA_FRAMED_IPV6_POOL (&nr_dict_attrs[100])
-#define NR_DA_ERROR_CAUSE (&nr_dict_attrs[101])
-#define NR_DA_EAP_KEY_NAME (&nr_dict_attrs[102])
-#define NR_DA_DIGEST_RESPONSE (&nr_dict_attrs[103])
-#define NR_DA_DIGEST_REALM (&nr_dict_attrs[104])
-#define NR_DA_DIGEST_NONCE (&nr_dict_attrs[105])
-#define NR_DA_DIGEST_RESPONSE_AUTH (&nr_dict_attrs[106])
-#define NR_DA_DIGEST_NEXTNONCE (&nr_dict_attrs[107])
-#define NR_DA_DIGEST_METHOD (&nr_dict_attrs[108])
-#define NR_DA_DIGEST_URI (&nr_dict_attrs[109])
-#define NR_DA_DIGEST_QOP (&nr_dict_attrs[110])
-#define NR_DA_DIGEST_ALGORITHM (&nr_dict_attrs[111])
-#define NR_DA_DIGEST_ENTITY_BODY_HASH (&nr_dict_attrs[112])
-#define NR_DA_DIGEST_CNONCE (&nr_dict_attrs[113])
-#define NR_DA_DIGEST_NONCE_COUNT (&nr_dict_attrs[114])
-#define NR_DA_DIGEST_USERNAME (&nr_dict_attrs[115])
-#define NR_DA_DIGEST_OPAQUE (&nr_dict_attrs[116])
-#define NR_DA_DIGEST_AUTH_PARAM (&nr_dict_attrs[117])
-#define NR_DA_DIGEST_AKA_AUTS (&nr_dict_attrs[118])
-#define NR_DA_DIGEST_DOMAIN (&nr_dict_attrs[119])
-#define NR_DA_DIGEST_STALE (&nr_dict_attrs[120])
-#define NR_DA_DIGEST_HA1 (&nr_dict_attrs[121])
-#define NR_DA_SIP_AOR (&nr_dict_attrs[122])
-#define NR_DA_DELEGATED_IPV6_PREFIX (&nr_dict_attrs[123])
-#define NR_DA_OPERATOR_NAME (&nr_dict_attrs[126])
-#define NR_DA_LOCATION_INFORMATION (&nr_dict_attrs[127])
-#define NR_DA_LOCATION_DATA (&nr_dict_attrs[128])
-#define NR_DA_BASIC_LOCATION_POLICY_RULES (&nr_dict_attrs[129])
-#define NR_DA_EXTENDED_LOCATION_POLICY_RULES (&nr_dict_attrs[130])
-#define NR_DA_LOCATION_CAPABLE (&nr_dict_attrs[131])
-#define NR_DA_REQUESTED_LOCATION_INFO (&nr_dict_attrs[132])
-#define NR_DA_FRAMED_MANAGEMENT (&nr_dict_attrs[133])
-#define NR_DA_MANAGEMENT_TRANSPORT_PROTECTION (&nr_dict_attrs[134])
-#define NR_DA_MANAGEMENT_POLICY_ID (&nr_dict_attrs[135])
-#define NR_DA_MANAGEMENT_PRIVILEGE_LEVEL (&nr_dict_attrs[136])
-#define NR_DA_PKM_SS_CERT (&nr_dict_attrs[137])
-#define NR_DA_PKM_CA_CERT (&nr_dict_attrs[138])
-#define NR_DA_PKM_CONFIG_SETTINGS (&nr_dict_attrs[139])
-#define NR_DA_PKM_CRYPTOSUITE_LIST (&nr_dict_attrs[140])
-#define NR_DA_PKM_SAID (&nr_dict_attrs[141])
-#define NR_DA_PKM_SA_DESCRIPTOR (&nr_dict_attrs[142])
-#define NR_DA_PKM_AUTH_KEY (&nr_dict_attrs[143])
-#define NR_DA_MS_CHAP_RESPONSE (&nr_dict_attrs[256])
-#define NR_DA_MS_CHAP_ERROR (&nr_dict_attrs[257])
-#define NR_DA_MS_MPPE_ENCRYPTION_POLICY (&nr_dict_attrs[258])
-#define NR_DA_MS_MPPE_ENCRYPTION_TYPES (&nr_dict_attrs[259])
-#define NR_DA_MS_CHAP_DOMAIN (&nr_dict_attrs[260])
-#define NR_DA_MS_CHAP_CHALLENGE (&nr_dict_attrs[261])
-#define NR_DA_MS_CHAP_MPPE_KEYS (&nr_dict_attrs[262])
-#define NR_DA_MS_MPPE_SEND_KEY (&nr_dict_attrs[263])
-#define NR_DA_MS_MPPE_RECV_KEY (&nr_dict_attrs[264])
-#define NR_DA_MS_CHAP2_RESPONSE (&nr_dict_attrs[265])
-#define NR_DA_MS_CHAP2_SUCCESS (&nr_dict_attrs[266])
-#define NR_DA_EXAMPLE_INTEGER (&nr_dict_attrs[267])
-#define NR_DA_EXAMPLE_STRING (&nr_dict_attrs[268])
-#define NR_DA_EXAMPLE_IP_ADDRESS (&nr_dict_attrs[269])
-/* Automatically generated file.  Do not edit */
diff --git a/lib/radius/share/dictionary.ukerna b/lib/radius/share/dictionary.ukerna
new file mode 100644 (file)
index 0000000..1694566
--- /dev/null
@@ -0,0 +1,19 @@
+# -*- text -*-
+#
+#      GSS-EAP VSAs
+#
+#      $Id$
+#
+
+VENDOR UKERNA                          25622
+
+BEGIN-VENDOR UKERNA
+
+ATTRIBUTE      GSS-Acceptor-Service-Name       128     string
+ATTRIBUTE      GSS-Acceptor-Host-Name          129     string
+ATTRIBUTE      GSS-Acceptor-Service-Specific   130     string
+ATTRIBUTE      GSS-Acceptor-Realm-Name         131     string
+ATTRIBUTE      SAML-AAA-Assertion              132     string
+ATTRIBUTE      MS-Windows-Auth-Data            133     octets
+
+END-VENDOR UKERNA
index d633e5b..bd87272 100644 (file)
@@ -29,7 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *  \brief Dummy file to include auto-generating static dictionary mappings.
  */
 
-#include <networkradius-devel/client.h>
+#include "client.h"
 
 /*
  *     Include the dynamically generated dictionaries.
index 603a970..b374fdd 100644 (file)
@@ -29,7 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *  \brief Functions to manipulate C structure versions of RADIUS attributes.
  */
 
-#include <networkradius-devel/client.h>
+#include "client.h"
 
 void nr_vp_free(VALUE_PAIR **head)
 {
@@ -71,9 +71,7 @@ VALUE_PAIR *nr_vp_alloc(const DICT_ATTR *da)
                return NULL;
        }
 
-#ifndef NR_NO_MALLOC
        vp = malloc(sizeof(*vp));
-#endif
        if (!vp) {
                nr_strerror_printf("Out of memory");
                return NULL;
@@ -87,9 +85,7 @@ VALUE_PAIR *nr_vp_alloc_raw(unsigned int attr, unsigned int vendor)
        VALUE_PAIR *vp = NULL;
        DICT_ATTR *da;
 
-#ifndef NR_NO_MALLOC
        vp = malloc(sizeof(*vp) + sizeof(*da) + 64);
-#endif
        if (!vp) {
                nr_strerror_printf("Out of memory");
                return NULL;
@@ -112,24 +108,24 @@ int nr_vp_set_data(VALUE_PAIR *vp, const void *data, size_t sizeof_data)
 {
        int rcode = 1;          /* OK */
 
-       if (!vp || !data || (sizeof_data == 0)) return -NR_ERR_INVALID_ARG;
+       if (!vp || !data || (sizeof_data == 0)) return -RSE_INVAL;
 
        switch (vp->da->type) {
-       case NR_TYPE_BYTE:
+       case RS_TYPE_BYTE:
                vp->vp_integer = *(const uint8_t *) data;
                break;
                
-       case NR_TYPE_SHORT:
+       case RS_TYPE_SHORT:
                vp->vp_integer = *(const uint16_t *) data;
                break;
                
-       case NR_TYPE_INTEGER:
-       case NR_TYPE_DATE:
-       case NR_TYPE_IPADDR:
+       case RS_TYPE_INTEGER:
+       case RS_TYPE_DATE:
+       case RS_TYPE_IPADDR:
                vp->vp_integer = *(const uint32_t *) data;
                break;
                
-       case NR_TYPE_STRING:
+       case RS_TYPE_STRING:
                if (sizeof_data >= sizeof(vp->vp_strvalue)) {
                        sizeof_data = sizeof(vp->vp_strvalue) - 1;
                        rcode = 0; /* truncated */
@@ -140,7 +136,7 @@ int nr_vp_set_data(VALUE_PAIR *vp, const void *data, size_t sizeof_data)
                vp->length = sizeof_data;
                break;
                
-       case NR_TYPE_OCTETS:
+       case RS_TYPE_OCTETS:
                if (sizeof_data > sizeof(vp->vp_octets)) {
                        sizeof_data = sizeof(vp->vp_octets);
                        rcode = 0; /* truncated */
@@ -150,7 +146,7 @@ int nr_vp_set_data(VALUE_PAIR *vp, const void *data, size_t sizeof_data)
                break;
                
        default:
-               return -NR_ERR_ATTR_TYPE_UNKNOWN;
+               return -RSE_ATTR_TYPE_UNKNOWN;
        }
 
        return rcode;
index d4c0a09..70a968e 100644 (file)
@@ -12,7 +12,7 @@
 #include <libgen.h>
 #include <assert.h>
 
-#include <freeradius/libradius.h>
+#include <radius/client.h>
 #include <event2/event.h>
 #include <event2/util.h>
 #include <radsec/radsec.h>
@@ -39,14 +39,8 @@ rs_context_create (struct rs_context **ctx)
 #if defined (RS_ENABLE_TLS)
   ssl_init ();
 #endif
-#if defined (DEBUG)
-  fr_log_fp = stderr;
-  fr_debug_flag = 1;
-#endif
-  debug_init ("libradsec");    /* radsecproxy compat, FIXME: remove */
 
-  fr_randinit (&h->fr_randctx, 0);
-  fr_rand_seed (NULL, 0);
+  debug_init ("libradsec");    /* radsecproxy compat, FIXME: remove */
 
   if (ctx != NULL)
     *ctx = h;
@@ -67,9 +61,6 @@ rs_context_init_freeradius_dict (struct rs_context *ctx, const char *dict)
     if (ctx->config != NULL && ctx->config->dictionary)
       dict = ctx->config->dictionary;
 
-  if (dict == NULL)
-    dict = RS_FREERADIUS_DICT;
-
   dictlen = strlen (dict);
   dir = rs_calloc (ctx, 1, dictlen + 1);
   fn = rs_calloc (ctx, 1, dictlen + 1);
@@ -81,13 +72,6 @@ rs_context_init_freeradius_dict (struct rs_context *ctx, const char *dict)
   strncpy (dir, dict, dictlen);
   strncpy (fn, dict, dictlen);
 
-  if (dict_init (dirname (dir), basename (fn)) < 0)
-    {
-      r = rs_err_ctx_push_fl (ctx, RSE_FR, __FILE__, __LINE__,
-                             "failing dict_init(\"%s\")", dict);
-      goto out;
-    }
-
  out:
   if (dir)
     rs_free (ctx, dir);
index fe17f07..aec17cd 100644 (file)
@@ -1,3 +1,38 @@
+rs_attr_find
+rs_avp_alloc
+rs_avp_append
+rs_avp_attrid
+rs_avp_byte_set
+rs_avp_byte_value
+rs_avp_date_set
+rs_avp_date_value
+rs_avp_delete
+rs_avp_display_value
+rs_avp_dup
+rs_avp_find
+rs_avp_find_const
+rs_avp_fragmented_value
+rs_avp_free
+rs_avp_ifid_set
+rs_avp_ifid_value
+rs_avp_integer_set
+rs_avp_integer_value
+rs_avp_ipaddr_set
+rs_avp_ipaddr_value
+rs_avp_length
+rs_avp_name
+rs_avp_next
+rs_avp_next_const
+rs_avp_octets_set
+rs_avp_octets_value
+rs_avp_octets_value_byref
+rs_avp_octets_value_const_ptr
+rs_avp_octets_value_ptr
+rs_avp_short_set
+rs_avp_short_value
+rs_avp_string_set
+rs_avp_string_value
+rs_avp_typeof
 rs_conf_find_realm
 rs_conn_add_listener
 rs_conn_create
@@ -29,6 +64,9 @@ rs_err_ctx_push
 rs_err_ctx_push_fl
 rs_err_free
 rs_err_msg
+rs_packet_append_avp
+rs_packet_avps
+rs_packet_code
 rs_packet_create
 rs_packet_create_authn_request
 rs_packet_destroy
index 3831773..b964bea 100644 (file)
@@ -14,7 +14,7 @@
 #include <radsec/radsec-impl.h>
 #include <radsec/request.h>
 #include <radsec/request-impl.h>
-#include <freeradius/libradius.h>
+#include <radius/client.h>
 #include "debug.h"
 #include "conn.h"
 #include "tcp.h"
@@ -82,7 +82,7 @@ rs_request_destroy (struct rs_request *request)
 static void
 _rand_rt (struct timeval *res, uint32_t rtprev, uint32_t factor)
 {
-  uint32_t ms = rtprev * (fr_rand () % factor);
+  uint32_t ms = rtprev * (nr_rand () % factor);
   res->tv_sec = rtprev + ms / 1000;
   res->tv_usec = (ms % 1000) * 1000;
 }
index ce071cd..3a59d6f 100644 (file)
--- a/lib/tcp.c
+++ b/lib/tcp.c
@@ -12,6 +12,7 @@
 #include <event2/bufferevent_ssl.h>
 #include <openssl/err.h>
 #endif
+#include <radius/client.h>
 #include <radsec/radsec.h>
 #include <radsec/radsec-impl.h>
 #include "tcp.h"
@@ -35,26 +36,19 @@ _read_header (struct rs_packet *pkt)
   if (n == RS_HEADER_LEN)
     {
       pkt->flags |= rs_packet_hdr_read_flag;
-      pkt->rpkt->data_len = (pkt->hdr[2] << 8) + pkt->hdr[3];
-      if (pkt->rpkt->data_len < 20 || pkt->rpkt->data_len > 4096)
+      pkt->rpkt->length = (pkt->hdr[2] << 8) + pkt->hdr[3];
+      if (pkt->rpkt->length < 20 || pkt->rpkt->length > RS_MAX_PACKET_LEN)
        {
          conn_close (&pkt->conn);
          return rs_err_conn_push (pkt->conn, RSE_INVALID_PKT,
                                   "invalid packet length: %d",
-                                  pkt->rpkt->data_len);
-       }
-      pkt->rpkt->data = rs_malloc (pkt->conn->ctx, pkt->rpkt->data_len);
-      if (!pkt->rpkt->data)
-       {
-         conn_close (&pkt->conn);
-         return rs_err_conn_push_fl (pkt->conn, RSE_NOMEM, __FILE__, __LINE__,
-                                     NULL);
+                                  pkt->rpkt->length);
        }
       memcpy (pkt->rpkt->data, pkt->hdr, RS_HEADER_LEN);
       bufferevent_setwatermark (pkt->conn->bev, EV_READ,
-                               pkt->rpkt->data_len - RS_HEADER_LEN, 0);
+                               pkt->rpkt->length - RS_HEADER_LEN, 0);
       rs_debug (("%s: packet header read, total pkt len=%d\n",
-                __func__, pkt->rpkt->data_len));
+                __func__, pkt->rpkt->length));
     }
   else if (n < 0)
     {
@@ -74,17 +68,18 @@ static int
 _read_packet (struct rs_packet *pkt)
 {
   size_t n = 0;
+  int err;
 
   rs_debug (("%s: trying to read %d octets of packet data\n", __func__,
-            pkt->rpkt->data_len - RS_HEADER_LEN));
+            pkt->rpkt->length - RS_HEADER_LEN));
 
   n = bufferevent_read (pkt->conn->bev,
                        pkt->rpkt->data + RS_HEADER_LEN,
-                       pkt->rpkt->data_len - RS_HEADER_LEN);
+                       pkt->rpkt->length - RS_HEADER_LEN);
 
   rs_debug (("%s: read %ld octets of packet data\n", __func__, n));
 
-  if (n == pkt->rpkt->data_len - RS_HEADER_LEN)
+  if (n == pkt->rpkt->length - RS_HEADER_LEN)
     {
       bufferevent_disable (pkt->conn->bev, EV_READ);
       rs_debug (("%s: complete packet read\n", __func__));
@@ -96,11 +91,12 @@ _read_packet (struct rs_packet *pkt)
         - invalid code field
         - attribute lengths >= 2
         - attribute sizes adding up correctly  */
-      if (!rad_packet_ok (pkt->rpkt, 0))
+      err = nr_packet_ok (pkt->rpkt);
+      if (err != RSE_OK)
        {
          conn_close (&pkt->conn);
-         return rs_err_conn_push_fl (pkt->conn, RSE_FR, __FILE__, __LINE__,
-                                     "invalid packet: %s", fr_strerror ());
+         return rs_err_conn_push_fl (pkt->conn, err, __FILE__, __LINE__,
+                                     "invalid packet");
        }
 
 #if defined (DEBUG)
@@ -123,7 +119,7 @@ _read_packet (struct rs_packet *pkt)
     rs_debug (("%s: buffer frozen when reading packet\n", __func__));
   else                         /* Short packet.  */
     rs_debug (("%s: waiting for another %d octets\n", __func__,
-              pkt->rpkt->data_len - RS_HEADER_LEN - n));
+              pkt->rpkt->length - RS_HEADER_LEN - n));
 
   return 0;
 }
index f264a51..e51531c 100644 (file)
@@ -8,8 +8,6 @@
 #define true 1                 /* FIXME: Bug report cgreen.  */
 #define false 0
 
-#define FREERADIUS_DICT "/usr/share/freeradius/dictionary"
-
 static void
 authenticate (struct rs_connection *conn, const char *user, const char *pw)
 {
@@ -21,7 +19,7 @@ authenticate (struct rs_connection *conn, const char *user, const char *pw)
   rs_request_add_reqpkt (req, msg);
   assert_true (rs_request_send (req, &resp) == 0);
   //printf ("%s\n", rs_err_msg (rs_err_conn_pop (conn), 1));
-  assert_true (rs_packet_frpkt (resp)->code == PW_AUTHENTICATION_ACK);
+  assert_true (rs_packet_frpkt (resp)->code == PW_ACCESS_ACCEPT);
 
   rs_request_destroy (req);
 }
@@ -45,9 +43,9 @@ send_large_packet (struct rs_connection *conn)
   char *buf;
   int f;
 
-  buf = malloc (4096);
+  buf = malloc (RS_MAX_PACKET_LEN);
   assert_true (buf != NULL);
-  memset (buf, 0, 4096);
+  memset (buf, 0, RS_MAX_PACKET_LEN);
 
   assert_true (rs_packet_create (conn, &msg0) == 0);
   /* 16 chunks --> heap corruption in evbuffer_drain detected by free() */
@@ -79,7 +77,7 @@ test_auth ()
   setup.username = "molgan";
   setup.pw = "password";
 
-  assert_true (rs_context_create (&ctx, FREERADIUS_DICT) == 0);
+  assert_true (rs_context_create (&ctx, NULL) == 0);
   assert_true (rs_context_read_config (ctx, setup.config_file) == 0);
   assert_true (rs_conn_create (ctx, &conn, setup.config_name) == 0);
 
@@ -98,7 +96,7 @@ test_buffering_cb (const uint8_t *buf, ssize_t len)
   hd (buf, len);
 #endif
   assert_true (len >= 20);
-  assert_true (len <= 4096);
+  assert_true (len <= RS_MAX_PACKET_LEN);
   assert_true ((buf[2] << 8) +  buf[3] == len);
   return len;
 }
@@ -111,7 +109,7 @@ test_buffering ()
   struct timeval timeout;
   struct polldata *polldata;
 
-  assert_true (rs_context_create (&ctx, FREERADIUS_DICT) == 0);
+  assert_true (rs_context_create (&ctx, NULL) == 0);
   assert_true (rs_context_read_config (ctx, "test.conf") == 0);
   assert_true (rs_conn_create (ctx, &conn, "test-udp-buffering") == 0);
 
index a29880a..47ea595 100644 (file)
@@ -60,7 +60,7 @@ udp_poll (struct polldata *data)
   long timeout;
   fd_set rfds;
   ssize_t len;
-  uint8_t buf[4096];
+  uint8_t buf[RS_MAX_PACKET_LEN];
 
   FD_ZERO (&rfds);
   FD_SET (data->s, &rfds);
index c04821d..1bab537 100644 (file)
--- a/lib/udp.c
+++ b/lib/udp.c
@@ -9,6 +9,7 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <event2/event.h>
+#include <radius/client.h>
 #include <radsec/radsec.h>
 #include <radsec/radsec-impl.h>
 #include "debug.h"
@@ -27,7 +28,7 @@ _send (struct rs_connection *conn, int fd)
   assert (pkt->rpkt->data);
 
   /* Send.  */
-  r = compat_send (fd, pkt->rpkt->data, pkt->rpkt->data_len, 0);
+  r = compat_send (fd, pkt->rpkt->data, pkt->rpkt->length, 0);
   if (r == -1)
     {
       int sockerr = evutil_socket_geterror (pkt->conn->fd);
@@ -37,7 +38,7 @@ _send (struct rs_connection *conn, int fd)
                                    evutil_socket_error_to_string (sockerr));
     }
 
-  assert (r == pkt->rpkt->data_len);
+  assert (r == pkt->rpkt->length);
   /* Unlink the packet.  */
   conn->out_queue = pkt->next;
 
@@ -63,6 +64,8 @@ _send (struct rs_connection *conn, int fd)
 static void
 _evcb (evutil_socket_t fd, short what, void *user_data)
 {
+  int err;
+
   rs_debug (("%s: fd=%d what =", __func__, fd));
   if (what & EV_TIMEOUT) rs_debug ((" TIMEOUT"));
   if (what & EV_READ) rs_debug ((" READ"));
@@ -78,14 +81,9 @@ _evcb (evutil_socket_t fd, short what, void *user_data)
 
       assert (pkt);
       assert (pkt->conn);
+      assert (pkt->rpkt->data);
 
-      pkt->rpkt->data = rs_malloc (pkt->conn->ctx, 4096);
-      if (pkt->rpkt->data == NULL)
-       {
-         rs_err_conn_push_fl (pkt->conn, RSE_NOMEM, __FILE__, __LINE__, NULL);
-         return;
-       }
-      r = compat_recv (fd, pkt->rpkt->data, 4096, MSG_TRUNC);
+      r = compat_recv (fd, pkt->rpkt->data, RS_MAX_PACKET_LEN, MSG_TRUNC);
       if (r == -1)
        {
          int sockerr = evutil_socket_geterror (pkt->conn->fd);
@@ -105,18 +103,19 @@ _evcb (evutil_socket_t fd, short what, void *user_data)
          return;
        }
       event_del (pkt->conn->tev);
-      if (r < 20 || r > 4096)  /* Short or long packet.  */
+      if (r < 20 || r > RS_MAX_PACKET_LEN)     /* Short or long packet.  */
        {
          rs_err_conn_push (pkt->conn, RSE_INVALID_PKT,
                            "invalid packet length: %d",
-                           pkt->rpkt->data_len);
+                           pkt->rpkt->length);
          return;
        }
-      pkt->rpkt->data_len = (pkt->rpkt->data[2] << 8) + pkt->rpkt->data[3];
-      if (!rad_packet_ok (pkt->rpkt, 0))
+      pkt->rpkt->length = (pkt->rpkt->data[2] << 8) + pkt->rpkt->data[3];
+      err = nr_packet_ok (pkt->rpkt);
+      if (err)
        {
-         rs_err_conn_push_fl (pkt->conn, RSE_FR, __FILE__, __LINE__,
-                              "invalid packet: %s", fr_strerror ());
+         rs_err_conn_push_fl (pkt->conn, err, __FILE__, __LINE__,
+                              "invalid packet");
          return;
        }
       /* Hand over message to user.  This changes ownership of pkt.