diff --git a/0001-Properly-encode-OAuth2-credentials.patch b/0001-Properly-encode-OAuth2-credentials.patch new file mode 100644 index 0000000..88a0da6 --- /dev/null +++ b/0001-Properly-encode-OAuth2-credentials.patch @@ -0,0 +1,76 @@ +From 8406c694eb58e610fbf94eba00719e097bad34d8 Mon Sep 17 00:00:00 2001 +From: Stephan Bergmann +Date: Tue, 4 Sep 2018 17:14:21 +0200 +Subject: [PATCH] Properly encode OAuth2 credentials + +Originally created as "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 ++ + #include + #include + +@@ -41,6 +43,29 @@ + + using namespace std; + ++namespace { ++ ++// See : ++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(*i); ++ if (c == ' ' || c == '*' || c == '-' || c == '.' || (c >= '0' && c <= '9') ++ || (c >= 'A' && c <= 'Z') || c == '_' || (c >= 'a' && c <= 'z')) ++ { ++ *buffer += static_cast(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 + diff --git a/libcmis.spec b/libcmis.spec index 915175c..1b7ff11 100644 --- a/libcmis.spec +++ b/libcmis.spec @@ -2,7 +2,7 @@ Name: libcmis Version: 0.5.1 -Release: 12%{?dist} +Release: 13%{?dist} Summary: A C/C++ client library for CM interfaces License: GPLv2+ or LGPLv2+ or MPLv1.1 @@ -27,6 +27,7 @@ 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) @@ -96,6 +97,9 @@ make %{?_smp_mflags} check %{_mandir}/man1/cmis-client.1* %changelog +* Wed Sep 12 2018 Stephan Bergmann - 0.5.1-13 +- fix Google Drive login + * Fri Jul 13 2018 Fedora Release Engineering - 0.5.1-12 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild