mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2024-12-22 16:58:55 +00:00
remove use of jsoncpp
This commit is contained in:
parent
4c73a0ae56
commit
11bd7128d2
@ -8,7 +8,7 @@ matrix:
|
|||||||
cache: apt
|
cache: apt
|
||||||
before_install:
|
before_install:
|
||||||
- sudo apt-get update -qq
|
- sudo apt-get update -qq
|
||||||
- sudo apt-get install -qq cppcheck libfuse-dev openjdk-7-jdk libjsoncpp-dev
|
- sudo apt-get install -qq cppcheck libfuse-dev openjdk-7-jdk
|
||||||
- sudo update-alternatives --set java /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
|
- sudo update-alternatives --set java /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
|
||||||
script:
|
script:
|
||||||
- ./autogen.sh
|
- ./autogen.sh
|
||||||
@ -24,7 +24,7 @@ matrix:
|
|||||||
osx_image: xcode8.3
|
osx_image: xcode8.3
|
||||||
before_install:
|
before_install:
|
||||||
- brew update
|
- brew update
|
||||||
- brew install truncate jsoncpp
|
- brew install truncate
|
||||||
- brew tap caskroom/cask
|
- brew tap caskroom/cask
|
||||||
- brew cask install osxfuse
|
- brew cask install osxfuse
|
||||||
- if [ -f /Library/Filesystems/osxfusefs.fs/Support/load_osxfusefs ]; then sudo chmod +s /Library/Filesystems/osxfusefs.fs/Support/load_osxfusefs ; elif [ -f /Library/Filesystems/osxfuse.fs/Contents/Resources/load_osxfuse ]; then sudo chmod +s /Library/Filesystems/osxfuse.fs/Contents/Resources/load_osxfuse ; fi
|
- if [ -f /Library/Filesystems/osxfusefs.fs/Support/load_osxfusefs ]; then sudo chmod +s /Library/Filesystems/osxfusefs.fs/Support/load_osxfusefs ; elif [ -f /Library/Filesystems/osxfuse.fs/Contents/Resources/load_osxfuse ]; then sudo chmod +s /Library/Filesystems/osxfuse.fs/Contents/Resources/load_osxfuse ; fi
|
||||||
|
10
configure.ac
10
configure.ac
@ -176,13 +176,13 @@ dnl
|
|||||||
dnl For PKG_CONFIG before checking nss/gnutls.
|
dnl For PKG_CONFIG before checking nss/gnutls.
|
||||||
dnl this is redundant checking, but we need checking before following.
|
dnl this is redundant checking, but we need checking before following.
|
||||||
dnl
|
dnl
|
||||||
PKG_CHECK_MODULES([common_lib_checking], [fuse >= ${min_fuse_version} libcurl >= 7.0 libxml-2.0 >= 2.6 jsoncpp >= 0.6 ])
|
PKG_CHECK_MODULES([common_lib_checking], [fuse >= ${min_fuse_version} libcurl >= 7.0 libxml-2.0 >= 2.6 ])
|
||||||
|
|
||||||
AC_MSG_CHECKING([compile s3fs with])
|
AC_MSG_CHECKING([compile s3fs with])
|
||||||
case "${auth_lib}" in
|
case "${auth_lib}" in
|
||||||
openssl)
|
openssl)
|
||||||
AC_MSG_RESULT(OpenSSL)
|
AC_MSG_RESULT(OpenSSL)
|
||||||
PKG_CHECK_MODULES([DEPS], [fuse >= ${min_fuse_version} libcurl >= 7.0 libxml-2.0 >= 2.6 libcrypto >= 0.9 jsoncpp >= 0.6 ])
|
PKG_CHECK_MODULES([DEPS], [fuse >= ${min_fuse_version} libcurl >= 7.0 libxml-2.0 >= 2.6 libcrypto >= 0.9 ])
|
||||||
;;
|
;;
|
||||||
gnutls)
|
gnutls)
|
||||||
AC_MSG_RESULT(GnuTLS-gcrypt)
|
AC_MSG_RESULT(GnuTLS-gcrypt)
|
||||||
@ -191,7 +191,7 @@ gnutls)
|
|||||||
AS_IF([test "$gnutls_nettle" = ""], [AC_CHECK_LIB(gcrypt, gcry_control, [gnutls_nettle=0])])
|
AS_IF([test "$gnutls_nettle" = ""], [AC_CHECK_LIB(gcrypt, gcry_control, [gnutls_nettle=0])])
|
||||||
AS_IF([test $gnutls_nettle = 0],
|
AS_IF([test $gnutls_nettle = 0],
|
||||||
[
|
[
|
||||||
PKG_CHECK_MODULES([DEPS], [fuse >= ${min_fuse_version} libcurl >= 7.0 libxml-2.0 >= 2.6 gnutls >= 2.12.0 jsoncpp >= 0.6 ])
|
PKG_CHECK_MODULES([DEPS], [fuse >= ${min_fuse_version} libcurl >= 7.0 libxml-2.0 >= 2.6 gnutls >= 2.12.0 ])
|
||||||
LIBS="-lgnutls -lgcrypt $LIBS"
|
LIBS="-lgnutls -lgcrypt $LIBS"
|
||||||
AC_MSG_CHECKING([gnutls is build with])
|
AC_MSG_CHECKING([gnutls is build with])
|
||||||
AC_MSG_RESULT(gcrypt)
|
AC_MSG_RESULT(gcrypt)
|
||||||
@ -205,7 +205,7 @@ nettle)
|
|||||||
AS_IF([test "$gnutls_nettle" = ""], [AC_CHECK_LIB(nettle, nettle_MD5Init, [gnutls_nettle=1])])
|
AS_IF([test "$gnutls_nettle" = ""], [AC_CHECK_LIB(nettle, nettle_MD5Init, [gnutls_nettle=1])])
|
||||||
AS_IF([test $gnutls_nettle = 1],
|
AS_IF([test $gnutls_nettle = 1],
|
||||||
[
|
[
|
||||||
PKG_CHECK_MODULES([DEPS], [fuse >= ${min_fuse_version} libcurl >= 7.0 libxml-2.0 >= 2.6 nettle >= 2.7.1 jsoncpp >= 0.6 ])
|
PKG_CHECK_MODULES([DEPS], [fuse >= ${min_fuse_version} libcurl >= 7.0 libxml-2.0 >= 2.6 nettle >= 2.7.1 ])
|
||||||
LIBS="-lgnutls -lnettle $LIBS"
|
LIBS="-lgnutls -lnettle $LIBS"
|
||||||
AC_MSG_CHECKING([gnutls is build with])
|
AC_MSG_CHECKING([gnutls is build with])
|
||||||
AC_MSG_RESULT(nettle)
|
AC_MSG_RESULT(nettle)
|
||||||
@ -214,7 +214,7 @@ nettle)
|
|||||||
;;
|
;;
|
||||||
nss)
|
nss)
|
||||||
AC_MSG_RESULT(NSS)
|
AC_MSG_RESULT(NSS)
|
||||||
PKG_CHECK_MODULES([DEPS], [fuse >= ${min_fuse_version} libcurl >= 7.0 libxml-2.0 >= 2.6 nss >= 3.15.0 jsoncpp >= 0.6 ])
|
PKG_CHECK_MODULES([DEPS], [fuse >= ${min_fuse_version} libcurl >= 7.0 libxml-2.0 >= 2.6 nss >= 3.15.0 ])
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
AC_MSG_ERROR([unknown ssl library type.])
|
AC_MSG_ERROR([unknown ssl library type.])
|
||||||
|
48
src/curl.cpp
48
src/curl.cpp
@ -42,8 +42,6 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <json/json.h>
|
|
||||||
#include <json/reader.h>
|
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "curl.h"
|
#include "curl.h"
|
||||||
@ -1426,23 +1424,39 @@ bool S3fsCurl::ParseIAMCredentialResponse(const char* response, iamcredmap_t& ke
|
|||||||
if(!response){
|
if(!response){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
istringstream sscred(response);
|
||||||
Json::Value root;
|
string oneline;
|
||||||
Json::Reader reader;
|
keyval.clear();
|
||||||
|
while(getline(sscred, oneline, '\n')){
|
||||||
if (!reader.parse(response, root)) {
|
string::size_type pos;
|
||||||
return false;
|
string key;
|
||||||
|
string val;
|
||||||
|
if(string::npos != (pos = oneline.find(IAMCRED_ACCESSKEYID))){
|
||||||
|
key = IAMCRED_ACCESSKEYID;
|
||||||
|
}else if(string::npos != (pos = oneline.find(IAMCRED_SECRETACCESSKEY))){
|
||||||
|
key = IAMCRED_SECRETACCESSKEY;
|
||||||
|
}else if(string::npos != (pos = oneline.find(IAMCRED_ACCESSTOKEN))){
|
||||||
|
key = IAMCRED_ACCESSTOKEN;
|
||||||
|
}else if(string::npos != (pos = oneline.find(IAMCRED_EXPIRATION))){
|
||||||
|
key = IAMCRED_EXPIRATION;
|
||||||
|
}else if(string::npos != (pos = oneline.find(IAMCRED_ROLEARN))){
|
||||||
|
key = IAMCRED_ROLEARN;
|
||||||
|
}else{
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
if(string::npos == (pos = oneline.find(':', pos + key.length()))){
|
||||||
keyval[string(IAMCRED_ACCESSKEYID)] = root.get(IAMCRED_ACCESSKEYID, "").asString();
|
continue;
|
||||||
keyval[string(IAMCRED_SECRETACCESSKEY)] = root.get(IAMCRED_SECRETACCESSKEY, "").asString();
|
}
|
||||||
keyval[string(IAMCRED_ACCESSTOKEN)] = root.get(IAMCRED_ACCESSTOKEN, "").asString();
|
if(string::npos == (pos = oneline.find('\"', pos))){
|
||||||
keyval[string(IAMCRED_EXPIRATION)] = root.get(IAMCRED_EXPIRATION, "").asString();
|
continue;
|
||||||
|
}
|
||||||
if (S3fsCurl::is_ecs) {
|
oneline = oneline.substr(pos + sizeof(char));
|
||||||
keyval[string(IAMCRED_ROLEARN)] = root.get(IAMCRED_ROLEARN, "").asString();
|
if(string::npos == (pos = oneline.find('\"'))){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
val = oneline.substr(0, pos);
|
||||||
|
keyval[key] = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user