[libcmis] 29/40: add patch from LibreOffice master to fix Google Drive login

Rene Engelhard rene at moszumanska.debian.org
Tue Sep 13 02:52:08 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 36372bedae4dd973aa6c1be7ead4992a19e62886
Author: Rene Engelhard <rene at rene-engelhard.de>
Date:   Tue May 3 22:03:37 2016 +0200

    add patch from LibreOffice master to fix Google Drive login
---
 debian/changelog                           |   6 ++
 debian/patches/fix-google-drive-login.diff | 140 +++++++++++++++++++++++++++++
 debian/patches/series                      |   1 +
 3 files changed, 147 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 1de8b0f..2b52173 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+libcmis (0.5.1-3) unstable; urgency=medium
+
+  * add patch from LibreOffice master to fix Google Drive login 
+
+ -- Rene Engelhard <rene at debian.org>  Tue, 03 May 2016 21:56:57 +0200
+
 libcmis (0.5.1-2) unstable; urgency=medium
 
   * of course we should keep the cppunit build-dep, just revert the
diff --git a/debian/patches/fix-google-drive-login.diff b/debian/patches/fix-google-drive-login.diff
new file mode 100644
index 0000000..8fcd913
--- /dev/null
+++ b/debian/patches/fix-google-drive-login.diff
@@ -0,0 +1,140 @@
+From 207d8440429d03d846f94c8c25fb0ff1bc773a95 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 @@
+ 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 @@
+         return string( );
+     }
+ 
+-    string loginPost, loginLink; 
+-    if ( !parseResponse( res.c_str( ), loginPost, loginLink ) ) 
++    string loginEmailPost, loginEmailLink;
++    if ( !parseResponse( res.c_str( ), loginEmailPost, loginEmailLink ) )
++        return string( );
++
++    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( );
+-    
+-    loginPost += "Email=";  
+-    loginPost += string( username );
+-    loginPost += "&Passwd=";
+-    loginPost += string( password );
+-    
+-    istringstream loginIs( loginPost );
+-    string loginRes;
+-    try 
++
++    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 @@
+     }
+ 
+     // 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 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 )
+Only in new-src/src/libcmis: oauth2-providers.cxx~
+-- 
+cgit v0.10.2
+
diff --git a/debian/patches/series b/debian/patches/series
index 29dcee5..458eca7 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 fix-docbook-to-man-call.diff
+fix-google-drive-login.diff

-- 
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