import libcmis-0.5.2-1.el8

This commit is contained in:
CentOS Sources 2020-07-28 09:43:22 -04:00 committed by Stepan Oksanichenko
parent a19eeefa99
commit cc2c4470a7
13 changed files with 9 additions and 902 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/libcmis-0.5.1.tar.gz
SOURCES/libcmis-0.5.2.tar.xz

View File

@ -1 +1 @@
94c00715ae8a31bc8e5a6a699e36c22d0020649e SOURCES/libcmis-0.5.1.tar.gz
feca71d94d2c6e6d5565ff2a3210ba61fb2451d9 SOURCES/libcmis-0.5.2.tar.xz

View File

@ -1,122 +0,0 @@
From 32aecffb5517dfc3b3674a8f7db418456bd877ed Mon Sep 17 00:00:00 2001
From: Giuseppe Castagno <giuseppe.castagno@acca-esse.eu>
Date: Sat, 30 Apr 2016 14:29:56 +0200
Subject: [PATCH 1/5] Add new Google Drive OAuth 2.0 login procedure.
The new Google login sequence uses two html pages: first page for user email
the second page for password.
The older sequence used only one page for both user email and user password.
---
src/libcmis/oauth2-providers.cxx | 67 +++++++++++++++++++++++++++++++---------
1 file changed, 52 insertions(+), 15 deletions(-)
diff --git a/src/libcmis/oauth2-providers.cxx b/src/libcmis/oauth2-providers.cxx
index 5e7f3bf..68a6aa5 100644
--- a/src/libcmis/oauth2-providers.cxx
+++ b/src/libcmis/oauth2-providers.cxx
@@ -37,11 +37,28 @@ using namespace std;
string OAuth2Providers::OAuth2Gdrive( HttpSession* session, const string& authUrl,
const string& username, const string& password )
{
+ /* This member function implements 'Google OAuth 2.0'
+ *
+ * The interaction is carried out by libcmis, with no web browser involved.
+ *
+ * Normal sequence (without 2FA) is:
+ * 1) a get to activate login page
+ * receive first login page, html format
+ * 2) subsequent post to sent email
+ * receive html page for password input
+ * 3) subsequent post to send password
+ * receive html page for application consent
+ * 4) subsequent post to send a consent for the application
+ * receive a single-use authorization code
+ * this code is returned as a string
+ */
+
static const string CONTENT_TYPE( "application/x-www-form-urlencoded" );
// STEP 1: Log in
string res;
try
{
+ // send the first get, receive the html login page
res = session->httpGetRequest( authUrl )->getStream( )->str( );
}
catch ( const CurlException& e )
@@ -49,20 +66,39 @@ string OAuth2Providers::OAuth2Gdrive( HttpSession* session, const string& authUr
return string( );
}
- string loginPost, loginLink;
- if ( !parseResponse( res.c_str( ), loginPost, loginLink ) )
+ string loginEmailPost, loginEmailLink;
+ if ( !parseResponse( res.c_str( ), loginEmailPost, loginEmailLink ) )
return string( );
-
- loginPost += "Email=";
- loginPost += string( username );
- loginPost += "&Passwd=";
- loginPost += string( password );
-
- istringstream loginIs( loginPost );
- string loginRes;
- try
+
+ loginEmailPost += "Email=";
+ loginEmailPost += string( username );
+
+ istringstream loginEmailIs( loginEmailPost );
+ string loginEmailRes;
+ try
+ {
+ // send a post with user email, receive the html page for password input
+ loginEmailRes = session->httpPostRequest ( loginEmailLink, loginEmailIs, CONTENT_TYPE )
+ ->getStream( )->str( );
+ }
+ catch ( const CurlException& e )
+ {
+ return string( );
+ }
+
+ string loginPasswdPost, loginPasswdLink;
+ if ( !parseResponse( loginEmailRes.c_str( ), loginPasswdPost, loginPasswdLink ) )
+ return string( );
+
+ loginPasswdPost += "Passwd=";
+ loginPasswdPost += string( password );
+
+ istringstream loginPasswdIs( loginPasswdPost );
+ string loginPasswdRes;
+ try
{
- loginRes = session->httpPostRequest ( loginLink, loginIs, CONTENT_TYPE )
+ // send a post with user password, receive the application consent page
+ loginPasswdRes = session->httpPostRequest ( loginPasswdLink, loginPasswdIs, CONTENT_TYPE )
->getStream( )->str( );
}
catch ( const CurlException& e )
@@ -71,8 +107,8 @@ string OAuth2Providers::OAuth2Gdrive( HttpSession* session, const string& authUr
}
// STEP 2: allow libcmis to access google drive
- string approvalPost, approvalLink;
- if ( !parseResponse( loginRes. c_str( ), approvalPost, approvalLink) )
+ string approvalPost, approvalLink;
+ if ( !parseResponse( loginPasswdRes. c_str( ), approvalPost, approvalLink) )
return string( );
approvalPost += "submit_access=true";
@@ -80,7 +116,8 @@ string OAuth2Providers::OAuth2Gdrive( HttpSession* session, const string& authUr
string approvalRes;
try
{
- approvalRes = session->httpPostRequest ( approvalLink, approvalIs,
+ // send a post with application consent
+ approvalRes = session->httpPostRequest ( approvalLink, approvalIs,
CONTENT_TYPE) ->getStream( )->str( );
}
catch ( const CurlException& e )
--
2.7.4

View File

@ -1,76 +0,0 @@
From 8406c694eb58e610fbf94eba00719e097bad34d8 Mon Sep 17 00:00:00 2001
From: Stephan Bergmann <sbergman@redhat.com>
Date: Tue, 4 Sep 2018 17:14:21 +0200
Subject: [PATCH] Properly encode OAuth2 credentials
Originally created as <https://gerrit.libreoffice.org/#/c/59986/> "Properly
encode OAuth2 credentials". I was not sure which C++ version to target, so kept
it pretty basic.
---
src/libcmis/oauth2-providers.cxx | 29 +++++++++++++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)
diff --git a/src/libcmis/oauth2-providers.cxx b/src/libcmis/oauth2-providers.cxx
index dd872dd..c14438f 100644
--- a/src/libcmis/oauth2-providers.cxx
+++ b/src/libcmis/oauth2-providers.cxx
@@ -26,6 +26,8 @@
* instead of those above.
*/
+#include <cassert>
+
#include <libxml/HTMLparser.h>
#include <libxml/xmlreader.h>
@@ -41,6 +43,29 @@
using namespace std;
+namespace {
+
+// See <https://url.spec.whatwg.org/#concept-urlencoded-byte-serializer>:
+void addXWwwFormUrlencoded(std::string * buffer, std::string const & data) {
+ assert(buffer);
+ for (string::const_iterator i = data.begin(); i != data.end(); ++i) {
+ unsigned char c = static_cast<unsigned char>(*i);
+ if (c == ' ' || c == '*' || c == '-' || c == '.' || (c >= '0' && c <= '9')
+ || (c >= 'A' && c <= 'Z') || c == '_' || (c >= 'a' && c <= 'z'))
+ {
+ *buffer += static_cast<char>(c);
+ } else {
+ static const char hex[16] = {
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
+ *buffer += '%';
+ *buffer += hex[c >> 4];
+ *buffer += hex[c & 0xF];
+ }
+ }
+}
+
+}
+
string OAuth2Providers::OAuth2Gdrive( HttpSession* session, const string& authUrl,
const string& username, const string& password )
{
@@ -93,7 +118,7 @@ string OAuth2Providers::OAuth2Gdrive( HttpSession* session, const string& authUr
return string( );
loginEmailPost += "Email=";
- loginEmailPost += string( username );
+ addXWwwFormUrlencoded(&loginEmailPost, username);
istringstream loginEmailIs( loginEmailPost );
string loginEmailRes;
@@ -115,7 +140,7 @@ string OAuth2Providers::OAuth2Gdrive( HttpSession* session, const string& authUr
return string( );
loginPasswdPost += "Passwd=";
- loginPasswdPost += string( password );
+ addXWwwFormUrlencoded(&loginPasswdPost, password);
istringstream loginPasswdIs( loginPasswdPost );
string loginPasswdRes;
--
2.17.1

View File

@ -1,25 +0,0 @@
From ff7ed27039693f91e8348495f3b909c23871123d Mon Sep 17 00:00:00 2001
From: David Tardon <dtardon@redhat.com>
Date: Thu, 18 Jan 2018 10:42:04 +0100
Subject: [PATCH 1/2] do not try to use [] on an empty string
---
src/libcmis/ws-relatedmultipart.cxx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/libcmis/ws-relatedmultipart.cxx b/src/libcmis/ws-relatedmultipart.cxx
index 3b31634..675c274 100644
--- a/src/libcmis/ws-relatedmultipart.cxx
+++ b/src/libcmis/ws-relatedmultipart.cxx
@@ -169,7 +169,7 @@ RelatedMultipart::RelatedMultipart( const string& body, const string& contentTyp
if ( inHeaders )
{
// Remove potential \r at the end
- if ( line[line.length() - 1] == '\r' )
+ if ( !line.empty() && line[line.length() - 1] == '\r' )
line = line.substr( 0, line.length() - 1 );
if ( line.empty( ) )
--
2.14.3

View File

@ -1,25 +0,0 @@
From 3637a6bbf0a3daf8c11d4290ea47523e3ebeb496 Mon Sep 17 00:00:00 2001
From: David Tardon <dtardon@redhat.com>
Date: Mon, 27 Feb 2017 19:33:45 +0100
Subject: [PATCH] rhbz#1410197 limit the number of redirections
---
src/libcmis/http-session.cxx | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/libcmis/http-session.cxx b/src/libcmis/http-session.cxx
index 943ed5b..5c2f5e9 100644
--- a/src/libcmis/http-session.cxx
+++ b/src/libcmis/http-session.cxx
@@ -396,6 +396,8 @@ libcmis::HttpResponsePtr HttpSession::httpPostRequest( const string& url, istrea
curl_easy_setopt( m_curlHandle, CURLOPT_HEADERFUNCTION, &lcl_getHeaders );
curl_easy_setopt( m_curlHandle, CURLOPT_WRITEHEADER, response.get() );
+ curl_easy_setopt( m_curlHandle, CURLOPT_MAXREDIRS, 20);
+
// Get the stream length
is.seekg( 0, ios::end );
long size = is.tellg( );
--
2.9.3

View File

@ -1,310 +0,0 @@
From 9ffb376c21f7f55fb9237d83f7ea322517f691e2 Mon Sep 17 00:00:00 2001
From: David Tardon <dtardon@redhat.com>
Date: Thu, 16 Jun 2016 15:03:37 +0200
Subject: [PATCH] update boost.m4 to fix version detection with gcc 6.1
---
m4/boost.m4 | 176 +++++++++++++++++++++++++++++++++++++++++++++++++++---------
1 file changed, 151 insertions(+), 25 deletions(-)
diff --git a/m4/boost.m4 b/m4/boost.m4
index a4c366a..2c1df68 100644
--- a/m4/boost.m4
+++ b/m4/boost.m4
@@ -22,7 +22,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
m4_define([_BOOST_SERIAL], [m4_translit([
-# serial 24
+# serial 26
], [#
], [])])
@@ -86,9 +86,10 @@ dnl boost-lib-version =
dnl # 2 "conftest.cc" 3
dnl "1_56"
dnl
-dnl So get rid of the # lines, and glue the remaining ones together.
+dnl So get rid of the # and empty lines, and glue the remaining ones together.
(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
grep -v '#' |
+ grep -v '^[[[:space:]]]*$' |
tr -d '\r' |
tr -s '\n' ' ' |
$SED -n -e "$1" >conftest.i 2>&1],
@@ -110,7 +111,7 @@ AC_LANG_POP([C++])dnl
# On # success, defines HAVE_BOOST. On failure, calls the optional
# ACTION-IF-NOT-FOUND action if one was supplied.
# Otherwise aborts with an error message.
-AC_DEFUN([BOOST_REQUIRE],
+AC_DEFUN_ONCE([BOOST_REQUIRE],
[AC_REQUIRE([AC_PROG_CXX])dnl
AC_REQUIRE([AC_PROG_GREP])dnl
echo "$as_me: this is boost.m4[]_BOOST_SERIAL" >&AS_MESSAGE_LOG_FD
@@ -548,6 +549,13 @@ BOOST_DEFUN([Asio],
BOOST_FIND_HEADER([boost/asio.hpp])])
+# BOOST_ASSIGN()
+# -------------
+# Look for Boost.Assign
+BOOST_DEFUN([Assign],
+[BOOST_FIND_HEADER([boost/assign.hpp])])
+
+
# BOOST_BIND()
# ------------
# Look for Boost.Bind.
@@ -574,7 +582,7 @@ BOOST_FIND_LIB([chrono], [$1],
[boost/chrono.hpp],
[boost::chrono::thread_clock d;])
if test $enable_static_boost = yes && test $boost_major_version -ge 135; then
- BOOST_FILESYSTEM_LIBS="$BOOST_FILESYSTEM_LIBS $BOOST_SYSTEM_LIBS"
+ BOOST_CHRONO_LIBS="$BOOST_CHRONO_LIBS $BOOST_SYSTEM_LIBS"
fi
LIBS=$boost_filesystem_save_LIBS
LDFLAGS=$boost_filesystem_save_LDFLAGS
@@ -584,27 +592,79 @@ LDFLAGS=$boost_filesystem_save_LDFLAGS
# BOOST_CONTEXT([PREFERRED-RT-OPT])
# -----------------------------------
# Look for Boost.Context. For the documentation of PREFERRED-RT-OPT, see the
-# documentation of BOOST_FIND_LIB above. This library was introduced in Boost
-# 1.51.0
+# documentation of BOOST_FIND_LIB above.
+#
+# * This library was introduced in Boost 1.51.0
+# * The signatures of make_fcontext() and jump_fcontext were changed in 1.56.0
+# * A dependency on boost_thread appears in 1.57.0
BOOST_DEFUN([Context],
-[BOOST_FIND_LIB([context], [$1],
+[boost_context_save_LIBS=$LIBS
+ boost_context_save_LDFLAGS=$LDFLAGS
+if test $boost_major_version -ge 157; then
+ BOOST_THREAD([$1])
+ m4_pattern_allow([^BOOST_THREAD_(LIBS|LDFLAGS)$])dnl
+ LIBS="$LIBS $BOOST_THREAD_LIBS"
+ LDFLAGS="$LDFLAGS $BOOST_THREAD_LDFLAGS"
+fi
+BOOST_FIND_LIB([context], [$1],
[boost/context/all.hpp],[[
+
// creates a stack
void * stack_pointer = new void*[4096];
std::size_t const size = sizeof(void*[4096]);
-// context fc uses f() as context function
-// fcontext_t is placed on top of context stack
-// a pointer to fcontext_t is returned
+#if BOOST_VERSION <= 105100
+ctx::make_fcontext(&fc, f);
+return ctx::jump_fcontext(&fcm, &fc, 3) == 6;
+
+#else
+
fc = ctx::make_fcontext(stack_pointer, size, f);
-return ctx::jump_fcontext(&fcm, fc, 3) == 6;]],[dnl
+return ctx::jump_fcontext(&fcm, fc, 3) == 6;
+
+#endif
+
+
+]],[dnl
+
+#include <boost/version.hpp>
+#if BOOST_VERSION <= 105100
+
+namespace ctx = boost::ctx;
+
+static ctx::fcontext_t fcm, fc;
+
+static void f(intptr_t i) {
+ ctx::jump_fcontext(&fc, &fcm, i * 2);
+}
+
+#elif BOOST_VERSION <= 105500
+
namespace ctx = boost::context;
+
// context
static ctx::fcontext_t fcm, *fc;
+
// context-function
static void f(intptr_t i) {
ctx::jump_fcontext(fc, &fcm, i * 2);
-}])
+}
+
+#else
+
+namespace ctx = boost::context;
+
+// context
+static ctx::fcontext_t fcm, fc;
+
+// context-function
+static void f(intptr_t i) {
+ ctx::jump_fcontext(&fc, fcm, i * 2);
+}
+#endif
+])
+LIBS=$boost_context_save_LIBS
+LDFLAGS=$boost_context_save_LDFLAGS
])# BOOST_CONTEXT
@@ -636,10 +696,21 @@ m4_pattern_allow([^BOOST_(CONTEXT|SYSTEM)_(LIBS|LDFLAGS)])
LIBS="$LIBS $BOOST_CONTEXT_LIBS $BOOST_SYSTEM_LIBS"
LDFLAGS="$LDFLAGS $BOOST_CONTEXT_LDFLAGS"
-BOOST_FIND_LIB([coroutine], [$1],
- [boost/coroutine/coroutine.hpp],
- [boost::coroutines::coroutine< int(int) > coro; coro.empty();])
-
+# in 1.53 coroutine was a header only library
+if test $boost_major_version -eq 153; then
+ BOOST_FIND_HEADER([boost/coroutine/coroutine.hpp])
+else
+ BOOST_FIND_LIB([coroutine], [$1],
+ [boost/coroutine/coroutine.hpp],
+ [
+ #include <boost/version.hpp>
+ #if BOOST_VERSION <= 105500
+ boost::coroutines::coroutine<int(int)> coro; coro.get();
+ #else
+ boost::coroutines::asymmetric_coroutine<int>::pull_type coro; coro.get();
+ #endif
+ ])
+fi
# Link-time dependency from coroutine to context, existed only in 1.53, in 1.54
# coroutine doesn't use context from its headers but from its library.
if test $boost_major_version -eq 153 || test $enable_static_boost = yes && test $boost_major_version -ge 154; then
@@ -751,8 +822,19 @@ BOOST_DEFUN([Geometry],
# Look for Boost.Graphs. For the documentation of PREFERRED-RT-OPT, see the
# documentation of BOOST_FIND_LIB above.
BOOST_DEFUN([Graph],
-[BOOST_FIND_LIB([graph], [$1],
+[boost_graph_save_LIBS=$LIBS
+boost_graph_save_LDFLAGS=$LDFLAGS
+# Link-time dependency from graph to regex was added as of 1.40.0.
+if test $boost_major_version -ge 140; then
+ BOOST_REGEX([$1])
+ m4_pattern_allow([^BOOST_REGEX_(LIBS|LDFLAGS)$])dnl
+ LIBS="$LIBS $BOOST_REGEX_LIBS"
+ LDFLAGS="$LDFLAGS $BOOST_REGEX_LDFLAGS"
+fi
+BOOST_FIND_LIB([graph], [$1],
[boost/graph/adjacency_list.hpp], [boost::adjacency_list<> g;])
+LIBS=$boost_graph_save_LIBS
+LDFLAGS=$boost_graph_save_LDFLAGS
])# BOOST_GRAPH
@@ -785,9 +867,21 @@ BOOST_DEFUN([Lambda],
# --------------
# Look for Boost.Locale
BOOST_DEFUN([Locale],
-[BOOST_FIND_LIB([locale], [$1],
+[
+boost_locale_save_LIBS=$LIBS
+boost_locale_save_LDFLAGS=$LDFLAGS
+# require SYSTEM for boost-1.50.0 and up
+if test $boost_major_version -ge 150; then
+ BOOST_SYSTEM([$1])
+ m4_pattern_allow([^BOOST_SYSTEM_(LIBS|LDFLAGS)$])dnl
+ LIBS="$LIBS $BOOST_SYSTEM_LIBS"
+ LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS"
+fi # end of the Boost.System check.
+BOOST_FIND_LIB([locale], [$1],
[boost/locale.hpp],
[[boost::locale::generator gen; std::locale::global(gen(""));]])
+LIBS=$boost_locale_save_LIBS
+LDFLAGS=$boost_locale_save_LDFLAGS
])# BOOST_LOCALE
# BOOST_LOG([PREFERRED-RT-OPT])
@@ -795,9 +889,19 @@ BOOST_DEFUN([Locale],
# Look for Boost.Log. For the documentation of PREFERRED-RT-OPT, see the
# documentation of BOOST_FIND_LIB above.
BOOST_DEFUN([Log],
-[BOOST_FIND_LIB([log], [$1],
+[boost_log_save_LIBS=$LIBS
+boost_log_save_LDFLAGS=$LDFLAGS
+BOOST_SYSTEM([$1])
+BOOST_FILESYSTEM([$1])
+BOOST_DATE_TIME([$1])
+m4_pattern_allow([^BOOST_(SYSTEM|FILESYSTEM|DATE_TIME)_(LIBS|LDFLAGS)$])dnl
+LIBS="$LIBS $BOOST_DATE_TIME_LIBS $BOOST_FILESYSTEM_LIBS $BOOST_SYSTEM_LIBS"
+LDFLAGS="$LDFLAGS $BOOST_DATE_TIME_LDFLAGS $BOOST_FILESYSTEM_LDFLAGS $BOOST_SYSTEM_LDFLAGS"
+BOOST_FIND_LIB([log], [$1],
[boost/log/core/core.hpp],
[boost::log::attribute a; a.get_value();])
+LIBS=$boost_log_save_LIBS
+LDFLAGS=$boost_log_save_LDFLAGS
])# BOOST_LOG
@@ -806,10 +910,17 @@ BOOST_DEFUN([Log],
# Look for Boost.Log. For the documentation of PREFERRED-RT-OPT, see the
# documentation of BOOST_FIND_LIB above.
BOOST_DEFUN([Log_Setup],
-[AC_REQUIRE([BOOST_LOG])dnl
+[boost_log_setup_save_LIBS=$LIBS
+boost_log_setup_save_LDFLAGS=$LDFLAGS
+BOOST_LOG([$1])
+m4_pattern_allow([^BOOST_LOG_(LIBS|LDFLAGS)$])dnl
+LIBS="$LIBS $BOOST_LOG_LIBS"
+LDFLAGS="$LDFLAGS $BOOST_LOG_LDFLAGS"
BOOST_FIND_LIB([log_setup], [$1],
[boost/log/utility/setup/from_settings.hpp],
[boost::log::basic_settings<char> bs; bs.empty();])
+LIBS=$boost_log_setup_save_LIBS
+LDFLAGS=$boost_log_setup_save_LDFLAGS
])# BOOST_LOG_SETUP
@@ -1067,15 +1178,24 @@ LDFLAGS="$LDFLAGS $BOOST_SYSTEM_LDFLAGS"
CPPFLAGS="$CPPFLAGS $boost_cv_pthread_flag"
# When compiling for the Windows platform, the threads library is named
-# differently.
-case $host_os in
- (*mingw*) boost_thread_lib_ext=_win32;;
-esac
+# differently. This suffix doesn't exist in new versions of Boost, or
+# possibly new versions of GCC on mingw I am assuming it's Boost's change for
+# now and I am setting version to 1.48, for lack of knowledge as to when this
+# change occurred.
+if test $boost_major_version -lt 148; then
+ case $host_os in
+ (*mingw*) boost_thread_lib_ext=_win32;;
+ esac
+fi
BOOST_FIND_LIBS([thread], [thread$boost_thread_lib_ext],
[$1],
[boost/thread.hpp], [boost::thread t; boost::mutex m;])
-BOOST_THREAD_LIBS="$BOOST_THREAD_LIBS $BOOST_SYSTEM_LIBS $boost_cv_pthread_flag"
+case $host_os in
+ (*mingw*) boost_thread_w32_socket_link=-lws2_32;;
+esac
+
+BOOST_THREAD_LIBS="$BOOST_THREAD_LIBS $BOOST_SYSTEM_LIBS $boost_cv_pthread_flag $boost_thread_w32_socket_link"
BOOST_THREAD_LDFLAGS="$BOOST_SYSTEM_LDFLAGS"
BOOST_CPPFLAGS="$BOOST_CPPFLAGS $boost_cv_pthread_flag"
LIBS=$boost_thread_save_LIBS
@@ -1296,6 +1416,12 @@ if test x$boost_cv_inc_path != xno; then
# I'm not sure about my test for `il' (be careful: Intel's ICC pre-defines
# the same defines as GCC's).
for i in \
+ _BOOST_mingw_test(5, 3) \
+ _BOOST_gcc_test(5, 3) \
+ _BOOST_mingw_test(5, 2) \
+ _BOOST_gcc_test(5, 2) \
+ _BOOST_mingw_test(5, 1) \
+ _BOOST_gcc_test(5, 1) \
_BOOST_mingw_test(5, 0) \
_BOOST_gcc_test(5, 0) \
_BOOST_mingw_test(4, 10) \
--
2.7.4

View File

@ -1,70 +0,0 @@
From 0490c023cd14cbb3d1ba2bc1b648b216f848a648 Mon Sep 17 00:00:00 2001
From: Giuseppe Castagno <giuseppe.castagno@acca-esse.eu>
Date: Tue, 3 May 2016 08:35:57 +0200
Subject: [PATCH 2/5] Add new mokup login pages
---
qa/libcmis/data/gdrive/login.html | 12 ------------
qa/libcmis/data/gdrive/login1.html | 12 ++++++++++++
qa/libcmis/data/gdrive/login2.html | 11 +++++++++++
3 files changed, 23 insertions(+), 12 deletions(-)
delete mode 100644 qa/libcmis/data/gdrive/login.html
create mode 100644 qa/libcmis/data/gdrive/login1.html
create mode 100644 qa/libcmis/data/gdrive/login2.html
diff --git a/qa/libcmis/data/gdrive/login.html b/qa/libcmis/data/gdrive/login.html
deleted file mode 100644
index eae53bf..0000000
--- a/qa/libcmis/data/gdrive/login.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<body>
-<form novalidate="" id="gaia_loginform" action="https://login/url" method="post">
- <input name="continue" id="continue" value="redirectLink&amp;scope=Scope" type="hidden">
- <input name="service" id="service" value="lso" type="hidden">
- <input name="GALX" value="cookie" type="hidden">
- <input spellcheck="false" name="Email" id="Email" value="" type="email">
- <input name="Passwd" id="Passwd" type="password">
-</form>
-</body>
-</html>
diff --git a/qa/libcmis/data/gdrive/login1.html b/qa/libcmis/data/gdrive/login1.html
new file mode 100644
index 0000000..eae53bf
--- /dev/null
+++ b/qa/libcmis/data/gdrive/login1.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html lang="en">
+<body>
+<form novalidate="" id="gaia_loginform" action="https://login/url" method="post">
+ <input name="continue" id="continue" value="redirectLink&amp;scope=Scope" type="hidden">
+ <input name="service" id="service" value="lso" type="hidden">
+ <input name="GALX" value="cookie" type="hidden">
+ <input spellcheck="false" name="Email" id="Email" value="" type="email">
+ <input name="Passwd" id="Passwd" type="password">
+</form>
+</body>
+</html>
diff --git a/qa/libcmis/data/gdrive/login2.html b/qa/libcmis/data/gdrive/login2.html
new file mode 100644
index 0000000..198f816
--- /dev/null
+++ b/qa/libcmis/data/gdrive/login2.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html lang="en">
+<body>
+<form novalidate="" id="gaia_loginform" action="https://auth/url" method="post">
+ <input name="continue" id="continue" value="redirectLink&amp;scope=Scope" type="hidden">
+ <input name="service" id="service" value="lso" type="hidden">
+ <input name="GALX" value="cookie" type="hidden">
+ <input name="Passwd" id="Passwd" type="password">
+</form>
+</body>
+</html>
--
2.7.4

View File

@ -1,25 +0,0 @@
From 738528d790b2b1d52d9b72d673842969a852815d Mon Sep 17 00:00:00 2001
From: David Tardon <dtardon@redhat.com>
Date: Thu, 18 Jan 2018 10:48:52 +0100
Subject: [PATCH 2/2] return early if the time part is empty
---
src/libcmis/xml-utils.cxx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/libcmis/xml-utils.cxx b/src/libcmis/xml-utils.cxx
index d20ff47..6363af8 100644
--- a/src/libcmis/xml-utils.cxx
+++ b/src/libcmis/xml-utils.cxx
@@ -385,5 +385,8 @@ namespace libcmis
size_t teePos = dateTimeStr.find( 'T' );
+ if ( teePos == string::npos || teePos == dateTimeStr.size() - 1 )
+ return t; // obviously not a time
+
string noTzStr = dateTimeStr.substr( 0, teePos + 1 );
string timeStr = dateTimeStr.substr( teePos + 1 );
--
2.14.3

View File

@ -1,113 +0,0 @@
From 04297298ad9659c949beb7ccd0f75cfd440a4fb8 Mon Sep 17 00:00:00 2001
From: Giuseppe Castagno <giuseppe.castagno@acca-esse.eu>
Date: Tue, 3 May 2016 11:47:43 +0200
Subject: [PATCH 3/5] Fix test in test-factory
---
qa/libcmis/data/gdrive/login1.html | 4 ++--
qa/libcmis/data/gdrive/login2.html | 2 +-
qa/libcmis/test-factory.cxx | 10 ++++++++--
qa/mockup/mockup-config.cxx | 3 +++
qa/mockup/mockup-config.h | 6 +++---
5 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/qa/libcmis/data/gdrive/login1.html b/qa/libcmis/data/gdrive/login1.html
index eae53bf..b6da338 100644
--- a/qa/libcmis/data/gdrive/login1.html
+++ b/qa/libcmis/data/gdrive/login1.html
@@ -1,12 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<body>
-<form novalidate="" id="gaia_loginform" action="https://login/url" method="post">
+<form novalidate="" id="gaia_loginform" action="https://login2/url" method="post">
+ <input name="Page" type="hidden" value="PasswordSeparationSignIn">
<input name="continue" id="continue" value="redirectLink&amp;scope=Scope" type="hidden">
<input name="service" id="service" value="lso" type="hidden">
<input name="GALX" value="cookie" type="hidden">
<input spellcheck="false" name="Email" id="Email" value="" type="email">
- <input name="Passwd" id="Passwd" type="password">
</form>
</body>
</html>
diff --git a/qa/libcmis/data/gdrive/login2.html b/qa/libcmis/data/gdrive/login2.html
index 198f816..6425091 100644
--- a/qa/libcmis/data/gdrive/login2.html
+++ b/qa/libcmis/data/gdrive/login2.html
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<body>
-<form novalidate="" id="gaia_loginform" action="https://auth/url" method="post">
+<form novalidate="" id="gaia_loginform" action="https://login/url" method="post">
<input name="continue" id="continue" value="redirectLink&amp;scope=Scope" type="hidden">
<input name="service" id="service" value="lso" type="hidden">
<input name="GALX" value="cookie" type="hidden">
diff --git a/qa/libcmis/test-factory.cxx b/qa/libcmis/test-factory.cxx
index c0bcb4c..3779e5a 100644
--- a/qa/libcmis/test-factory.cxx
+++ b/qa/libcmis/test-factory.cxx
@@ -64,6 +64,7 @@
#define GDRIVE_AUTH_URL string ( "https://auth/url" )
#define GDRIVE_LOGIN_URL string ("https://login/url" )
+#define GDRIVE_LOGIN_URL2 string ("https://login2/url" )
#define GDRIVE_APPROVAL_URL string ("https://approval/url" )
#define GDRIVE_TOKEN_URL string ( "https://token/url" )
@@ -101,10 +102,15 @@ namespace
string("&redirect_uri=") + OAUTH_REDIRECT_URI +
string("&response_type=code") +
string("&client_id=") + OAUTH_CLIENT_ID;
+
curl_mockup_addResponse ( GDRIVE_AUTH_URL.c_str(), loginIdentifier.c_str( ),
- "GET", DATA_DIR "/gdrive/login.html", 200, true);
+ "GET", DATA_DIR "/gdrive/login1.html", 200, true);
+
+ //authentication email
+ curl_mockup_addResponse( GDRIVE_LOGIN_URL2.c_str( ), "", "POST",
+ DATA_DIR "/gdrive/login2.html", 200, true);
- //authentication response
+ //authentication password,
curl_mockup_addResponse( GDRIVE_LOGIN_URL.c_str( ), "", "POST",
DATA_DIR "/gdrive/approve.html", 200, true);
diff --git a/qa/mockup/mockup-config.cxx b/qa/mockup/mockup-config.cxx
index f6b84ad..fb19927 100644
--- a/qa/mockup/mockup-config.cxx
+++ b/qa/mockup/mockup-config.cxx
@@ -117,6 +117,9 @@ namespace mockup
return !m_username.empty( ) && !m_password.empty( );
}
+ /** Find a suitable response
+ * using the request as a search key
+ */
CURLcode Configuration::writeResponse( CurlHandle* handle )
{
CURLcode code = CURLE_OK;
diff --git a/qa/mockup/mockup-config.h b/qa/mockup/mockup-config.h
index 6b94706..d0fc3bb 100644
--- a/qa/mockup/mockup-config.h
+++ b/qa/mockup/mockup-config.h
@@ -41,13 +41,13 @@ void curl_mockup_reset( );
the base URL of the request without parameters
\param matchParam
a string to find in the parameters part of the URL to match
+ \param method
+ HTTP method to match like PUT, GET, POST or DELETE. An empty
+ string matches any method.
\param response
a string corresponding either to the file path of the request
body to send or directly the content to send. This value has
a different meaning depending on isFilePath parameter.
- \param method
- HTTP method to match like PUT, GET, POST or DELETE. An empty
- string matches any method.
\param status
the HTTP status to return. 0 means HTTP OK (200).
\param isFilePath
--
2.7.4

View File

@ -1,74 +0,0 @@
From 73662089059eb2e272a4c5eb245a497af044ccf6 Mon Sep 17 00:00:00 2001
From: Giuseppe Castagno <giuseppe.castagno@acca-esse.eu>
Date: Tue, 3 May 2016 15:35:57 +0200
Subject: [PATCH 4/5] Fix test in test-gdrive
---
qa/libcmis/test-gdrive.cxx | 32 ++++++++++++++++++++++++--------
1 file changed, 24 insertions(+), 8 deletions(-)
diff --git a/qa/libcmis/test-gdrive.cxx b/qa/libcmis/test-gdrive.cxx
index 0cd9577..6323099 100644
--- a/qa/libcmis/test-gdrive.cxx
+++ b/qa/libcmis/test-gdrive.cxx
@@ -51,6 +51,7 @@ static const string CLIENT_SECRET ( "mock-secret" );
static const string USERNAME( "mock-user" );
static const string PASSWORD( "mock-password" );
static const string LOGIN_URL ("https://login/url" );
+static const string LOGIN_URL2 ("https://login2/url" );
static const string APPROVAL_URL ("https://approval/url" );
static const string AUTH_URL ( "https://auth/url" );
static const string TOKEN_URL ( "https://token/url" );
@@ -149,10 +150,15 @@ GDriveSession GDriveTest::getTestSession( string username, string password )
string("&redirect_uri=") + REDIRECT_URI +
string("&response_type=code") +
string("&client_id=") + CLIENT_ID;
+
curl_mockup_addResponse ( AUTH_URL.c_str(), loginIdentifier.c_str( ),
- "GET", DATA_DIR "/gdrive/login.html", 200, true);
+ "GET", DATA_DIR "/gdrive/login1.html", 200, true);
+
+ //authentication email
+ curl_mockup_addResponse( LOGIN_URL2.c_str( ), empty.c_str( ), "POST",
+ DATA_DIR "/gdrive/login2.html", 200, true);
- //authentication response
+ //authentication password,
curl_mockup_addResponse( LOGIN_URL.c_str( ), empty.c_str( ), "POST",
DATA_DIR "/gdrive/approve.html", 200, true);
@@ -171,15 +177,25 @@ void GDriveTest::sessionAuthenticationTest( )
GDriveSession session = getTestSession( USERNAME, PASSWORD );
string empty;
- // Check authentication request
- string authRequest( curl_mockup_getRequestBody( LOGIN_URL.c_str(), empty.c_str( ),
+ // Check authentication request for email
+ string authRequestEmail( curl_mockup_getRequestBody( LOGIN_URL2.c_str(), empty.c_str( ),
+ "POST" ) );
+ string expectedAuthRequestEmail =
+ string ( "Page=PasswordSeparationSignIn&continue=redirectLink&scope=Scope&service=lso&GALX=cookie"
+ "&Email=") + USERNAME;
+
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "Wrong authentication request for Email",
+ expectedAuthRequestEmail, authRequestEmail );
+
+ // Check authentication request for password
+ string authRequestPassword( curl_mockup_getRequestBody( LOGIN_URL.c_str(), empty.c_str( ),
"POST" ) );
- string expectedAuthRequest =
+ string expectedAuthRequestPassword =
string ( "continue=redirectLink&scope=Scope&service=lso&GALX=cookie"
- "&Email=") + USERNAME + string("&Passwd=") + PASSWORD;
+ "&Passwd=") + PASSWORD;
- CPPUNIT_ASSERT_EQUAL_MESSAGE( "Wrong authentication request",
- expectedAuthRequest, authRequest );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "Wrong authentication request for Password",
+ expectedAuthRequestPassword, authRequestPassword );
// Check code request
string codeRequest( curl_mockup_getRequestBody( APPROVAL_URL.c_str(),
--
2.7.4

View File

@ -1,42 +0,0 @@
From 3ebc3d9fe6a9806de2bcdf79ac6398f0c14c3246 Mon Sep 17 00:00:00 2001
From: Giuseppe Castagno <giuseppe.castagno@acca-esse.eu>
Date: Tue, 3 May 2016 15:41:52 +0200
Subject: [PATCH 5/5] Fix test in test-onedrive
---
qa/libcmis/test-onedrive.cxx | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/qa/libcmis/test-onedrive.cxx b/qa/libcmis/test-onedrive.cxx
index b88751b..5da8918 100644
--- a/qa/libcmis/test-onedrive.cxx
+++ b/qa/libcmis/test-onedrive.cxx
@@ -51,6 +51,7 @@ static const string CLIENT_SECRET ( "mock-secret" );
static const string USERNAME( "mock-user" );
static const string PASSWORD( "mock-password" );
static const string LOGIN_URL ("https://login/url" );
+static const string LOGIN_URL2 ("https://login2/url" );
static const string APPROVAL_URL ("https://approval/url" );
static const string AUTH_URL ( "https://auth/url" );
static const string TOKEN_URL ( "https://token/url" );
@@ -123,10 +124,15 @@ OneDriveSession OneDriveTest::getTestSession( string username, string password )
string("&redirect_uri=") + REDIRECT_URI +
string("&response_type=code") +
string("&client_id=") + CLIENT_ID;
+
curl_mockup_addResponse ( AUTH_URL.c_str(), loginIdentifier.c_str( ),
- "GET", DATA_DIR "/gdrive/login.html", 200, true);
+ "GET", DATA_DIR "/gdrive/login1.html", 200, true);
+
+ //authentication email
+ curl_mockup_addResponse( LOGIN_URL2.c_str( ), empty.c_str( ), "POST",
+ DATA_DIR "/gdrive/login2.html", 200, true);
- //authentication response
+ //authentication password
curl_mockup_addResponse( LOGIN_URL.c_str( ), empty.c_str( ), "POST",
DATA_DIR "/gdrive/approve.html", 200, true);
--
2.7.4

View File

@ -1,33 +1,21 @@
%global apiversion 0.5
Name: libcmis
Version: 0.5.1
Release: 13%{?dist}
Version: 0.5.2
Release: 1%{?dist}
Summary: A C/C++ client library for CM interfaces
License: GPLv2+ or LGPLv2+ or MPLv1.1
URL: https://github.com/tdf/libcmis
Source: https://github.com/tdf/libcmis/releases/download/v%{version}/%{name}-%{version}.tar.gz
Source: https://github.com/tdf/libcmis/releases/download/v%{version}/%{name}-%{version}.tar.xz
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: boost-devel
BuildRequires: gcc-c++
BuildRequires: pkgconfig(cppunit)
BuildRequires: pkgconfig(libcurl)
BuildRequires: pkgconfig(libxml-2.0)
BuildRequires: xmlto
Patch0: 0001-Add-new-Google-Drive-OAuth-2.0-login-procedure.patch
Patch1: 0002-Add-new-mokup-login-pages.patch
Patch2: 0003-Fix-test-in-test-factory.patch
Patch3: 0004-Fix-test-in-test-gdrive.patch
Patch4: 0005-Fix-test-in-test-onedrive.patch
Patch5: 0001-update-boost.m4-to-fix-version-detection-with-gcc-6..patch
Patch6: 0001-rhbz-1410197-limit-the-number-of-redirections.patch
Patch7: 0001-do-not-try-to-use-on-an-empty-string.patch
Patch8: 0002-return-early-if-the-time-part-is-empty.patch
Patch9: 0001-Properly-encode-OAuth2-credentials.patch
%description
LibCMIS is a C/C++ client library for working with CM (content management)
interfaces. The primary supported interface (which gave the library its
@ -55,8 +43,6 @@ command line.
%autosetup -p1
%build
aclocal -I m4
autoconf
%configure --disable-silent-rules --disable-static --disable-werror \
DOCBOOK2MAN='xmlto man'
sed -i \
@ -96,6 +82,9 @@ make %{?_smp_mflags} check
%{_mandir}/man1/cmis-client.1*
%changelog
* Fri Mar 13 2020 Caolán McNamara <caolanm@redhat.com> - 0.5.2-1
- Related: rhbz#1796893 update to 0.5.2
* Wed Nov 07 2018 Stephan Bergmann <sbergman@redhat.com> - 0.5.1-13
- Resolves: rhbz#1647470 fix Google Drive login