[arch-commits] Commit in libcmis/repos (6 files)

Andreas Radke andyrtr at archlinux.org
Sat Oct 8 15:13:45 UTC 2016


    Date: Saturday, October 8, 2016 @ 15:13:45
  Author: andyrtr
Revision: 277932

archrelease: copy trunk to staging-x86_64, staging-i686

Added:
  libcmis/repos/staging-i686/
  libcmis/repos/staging-i686/PKGBUILD
    (from rev 277931, libcmis/trunk/PKGBUILD)
  libcmis/repos/staging-i686/google_drive.diff
    (from rev 277931, libcmis/trunk/google_drive.diff)
  libcmis/repos/staging-x86_64/
  libcmis/repos/staging-x86_64/PKGBUILD
    (from rev 277931, libcmis/trunk/PKGBUILD)
  libcmis/repos/staging-x86_64/google_drive.diff
    (from rev 277931, libcmis/trunk/google_drive.diff)

----------------------------------+
 staging-i686/PKGBUILD            |   39 +++++++++++++
 staging-i686/google_drive.diff   |  106 +++++++++++++++++++++++++++++++++++++
 staging-x86_64/PKGBUILD          |   39 +++++++++++++
 staging-x86_64/google_drive.diff |  106 +++++++++++++++++++++++++++++++++++++
 4 files changed, 290 insertions(+)

Copied: libcmis/repos/staging-i686/PKGBUILD (from rev 277931, libcmis/trunk/PKGBUILD)
===================================================================
--- staging-i686/PKGBUILD	                        (rev 0)
+++ staging-i686/PKGBUILD	2016-10-08 15:13:45 UTC (rev 277932)
@@ -0,0 +1,39 @@
+# $Id$
+# Maintainer: AndyRTR <andyrtr at archlinux.org>
+
+pkgname=libcmis
+pkgver=0.5.1
+pkgrel=4
+pkgdesc="a C/C++ client library for the CMIS protocol"
+arch=('x86_64' 'i686')
+url="https://github.com/tdf/libcmis"
+license=('GPL2' 'LGPL2.1' 'MPL')
+depends=('boost-libs' 'curl' 'libxml2')
+makedepends=('docbook2x' 'cppunit' 'boost')
+source=("https://github.com/tdf/libcmis/releases/download/v${pkgver}/$pkgname-$pkgver.tar.gz"
+        google_drive.diff)
+md5sums=('3270154f0f40d86fce849b161f914101'
+         '57eede4fdbd4709f48beee9e7b5f1509')
+validpgpkeys=()
+
+prepare() {
+        cd "$pkgname-$pkgver"
+        patch -Np1 -i ${srcdir}/google_drive.diff
+}
+
+build() {
+	cd "$pkgname-$pkgver"
+	./configure --prefix=/usr DOCBOOK2MAN='docbook2man'
+	make
+}
+
+check() {
+	cd "$pkgname-$pkgver"
+        # fails a google drive check - fix will be included in the next release
+	make check || /bin/true
+}
+
+package() {
+	cd "$pkgname-$pkgver"
+	make DESTDIR="$pkgdir/" install
+}

Copied: libcmis/repos/staging-i686/google_drive.diff (from rev 277931, libcmis/trunk/google_drive.diff)
===================================================================
--- staging-i686/google_drive.diff	                        (rev 0)
+++ staging-i686/google_drive.diff	2016-10-08 15:13:45 UTC (rev 277932)
@@ -0,0 +1,106 @@
+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 )

Copied: libcmis/repos/staging-x86_64/PKGBUILD (from rev 277931, libcmis/trunk/PKGBUILD)
===================================================================
--- staging-x86_64/PKGBUILD	                        (rev 0)
+++ staging-x86_64/PKGBUILD	2016-10-08 15:13:45 UTC (rev 277932)
@@ -0,0 +1,39 @@
+# $Id$
+# Maintainer: AndyRTR <andyrtr at archlinux.org>
+
+pkgname=libcmis
+pkgver=0.5.1
+pkgrel=4
+pkgdesc="a C/C++ client library for the CMIS protocol"
+arch=('x86_64' 'i686')
+url="https://github.com/tdf/libcmis"
+license=('GPL2' 'LGPL2.1' 'MPL')
+depends=('boost-libs' 'curl' 'libxml2')
+makedepends=('docbook2x' 'cppunit' 'boost')
+source=("https://github.com/tdf/libcmis/releases/download/v${pkgver}/$pkgname-$pkgver.tar.gz"
+        google_drive.diff)
+md5sums=('3270154f0f40d86fce849b161f914101'
+         '57eede4fdbd4709f48beee9e7b5f1509')
+validpgpkeys=()
+
+prepare() {
+        cd "$pkgname-$pkgver"
+        patch -Np1 -i ${srcdir}/google_drive.diff
+}
+
+build() {
+	cd "$pkgname-$pkgver"
+	./configure --prefix=/usr DOCBOOK2MAN='docbook2man'
+	make
+}
+
+check() {
+	cd "$pkgname-$pkgver"
+        # fails a google drive check - fix will be included in the next release
+	make check || /bin/true
+}
+
+package() {
+	cd "$pkgname-$pkgver"
+	make DESTDIR="$pkgdir/" install
+}

Copied: libcmis/repos/staging-x86_64/google_drive.diff (from rev 277931, libcmis/trunk/google_drive.diff)
===================================================================
--- staging-x86_64/google_drive.diff	                        (rev 0)
+++ staging-x86_64/google_drive.diff	2016-10-08 15:13:45 UTC (rev 277932)
@@ -0,0 +1,106 @@
+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 )



More information about the arch-commits mailing list