[libcmis] 31/40: add complete upstream patch including tests for Google Drive fix. re-enable the tests

Rene Engelhard rene at moszumanska.debian.org
Tue Sep 13 02:52:09 UTC 2016


This is an automated email from the git hooks/post-receive script.

rene pushed a commit to branch master
in repository libcmis.

commit 27696552621062140eed3063b9f370e78edb2bf4
Author: Rene Engelhard <rene at rene-engelhard.de>
Date:   Wed May 4 21:35:53 2016 +0200

    add complete upstream patch including tests for Google Drive fix. re-enable the tests
---
 debian/changelog                           |   7 +
 debian/patches/fix-google-drive-login.diff | 383 +++++++++++++++++++++++++----
 debian/rules                               |   2 +-
 3 files changed, 340 insertions(+), 52 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 0c4d8a0..9fbb976 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+libcmis (0.5.1-4) unstable; urgency=medium
+
+  * add complete upstream patch including tests for Google Drive fix.
+    re-enable the tests 
+
+ -- Rene Engelhard <rene at debian.org>  Wed, 04 May 2016 21:35:28 +0200
+
 libcmis (0.5.1-3) unstable; urgency=medium
 
   * add patch from LibreOffice master to fix Google Drive login 
diff --git a/debian/patches/fix-google-drive-login.diff b/debian/patches/fix-google-drive-login.diff
index 8fcd913..ea0be1c 100644
--- a/debian/patches/fix-google-drive-login.diff
+++ b/debian/patches/fix-google-drive-login.diff
@@ -1,38 +1,21 @@
-From 207d8440429d03d846f94c8c25fb0ff1bc773a95 Mon Sep 17 00:00:00 2001
+From 32aecffb5517dfc3b3674a8f7db418456bd877ed Mon Sep 17 00:00:00 2001
 From: Giuseppe Castagno <giuseppe.castagno at acca-esse.eu>
-Date: Tue, 15 Mar 2016 17:33:29 +0100
-Subject: Related tdf#98416 Libcmis: add a patch to fix Google Drive login
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-The new Google login sequence uses two html pages: one for user email
-the other for password.
-
-The older sequence used only one page for both user email and
-user password.
-
-Reviewed-on: https://gerrit.libreoffice.org/24513
-Tested-by: Jenkins <ci at libreoffice.org>
-Reviewed-by: David Tardon <dtardon at redhat.com>
-(cherry picked from commit 3db082a75210bbf0fc657831443c589a4226b997)
-Signed-off-by: David Tardon <dtardon at redhat.com>
-
-Change-Id: If875ba3ec9680d7e8c700a269873e427ac037a8e
-Reviewed-on: https://gerrit.libreoffice.org/24588
-Tested-by: Jenkins <ci at libreoffice.org>
-Reviewed-by: Giuseppe Castagno <giuseppe.castagno at acca-esse.eu>
-Reviewed-by: Caolán McNamara <caolanm at redhat.com>
-Tested-by: Caolán McNamara <caolanm at redhat.com>
-(cherry picked from commit 1f8a8cc460b936f234a018cde48ef52ff25b537d)
-Reviewed-on: https://gerrit.libreoffice.org/24606
-Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
-Tested-by: Michael Meeks <michael.meeks at collabora.com>
-
-diff -aru old-src/src/libcmis/oauth2-providers.cxx new-src/src/libcmis/oauth2-providers.cxx
---- old-src/src/libcmis/oauth2-providers.cxx	2016-03-01 17:14:26.000000000 +0100
-+++ new-src/src/libcmis/oauth2-providers.cxx	2016-04-28 11:28:25.233803971 +0200
-@@ -37,11 +37,28 @@
+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 )
  {
@@ -61,7 +44,7 @@ diff -aru old-src/src/libcmis/oauth2-providers.cxx new-src/src/libcmis/oauth2-pr
          res = session->httpGetRequest( authUrl )->getStream( )->str( );
      }
      catch ( const CurlException& e )
-@@ -49,20 +66,39 @@
+@@ -49,20 +66,39 @@ string OAuth2Providers::OAuth2Gdrive( HttpSession* session, const string& authUr
          return string( );
      }
  
@@ -69,7 +52,16 @@ diff -aru old-src/src/libcmis/oauth2-providers.cxx new-src/src/libcmis/oauth2-pr
 -    if ( !parseResponse( res.c_str( ), loginPost, loginLink ) ) 
 +    string loginEmailPost, loginEmailLink;
 +    if ( !parseResponse( res.c_str( ), loginEmailPost, loginEmailLink ) )
-+        return string( );
+         return string( );
+-    
+-    loginPost += "Email=";  
+-    loginPost += string( username );
+-    loginPost += "&Passwd=";
+-    loginPost += string( password );
+-    
+-    istringstream loginIs( loginPost );
+-    string loginRes;
+-    try 
 +
 +    loginEmailPost += "Email=";
 +    loginEmailPost += string( username );
@@ -89,18 +81,9 @@ diff -aru old-src/src/libcmis/oauth2-providers.cxx new-src/src/libcmis/oauth2-pr
 +
 +    string loginPasswdPost, loginPasswdLink;
 +    if ( !parseResponse( loginEmailRes.c_str( ), loginPasswdPost, loginPasswdLink ) )
-         return string( );
--    
--    loginPost += "Email=";  
--    loginPost += string( username );
--    loginPost += "&Passwd=";
--    loginPost += string( password );
--    
--    istringstream loginIs( loginPost );
--    string loginRes;
--    try 
++        return string( );
 +
-+    loginPasswdPost += "&Passwd=";
++    loginPasswdPost += "Passwd=";
 +    loginPasswdPost += string( password );
 +
 +    istringstream loginPasswdIs( loginPasswdPost );
@@ -113,7 +96,7 @@ diff -aru old-src/src/libcmis/oauth2-providers.cxx new-src/src/libcmis/oauth2-pr
                          ->getStream( )->str( );
      }
      catch ( const CurlException& e )
-@@ -71,8 +107,8 @@
+@@ -71,8 +107,8 @@ string OAuth2Providers::OAuth2Gdrive( HttpSession* session, const string& authUr
      }
  
      // STEP 2: allow libcmis to access google drive
@@ -124,7 +107,7 @@ diff -aru old-src/src/libcmis/oauth2-providers.cxx new-src/src/libcmis/oauth2-pr
          return string( );
      approvalPost += "submit_access=true";
  
-@@ -80,7 +116,8 @@
+@@ -80,7 +116,8 @@ string OAuth2Providers::OAuth2Gdrive( HttpSession* session, const string& authUr
      string approvalRes;
      try
      {
@@ -134,7 +117,305 @@ diff -aru old-src/src/libcmis/oauth2-providers.cxx new-src/src/libcmis/oauth2-pr
                              CONTENT_TYPE) ->getStream( )->str( );
      }
      catch ( const CurlException& e )
-Only in new-src/src/libcmis: oauth2-providers.cxx~
 -- 
-cgit v0.10.2
+2.1.4
+
+From 0490c023cd14cbb3d1ba2bc1b648b216f848a648 Mon Sep 17 00:00:00 2001
+From: Giuseppe Castagno <giuseppe.castagno at 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&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&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&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.1.4
+
+From 04297298ad9659c949beb7ccd0f75cfd440a4fb8 Mon Sep 17 00:00:00 2001
+From: Giuseppe Castagno <giuseppe.castagno at 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&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&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.1.4
+
+From 73662089059eb2e272a4c5eb245a497af044ccf6 Mon Sep 17 00:00:00 2001
+From: Giuseppe Castagno <giuseppe.castagno at 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.1.4
+
+From 3ebc3d9fe6a9806de2bcdf79ac6398f0c14c3246 Mon Sep 17 00:00:00 2001
+From: Giuseppe Castagno <giuseppe.castagno at 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.1.4
 
diff --git a/debian/rules b/debian/rules
index 8ab01b6..d090abc 100755
--- a/debian/rules
+++ b/debian/rules
@@ -43,7 +43,7 @@ override_dh_auto_build:
 	$(MAKE) $(NJOBS)
 
 override_dh_auto_test:
-#	$(MAKE) $(NJOBS) check
+	$(MAKE) $(NJOBS) check
 
 override_dh_auto_install:
 	dh_auto_install

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-openoffice/libcmis.git



More information about the Pkg-openoffice-commits mailing list