]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
applicable parts of #1174 backported for 3.0.x 1175/head
authorAaron Hurt <ahurt@ena.com>
Mon, 3 Aug 2015 21:58:21 +0000 (16:58 -0500)
committerAaron Hurt <ahurt@ena.com>
Mon, 3 Aug 2015 21:58:21 +0000 (16:58 -0500)
src/modules/rlm_couchbase/config.h.in
src/modules/rlm_couchbase/configure
src/modules/rlm_couchbase/configure.ac
src/modules/rlm_couchbase/couchbase.c
src/modules/rlm_couchbase/couchbase.h
src/modules/rlm_couchbase/jsonc_missing.h
src/modules/rlm_couchbase/mod.c
src/modules/rlm_couchbase/mod.h
src/modules/rlm_couchbase/rlm_couchbase.c

index 6d5e1d1bcbdb3fa8b5897adc454d5d8dfacc00d7..490c9ec43db5ab6fcc187db392778a0a8f5fa59f 100644 (file)
@@ -1,8 +1,14 @@
 /* config.h.in.  Generated from configure.ac by autoheader.  */
 
+/* json.h is at json-c/json.h relative to include dir */
+#undef HAVE_JSONMC_JSON_H
+
 /* Define to 1 if you have the `json_c_version' function. */
 #undef HAVE_JSON_C_VERSION
 
+/* json.h is at json/json.h relative to include dir */
+#undef HAVE_JSON_JSON_H
+
 /* Define to 1 if you have the `json_object_get_string_len' function. */
 #undef HAVE_JSON_OBJECT_GET_STRING_LEN
 
index d31392d32c92c0c04c4aee90fbbc911b02318709..e567fb1134b49877f61946fd8726af0e8e39e967 100755 (executable)
 
 
        have_json="yes"
-
-       smart_prefix="json-c json"
        smart_try_dir="$jsonc_include_dir"
 
 
 
-ac_safe=`echo "json.h" | sed 'y%./+-%__pm%'`
+ac_safe=`echo "json/json.h" | sed 'y%./+-%__pm%'`
+old_CPPFLAGS="$CPPFLAGS"
+smart_include=
+smart_include_dir="/usr/local/include /opt/include"
+
+_smart_try_dir=
+_smart_include_dir=
+
+for _prefix in $smart_prefix ""; do
+  for _dir in $smart_try_dir; do
+    _smart_try_dir="${_smart_try_dir} ${_dir}/${_prefix}"
+  done
+
+  for _dir in $smart_include_dir; do
+    _smart_include_dir="${_smart_include_dir} ${_dir}/${_prefix}"
+  done
+done
+
+if test "x$_smart_try_dir" != "x"; then
+  for try in $_smart_try_dir; do
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for json/json.h in $try" >&5
+$as_echo_n "checking for json/json.h in $try... " >&6; }
+    CPPFLAGS="-isystem $try $old_CPPFLAGS"
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+                   #include <json/json.h>
+int
+main ()
+{
+int a = 1;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+                    smart_include="-isystem $try"
+                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+                    break
+
+else
+
+                    smart_include=
+                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+  CPPFLAGS="$old_CPPFLAGS"
+fi
+
+if test "x$smart_include" = "x"; then
+  for _prefix in $smart_prefix; do
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${_prefix}/json/json.h" >&5
+$as_echo_n "checking for ${_prefix}/json/json.h... " >&6; }
+
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+                   #include <json/json.h>
+int
+main ()
+{
+int a = 1;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+                    smart_include="-isystem ${_prefix}/"
+                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+                    break
+
+else
+
+                    smart_include=
+                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+fi
+
+if test "x$smart_include" = "x"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for json/json.h" >&5
+$as_echo_n "checking for json/json.h... " >&6; }
+
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+                   #include <json/json.h>
+int
+main ()
+{
+int a = 1;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+                    smart_include=" "
+                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+                    break
+
+else
+
+                    smart_include=
+                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+if test "x$smart_include" = "x"; then
+
+  for prefix in $smart_prefix; do
+
+
+if test "x$LOCATE" != "x"; then
+        DIRS=
+  file="${_prefix}/${1}"
+
+  for x in `${LOCATE} $file 2>/dev/null`; do
+                                        base=`echo $x | sed "s%/${file}%%"`
+    if test "x$x" = "x$base"; then
+      continue;
+    fi
+
+    dir=`${DIRNAME} $x 2>/dev/null`
+                exclude=`echo ${dir} | ${GREP} /home`
+    if test "x$exclude" != "x"; then
+      continue
+    fi
+
+                    already=`echo \$_smart_include_dir ${DIRS} | ${GREP} ${dir}`
+    if test "x$already" = "x"; then
+      DIRS="$DIRS $dir"
+    fi
+  done
+fi
+
+eval "_smart_include_dir=\"\$_smart_include_dir $DIRS\""
+
+  done
+
+
+if test "x$LOCATE" != "x"; then
+        DIRS=
+  file=json/json.h
+
+  for x in `${LOCATE} $file 2>/dev/null`; do
+                                        base=`echo $x | sed "s%/${file}%%"`
+    if test "x$x" = "x$base"; then
+      continue;
+    fi
+
+    dir=`${DIRNAME} $x 2>/dev/null`
+                exclude=`echo ${dir} | ${GREP} /home`
+    if test "x$exclude" != "x"; then
+      continue
+    fi
+
+                    already=`echo \$_smart_include_dir ${DIRS} | ${GREP} ${dir}`
+    if test "x$already" = "x"; then
+      DIRS="$DIRS $dir"
+    fi
+  done
+fi
+
+eval "_smart_include_dir=\"\$_smart_include_dir $DIRS\""
+
+
+  for try in $_smart_include_dir; do
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for json/json.h in $try" >&5
+$as_echo_n "checking for json/json.h in $try... " >&6; }
+    CPPFLAGS="-isystem $try $old_CPPFLAGS"
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+                   #include <json/json.h>
+int
+main ()
+{
+int a = 1;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+                    smart_include="-isystem $try"
+                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+                    break
+
+else
+
+                    smart_include=
+                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+  CPPFLAGS="$old_CPPFLAGS"
+fi
+
+if test "x$smart_include" != "x"; then
+  eval "ac_cv_header_$ac_safe=yes"
+  CPPFLAGS="$smart_include $old_CPPFLAGS"
+  SMART_CPPFLAGS="$smart_include $SMART_CPPFLAGS"
+fi
+
+smart_prefix=
+
+       if test "x$ac_cv_header_json_json_h" != "xyes"; then
+
+
+ac_safe=`echo "json-c/json.h" | sed 'y%./+-%__pm%'`
 old_CPPFLAGS="$CPPFLAGS"
 smart_include=
 smart_include_dir="/usr/local/include /opt/include"
@@ -2917,13 +3142,13 @@ done
 
 if test "x$_smart_try_dir" != "x"; then
   for try in $_smart_try_dir; do
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for json.h in $try" >&5
-$as_echo_n "checking for json.h in $try... " >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for json-c/json.h in $try" >&5
+$as_echo_n "checking for json-c/json.h in $try... " >&6; }
     CPPFLAGS="-isystem $try $old_CPPFLAGS"
     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-                   #include <json.h>
+                   #include <json-c/json.h>
 int
 main ()
 {
@@ -2953,13 +3178,13 @@ fi
 
 if test "x$smart_include" = "x"; then
   for _prefix in $smart_prefix; do
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${_prefix}/json.h" >&5
-$as_echo_n "checking for ${_prefix}/json.h... " >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${_prefix}/json-c/json.h" >&5
+$as_echo_n "checking for ${_prefix}/json-c/json.h... " >&6; }
 
     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-                   #include <json.h>
+                   #include <json-c/json.h>
 int
 main ()
 {
@@ -2987,13 +3212,13 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 
 if test "x$smart_include" = "x"; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for json.h" >&5
-$as_echo_n "checking for json.h... " >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for json-c/json.h" >&5
+$as_echo_n "checking for json-c/json.h... " >&6; }
 
     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-                   #include <json.h>
+                   #include <json-c/json.h>
 int
 main ()
 {
@@ -3054,7 +3279,7 @@ eval "_smart_include_dir=\"\$_smart_include_dir $DIRS\""
 
 if test "x$LOCATE" != "x"; then
         DIRS=
-  file=json.h
+  file=json-c/json.h
 
   for x in `${LOCATE} $file 2>/dev/null`; do
                                         base=`echo $x | sed "s%/${file}%%"`
@@ -3079,13 +3304,13 @@ eval "_smart_include_dir=\"\$_smart_include_dir $DIRS\""
 
 
   for try in $_smart_include_dir; do
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for json.h in $try" >&5
-$as_echo_n "checking for json.h in $try... " >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for json-c/json.h in $try" >&5
+$as_echo_n "checking for json-c/json.h in $try... " >&6; }
     CPPFLAGS="-isystem $try $old_CPPFLAGS"
     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-                   #include <json.h>
+                   #include <json-c/json.h>
 int
 main ()
 {
@@ -3121,10 +3346,20 @@ fi
 
 smart_prefix=
 
-       if test "x$ac_cv_header_json_h" != "xyes"; then
-               have_json="no"
-               { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: json-c headers not found. Use --with-jsonc-include-dir=<path>." >&5
+               if test "x$ac_cv_header_jsonmc_json_h" != "xyes"; then
+                       have_json="no"
+                       { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: json-c headers not found. Use --with-jsonc-include-dir=<path>." >&5
 $as_echo "$as_me: WARNING: json-c headers not found. Use --with-jsonc-include-dir=<path>." >&2;}
+                       fail="$fail json.h"
+               else
+
+$as_echo "#define HAVE_JSONMC_JSON_H 1" >>confdefs.h
+
+               fi
+       else
+
+$as_echo "#define HAVE_JSON_JSON_H 1" >>confdefs.h
+
        fi
 
 
index c126e6e1d01353d2e488aa321eb37e4d5125ad96..a43ee2fb18791323769ebea21b2624a30540ce54 100644 (file)
@@ -70,13 +70,19 @@ if test x$with_[]modname != xno; then
        dnl ############################################################
 
        have_json="yes"
-
-       smart_prefix="json-c json"
        smart_try_dir="$jsonc_include_dir"
-       FR_SMART_CHECK_INCLUDE([json.h])
-       if test "x$ac_cv_header_json_h" != "xyes"; then
-               have_json="no"
-               AC_MSG_WARN([json-c headers not found. Use --with-jsonc-include-dir=<path>.])
+       FR_SMART_CHECK_INCLUDE([json/json.h])
+       if test "x$ac_cv_header_json_json_h" != "xyes"; then
+               FR_SMART_CHECK_INCLUDE([json-c/json.h])
+               if test "x$ac_cv_header_jsonmc_json_h" != "xyes"; then
+                       have_json="no"
+                       AC_MSG_WARN([json-c headers not found. Use --with-jsonc-include-dir=<path>.])
+                       fail="$fail json.h"
+               else
+                       AC_DEFINE([HAVE_JSONMC_JSON_H],[1],[json.h is at json-c/json.h relative to include dir])
+               fi
+       else
+               AC_DEFINE([HAVE_JSON_JSON_H],[1],[json.h is at json/json.h relative to include dir])
        fi
 
        dnl ############################################################
index bfe4ec876cf78a064a15bdf970bc92026a67e7e4..a278dca5f8f2cb891c3d578110f7a819eb42a474 100644 (file)
@@ -29,7 +29,6 @@ RCSID("$Id$")
 #include <freeradius-devel/radiusd.h>
 
 #include <libcouchbase/couchbase.h>
-#include <json.h>
 
 #include "couchbase.h"
 #include "jsonc_missing.h"
index ad6cba579d72366e37f71a153be9defb72879d63..1e1ded49ec7d5f9096c498c86fdb1f0285d06b2b 100644 (file)
@@ -30,7 +30,8 @@
 RCSIDH(couchbase_h, "$Id$")
 
 #include <libcouchbase/couchbase.h>
-#include <json.h>
+
+#include "jsonc_missing.h"
 
 /** Information relating to the parsing of Couchbase document payloads
  *
index b248786bd6d6c05a4002ec7cb11bc924d10777e8..5df68a89eccfa9e7a974557233bb0e49e72babda 100644 (file)
 
 RCSIDH(jsonc_missing_h, "$Id$")
 
-#include <json.h>
-
 #include "config.h"
 
+#if defined(HAVE_JSONMC_JSON_H)
+#  include <json-c/json.h>
+#elif defined(HAVE_JSON_JSON_H)
+#  include <json/json.h>
+#endif
+
 #ifndef HAVE_JSON_C_VERSION
 const char *json_c_version(void);
 #endif
index 4d32e4849913d69fd5d35839c05467c25b7aa346..9e1e6197e0c099072040400810072a5636053a65 100644 (file)
@@ -29,7 +29,6 @@ RCSID("$Id$")
 #include <freeradius-devel/radiusd.h>
 
 #include <libcouchbase/couchbase.h>
-#include <json.h>
 
 #include "mod.h"
 #include "couchbase.h"
@@ -121,9 +120,14 @@ int mod_build_attribute_element_map(CONF_SECTION *conf, void *instance)
        CONF_PAIR *cp;                      /* conig pair */
        const char *attribute, *element;    /* attribute and element names */
 
-       /* find map section */
-       cs = cf_section_sub_find(conf, "map");
-       if (!cs) cf_section_sub_find(conf, "update");
+       /* find update section */
+       cs = cf_section_sub_find(conf, "update");
+
+       /* backwards compatibility */
+       if (!cs) {
+               cs = cf_section_sub_find(conf, "map");
+               WARN("rlm_couchbase: found deprecated 'map' section - please change to 'update'");
+       }
 
        /* check section */
        if (!cs) {
@@ -139,7 +143,7 @@ int mod_build_attribute_element_map(CONF_SECTION *conf, void *instance)
        for (ci = cf_item_find_next(cs, NULL); ci != NULL; ci = cf_item_find_next(cs, ci)) {
                /* validate item */
                if (!cf_item_is_pair(ci)) {
-                       ERROR("rlm_couchbase: failed to parse invalid item in 'map' section");
+                       ERROR("rlm_couchbase: failed to parse invalid item in 'update' section");
                        /* free map */
                        if (inst->map) {
                                json_object_put(inst->map);
index 764c6f8e958003984d2154bbcf8a9a0e921d56e6..5f40db9c9fed2aa16a149dd8c9f38e185d466199 100644 (file)
@@ -32,7 +32,6 @@ RCSIDH(mod_h, "$Id$")
 #include <freeradius-devel/radiusd.h>
 
 #include <libcouchbase/couchbase.h>
-#include <json.h>
 
 #include "jsonc_missing.h"
 
index d45ee9c6211ecb089a020db9f9974fa7bf460b84..a5365ed24a3dbbf9a041d853c0432302623a01a7 100644 (file)
@@ -32,7 +32,6 @@ RCSID("$Id$")
 #include <freeradius-devel/rad_assert.h>
 
 #include <libcouchbase/couchbase.h>
-#include <json.h>
 
 #include "mod.h"
 #include "couchbase.h"