commit:     be8dc4f5b4ef1d2ee4eb99fd2952229dba5f8d4f
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 26 12:16:32 2022 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Mon Dec 26 23:19:22 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=be8dc4f5

dev-cpp/libcmis: Apply fixes from copy bundled in LO

Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 .../files/libcmis-0.5.2-fix-gdrive-onedrive.patch  | 980 +++++++++++++++++++++
 .../libcmis/files/libcmis-0.5.2-fix-onedrive.patch | 481 ++++++++++
 ...libcmis-0.5.2-gdrive-do-not-allow-copying.patch | 722 +++++++++++++++
 ...bcmis-0.5.2-onedrive-do-not-allow-copying.patch | 430 +++++++++
 dev-cpp/libcmis/libcmis-0.5.2-r2.ebuild            |  69 ++
 5 files changed, 2682 insertions(+)

diff --git a/dev-cpp/libcmis/files/libcmis-0.5.2-fix-gdrive-onedrive.patch 
b/dev-cpp/libcmis/files/libcmis-0.5.2-fix-gdrive-onedrive.patch
new file mode 100644
index 000000000000..b1e07ad89e24
--- /dev/null
+++ b/dev-cpp/libcmis/files/libcmis-0.5.2-fix-gdrive-onedrive.patch
@@ -0,0 +1,980 @@
+From bce91e0854a0ff1d0b2023f1f3a54077a36e3738 Mon Sep 17 00:00:00 2001
+From: Christian Lohmaier <[email protected]>
+Date: Mon, 23 Aug 2021 15:10:08 +0100
+Subject: [PATCH] tdf#101630 - gdrive support w/oAuth and Drive API v3
+
+LibreOffice is only using drive.file scope, so can only see files it
+owns/that were created by LibreOffice.
+
+In addition, also store the refresh token in LO's password-store if the
+user enabled persistent storage, removing the need to to the
+copy'n'paste dance to grant access each time LO is launched.
+
+related tdf#115643 also store the refresh token for onedrive
+consolidate the fallback-auth provides for onedrive/gdrive into one,
+they are all the same login in browser, then copy code method that
+ultimately should be changed to having LO listen on local port for the
+code
+---
+ inc/libcmis/session.hxx           |   2 +
+ src/libcmis/gdrive-document.cxx   |  49 ++------
+ src/libcmis/gdrive-folder.cxx     |  25 ++--
+ src/libcmis/gdrive-object.cxx     |  43 +++----
+ src/libcmis/gdrive-repository.cxx |   2 +-
+ src/libcmis/gdrive-session.cxx    |  76 ++++++++++-
+ src/libcmis/gdrive-session.hxx    |   8 ++
+ src/libcmis/gdrive-utils.cxx      |  33 ++---
+ src/libcmis/gdrive-utils.hxx      |   3 +-
+ src/libcmis/http-session.hxx      |   2 +-
+ src/libcmis/oauth2-handler.cxx    |  16 ++-
+ src/libcmis/oauth2-handler.hxx    |   1 +
+ src/libcmis/oauth2-providers.cxx  | 203 +-----------------------------
+ src/libcmis/oauth2-providers.hxx  |   6 +-
+ src/libcmis/onedrive-session.cxx  |  39 ++++++
+ src/libcmis/onedrive-session.hxx  |  10 +-
+ src/libcmis/session-factory.cxx   |   2 +-
+ 17 files changed, 206 insertions(+), 314 deletions(-)
+
+diff --git a/inc/libcmis/session.hxx b/inc/libcmis/session.hxx
+index 0a768a8..ec95ab4 100644
+--- a/inc/libcmis/session.hxx
++++ b/inc/libcmis/session.hxx
+@@ -95,6 +95,8 @@ namespace libcmis
+                 certificate exception feature available on common web browser.
+               */
+             virtual void setNoSSLCertificateCheck( bool noCheck ) = 0;
++
++            virtual std::string getRefreshToken() { return ""; };
+     };
+ }
+ 
+diff --git a/src/libcmis/gdrive-document.cxx b/src/libcmis/gdrive-document.cxx
+index fe7b73a..ecb13d6 100644
+--- a/src/libcmis/gdrive-document.cxx
++++ b/src/libcmis/gdrive-document.cxx
+@@ -145,23 +145,17 @@ void GDriveDocument::uploadStream( boost::shared_ptr< 
ostream > os,
+ {
+     if ( !os.get( ) )
+         throw libcmis::Exception( "Missing stream" );
+-    if ( !isImmutable( ) )
+-        throw libcmis::Exception( string ( "Document " + getId( )+ 
+-                                    " is not editable" ) );
+-    string putUrl = getUploadUrl( ) + getId( );
+-    putUrl += "?uploadType=media";
+-    
+-    // If it's a Google document, convert it 
+-    if ( isGoogleDoc( ) )
+-        putUrl  += "&convert=true";
++
++    string putUrl = GDRIVE_UPLOAD_LINK + getId( ) + "?uploadType=media";
+ 
+     // Upload stream
+     boost::shared_ptr< istream> is ( new istream ( os->rdbuf( ) ) );
+     vector <string> headers;
+     headers.push_back( string( "Content-Type: " ) + contentType );
++    string res;
+     try
+     {
+-        getSession()->httpPutRequest( putUrl, *is, headers );
++        res = getSession()->httpPatchRequest( putUrl, *is, headers 
)->getStream()->str();
+     }
+     catch ( const CurlException& e )
+     {
+@@ -181,35 +175,10 @@ void GDriveDocument::setContentStream( 
boost::shared_ptr< ostream > os,
+ {
+     if ( !os.get( ) )
+         throw libcmis::Exception( "Missing stream" );
+-    
+-    if ( !isImmutable( ) )
+-        throw libcmis::Exception( string ( "Document " + getId( )+ 
+-                                    " is not editable" ) );
+-    string metaUrl = getUrl( );
+-
+-    // If it's a Google document, convert it 
+-    if ( isGoogleDoc( ) )
+-        metaUrl += "?convert=true";
+-
+-    // Update file name meta information
+-    if ( !fileName.empty( ) && fileName != getContentFilename( ) )
+-    {
+-        Json metaJson;
+-        Json fileJson( fileName.c_str( ) );
+-        metaJson.add("title", fileJson );
+ 
+-        std::istringstream is( metaJson.toString( ) );
+-        vector<string> headers;
+-        headers.push_back( "Content-Type: application/json" );
+-        try
+-        {
+-            getSession()->httpPutRequest( metaUrl, is, headers );
+-        }
+-        catch ( const CurlException& e )
+-        {
+-            throw e.getCmisException( );
+-        }
+-    }
++    // TODO: when would the filename need an update?
++    if (!fileName.empty() && fileName != getContentFilename())
++        std::cout << "filename change is not implemented in setContentStream" 
<< std::endl;
+ 
+     // Upload stream
+     uploadStream( os, contentType );
+@@ -251,7 +220,7 @@ libcmis::DocumentPtr GDriveDocument::checkIn(
+ vector< libcmis::DocumentPtr > GDriveDocument::getAllVersions( ) 
+ {   
+     vector< libcmis::DocumentPtr > revisions;
+-    string versionUrl = getUrl( ) + "/revisions";
++    string versionUrl = GDRIVE_METADATA_LINK + getId( ) + "/revisions";
+     // Run the http request to get the properties definition
+     string res;
+     try
+@@ -263,7 +232,7 @@ vector< libcmis::DocumentPtr > 
GDriveDocument::getAllVersions( )
+         throw e.getCmisException( );
+     }
+     Json jsonRes = Json::parse( res );        
+-    Json::JsonVector objs = jsonRes["items"].getList( );
++    Json::JsonVector objs = jsonRes["revisions"].getList( );
+    
+     string parentId = getStringProperty( "cmis:parentId" );
+ 
+diff --git a/src/libcmis/gdrive-folder.cxx b/src/libcmis/gdrive-folder.cxx
+index 34ab187..26de89b 100644
+--- a/src/libcmis/gdrive-folder.cxx
++++ b/src/libcmis/gdrive-folder.cxx
+@@ -62,8 +62,8 @@ vector< libcmis::ObjectPtr > GDriveFolder::getChildren( )
+     // Instead of sending multiple queries for children,
+     // we send a single query to search for objects where parents
+     // include the folderID.
+-    string query = getSession( )->getBindingUrl( ) + 
+-        "/files?q=\"" + getId( ) + "\"+in+parents+and+trashed+=+false";
++    string query = GDRIVE_METADATA_LINK + "?q=\"" + getId( ) + 
"\"+in+parents+and+trashed+=+false" +
++        
"&fields=files(kind,id,name,parents,mimeType,createdTime,modifiedTime,thumbnailLink,size)";
+ 
+     string res;
+     try
+@@ -76,7 +76,7 @@ vector< libcmis::ObjectPtr > GDriveFolder::getChildren( )
+     }
+ 
+     Json jsonRes = Json::parse( res );
+-    Json::JsonVector objs = jsonRes["items"].getList( );
++    Json::JsonVector objs = jsonRes["files"].getList( );
+     
+     // Create children objects from Json objects
+     for(unsigned int i = 0; i < objs.size(); i++)
+@@ -95,7 +95,7 @@ vector< libcmis::ObjectPtr > GDriveFolder::getChildren( )
+ string GDriveFolder::uploadProperties( Json properties )
+ {
+     // URL for uploading meta data
+-    string metaUrl =  getSession()->getBindingUrl() + "/files/";
++    string metaUrl =  GDRIVE_METADATA_LINK + 
"?fields=kind,id,name,parents,mimeType,createdTime,modifiedTime";
+ 
+     // add parents to the properties    
+     properties.add( "parents", GdriveUtils::createJsonFromParentId( getId( ) 
) );
+@@ -147,9 +147,15 @@ libcmis::DocumentPtr GDriveFolder::createDocument(
+     
+     Json propsJson = GdriveUtils::toGdriveJson( properties );
+ 
+-    // Add filename to properties
+-    Json jsonFilename( fileName.c_str( ) );
+-    propsJson.add( "title", jsonFilename );
++    if(!fileName.empty()) {
++        // use provided filename
++        Json jsonFilename( fileName.c_str( ) );
++
++        propsJson.add( "name", jsonFilename );
++    }
++    if(!contentType.empty()) {
++        propsJson.add( "mimeType", Json(contentType.c_str()));
++    }
+     
+     // Upload meta-datas
+     string res = uploadProperties( propsJson);
+@@ -171,12 +177,9 @@ vector< string > GDriveFolder::removeTree(
+     libcmis::UnfileObjects::Type /*unfile*/, 
+     bool /*continueOnError*/ ) 
+ {
+-    // Object remove doesn't work with folder
+-    // Using trash instead
+     try
+     {   
+-        istringstream is( "" );
+-        getSession( )->httpPostRequest( getUrl( ) + "/trash", is, "" );
++        getSession( )->httpDeleteRequest( GDRIVE_METADATA_LINK + getId( ) );
+     }
+     catch ( const CurlException& e )
+     {
+diff --git a/src/libcmis/gdrive-object.cxx b/src/libcmis/gdrive-object.cxx
+index f22c240..b472e2f 100644
+--- a/src/libcmis/gdrive-object.cxx
++++ b/src/libcmis/gdrive-object.cxx
+@@ -89,8 +89,8 @@ void GDriveObject::initializeFromJson ( Json json, string 
id, string name )
+             property.reset( new GDriveProperty( it->first, it->second ) );
+             m_properties[ property->getPropertyType( )->getId()] = property;
+            
+-            // we map "title" to both "cmis:name" and 
"cmis:getContentStreamFileName"
+-            if ( it->first == "title" )
++            // we map "name" to both "cmis:name" and 
"cmis:getContentStreamFileName"
++            if ( it->first == "name" )
+             {
+                 property.reset( new GDriveProperty( "cmis:name", it->second) 
);
+                 m_properties[ property->getPropertyType( )->getId()] = 
property;
+@@ -142,16 +142,13 @@ vector< RenditionPtr> GDriveObject::getRenditions( 
string /* filter */ )
+ {
+     if ( m_renditions.empty( ) )
+     {
+-        string downloadUrl = getStringProperty( "downloadUrl" );
+-        if ( !downloadUrl.empty( ) )
++        string downloadUrl = GDRIVE_METADATA_LINK + getId( ) + "?alt=media";
++        string mimeType = getStringProperty( "cmis:contentStreamMimeType" );
++        if ( !mimeType.empty( ) )
+         {
+-            string mimeType = getStringProperty( "cmis:contentStreamMimeType" 
);
+-            if ( !mimeType.empty( ) )
+-            { 
+-                RenditionPtr rendition( 
+-                    new Rendition( mimeType, mimeType, mimeType, downloadUrl 
));
+-                m_renditions.push_back( rendition );
+-            }
++            RenditionPtr rendition(
++                new Rendition( mimeType, mimeType, mimeType, downloadUrl ));
++            m_renditions.push_back( rendition );
+         }
+ 
+         vector< string > exportLinks = getMultiStringProperty( "exportLinks" 
);
+@@ -159,7 +156,7 @@ vector< RenditionPtr> GDriveObject::getRenditions( string 
/* filter */ )
+         { 
+             int pos = (*it).find(":\"");
+             if ( pos == -1 ) continue;
+-            string mimeType = (*it).substr( 0, pos );
++            mimeType = (*it).substr( 0, pos );
+             string url = (*it).substr( pos + 2, (*it).length( ) - pos - 3 );
+             RenditionPtr rendition(
+                 new Rendition( mimeType, mimeType, mimeType, url ) );
+@@ -170,7 +167,7 @@ vector< RenditionPtr> GDriveObject::getRenditions( string 
/* filter */ )
+         string thumbnailLink = getStringProperty( "thumbnailLink" );
+         if ( !thumbnailLink.empty( ) )
+         {
+-            string mimeType = "cmis:thumbnail";   
++            mimeType = "cmis:thumbnail";
+             RenditionPtr rendition( 
+                 new Rendition( mimeType, mimeType, mimeType, thumbnailLink ));
+             m_renditions.push_back( rendition );
+@@ -192,7 +189,7 @@ libcmis::ObjectPtr GDriveObject::updateProperties(
+     {   
+         vector< string > headers;
+         headers.push_back( "Content-Type: application/json" );
+-        response = getSession( )->httpPutRequest( getUrl( ), is, headers );
++        response = getSession( )->httpPatchRequest( getUrl( ), is, headers );
+     }
+     catch ( const CurlException& e )
+     {   
+@@ -228,7 +225,7 @@ void GDriveObject::remove( bool /*allVersions*/ )
+ {
+     try
+     {
+-        getSession( )->httpDeleteRequest( getUrl( ) );
++        getSession( )->httpDeleteRequest( GDRIVE_METADATA_LINK + getId( ) );
+     }
+     catch ( const CurlException& e )
+     {
+@@ -239,8 +236,8 @@ void GDriveObject::remove( bool /*allVersions*/ )
+ void GDriveObject::move( FolderPtr /*source*/, FolderPtr destination ) 
+ {  
+     Json parentsJson;
+-    Json parentsValue = GdriveUtils::createJsonFromParentId( 
destination->getId( ) );
+-    parentsJson.add( "parents", parentsValue );
++    parentsJson.add( "addParents", Json(destination->getId( ).c_str()) );
++    parentsJson.add( "removeParents", Json(getStringProperty( "cmis:parentId" 
).c_str()) );
+     
+     istringstream is( parentsJson.toString( ) );
+     libcmis::HttpResponsePtr response;
+@@ -248,7 +245,7 @@ void GDriveObject::move( FolderPtr /*source*/, FolderPtr 
destination )
+     {   
+         vector< string > headers;
+         headers.push_back( "Content-Type: application/json" );
+-        response = getSession( )->httpPutRequest( getUrl( ), is, headers );
++        response = getSession( )->httpPatchRequest( getUrl( ), is, headers );
+     }
+     catch ( const CurlException& e )
+     {   
+@@ -262,12 +259,10 @@ void GDriveObject::move( FolderPtr /*source*/, FolderPtr 
destination )
+ 
+ string GDriveObject::getUrl( )
+ {
+-    return getSession( )->getBindingUrl( ) + "/files/" + getId( );
+-}
+-
+-string GDriveObject::getUploadUrl( )
+-{
+-    return GDRIVE_UPLOAD_LINKS;
++    // thumbnailLink causes some operations to fail with internal server 
error,
++    // see https://issuetracker.google.com/issues/36760667
++    return GDRIVE_METADATA_LINK + getId( ) +
++                
"?fields=kind,id,name,parents,mimeType,createdTime,modifiedTime,size";
+ }
+ 
+ vector< string> GDriveObject::getMultiStringProperty( const string& 
propertyName )
+diff --git a/src/libcmis/gdrive-repository.cxx 
b/src/libcmis/gdrive-repository.cxx
+index e6cec69..24b42b5 100644
+--- a/src/libcmis/gdrive-repository.cxx
++++ b/src/libcmis/gdrive-repository.cxx
+@@ -35,7 +35,7 @@ GdriveRepository::GdriveRepository( ) :
+     m_name = "Google Drive";
+     m_description = "Google Drive repository";
+     m_productName = "Google Drive";
+-    m_productVersion = "v2";
++    m_productVersion = "v3";
+     m_rootId = "root";
+  
+     m_capabilities[ ACL ] = "discover";
+diff --git a/src/libcmis/gdrive-session.cxx b/src/libcmis/gdrive-session.cxx
+index 87bb160..1ee748e 100644
+--- a/src/libcmis/gdrive-session.cxx
++++ b/src/libcmis/gdrive-session.cxx
+@@ -65,6 +65,46 @@ GDriveSession::~GDriveSession()
+ {
+ }
+ 
++
++void GDriveSession::setOAuth2Data( libcmis::OAuth2DataPtr oauth2 )
++{
++    m_oauth2Handler = new OAuth2Handler( this, oauth2 );
++    m_oauth2Handler->setOAuth2Parser( OAuth2Providers::getOAuth2Parser( 
getBindingUrl( ) ) );
++
++    oauth2Authenticate( );
++}
++
++void GDriveSession::oauth2Authenticate()
++{
++    // treat the supplied password as refresh token
++    if (!m_password.empty())
++    {
++        try
++        {
++            m_inOAuth2Authentication = true;
++
++            m_oauth2Handler->setRefreshToken(m_password);
++            // Try to get new access tokens using the stored refreshtoken
++            m_oauth2Handler->refresh();
++            m_inOAuth2Authentication = false;
++        }
++        catch (const CurlException &e)
++        {
++            m_inOAuth2Authentication = false;
++            // refresh token expired or invalid, trigger initial auth (that 
in turn will hit the fallback with copy'n'paste method)
++            BaseSession::oauth2Authenticate();
++        }
++    }
++    else
++    {
++        BaseSession::oauth2Authenticate();
++    }
++}
++
++string GDriveSession::getRefreshToken() {
++    return HttpSession::getRefreshToken();
++}
++
+ libcmis::RepositoryPtr GDriveSession::getRepository( )
+ {
+     // Return a dummy repository since GDrive doesn't have that notion
+@@ -79,9 +119,13 @@ bool GDriveSession::setRepository( std::string )
+ 
+ libcmis::ObjectPtr GDriveSession::getObject( string objectId )
+ {
++    if(objectId == "root") {
++        return getRootFolder();
++    }
+     // Run the http request to get the properties definition
+     string res;
+-    string objectLink = m_bindingUrl + "/files/" + objectId;
++    string objectLink = GDRIVE_METADATA_LINK + objectId +
++         
"?fields=kind,id,name,parents,mimeType,createdTime,modifiedTime,thumbnailLink,size";
+     try
+     {
+         res = httpGetRequest( objectLink )->getStream()->str();
+@@ -143,9 +187,10 @@ libcmis::ObjectPtr GDriveSession::getObjectByPath( string 
path )
+         {
+             // Normal child case
+             // Ask for the ID of the child if there is any
+-            string childIdUrl = m_bindingUrl + "/files/" + objectId +
+-                                "/children/?q=title+=+'" + segment +
+-                                "'&fields=items:id";
++            // somewhat flawed as names are not necessarily unique in 
GDrive...
++            string query = libcmis::escape("'" + objectId + "' in parents and 
trashed = false and name='" + segment + "'");
++
++            string childIdUrl = m_bindingUrl + "/files/?q=" + query + 
"&fields=files(id)";
+ 
+             string res;
+             try
+@@ -159,7 +204,7 @@ libcmis::ObjectPtr GDriveSession::getObjectByPath( string 
path )
+             Json jsonRes = Json::parse( res );
+ 
+             // Did we get an id?
+-            Json::JsonVector items = jsonRes["items"].getList();
++            Json::JsonVector items = jsonRes["files"].getList();
+             if ( items.empty( ) )
+                 throw libcmis::Exception( "Object not found: " + path, 
"objectNotFound" );
+ 
+@@ -174,6 +219,27 @@ libcmis::ObjectPtr GDriveSession::getObjectByPath( string 
path )
+     return getObject( objectId );
+ }
+ 
++libcmis::FolderPtr GDriveSession::getRootFolder()
++{
++    // permissions/scope with just drive.file don't allow to get it with the 
"root" alias/by its actual object-ID
++    Json propsJson;
++
++    // GDrive folder is a file with a different mime type.
++    string mimeType = GDRIVE_FOLDER_MIME_TYPE;
++
++    // Add mimetype to the propsJson
++    Json jsonMimeType( mimeType.c_str( ) );
++    propsJson.add( "mimeType", jsonMimeType );
++    propsJson.add( "id", "root" );
++
++    // Upload meta-datas
++    propsJson.add("cmis:name", "VirtualRoot");
++
++    libcmis::FolderPtr folderPtr( new GDriveFolder( this, propsJson ) );
++
++    return folderPtr;
++}
++
+ libcmis::ObjectTypePtr GDriveSession::getType( string id )
+ {
+     libcmis::ObjectTypePtr type( new GdriveObjectType( id ) );
+diff --git a/src/libcmis/gdrive-session.hxx b/src/libcmis/gdrive-session.hxx
+index f60ff6c..d29d454 100644
+--- a/src/libcmis/gdrive-session.hxx
++++ b/src/libcmis/gdrive-session.hxx
+@@ -55,10 +55,18 @@ class GDriveSession : public BaseSession
+ 
+         virtual std::vector< libcmis::ObjectTypePtr > getBaseTypes( );
+ 
++        virtual libcmis::FolderPtr getRootFolder();
++
++        virtual std::string getRefreshToken();
++
+     private:
+         GDriveSession( );
+         GDriveSession( const GDriveSession& copy ) = delete;
+         GDriveSession& operator=( const GDriveSession& copy ) = delete;
++
++        virtual void setOAuth2Data( libcmis::OAuth2DataPtr oauth2 );
++
++        void oauth2Authenticate( );
+ };
+ 
+ #endif /* _GDRIVE_SESSION_HXX_ */
+diff --git a/src/libcmis/gdrive-utils.cxx b/src/libcmis/gdrive-utils.cxx
+index 6be2e43..3cc0288 100644
+--- a/src/libcmis/gdrive-utils.cxx
++++ b/src/libcmis/gdrive-utils.cxx
+@@ -44,17 +44,17 @@ string GdriveUtils::toCmisKey( const string& key )
+         convertedKey = "cmis:createdBy";
+     else if ( key == "description" )
+         convertedKey = "cmis:description";
+-    else if ( key == "createdDate" )
++    else if ( key == "createdTime" )
+         convertedKey = "cmis:creationDate";
+     else if ( key == "lastModifyingUserName" )
+         convertedKey = "cmis:lastModifiedBy";
+-    else if ( key == "modifiedDate" )
++    else if ( key == "modifiedTime" )
+         convertedKey = "cmis:lastModificationDate";
+-    else if ( key == "title" )
++    else if ( key == "name" )
+         convertedKey = "cmis:contentStreamFileName";
+     else if ( key == "mimeType" )
+         convertedKey = "cmis:contentStreamMimeType";
+-    else if ( key == "fileSize" )
++    else if ( key == "size" )
+         convertedKey = "cmis:contentStreamLength";
+     else if ( key == "editable" )
+         convertedKey = "cmis:isImmutable";
+@@ -72,21 +72,21 @@ string GdriveUtils::toGdriveKey( const string& key )
+     else if ( key == "cmis:createdBy" )
+         convertedKey = "ownerNames";
+     else if ( key == "cmis:creationDate" )
+-        convertedKey = "createdDate";
++        convertedKey = "createdTime";
+     else if ( key == "cmis:description" )
+         convertedKey = "description";
+     else if ( key == "cmis:lastModifiedBy" )
+         convertedKey = "lastModifyingUserName";
+     else if ( key == "cmis:lastModificationDate" )
+-        convertedKey = "modifiedDate";
++        convertedKey = "modifiedTime";
+     else if ( key == "cmis:contentStreamFileName" )
+-        convertedKey = "title";
++        convertedKey = "name";
+     else if ( key == "cmis:name" )
+-        convertedKey = "title";
++        convertedKey = "name";
+     else if ( key == "cmis:contentStreamMimeType" )
+         convertedKey = "mimeType";
+     else if ( key == "cmis:contentStreamLength" )
+-        convertedKey = "fileSize";
++        convertedKey = "size";
+     else if ( key == "cmis:isImmutable" )
+         convertedKey = "editable";
+     else if ( key == "cmis:parentId" )
+@@ -124,9 +124,9 @@ Json GdriveUtils::toGdriveJson( const PropertyPtrMap& 
properties )
+ bool GdriveUtils::checkUpdatable( const string& key )
+ {
+     // taken from https://developers.google.com/drive/v2/reference/files
+-    bool updatable = ( key == "title" ||
++    bool updatable = ( key == "name" ||
+                   key == "description" ||
+-                  key == "modifiedDate" ||
++                  key == "modifiedTime" ||
+                   key == "lastViewedByMeDate" );
+     return updatable;    
+ }
+@@ -143,18 +143,11 @@ bool GdriveUtils::checkMultiValued( const string& key )
+ 
+ Json GdriveUtils::createJsonFromParentId( const string& parentId )
+ {
+-    Json parentValue( parentId.c_str( ) );
+-    
+     // parents is a Json array
+     Json firstParent;
+-    firstParent.add( "id", parentValue );
+-    
+-    Json::JsonVector parents;
+-    parents.insert( parents.begin( ), firstParent );
++    firstParent.add( Json( parentId.c_str() ) );
+     
+-    Json parentsValue( parents );
+-
+-    return parentsValue;
++    return firstParent;
+ }
+ 
+ vector< string > GdriveUtils::parseGdriveProperty( string key, Json json )
+diff --git a/src/libcmis/gdrive-utils.hxx b/src/libcmis/gdrive-utils.hxx
+index 6f1c257..06ad568 100644
+--- a/src/libcmis/gdrive-utils.hxx
++++ b/src/libcmis/gdrive-utils.hxx
+@@ -35,7 +35,8 @@
+ #include "json-utils.hxx"
+ 
+ static const std::string GDRIVE_FOLDER_MIME_TYPE = 
"application/vnd.google-apps.folder" ;
+-static const std::string GDRIVE_UPLOAD_LINKS = 
"https://www.googleapis.com/upload/drive/v2/files/";;
++static const std::string GDRIVE_UPLOAD_LINK = 
"https://www.googleapis.com/upload/drive/v3/files/";;
++static const std::string GDRIVE_METADATA_LINK = 
"https://www.googleapis.com/drive/v3/files/";;
+ 
+ class GdriveUtils
+ {
+diff --git a/src/libcmis/http-session.hxx b/src/libcmis/http-session.hxx
+index 29de64d..6c9ed1b 100644
+--- a/src/libcmis/http-session.hxx
++++ b/src/libcmis/http-session.hxx
+@@ -148,7 +148,7 @@ class HttpSession
+ 
+         void setNoSSLCertificateCheck( bool noCheck );
+ 
+-        std::string getRefreshToken( );
++        virtual std::string getRefreshToken( );
+ 
+     protected:
+         HttpSession( );
+diff --git a/src/libcmis/oauth2-handler.cxx b/src/libcmis/oauth2-handler.cxx
+index 842769f..d70628d 100644
+--- a/src/libcmis/oauth2-handler.cxx
++++ b/src/libcmis/oauth2-handler.cxx
+@@ -92,8 +92,11 @@ void OAuth2Handler::fetchTokens( string authCode )
+         "code="              + authCode +
+         "&client_id="        + m_data->getClientId() +
+         "&redirect_uri="     + m_data->getRedirectUri() +
+-        "&scope="            + libcmis::escape( m_data->getScope() ) +
+         "&grant_type=authorization_code" ;
++    if(boost::starts_with(m_data->getTokenUrl(), 
"https://oauth2.googleapis.com/";))
++        post += "&client_secret="    + m_data->getClientSecret();
++    else
++        post += "&scope="            + libcmis::escape( m_data->getScope() );
+ 
+     istringstream is( post );
+ 
+@@ -104,7 +107,7 @@ void OAuth2Handler::fetchTokens( string authCode )
+         resp = m_session->httpPostRequest ( m_data->getTokenUrl(), is,
+                                         "application/x-www-form-urlencoded" );
+     }
+-    catch ( const CurlException& )
++    catch ( const CurlException& e)
+     {
+         throw libcmis::Exception(
+                 "Couldn't get tokens from the authorization code ");
+@@ -122,6 +125,8 @@ void OAuth2Handler::refresh( )
+         "refresh_token="     + m_refresh +
+         "&client_id="        + m_data->getClientId() +
+         "&grant_type=refresh_token" ;
++    if(boost::starts_with(m_data->getTokenUrl(), 
"https://oauth2.googleapis.com/";))
++        post += "&client_secret="    + m_data->getClientSecret();
+ 
+     istringstream is( post );
+     libcmis::HttpResponsePtr resp;
+@@ -130,7 +135,7 @@ void OAuth2Handler::refresh( )
+         resp = m_session->httpPostRequest( m_data->getTokenUrl( ), is,
+                                            
"application/x-www-form-urlencoded" );
+     }
+-    catch (const CurlException& )
++    catch (const CurlException& e )
+     {
+         throw libcmis::Exception( "Couldn't refresh token ");
+     }
+@@ -158,6 +163,11 @@ string OAuth2Handler::getRefreshToken( )
+     return m_refresh;
+ }
+ 
++void OAuth2Handler::setRefreshToken( string refreshToken )
++{
++    m_refresh = refreshToken;
++}
++
+ string OAuth2Handler::getHttpHeader( )
+ {
+     string header;
+diff --git a/src/libcmis/oauth2-handler.hxx b/src/libcmis/oauth2-handler.hxx
+index 83e91cf..bb9a394 100644
+--- a/src/libcmis/oauth2-handler.hxx
++++ b/src/libcmis/oauth2-handler.hxx
+@@ -61,6 +61,7 @@ class OAuth2Handler
+ 
+         std::string getAccessToken( ) ;
+         std::string getRefreshToken( ) ;
++        void setRefreshToken( std::string refreshToken ) ;
+ 
+         // adding HTTP auth header
+         std::string getHttpHeader( ) ;
+diff --git a/src/libcmis/oauth2-providers.cxx 
b/src/libcmis/oauth2-providers.cxx
+index db6fbef..1c8d3cc 100644
+--- a/src/libcmis/oauth2-providers.cxx
++++ b/src/libcmis/oauth2-providers.cxx
+@@ -47,201 +47,8 @@
+ 
+ using namespace std;
+ 
+-namespace {
+-
+-// Encodes the given data according to the application/x-www-form-urlencoded 
format, see
+-// <https://url.spec.whatwg.org/#concept-urlencoded-byte-serializer>:
+-std::string escapeForm(const std::string& data)
+-{
+-    std::string res;
+-    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' ) )
+-        {
+-            res += 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' };
+-            res += '%';
+-            res += hex[c >> 4];
+-            res += hex[c & 0xF];
+-        }
+-    }
+-    return res;
+-}
+-
+-}
+-
+-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
+-     *
+-     * Sequence with 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 pin input
+-     * 3b) subsequent post to send pin number
+-     *    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: get login page
+-    string res;
+-    try
+-    {
+-        // send the first get, receive the html login page
+-        res = session->httpGetRequest( authUrl )->getStream( )->str( );
+-    }
+-    catch ( const CurlException& )
+-    {
+-        return string( );
+-    }
+-
+-    // STEP 2: send email
+-
+-    string loginEmailPost, loginEmailLink;
+-    if ( !parseResponse( res.c_str( ), loginEmailPost, loginEmailLink ) )
+-        return string( );
+-
+-    loginEmailPost += "Email=";
+-    loginEmailPost += escapeForm( 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& )
+-    {
+-        return string( );
+-    }
+-
+-    // STEP 3: password page
+-
+-    string loginPasswdPost, loginPasswdLink;
+-    if ( !parseResponse( loginEmailRes.c_str( ), loginPasswdPost, 
loginPasswdLink ) )
+-        return string( );
+-
+-    loginPasswdPost += "Passwd=";
+-    loginPasswdPost += escapeForm( password );
+-
+-    istringstream loginPasswdIs( loginPasswdPost );
+-    string loginPasswdRes;
+-    try
+-    {
+-        // send a post with user password, receive the application consent 
page
+-        loginPasswdRes = session->httpPostRequest ( loginPasswdLink, 
loginPasswdIs, CONTENT_TYPE )
+-                        ->getStream( )->str( );
+-    }
+-    catch ( const CurlException& )
+-    {
+-        return string( );
+-    }
+-
+-    string approvalPost, approvalLink;
+-    if ( !parseResponse( loginPasswdRes. c_str( ), approvalPost, 
approvalLink) )
+-        return string( );
+-
+-    // when 2FA is enabled, link doesn't start with 'http'
+-    if ( approvalLink.compare(0, 4, "http") != 0 )
+-    {
+-        // STEP 3b: 2 Factor Authentication, pin code request
+-
+-        string loginChallengePost( approvalPost );
+-        string loginChallengeLink( approvalLink );
+-
+-        libcmis::OAuth2AuthCodeProvider fallbackProvider = 
libcmis::SessionFactory::getOAuth2AuthCodeProvider( );
+-        unique_ptr< char, void (*)( void * ) > pin{ fallbackProvider( "", "", 
"" ), free };
+-
+-        if( !pin )
+-        {
+-            // unset OAuth2AuthCode Provider to avoid showing pin request 
again in the HttpSession::oauth2Authenticate
+-            libcmis::SessionFactory::setOAuth2AuthCodeProvider( NULL );
+-            return string( );
+-        }
+-
+-        loginChallengeLink = "https://accounts.google.com"; + 
loginChallengeLink;
+-        loginChallengePost += string( PIN_INPUT_NAME ) + "=";
+-        loginChallengePost += string( pin.get() );
+-
+-        istringstream loginChallengeIs( loginChallengePost );
+-        string loginChallengeRes;
+-        try
+-        {
+-            // send a post with pin, receive the application consent page
+-            loginChallengeRes = session->httpPostRequest ( 
loginChallengeLink, loginChallengeIs, CONTENT_TYPE )
+-                            ->getStream( )->str( );
+-        }
+-        catch ( const CurlException& )
+-        {
+-            return string( );
+-        }
+-
+-        approvalPost = string();
+-        approvalLink = string();
+-
+-        if ( !parseResponse( loginChallengeRes. c_str( ), approvalPost, 
approvalLink) )
+-            return string( );
+-    }
+-    else if( approvalLink.compare( 
"https://accounts.google.com/ServiceLoginAuth"; ) == 0 )
+-    {
+-        // wrong password,
+-        // unset OAuth2AuthCode Provider to avoid showing pin request again 
in the HttpSession::oauth2Authenticate
+-        libcmis::SessionFactory::setOAuth2AuthCodeProvider( NULL );
+-        return string( );
+-    }
+-
+-    // STEP 4: allow libcmis to access google drive
+-    approvalPost += "submit_access=true";
+-
+-    istringstream approvalIs( approvalPost );
+-    string approvalRes;
+-    try
+-    {
+-        // send a post with application consent
+-        approvalRes = session->httpPostRequest ( approvalLink, approvalIs,
+-                            CONTENT_TYPE) ->getStream( )->str( );
+-    }
+-    catch ( const CurlException& e )
+-    {
+-        throw e.getCmisException( );
+-    }
+-
+-    // Take the authentication code from the text bar
+-    string code = parseCode( approvalRes.c_str( ) );
+-
+-    return code;
+-}
+-
+-string OAuth2Providers::OAuth2Onedrive( HttpSession* /*session*/, const 
string& /*authUrl*/,
+-                                      const string& /*username*/, const 
string& /*password*/ )
++string OAuth2Providers::OAuth2Dummy( HttpSession* /*session*/, const string& 
/*authUrl*/,
++                                     const string& /*username*/, const 
string& /*password*/ )
+ {
+     return string( );
+ }
+@@ -309,12 +116,8 @@ OAuth2Parser OAuth2Providers::getOAuth2Parser( const 
std::string& url )
+         // For Alfresco in the cloud, only match the hostname as there can be 
several
+         // binding URLs created with it.
+         return OAuth2Alfresco;
+-    else if ( boost::starts_with( url, "https://www.googleapis.com/drive/v2"; 
) )
+-        return OAuth2Gdrive;
+-    else if ( boost::starts_with( url, "https://graph.microsoft.com/v1.0"; ) )
+-        return OAuth2Onedrive;
+ 
+-    return OAuth2Gdrive;
++    return OAuth2Dummy;
+ }
+ 
+ int OAuth2Providers::parseResponse ( const char* response, string& post, 
string& link )
+diff --git a/src/libcmis/oauth2-providers.hxx 
b/src/libcmis/oauth2-providers.hxx
+index 04dff53..eaeb1c4 100644
+--- a/src/libcmis/oauth2-providers.hxx
++++ b/src/libcmis/oauth2-providers.hxx
+@@ -39,12 +39,8 @@ typedef std::string ( *OAuth2Parser ) ( HttpSession* 
session, const std::string&
+ class OAuth2Providers
+ {
+     public :
+-        static std::string OAuth2Gdrive( HttpSession* session, const 
std::string& authUrl, 
++        static std::string OAuth2Dummy( HttpSession* session, const 
std::string& authUrl,
+                                        const std::string& username, const 
std::string& password );
+-
+-        static std::string OAuth2Onedrive( HttpSession* session, const 
std::string& authUrl, 
+-                                       const std::string& username, const 
std::string& password );
+-
+         static std::string OAuth2Alfresco( HttpSession* session, const 
std::string& authUrl, 
+                                        const std::string& username, const 
std::string& password );
+ 
+diff --git a/src/libcmis/onedrive-session.cxx 
b/src/libcmis/onedrive-session.cxx
+index 05ff45e..375cd2e 100644
+--- a/src/libcmis/onedrive-session.cxx
++++ b/src/libcmis/onedrive-session.cxx
+@@ -63,6 +63,45 @@ OneDriveSession::~OneDriveSession()
+ {
+ }
+ 
++void OneDriveSession::setOAuth2Data( libcmis::OAuth2DataPtr oauth2 )
++{
++    m_oauth2Handler = new OAuth2Handler( this, oauth2 );
++    m_oauth2Handler->setOAuth2Parser( OAuth2Providers::getOAuth2Parser( 
getBindingUrl( ) ) );
++
++    oauth2Authenticate( );
++}
++
++void OneDriveSession::oauth2Authenticate()
++{
++    // treat the supplied password as refresh token
++    if (!m_password.empty())
++    {
++        try
++        {
++            m_inOAuth2Authentication = true;
++
++            m_oauth2Handler->setRefreshToken(m_password);
++            // Try to get new access tokens using the stored refreshtoken
++            m_oauth2Handler->refresh();
++            m_inOAuth2Authentication = false;
++        }
++        catch (const CurlException &e)
++        {
++            m_inOAuth2Authentication = false;
++            // refresh token expired or invalid, trigger initial auth (that 
in turn will hit the fallback with copy'n'paste method)
++            BaseSession::oauth2Authenticate();
++        }
++    }
++    else
++    {
++        BaseSession::oauth2Authenticate();
++    }
++}
++
++string OneDriveSession::getRefreshToken() {
++    return HttpSession::getRefreshToken();
++}
++
+ libcmis::RepositoryPtr OneDriveSession::getRepository( )
+ {
+     // Return a dummy repository since OneDrive doesn't have that notion
+diff --git a/src/libcmis/onedrive-session.hxx 
b/src/libcmis/onedrive-session.hxx
+index f11fbaf..3c30c04 100644
+--- a/src/libcmis/onedrive-session.hxx
++++ b/src/libcmis/onedrive-session.hxx
+@@ -56,14 +56,20 @@ class OneDriveSession : public BaseSession
+         
+         virtual std::vector< libcmis::ObjectTypePtr > getBaseTypes( );
+ 
+-       libcmis::ObjectPtr getObjectFromJson( Json& jsonRes );
++        libcmis::ObjectPtr getObjectFromJson( Json& jsonRes );
+ 
+-       bool isAPathMatch( Json objectJson, std::string path );
++        bool isAPathMatch( Json objectJson, std::string path );
++
++        virtual std::string getRefreshToken();
+ 
+     private:
+         OneDriveSession( );
+         OneDriveSession( const OneDriveSession& copy ) = delete;
+         OneDriveSession& operator=( const OneDriveSession& copy ) = delete;
++
++        virtual void setOAuth2Data( libcmis::OAuth2DataPtr oauth2 );
++
++        void oauth2Authenticate( );
+ };
+ 
+ #endif /* _ONEDRIVE_SESSION_HXX_ */
+diff --git a/src/libcmis/session-factory.cxx b/src/libcmis/session-factory.cxx
+index e740afb..1222473 100644
+--- a/src/libcmis/session-factory.cxx
++++ b/src/libcmis/session-factory.cxx
+@@ -66,7 +66,7 @@ namespace libcmis
+         if ( !bindingUrl.empty( ) )
+         {
+             // Try the special cases based on the binding URL
+-            if ( bindingUrl == "https://www.googleapis.com/drive/v2"; )
++            if ( bindingUrl == "https://www.googleapis.com/drive/v3"; )
+             {
+                 session = new GDriveSession( bindingUrl, username, password,
+                                              oauth2, verbose );

diff --git a/dev-cpp/libcmis/files/libcmis-0.5.2-fix-onedrive.patch 
b/dev-cpp/libcmis/files/libcmis-0.5.2-fix-onedrive.patch
new file mode 100644
index 000000000000..9827bf7d9a5a
--- /dev/null
+++ b/dev-cpp/libcmis/files/libcmis-0.5.2-fix-onedrive.patch
@@ -0,0 +1,481 @@
+From fa5a130caff96c6f59085951f12f42f4e96a4f60 Mon Sep 17 00:00:00 2001
+From: Christian Lohmaier <[email protected]>
+Date: Mon, 23 Aug 2021 10:49:09 +0100
+Subject: [PATCH] tdf#115643 make onedrive work again by switching to graph API
+
+the live SDK method had been deprecated quite a while ago and has been
+turned off a while back.
+Notes:
+While you can access and save existing files using the remote files
+dialog, creating new files or using "save as" requires using the
+LibreOffice open/save dialogs.
+Authentication is clunky: username and password you're asked when
+creating a new connection is not used at all for connecting, so only
+fill out a username to label your onedrive entry. Actual authentication
+is done in browser - copy'n'paste the URL from the dialog into the
+browser, login and approve access for LibreOffice (approving access only
+necessary once), then you get redirected to localhost, ignore that there
+is nothing to display. The important part is the code from the URL-bar.
+Copy and paste that into the LibreOffice dialog and LO can request an
+authentication token for API access.
+Testing this feature requires compiling with corresponding api-keys
+specified in configure/having an app registered with microsoft.
+---
+ src/libcmis/http-session.cxx        | 88 +++++++++++++++++++++++++++++
+ src/libcmis/http-session.hxx        |  3 +
+ src/libcmis/oauth2-handler.cxx      |  3 +-
+ src/libcmis/oauth2-providers.cxx    |  2 +-
+ src/libcmis/onedrive-document.cxx   | 17 +++---
+ src/libcmis/onedrive-folder.cxx     | 14 +++--
+ src/libcmis/onedrive-object.cxx     | 13 +++--
+ src/libcmis/onedrive-repository.cxx |  2 +-
+ src/libcmis/onedrive-session.cxx    | 51 +++++------------
+ src/libcmis/onedrive-utils.cxx      | 10 ++--
+ src/libcmis/session-factory.cxx     |  2 +-
+ 11 files changed, 138 insertions(+), 67 deletions(-)
+
+diff --git a/src/libcmis/http-session.cxx b/src/libcmis/http-session.cxx
+index 2638482..227667e 100644
+--- a/src/libcmis/http-session.cxx
++++ b/src/libcmis/http-session.cxx
+@@ -293,6 +293,94 @@ libcmis::HttpResponsePtr HttpSession::httpGetRequest( 
string url )
+     return response;
+ }
+ 
++libcmis::HttpResponsePtr HttpSession::httpPatchRequest( string url, istream& 
is, vector< string > headers )
++{
++    checkOAuth2( url );
++
++    // Duplicate istream in case we need to retry
++    string isStr( static_cast< stringstream const&>( stringstream( ) << 
is.rdbuf( ) ).str( ) );
++
++    istringstream isOriginal( isStr ), isBackup( isStr );
++
++    // Reset the handle for the request
++    curl_easy_reset( m_curlHandle );
++    initProtocols( );
++
++    libcmis::HttpResponsePtr response( new libcmis::HttpResponse( ) );
++
++    curl_easy_setopt( m_curlHandle, CURLOPT_WRITEFUNCTION, lcl_bufferData );
++    curl_easy_setopt( m_curlHandle, CURLOPT_WRITEDATA, response->getData( 
).get( ) );
++
++    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( );
++    is.seekg( 0, ios::beg );
++    curl_easy_setopt( m_curlHandle, CURLOPT_INFILESIZE, size );
++    curl_easy_setopt( m_curlHandle, CURLOPT_READDATA, &isOriginal );
++    curl_easy_setopt( m_curlHandle, CURLOPT_READFUNCTION, lcl_readStream );
++    curl_easy_setopt( m_curlHandle, CURLOPT_UPLOAD, 1 );
++    curl_easy_setopt( m_curlHandle, CURLOPT_CUSTOMREQUEST, "PATCH" );
++    curl_easy_setopt( m_curlHandle, CURLOPT_IOCTLFUNCTION, lcl_ioctlStream );
++    curl_easy_setopt( m_curlHandle, CURLOPT_IOCTLDATA, &isOriginal );
++
++    // If we know for sure that 100-Continue won't be accepted,
++    // don't even try with it to save one HTTP request.
++    if ( m_no100Continue )
++        headers.push_back( "Expect:" );
++    try
++    {
++        httpRunRequest( url, headers );
++        response->getData( )->finish();
++    }
++    catch ( const CurlException& )
++    {
++        long status = getHttpStatus( );
++        /** If we had a HTTP 417 response, this is likely to be due to some
++            HTTP 1.0 proxy / server not accepting the "Expect: 100-continue"
++            header. Try to disable this header and try again.
++        */
++        if ( status == 417 && !m_no100Continue)
++        {
++            // Remember that we don't want 100-Continue for the future 
requests
++            m_no100Continue = true;
++            response = httpPutRequest( url, isBackup, headers );
++        }
++
++        // If the access token is expired, we get 401 error,
++        // Need to use the refresh token to get a new one.
++        if ( status == 401 && !getRefreshToken( ).empty( ) && 
!m_refreshedToken )
++        {
++
++            // Refresh the token
++            oauth2Refresh();
++
++            // Resend the query
++            try
++            {
++                // Avoid infinite recursive call
++                m_refreshedToken = true;
++                response = httpPutRequest( url, isBackup, headers );
++                m_refreshedToken = false;
++            }
++            catch (const CurlException&)
++            {
++                m_refreshedToken = false;
++                throw;
++            }
++        }
++        // Has tried but failed
++        if ( ( status != 417 || m_no100Continue ) &&
++             ( status != 401 || getRefreshToken( ).empty( ) || 
m_refreshedToken ) ) throw;
++    }
++    m_refreshedToken = false;
++    return response;
++}
++
+ libcmis::HttpResponsePtr HttpSession::httpPutRequest( string url, istream& 
is, vector< string > headers )
+ {
+     checkOAuth2( url );
+diff --git a/src/libcmis/http-session.hxx b/src/libcmis/http-session.hxx
+index 851d52d..29de64d 100644
+--- a/src/libcmis/http-session.hxx
++++ b/src/libcmis/http-session.hxx
+@@ -132,6 +132,9 @@ class HttpSession
+         virtual void setOAuth2Data( libcmis::OAuth2DataPtr oauth2 );
+ 
+         libcmis::HttpResponsePtr httpGetRequest( std::string url );
++        libcmis::HttpResponsePtr httpPatchRequest( std::string url,
++                                                 std::istream& is,
++                                                 std::vector< std::string > 
headers );
+         libcmis::HttpResponsePtr httpPutRequest( std::string url,
+                                                  std::istream& is,
+                                                  std::vector< std::string > 
headers );
+diff --git a/src/libcmis/oauth2-handler.cxx b/src/libcmis/oauth2-handler.cxx
+index a3320e3..842769f 100644
+--- a/src/libcmis/oauth2-handler.cxx
++++ b/src/libcmis/oauth2-handler.cxx
+@@ -91,8 +91,8 @@ void OAuth2Handler::fetchTokens( string authCode )
+     string post =
+         "code="              + authCode +
+         "&client_id="        + m_data->getClientId() +
+-        "&client_secret="    + m_data->getClientSecret() +
+         "&redirect_uri="     + m_data->getRedirectUri() +
++        "&scope="            + libcmis::escape( m_data->getScope() ) +
+         "&grant_type=authorization_code" ;
+ 
+     istringstream is( post );
+@@ -121,7 +121,6 @@ void OAuth2Handler::refresh( )
+     string post =
+         "refresh_token="     + m_refresh +
+         "&client_id="        + m_data->getClientId() +
+-        "&client_secret="    + m_data->getClientSecret() +
+         "&grant_type=refresh_token" ;
+ 
+     istringstream is( post );
+diff --git a/src/libcmis/oauth2-providers.cxx 
b/src/libcmis/oauth2-providers.cxx
+index 5a4926b..db6fbef 100644
+--- a/src/libcmis/oauth2-providers.cxx
++++ b/src/libcmis/oauth2-providers.cxx
+@@ -311,7 +311,7 @@ OAuth2Parser OAuth2Providers::getOAuth2Parser( const 
std::string& url )
+         return OAuth2Alfresco;
+     else if ( boost::starts_with( url, "https://www.googleapis.com/drive/v2"; 
) )
+         return OAuth2Gdrive;
+-    else if ( boost::starts_with( url, "https://apis.live.net/v5.0"; ) )
++    else if ( boost::starts_with( url, "https://graph.microsoft.com/v1.0"; ) )
+         return OAuth2Onedrive;
+ 
+     return OAuth2Gdrive;
+diff --git a/src/libcmis/onedrive-document.cxx 
b/src/libcmis/onedrive-document.cxx
+index f753b42..863a92f 100644
+--- a/src/libcmis/onedrive-document.cxx
++++ b/src/libcmis/onedrive-document.cxx
+@@ -73,7 +73,7 @@ boost::shared_ptr< istream > 
OneDriveDocument::getContentStream( string /*stream
+     boost::shared_ptr< istream > stream;
+     string streamUrl = getStringProperty( "source" );
+     if ( streamUrl.empty( ) )
+-        throw libcmis::Exception( "can not found stream url" );
++        throw libcmis::Exception( "could not find stream url" );
+ 
+     try
+     {
+@@ -89,15 +89,15 @@ boost::shared_ptr< istream > 
OneDriveDocument::getContentStream( string /*stream
+ void OneDriveDocument::setContentStream( boost::shared_ptr< ostream > os, 
+                                          string /*contentType*/, 
+                                          string fileName, 
+-                                         bool /*overwrite*/ ) 
++                                         bool bReplaceExisting )
+ {
+     if ( !os.get( ) )
+         throw libcmis::Exception( "Missing stream" );
+-    
++
+     string metaUrl = getUrl( );
+ 
+     // Update file name meta information
+-    if ( !fileName.empty( ) && fileName != getContentFilename( ) )
++    if ( bReplaceExisting && !fileName.empty( ) && fileName != 
getContentFilename( ) )
+     {
+         Json metaJson;
+         Json fileJson( fileName.c_str( ) );
+@@ -108,7 +108,7 @@ void OneDriveDocument::setContentStream( 
boost::shared_ptr< ostream > os,
+         headers.push_back( "Content-Type: application/json" );
+         try
+         {
+-            getSession()->httpPutRequest( metaUrl, is, headers );
++            getSession()->httpPatchRequest( metaUrl, is, headers );
+         }
+         catch ( const CurlException& e )
+         {
+@@ -117,9 +117,9 @@ void OneDriveDocument::setContentStream( 
boost::shared_ptr< ostream > os,
+     }
+ 
+     fileName = libcmis::escape( getStringProperty( "cmis:name" ) );
+-    string putUrl = getSession( )->getBindingUrl( ) + "/" + 
+-                    getStringProperty( "cmis:parentId" ) + "/files/" +
+-                    fileName + "?overwrite=true";
++    string putUrl = getSession( )->getBindingUrl( ) + "/me/drive/items/" +
++                    getStringProperty( "cmis:parentId" ) + ":/" +
++                    fileName + ":/content";
+     
+     // Upload stream
+     boost::shared_ptr< istream> is ( new istream ( os->rdbuf( ) ) );
+@@ -142,6 +142,7 @@ void OneDriveDocument::setContentStream( 
boost::shared_ptr< ostream > os,
+ libcmis::DocumentPtr OneDriveDocument::checkOut( )
+ {
+     // OneDrive doesn't have CheckOut, so just return the same document here
++    // TODO: no longer true - onedrive now has checkout/checkin
+     libcmis::ObjectPtr obj = getSession( )->getObject( getId( ) );
+     libcmis::DocumentPtr checkout =
+         boost::dynamic_pointer_cast< libcmis::Document > ( obj );
+diff --git a/src/libcmis/onedrive-folder.cxx b/src/libcmis/onedrive-folder.cxx
+index a9ae694..c1980c8 100644
+--- a/src/libcmis/onedrive-folder.cxx
++++ b/src/libcmis/onedrive-folder.cxx
+@@ -57,7 +57,9 @@ OneDriveFolder::~OneDriveFolder( )
+ vector< libcmis::ObjectPtr > OneDriveFolder::getChildren( ) 
+ {
+     vector< libcmis::ObjectPtr > children;
+-    string query = getSession( )->getBindingUrl( ) + "/" + getId( ) + 
"/files";
++    // TODO: limited to 200 items by default - to get more one would have to
++    // follow @odata.nextLink or change pagination size
++    string query = getSession( )->getBindingUrl( ) + "/me/drive/items/" + 
getId( ) + "/children";
+ 
+     string res;
+     try
+@@ -70,7 +72,7 @@ vector< libcmis::ObjectPtr > OneDriveFolder::getChildren( )
+     }
+ 
+     Json jsonRes = Json::parse( res );
+-    Json::JsonVector objs = jsonRes["data"].getList( );
++    Json::JsonVector objs = jsonRes["value"].getList( );
+     
+     // Create children objects from Json objects
+     for(unsigned int i = 0; i < objs.size(); i++)
+@@ -85,8 +87,7 @@ libcmis::FolderPtr OneDriveFolder::createFolder(
+     const PropertyPtrMap& properties ) 
+ {
+     Json propsJson = OneDriveUtils::toOneDriveJson( properties );
+-
+-    string uploadUrl = getSession( )->getBindingUrl( ) + "/" + getId( );
++    string uploadUrl = getSession( )->getBindingUrl( ) + "/me/drive/items/" + 
getId( ) + "/children";
+     
+     std::istringstream is( propsJson.toString( ) );
+     string response;
+@@ -126,9 +127,10 @@ libcmis::DocumentPtr OneDriveFolder::createDocument(
+         }
+     }
+ 
++    // TODO: limited to 4MB, larger uploads need dedicated UploadSession
+     fileName = libcmis::escape( fileName );
+-    string newDocUrl = getSession( )->getBindingUrl( ) + "/" +
+-                       getId( ) + "/files/" + fileName;
++    string newDocUrl = getSession( )->getBindingUrl( ) + "/me/drive/items/" +
++                       getId( ) + ":/" + fileName + ":/content";
+     boost::shared_ptr< istream> is ( new istream ( os->rdbuf( ) ) );
+     vector< string > headers;
+     string res;
+diff --git a/src/libcmis/onedrive-object.cxx b/src/libcmis/onedrive-object.cxx
+index 976a97b..8deb591 100644
+--- a/src/libcmis/onedrive-object.cxx
++++ b/src/libcmis/onedrive-object.cxx
+@@ -65,7 +65,7 @@ void OneDriveObject::initializeFromJson ( Json json, string 
/*id*/, string /*nam
+     Json::JsonObject objs = json.getObjects( );
+     Json::JsonObject::iterator it;
+     PropertyPtr property;
+-    bool isFolder = json["type"].toString( ) == "folder";
++    bool isFolder = json["folder"].toString( ) != "";
+     for ( it = objs.begin( ); it != objs.end( ); ++it)
+     {
+         property.reset( new OneDriveProperty( it->first, it->second ) );
+@@ -74,7 +74,12 @@ void OneDriveObject::initializeFromJson ( Json json, string 
/*id*/, string /*nam
+         {
+             property.reset( new OneDriveProperty( 
"cmis:contentStreamFileName", it->second ) );
+             m_properties[ property->getPropertyType( )->getId()] = property;
+-        }
++        } else if ( it->first == "parentReference" ) {
++            if (it->second["id"].toString() != "") {
++                property.reset( new OneDriveProperty( "cmis:parentId", 
it->second["id"] ) );
++                m_properties[ property->getPropertyType( )->getId()] = 
property;
++            }
++       }
+     }
+ 
+     m_refreshTimestamp = time( NULL );
+@@ -122,7 +127,7 @@ void OneDriveObject::remove( bool /*allVersions*/ )
+ 
+ string OneDriveObject::getUrl( )
+ {
+-    return getSession( )->getBindingUrl( ) + "/" + getId( );
++    return getSession( )->getBindingUrl( ) + "/me/drive/items/" + getId( );
+ }
+ 
+ string OneDriveObject::getUploadUrl( )
+@@ -152,7 +157,7 @@ libcmis::ObjectPtr OneDriveObject::updateProperties(
+     {   
+         vector< string > headers;
+         headers.push_back( "Content-Type: application/json" );
+-        response = getSession( )->httpPutRequest( getUrl( ), is, headers );
++        response = getSession( )->httpPatchRequest( getUrl( ), is, headers );
+     }
+     catch ( const CurlException& e )
+     {   
+diff --git a/src/libcmis/onedrive-repository.cxx 
b/src/libcmis/onedrive-repository.cxx
+index 3eaac9c..b01f5c2 100644
+--- a/src/libcmis/onedrive-repository.cxx
++++ b/src/libcmis/onedrive-repository.cxx
+@@ -35,7 +35,7 @@ OneDriveRepository::OneDriveRepository( ) :
+     m_description = "One Drive repository";
+     m_productName = "One Drive";
+     m_productVersion = "v5";
+-    m_rootId = "me/skydrive";
++    m_rootId = "/me/drive/root";
+  
+     m_capabilities[ ACL ] = "discover";
+     m_capabilities[ AllVersionsSearchable ] = "true";
+diff --git a/src/libcmis/onedrive-session.cxx 
b/src/libcmis/onedrive-session.cxx
+index a6652b4..05ff45e 100644
+--- a/src/libcmis/onedrive-session.cxx
++++ b/src/libcmis/onedrive-session.cxx
+@@ -74,7 +74,9 @@ libcmis::ObjectPtr OneDriveSession::getObject( string 
objectId )
+ {
+     // Run the http request to get the properties definition
+     string res;
+-    string objectLink = m_bindingUrl + "/" + objectId;
++    string objectLink = m_bindingUrl + "/me/drive/items/" + objectId;
++    if (objectId == getRootId())
++        objectLink = m_bindingUrl + objectId;
+     try
+     {
+         res = httpGetRequest( objectLink )->getStream()->str();
+@@ -90,12 +92,11 @@ libcmis::ObjectPtr OneDriveSession::getObject( string 
objectId )
+ libcmis::ObjectPtr OneDriveSession::getObjectFromJson( Json& jsonRes ) 
+ {
+     libcmis::ObjectPtr object;
+-    string kind = jsonRes["type"].toString( );
+-    if ( kind == "folder" || kind == "album" )
++    if ( jsonRes["folder"].toString() != "" )
+     {
+         object.reset( new OneDriveFolder( this, jsonRes ) );
+     }
+-    else if ( kind == "file" )
++    else if ( jsonRes["file"].toString() != "" )
+     {
+         object.reset( new OneDriveDocument( this, jsonRes ) );
+     }
+@@ -108,44 +109,18 @@ libcmis::ObjectPtr OneDriveSession::getObjectFromJson( 
Json& jsonRes )
+ 
+ libcmis::ObjectPtr OneDriveSession::getObjectByPath( string path )
+ {
+-    string id;
+-    if ( path == "/" )
+-    {
+-        id = "me/skydrive";
+-    }
+-    else
++    string res;
++    string objectQuery = m_bindingUrl + "/me/drive/root:" + libcmis::escape( 
path );
++    try
+     {
+-        path = "/SkyDrive" + path;
+-        size_t pos = path.rfind("/");
+-        string name = libcmis::escape( path.substr( pos + 1, path.size( ) ) );
+-        string res;
+-        string objectQuery = m_bindingUrl + "/me/skydrive/search?q=" + name;
+-        try
+-        {
+-            res = httpGetRequest( objectQuery )->getStream( )->str( );
+-        }
+-        catch ( const CurlException& e )
+-        {
+-            throw e.getCmisException( );
+-        }
+-        Json jsonRes = Json::parse( res );
+-        Json::JsonVector objs = jsonRes["data"].getList( );
+-        
+-        // Searching for a match in the path to the object
+-        for ( unsigned int i = 0; i < objs.size( ); i++ )
+-        {   
+-            if ( isAPathMatch( objs[i], path ) )
+-            {
+-                id = objs[i]["id"].toString( );
+-                break;
+-            }
+-        }
++        res = httpGetRequest( objectQuery )->getStream( )->str( );
+     }
+-    if ( id.empty( ) )
++    catch ( const CurlException& e )
+     {
+-        throw libcmis::Exception( "No file could be found" );
++        throw libcmis::Exception( "No file could be found for path " + path + 
": " + e.what() );
+     }
+-    return getObject( id );
++    Json jsonRes = Json::parse( res );
++    return getObjectFromJson( jsonRes );
+ }
+ 
+ bool OneDriveSession::isAPathMatch( Json objectJson, string path )
+diff --git a/src/libcmis/onedrive-utils.cxx b/src/libcmis/onedrive-utils.cxx
+index dc6ec5d..17ed324 100644
+--- a/src/libcmis/onedrive-utils.cxx
++++ b/src/libcmis/onedrive-utils.cxx
+@@ -44,16 +44,16 @@ string OneDriveUtils::toCmisKey( const string& key )
+         convertedKey = "cmis:createdBy";
+     else if ( key == "description" )
+         convertedKey = "cmis:description";
+-    else if ( key == "created_time" )
++    else if ( key == "createdDateTime" )
+         convertedKey = "cmis:creationDate";
+-    else if ( key == "updated_time" )
++    else if ( key == "lastModifiedDateTime" )
+         convertedKey = "cmis:lastModificationDate";
+     else if ( key == "name" )
+         convertedKey = "cmis:name";
+     else if ( key == "size" )
+         convertedKey = "cmis:contentStreamLength";
+-    else if ( key == "parent_id" )
+-        convertedKey = "cmis:parentId";
++    else if ( key == "@microsoft.graph.downloadUrl" )
++        convertedKey = "source";
+     else convertedKey = key;
+     return convertedKey;
+ }
+@@ -75,8 +75,6 @@ string OneDriveUtils::toOneDriveKey( const string& key )
+         convertedKey = "name";
+     else if ( key == "cmis:contentStreamLength" )
+         convertedKey = "file_size";
+-    else if ( key == "cmis:parentId" )
+-        convertedKey = "parent_id";
+     else convertedKey = key;
+     return convertedKey;
+ }
+diff --git a/src/libcmis/session-factory.cxx b/src/libcmis/session-factory.cxx
+index ba55cd9..e740afb 100644
+--- a/src/libcmis/session-factory.cxx
++++ b/src/libcmis/session-factory.cxx
+@@ -71,7 +71,7 @@ namespace libcmis
+                 session = new GDriveSession( bindingUrl, username, password,
+                                              oauth2, verbose );
+             }
+-            else if ( bindingUrl == "https://apis.live.net/v5.0"; )
++            else if ( bindingUrl == "https://graph.microsoft.com/v1.0"; )
+             {
+                 session = new OneDriveSession( bindingUrl, username, password,
+                                                oauth2, verbose);

diff --git 
a/dev-cpp/libcmis/files/libcmis-0.5.2-gdrive-do-not-allow-copying.patch 
b/dev-cpp/libcmis/files/libcmis-0.5.2-gdrive-do-not-allow-copying.patch
new file mode 100644
index 000000000000..c2056d2aa239
--- /dev/null
+++ b/dev-cpp/libcmis/files/libcmis-0.5.2-gdrive-do-not-allow-copying.patch
@@ -0,0 +1,722 @@
+From 8434965bed146a1ff543787336cf8d98092b42e6 Mon Sep 17 00:00:00 2001
+From: David Tardon <[email protected]>
+Date: Sat, 30 Mar 2019 16:35:43 +0100
+Subject: [PATCH] gdrive-session: do not allow copying
+
+---
+ qa/libcmis/test-gdrive.cxx     | 167 +++++++++++++++++----------------
+ src/libcmis/gdrive-session.cxx |   5 -
+ src/libcmis/gdrive-session.hxx |   4 +-
+ 3 files changed, 87 insertions(+), 89 deletions(-)
+
+diff --git a/qa/libcmis/test-gdrive.cxx b/qa/libcmis/test-gdrive.cxx
+index ef9afd8..b04e230 100644
+--- a/qa/libcmis/test-gdrive.cxx
++++ b/qa/libcmis/test-gdrive.cxx
+@@ -30,6 +30,7 @@
+ #include <cppunit/TestFixture.h>
+ #include <cppunit/TestAssert.h>
+ 
++#include <memory>
+ #include <string>
+ 
+ #if defined __clang__
+@@ -82,6 +83,8 @@ namespace
+     }
+ }
+ 
++typedef std::unique_ptr<GDriveSession> GDriveSessionPtr;
++
+ class GDriveTest : public CppUnit::TestFixture
+ {
+     public:
+@@ -160,10 +163,10 @@ class GDriveTest : public CppUnit::TestFixture
+         CPPUNIT_TEST_SUITE_END( );
+ 
+     private:
+-        GDriveSession getTestSession( string username, string password, bool 
with2FA = false );
++        GDriveSessionPtr getTestSession( string username, string password, 
bool with2FA = false );
+ };
+ 
+-GDriveSession GDriveTest::getTestSession( string username, string password, 
bool with2FA )
++GDriveSessionPtr GDriveTest::getTestSession( string username, string 
password, bool with2FA )
+ {
+     libcmis::OAuth2DataPtr oauth2(
+         new libcmis::OAuth2Data( AUTH_URL, TOKEN_URL, SCOPE,
+@@ -207,12 +210,12 @@ GDriveSession GDriveTest::getTestSession( string 
username, string password, bool
+     curl_mockup_addResponse ( TOKEN_URL.c_str( ), empty.c_str( ), "POST",
+                               DATA_DIR "/gdrive/token-response.json", 200, 
true );
+ 
+-    return GDriveSession( BASE_URL, username, password, oauth2, false );
++    return GDriveSessionPtr( new GDriveSession( BASE_URL, username, password, 
oauth2, false ) );
+ }
+ 
+ void GDriveTest::sessionAuthenticationTest( )
+ {
+-    GDriveSession session = getTestSession( USERNAME, PASSWORD );
++    GDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+     string empty;
+ 
+     // Check authentication request for email
+@@ -259,18 +262,18 @@ void GDriveTest::sessionAuthenticationTest( )
+     CPPUNIT_ASSERT_EQUAL_MESSAGE(
+         "Wrong access token",
+          string ( "mock-access-token" ),
+-         session.m_oauth2Handler->getAccessToken( ));
++         session->m_oauth2Handler->getAccessToken( ));
+     CPPUNIT_ASSERT_EQUAL_MESSAGE(
+         "Wrong refresh token",
+         string ("mock-refresh-token"),
+-        session.m_oauth2Handler->getRefreshToken( ));
++        session->m_oauth2Handler->getRefreshToken( ));
+ }
+ 
+ void GDriveTest::sessionAuthenticationTestWith2FA( )
+ {
+     libcmis::SessionFactory::setOAuth2AuthCodeProvider( lcl_authCodeFallback 
);
+ 
+-    GDriveSession session = getTestSession( USERNAME2, PASSWORD2, true );
++    GDriveSessionPtr session = getTestSession( USERNAME2, PASSWORD2, true );
+     string empty;
+ 
+     // Check authentication request for email
+@@ -327,11 +330,11 @@ void GDriveTest::sessionAuthenticationTestWith2FA( )
+     CPPUNIT_ASSERT_EQUAL_MESSAGE(
+         "Wrong access token",
+          string ( "mock-access-token" ),
+-         session.m_oauth2Handler->getAccessToken( ));
++         session->m_oauth2Handler->getAccessToken( ));
+     CPPUNIT_ASSERT_EQUAL_MESSAGE(
+         "Wrong refresh token",
+         string ("mock-refresh-token"),
+-        session.m_oauth2Handler->getRefreshToken( ));
++        session->m_oauth2Handler->getRefreshToken( ));
+ }
+ 
+ void GDriveTest::sessionExpiryTokenGetTest( )
+@@ -340,7 +343,7 @@ void GDriveTest::sessionExpiryTokenGetTest( )
+     // We need to use the refresh key to get a new one.
+ 
+     curl_mockup_reset( );
+-    GDriveSession session = getTestSession( USERNAME, PASSWORD );
++    GDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+ 
+     curl_mockup_reset( );
+     static const string objectId("aFileId");
+@@ -354,17 +357,17 @@ void GDriveTest::sessionExpiryTokenGetTest( )
+     try
+     {
+         // GET expires, need to refresh then GET again
+-        libcmis::ObjectPtr obj = session.getObject( objectId );
++        libcmis::ObjectPtr obj = session->getObject( objectId );
+     }
+     catch ( ... )
+     {
+-        if ( session.getHttpStatus( ) == 401 )
++        if ( session->getHttpStatus( ) == 401 )
+         {
+             // Check if access token is refreshed
+             CPPUNIT_ASSERT_EQUAL_MESSAGE(
+                    "wrong access token",
+                    string ( "new-access-token" ),
+-                   session.m_oauth2Handler->getAccessToken( ) );
++                   session->m_oauth2Handler->getAccessToken( ) );
+         }
+     }
+ }
+@@ -375,7 +378,7 @@ void GDriveTest::sessionExpiryTokenPostTest( )
+     // We need to use the refresh key to get a new one.
+ 
+     curl_mockup_reset( );
+-    GDriveSession session = getTestSession( USERNAME, PASSWORD );
++    GDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+ 
+     curl_mockup_reset( );
+     static const string folderId("aFileId");
+@@ -392,7 +395,7 @@ void GDriveTest::sessionExpiryTokenPostTest( )
+     // refresh and then POST again
+     curl_mockup_addResponse( metaUrl.c_str( ), "",
+                                "POST", "", 401, false );
+-    libcmis::FolderPtr parent = session.getFolder( folderId );
++    libcmis::FolderPtr parent = session->getFolder( folderId );
+ 
+     try
+     {
+@@ -402,13 +405,13 @@ void GDriveTest::sessionExpiryTokenPostTest( )
+     }
+     catch ( ... )
+     {
+-        if ( session.getHttpStatus( ) == 401 )
++        if ( session->getHttpStatus( ) == 401 )
+         {
+             // Check if access token is refreshed
+             CPPUNIT_ASSERT_EQUAL_MESSAGE(
+                    "wrong access token",
+                    string ( "new-access-token" ),
+-                   session.m_oauth2Handler->getAccessToken( ) );
++                   session->m_oauth2Handler->getAccessToken( ) );
+         }
+     }
+ }
+@@ -419,7 +422,7 @@ void GDriveTest::sessionExpiryTokenDeleteTest( )
+     // We need to use the refresh key to get a new one.
+ 
+     curl_mockup_reset( );
+-    GDriveSession session = getTestSession( USERNAME, PASSWORD );
++    GDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+ 
+     curl_mockup_reset( );
+     static const string objectId("aFileId");
+@@ -433,9 +436,9 @@ void GDriveTest::sessionExpiryTokenDeleteTest( )
+     // 401 response, token is expired
+     curl_mockup_addResponse( url.c_str( ),"", "DELETE", "", 401, false);
+ 
+-    libcmis::ObjectPtr obj = session.getObject( objectId );
++    libcmis::ObjectPtr obj = session->getObject( objectId );
+ 
+-    libcmis::ObjectPtr object = session.getObject( objectId );
++    libcmis::ObjectPtr object = session->getObject( objectId );
+ 
+     try
+     {
+@@ -444,13 +447,13 @@ void GDriveTest::sessionExpiryTokenDeleteTest( )
+     }
+     catch ( ... )
+     {
+-        if ( session.getHttpStatus( ) == 401 )
++        if ( session->getHttpStatus( ) == 401 )
+         {
+             // Check if access token is refreshed
+             CPPUNIT_ASSERT_EQUAL_MESSAGE(
+                    "wrong access token",
+                    string ( "new-access-token" ),
+-                   session.m_oauth2Handler->getAccessToken( ) );
++                   session->m_oauth2Handler->getAccessToken( ) );
+             const struct HttpRequest* deleteRequest = curl_mockup_getRequest( 
url.c_str( ), "", "DELETE" );
+             CPPUNIT_ASSERT_MESSAGE( "Delete request not sent", deleteRequest 
);
+             curl_mockup_HttpRequest_free( deleteRequest );
+@@ -465,7 +468,7 @@ void GDriveTest::sessionExpiryTokenPutTest( )
+     // We need to use the refresh key to get a new one.
+ 
+     curl_mockup_reset( );
+-    GDriveSession session = getTestSession( USERNAME, PASSWORD );
++    GDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+ 
+     curl_mockup_reset( );
+     static const string objectId("aFileId");
+@@ -480,7 +483,7 @@ void GDriveTest::sessionExpiryTokenPutTest( )
+     // 401 response, token is expired
+     curl_mockup_addResponse( url.c_str( ),"", "PUT", "", 401, false );
+ 
+-    libcmis::ObjectPtr object = session.getObject( objectId );
++    libcmis::ObjectPtr object = session->getObject( objectId );
+ 
+     try
+     {
+@@ -489,13 +492,13 @@ void GDriveTest::sessionExpiryTokenPutTest( )
+     }
+     catch ( ... )
+     {
+-        if ( session.getHttpStatus( ) == 401 )
++        if ( session->getHttpStatus( ) == 401 )
+         {
+             // Check if access token is refreshed
+             CPPUNIT_ASSERT_EQUAL_MESSAGE(
+                    "wrong access token",
+                    string ( "new-access-token" ),
+-                   session.m_oauth2Handler->getAccessToken( ) );
++                   session->m_oauth2Handler->getAccessToken( ) );
+         }
+     }
+ }
+@@ -511,12 +514,12 @@ void GDriveTest::getDocumentTest( )
+     curl_mockup_reset( );
+     static const string objectId ("aFileId");
+ 
+-    GDriveSession session = getTestSession( USERNAME, PASSWORD );
++    GDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+     string url = BASE_URL + "/files/" + objectId;
+     curl_mockup_addResponse( url.c_str( ), "",
+                              "GET", DATA_DIR "/gdrive/document.json", 200, 
true);
+ 
+-    libcmis::ObjectPtr obj = session.getObject( objectId );
++    libcmis::ObjectPtr obj = session->getObject( objectId );
+ 
+     // Check if we got the document object.
+     libcmis::DocumentPtr document = boost::dynamic_pointer_cast< 
libcmis::Document >( obj );
+@@ -546,7 +549,7 @@ void GDriveTest::getFolderTest( )
+ {
+     curl_mockup_reset( );
+ 
+-    GDriveSession session = getTestSession( USERNAME, PASSWORD );
++    GDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+     static const string folderId( "aFolderId" );
+     static const string parentId( "parentID" );
+     string url = BASE_URL + "/files/" + folderId;
+@@ -557,7 +560,7 @@ void GDriveTest::getFolderTest( )
+     curl_mockup_addResponse( parentUrl.c_str( ), "",
+                              "GET", DATA_DIR "/gdrive/folder.json", 200, 
true);
+     // Check if we got the Folder object.
+-    libcmis::FolderPtr folder = session.getFolder( folderId );
++    libcmis::FolderPtr folder = session->getFolder( folderId );
+     CPPUNIT_ASSERT_MESSAGE( "Fetched object should be an instance of 
libcmis::FolderPtr",
+             NULL != folder );
+ 
+@@ -578,7 +581,7 @@ void GDriveTest::getFolderTest( )
+ void GDriveTest::getDocumentParentsTest( )
+ {
+     curl_mockup_reset( );
+-    GDriveSession session = getTestSession( USERNAME, PASSWORD );
++    GDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+ 
+     static const string documentId( "aFileId" );
+     static const string parentId( "aFolderId" );
+@@ -594,7 +597,7 @@ void GDriveTest::getDocumentParentsTest( )
+     curl_mockup_addResponse( parent2Url.c_str( ), "",
+                              "GET", DATA_DIR "/gdrive/folder2.json", 200, 
true);
+ 
+-    libcmis::ObjectPtr object = session.getObject( "aFileId" );
++    libcmis::ObjectPtr object = session->getObject( "aFileId" );
+     libcmis::DocumentPtr document = boost::dynamic_pointer_cast< 
libcmis::Document >( object );
+ 
+     CPPUNIT_ASSERT_MESSAGE( "Document expected", document != NULL );
+@@ -610,7 +613,7 @@ void GDriveTest::getDocumentParentsTest( )
+ void GDriveTest::getContentStreamTest( )
+ {
+     curl_mockup_reset( );
+-    GDriveSession session = getTestSession( USERNAME, PASSWORD );
++    GDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+ 
+     static const string documentId( "aFileId" );
+     string url = BASE_URL + "/files/" + documentId;
+@@ -620,7 +623,7 @@ void GDriveTest::getContentStreamTest( )
+     string downloadUrl = "https://downloadLink";;
+     curl_mockup_addResponse( downloadUrl.c_str( ), "", "GET", 
expectedContent.c_str( ), 0, false );
+ 
+-    libcmis::ObjectPtr object = session.getObject( documentId );
++    libcmis::ObjectPtr object = session->getObject( documentId );
+     libcmis::DocumentPtr document = boost::dynamic_pointer_cast< 
libcmis::Document >( object );
+ 
+     try
+@@ -642,7 +645,7 @@ void GDriveTest::getContentStreamTest( )
+ void GDriveTest::setContentStreamTest( )
+ {
+     curl_mockup_reset( );
+-    GDriveSession session = getTestSession( USERNAME, PASSWORD );
++    GDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+ 
+     const string documentId( "aFileId" );
+     const string uploadBaseUrl = 
"https://www.googleapis.com/upload/drive/v2/files/";;
+@@ -652,7 +655,7 @@ void GDriveTest::setContentStreamTest( )
+     curl_mockup_addResponse( url.c_str( ), "",
+                                "GET", DATA_DIR "/gdrive/document2.json", 200, 
true);
+ 
+-    libcmis::ObjectPtr object = session.getObject( documentId );
++    libcmis::ObjectPtr object = session->getObject( documentId );
+     libcmis::DocumentPtr document = boost::dynamic_pointer_cast< 
libcmis::Document >( object );
+ 
+     curl_mockup_addResponse( url.c_str( ), "",
+@@ -687,7 +690,7 @@ void GDriveTest::setContentStreamGdocTest( )
+ {
+ 
+     curl_mockup_reset( );
+-    GDriveSession session = getTestSession( USERNAME, PASSWORD );
++    GDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+ 
+     const string documentId( "aFileId" );
+     const string uploadBaseUrl = 
"https://www.googleapis.com/upload/drive/v2/files/";;
+@@ -697,7 +700,7 @@ void GDriveTest::setContentStreamGdocTest( )
+     curl_mockup_addResponse( url.c_str( ), "",
+                                "GET", DATA_DIR "/gdrive/document.json", 200, 
true);
+ 
+-    libcmis::ObjectPtr object = session.getObject( documentId );
++    libcmis::ObjectPtr object = session->getObject( documentId );
+     libcmis::DocumentPtr document = boost::dynamic_pointer_cast< 
libcmis::Document >( object );
+ 
+     curl_mockup_addResponse( url.c_str( ), "convert=true",
+@@ -728,7 +731,7 @@ void GDriveTest::getChildrenTest( )
+ {
+     curl_mockup_reset( );
+ 
+-    GDriveSession session = getTestSession( USERNAME, PASSWORD );
++    GDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+     static const string folderId ("aFolderId");
+     string url = BASE_URL + "/files/" + folderId;
+     curl_mockup_addResponse( url.c_str( ), "",
+@@ -742,7 +745,7 @@ void GDriveTest::getChildrenTest( )
+     curl_mockup_addResponse( urlChildDocument.c_str( ), "",
+                              "GET", DATA_DIR "/gdrive/document.json", 200, 
true);
+ 
+-    libcmis::ObjectPtr obj = session.getObject( folderId );
++    libcmis::ObjectPtr obj = session->getObject( folderId );
+ 
+     // Check if we got the Folder object.
+     libcmis::FolderPtr folder = boost::dynamic_pointer_cast< libcmis::Folder 
>( obj );
+@@ -777,10 +780,10 @@ void GDriveTest::getTypeTest( )
+ {
+     curl_mockup_reset( );
+ 
+-    GDriveSession session = getTestSession( USERNAME, PASSWORD );
++    GDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+ 
+     string expectedId( "cmis:document" );
+-    libcmis::ObjectTypePtr actual = session.getType( expectedId );
++    libcmis::ObjectTypePtr actual = session->getType( expectedId );
+ 
+     CPPUNIT_ASSERT_EQUAL_MESSAGE( "Wrong Id for fetched type", expectedId, 
actual->getId( ) );
+ }
+@@ -789,8 +792,8 @@ void GDriveTest::getRepositoriesTest( )
+ {
+      curl_mockup_reset( );
+ 
+-     GDriveSession session = getTestSession( USERNAME, PASSWORD );
+-     vector< libcmis::RepositoryPtr > actual = session.getRepositories( );
++     GDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
++     vector< libcmis::RepositoryPtr > actual = session->getRepositories( );
+ 
+      CPPUNIT_ASSERT_EQUAL_MESSAGE( "Wrong number of repositories", size_t( 1 
),
+                                    actual.size( ) );
+@@ -803,11 +806,11 @@ void GDriveTest::getObjectTest()
+ {
+     static const string objectId ("aFileId");
+ 
+-    GDriveSession session = getTestSession( USERNAME, PASSWORD );
++    GDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+     string url = BASE_URL + "/files/" + objectId;
+     curl_mockup_addResponse ( url.c_str( ), "",
+                               "GET", DATA_DIR "/gdrive/gdoc-file.json", 200, 
true);
+-    libcmis::ObjectPtr object = session.getObject( objectId );
++    libcmis::ObjectPtr object = session->getObject( objectId );
+     boost::shared_ptr<GDriveObject> obj = boost::dynamic_pointer_cast
+                                             <GDriveObject>(object);
+     CPPUNIT_ASSERT_EQUAL_MESSAGE( "Wrong Object Id", objectId,
+@@ -816,12 +819,12 @@ void GDriveTest::getObjectTest()
+ 
+ void GDriveTest::getObjectByPathRootTest()
+ {
+-    GDriveSession session = getTestSession( USERNAME, PASSWORD );
++    GDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+     string rootUrl = BASE_URL + "/files/root";
+     curl_mockup_addResponse ( rootUrl.c_str( ), "",
+                               "GET", DATA_DIR "/gdrive/folder.json", 200, 
true);
+ 
+-    libcmis::ObjectPtr object = session.getObjectByPath( "/" );
++    libcmis::ObjectPtr object = session->getObjectByPath( "/" );
+     CPPUNIT_ASSERT_EQUAL_MESSAGE( "Wrong Object Id",
+                                   string("testFolder"), object->getName( ) );
+ }
+@@ -829,7 +832,7 @@ void GDriveTest::getObjectByPathRootTest()
+ void GDriveTest::getObjectByPathTest()
+ {
+     // Mockup setup
+-    GDriveSession session = getTestSession( USERNAME, PASSWORD );
++    GDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+     string rootChildUrl = BASE_URL + "/files/root/children/";
+     curl_mockup_addResponse ( rootChildUrl.c_str( ), "q=title+=+'GDrive 
File'",
+                               "GET", DATA_DIR 
"/gdrive/root_child_search.json", 200, true );
+@@ -839,7 +842,7 @@ void GDriveTest::getObjectByPathTest()
+                              "GET", DATA_DIR "/gdrive/document.json", 200, 
true );
+ 
+     // Tested method
+-    libcmis::ObjectPtr object = session.getObjectByPath( "/GDrive File" );
++    libcmis::ObjectPtr object = session->getObjectByPath( "/GDrive File" );
+ 
+     // Check the result
+     CPPUNIT_ASSERT_EQUAL_MESSAGE( "Wrong Object",
+@@ -849,7 +852,7 @@ void GDriveTest::getObjectByPathTest()
+ void GDriveTest::getObjectByPathMissingTest()
+ {
+     // Mockup setup
+-    GDriveSession session = getTestSession( USERNAME, PASSWORD );
++    GDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+     string rootChildUrl = BASE_URL + "/files/root/children/";
+     curl_mockup_addResponse ( rootChildUrl.c_str( ), "q=title+=+'GDrive 
File'",
+                               "GET", DATA_DIR 
"/gdrive/root_child_missing.json", 200, true );
+@@ -857,7 +860,7 @@ void GDriveTest::getObjectByPathMissingTest()
+     // Tested method
+     try
+     {
+-        libcmis::ObjectPtr object = session.getObjectByPath( "/GDrive File" );
++        libcmis::ObjectPtr object = session->getObjectByPath( "/GDrive File" 
);
+         CPPUNIT_FAIL( "objectNotFound exception expected" );
+     }
+     catch ( libcmis::Exception& e )
+@@ -872,12 +875,12 @@ void GDriveTest::getDocumentAllowableActionsTest( )
+     curl_mockup_reset( );
+     static const string objectId ("aFileId");
+ 
+-    GDriveSession session = getTestSession( USERNAME, PASSWORD );
++    GDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+     string url = BASE_URL + "/files/" + objectId;
+     curl_mockup_addResponse( url.c_str( ), "",
+                              "GET", DATA_DIR "/gdrive/document.json", 200, 
true);
+ 
+-    libcmis::ObjectPtr obj = session.getObject( objectId );
++    libcmis::ObjectPtr obj = session->getObject( objectId );
+ 
+     libcmis::DocumentPtr document = boost::dynamic_pointer_cast< 
libcmis::Document >( obj );
+ 
+@@ -896,12 +899,12 @@ void GDriveTest::getFolderAllowableActionsTest( )
+     curl_mockup_reset( );
+     static const string folderId ("aFolderId");
+ 
+-    GDriveSession session = getTestSession( USERNAME, PASSWORD );
++    GDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+     string url = BASE_URL + "/files/" + folderId;
+     curl_mockup_addResponse( url.c_str( ), "",
+                              "GET", DATA_DIR "/gdrive/folder.json", 200, 
true);
+ 
+-    libcmis::FolderPtr folder = session.getFolder( folderId );
++    libcmis::FolderPtr folder = session->getFolder( folderId );
+ 
+     boost::shared_ptr< libcmis::AllowableActions > actions = 
folder->getAllowableActions( );
+ 
+@@ -917,14 +920,14 @@ void GDriveTest::getFolderAllowableActionsTest( )
+ void GDriveTest::checkOutTest( )
+ {
+     curl_mockup_reset( );
+-    GDriveSession session = getTestSession( USERNAME, PASSWORD );
++    GDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+ 
+     static const string documentId( "aFileId" );
+     string url = BASE_URL + "/files/" + documentId;
+     curl_mockup_addResponse( url.c_str( ), "",
+                                "GET", DATA_DIR "/gdrive/document.json", 200, 
true);
+ 
+-    libcmis::ObjectPtr object = session.getObject( documentId );
++    libcmis::ObjectPtr object = session->getObject( documentId );
+     libcmis::DocumentPtr document = boost::dynamic_pointer_cast< 
libcmis::Document >( object );
+     libcmis::DocumentPtr checkout = document->checkOut( );
+     CPPUNIT_ASSERT_MESSAGE( "CheckOut failed", NULL != checkout );
+@@ -933,7 +936,7 @@ void GDriveTest::checkOutTest( )
+ void GDriveTest::checkInTest( )
+ {
+     curl_mockup_reset( );
+-    GDriveSession session = getTestSession( USERNAME, PASSWORD );
++    GDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+ 
+     const string documentId( "aFileId" );
+     const string uploadBaseUrl = 
"https://www.googleapis.com/upload/drive/v2/files/";;
+@@ -943,7 +946,7 @@ void GDriveTest::checkInTest( )
+     curl_mockup_addResponse( url.c_str( ), "",
+                                "GET", DATA_DIR "/gdrive/document2.json", 200, 
true);
+ 
+-    libcmis::ObjectPtr object = session.getObject( documentId );
++    libcmis::ObjectPtr object = session->getObject( documentId );
+     libcmis::DocumentPtr document = boost::dynamic_pointer_cast< 
libcmis::Document >( object );
+ 
+     curl_mockup_addResponse( url.c_str( ), "",
+@@ -962,7 +965,7 @@ void GDriveTest::checkInTest( )
+ void GDriveTest::deleteTest( )
+ {
+     curl_mockup_reset( );
+-    GDriveSession session = getTestSession( USERNAME, PASSWORD );
++    GDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+ 
+     const string objectId( "aFileId" );
+ 
+@@ -971,7 +974,7 @@ void GDriveTest::deleteTest( )
+                                "GET", DATA_DIR "/gdrive/document2.json", 200, 
true);
+     curl_mockup_addResponse( url.c_str( ),"", "DELETE", "", 204, false);
+ 
+-    libcmis::ObjectPtr object = session.getObject( objectId );
++    libcmis::ObjectPtr object = session->getObject( objectId );
+ 
+     object->remove( );
+     const struct HttpRequest* deleteRequest = curl_mockup_getRequest( 
url.c_str( ), "", "DELETE" );
+@@ -982,7 +985,7 @@ void GDriveTest::deleteTest( )
+ void GDriveTest::moveTest( )
+ {
+     curl_mockup_reset( );
+-    GDriveSession session = getTestSession( USERNAME, PASSWORD );
++    GDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+     const string objectId( "aFileId" );
+     const string sourceId( "aFolderId" );
+     const string desId( "aNewFolderId" );
+@@ -999,10 +1002,10 @@ void GDriveTest::moveTest( )
+     curl_mockup_addResponse( desUrl.c_str( ), "",
+                                "GET", DATA_DIR "/gdrive/folder2.json", 200, 
true );
+ 
+-    libcmis::ObjectPtr object = session.getObject( objectId );
++    libcmis::ObjectPtr object = session->getObject( objectId );
+ 
+-    libcmis::FolderPtr source = session.getFolder( sourceId );
+-    libcmis::FolderPtr destination = session.getFolder( desId );
++    libcmis::FolderPtr source = session->getFolder( sourceId );
++    libcmis::FolderPtr destination = session->getFolder( desId );
+ 
+     object->move( source, destination );
+     const char* moveRequest = curl_mockup_getRequestBody( url.c_str( ), "", 
"PUT" );
+@@ -1015,7 +1018,7 @@ void GDriveTest::moveTest( )
+ void GDriveTest::createDocumentTest( )
+ {
+     curl_mockup_reset( );
+-    GDriveSession session = getTestSession( USERNAME, PASSWORD );
++    GDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+     const string documentId( "aFileId" );
+     const string folderId( "aFolderId" );
+ 
+@@ -1034,7 +1037,7 @@ void GDriveTest::createDocumentTest( )
+     curl_mockup_addResponse( documentUrl.c_str( ), "",
+                                "GET", DATA_DIR "/gdrive/document2.json", 200, 
true);
+ 
+-    libcmis::FolderPtr parent = session.getFolder( folderId );
++    libcmis::FolderPtr parent = session->getFolder( folderId );
+ 
+     try
+     {
+@@ -1067,7 +1070,7 @@ void GDriveTest::createDocumentTest( )
+ void GDriveTest::createFolderTest( )
+ {
+     curl_mockup_reset( );
+-    GDriveSession session = getTestSession( USERNAME, PASSWORD );
++    GDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+     const string folderId( "aFolderId" );
+ 
+     const string folderUrl = BASE_URL + "/files/" + folderId;
+@@ -1077,7 +1080,7 @@ void GDriveTest::createFolderTest( )
+                                "GET", DATA_DIR "/gdrive/folder.json", 200, 
true );
+     curl_mockup_addResponse( metaUrl.c_str( ), "",
+                                "POST", DATA_DIR "/gdrive/folder2.json", 200, 
true );
+-    libcmis::FolderPtr parent = session.getFolder( folderId );
++    libcmis::FolderPtr parent = session->getFolder( folderId );
+     try
+     {
+         PropertyPtrMap properties;
+@@ -1106,7 +1109,7 @@ void GDriveTest::createFolderTest( )
+ void GDriveTest::removeTreeTest( )
+ {
+     curl_mockup_reset( );
+-    GDriveSession session = getTestSession( USERNAME, PASSWORD );
++    GDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+     const string folderId( "aFolderId" );
+ 
+     const string folderUrl = BASE_URL + "/files/" + folderId;
+@@ -1116,7 +1119,7 @@ void GDriveTest::removeTreeTest( )
+                                "GET", DATA_DIR "/gdrive/folder.json", 200, 
true );
+     curl_mockup_addResponse( trashUrl.c_str( ), "",
+                                "POST", "", 200, false );
+-    libcmis::FolderPtr folder = session.getFolder( folderId );
++    libcmis::FolderPtr folder = session->getFolder( folderId );
+ 
+     // just make sure it doesn't crash
+     folder->removeTree( );
+@@ -1125,13 +1128,13 @@ void GDriveTest::removeTreeTest( )
+ void GDriveTest::getContentStreamWithRenditionsTest( )
+ {
+     curl_mockup_reset( );
+-    GDriveSession session = getTestSession( USERNAME, PASSWORD );
++    GDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+ 
+     static const string documentId( "aFileId" );
+     string url = BASE_URL + "/files/" + documentId;
+     curl_mockup_addResponse( url.c_str( ), "",
+                                "GET", DATA_DIR "/gdrive/document.json", 200, 
true);
+-    libcmis::ObjectPtr object = session.getObject( documentId );
++    libcmis::ObjectPtr object = session->getObject( documentId );
+     libcmis::DocumentPtr document = boost::dynamic_pointer_cast< 
libcmis::Document >( object );
+ 
+     // pdf stream
+@@ -1197,7 +1200,7 @@ void GDriveTest::getContentStreamWithRenditionsTest( )
+ void GDriveTest::updatePropertiesTest( )
+ {
+     curl_mockup_reset( );
+-    GDriveSession session = getTestSession( USERNAME, PASSWORD );
++    GDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+     const string documentId( "aFileId" );
+     const string documentUrl = BASE_URL + "/files/" + documentId;
+     curl_mockup_addResponse( documentUrl.c_str( ), "",
+@@ -1209,7 +1212,7 @@ void GDriveTest::updatePropertiesTest( )
+     // Values for the test
+     string propertyName( "cmis:name" );
+     string expectedValue( "New Title" );
+-    libcmis::ObjectPtr object = session.getObject( documentId );
++    libcmis::ObjectPtr object = session->getObject( documentId );
+ 
+     // Fill the map of properties to change
+     PropertyPtrMap newProperties;
+@@ -1264,16 +1267,16 @@ void GDriveTest::propertyCopyTest( )
+ void GDriveTest::getRefreshTokenTest( )
+ {
+     curl_mockup_reset( );
+-    GDriveSession session = getTestSession( USERNAME, PASSWORD );
++    GDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+     CPPUNIT_ASSERT_EQUAL_MESSAGE( "Refresh token does not match",
+                                   string ("mock-refresh-token"),
+-                                  session.getRefreshToken( ) );
++                                  session->getRefreshToken( ) );
+ }
+ 
+ void GDriveTest::getThumbnailUrlTest( )
+ {
+     curl_mockup_reset( );
+-    GDriveSession session = getTestSession( USERNAME, PASSWORD );
++    GDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+     const string documentId( "aFileId" );
+ 
+     const string documentUrl = BASE_URL + "/files/" + documentId;
+@@ -1281,7 +1284,7 @@ void GDriveTest::getThumbnailUrlTest( )
+     curl_mockup_addResponse( documentUrl.c_str( ), "",
+                                "GET", DATA_DIR "/gdrive/document.json", 200, 
true );
+ 
+-    libcmis::ObjectPtr document = session.getObject( documentId );
++    libcmis::ObjectPtr document = session->getObject( documentId );
+     CPPUNIT_ASSERT_EQUAL_MESSAGE( "Thumbnail URL does not match",
+                                    string ("https://aThumbnailLink";),
+                                    document->getThumbnailUrl( ) );
+@@ -1293,7 +1296,7 @@ void GDriveTest::getAllVersionsTest( )
+     curl_mockup_reset( );
+     static const string objectId ("aFileId");
+ 
+-    GDriveSession session = getTestSession( USERNAME, PASSWORD );
++    GDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+     string url = BASE_URL + "/files/" + objectId;
+     curl_mockup_addResponse( url.c_str( ), "",
+                              "GET", DATA_DIR "/gdrive/document.json", 200, 
true);
+@@ -1301,7 +1304,7 @@ void GDriveTest::getAllVersionsTest( )
+     curl_mockup_addResponse( revisionUrl.c_str( ), "",
+                              "GET", DATA_DIR "/gdrive/allVersions.json", 200, 
true);
+ 
+-    libcmis::ObjectPtr obj = session.getObject( objectId );
++    libcmis::ObjectPtr obj = session->getObject( objectId );
+ 
+     libcmis::DocumentPtr document = boost::dynamic_pointer_cast< 
libcmis::Document >( obj );
+ 
+diff --git a/src/libcmis/gdrive-session.cxx b/src/libcmis/gdrive-session.cxx
+index c31637a..87bb160 100644
+--- a/src/libcmis/gdrive-session.cxx
++++ b/src/libcmis/gdrive-session.cxx
+@@ -56,11 +56,6 @@ GDriveSession::GDriveSession ( string baseUrl,
+     }
+ }
+ 
+-GDriveSession::GDriveSession( const GDriveSession& copy ) :
+-    BaseSession( copy )
+-{
+-}
+-
+ GDriveSession::GDriveSession() :
+     BaseSession()
+ {
+diff --git a/src/libcmis/gdrive-session.hxx b/src/libcmis/gdrive-session.hxx
+index 6fd0777..f60ff6c 100644
+--- a/src/libcmis/gdrive-session.hxx
++++ b/src/libcmis/gdrive-session.hxx
+@@ -41,8 +41,6 @@ class GDriveSession : public BaseSession
+                        libcmis::OAuth2DataPtr oauth2,
+                        bool verbose = false );
+ 
+-        GDriveSession( const GDriveSession& copy );
+-
+         ~GDriveSession ( );
+ 
+         virtual libcmis::RepositoryPtr getRepository( );
+@@ -59,6 +57,8 @@ class GDriveSession : public BaseSession
+ 
+     private:
+         GDriveSession( );
++        GDriveSession( const GDriveSession& copy ) = delete;
++        GDriveSession& operator=( const GDriveSession& copy ) = delete;
+ };
+ 
+ #endif /* _GDRIVE_SESSION_HXX_ */

diff --git 
a/dev-cpp/libcmis/files/libcmis-0.5.2-onedrive-do-not-allow-copying.patch 
b/dev-cpp/libcmis/files/libcmis-0.5.2-onedrive-do-not-allow-copying.patch
new file mode 100644
index 000000000000..d14f36830f7b
--- /dev/null
+++ b/dev-cpp/libcmis/files/libcmis-0.5.2-onedrive-do-not-allow-copying.patch
@@ -0,0 +1,430 @@
+From d55b04376e509997b01e68bcacebd4cad2ec4002 Mon Sep 17 00:00:00 2001
+From: David Tardon <[email protected]>
+Date: Sat, 30 Mar 2019 16:18:40 +0100
+Subject: [PATCH] onedrive-session: do not allow copying
+
+---
+ qa/libcmis/test-onedrive.cxx     | 102 ++++++++++++++++---------------
+ src/libcmis/onedrive-session.cxx |   5 --
+ src/libcmis/onedrive-session.hxx |   4 +-
+ 3 files changed, 54 insertions(+), 57 deletions(-)
+
+diff --git a/qa/libcmis/test-onedrive.cxx b/qa/libcmis/test-onedrive.cxx
+index 1df1b30..b15edd1 100644
+--- a/qa/libcmis/test-onedrive.cxx
++++ b/qa/libcmis/test-onedrive.cxx
+@@ -68,6 +68,8 @@ static const string SCOPE ( "https://scope/url"; );
+ static const string REDIRECT_URI ("redirect:uri" );
+ static const string BASE_URL ( "https://base/url"; );
+ 
++typedef std::unique_ptr<OneDriveSession> OneDriveSessionPtr;
++
+ class OneDriveTest : public CppUnit::TestFixture
+ {
+     public:
+@@ -116,10 +118,10 @@ class OneDriveTest : public CppUnit::TestFixture
+         CPPUNIT_TEST_SUITE_END( );
+ 
+     private:
+-        OneDriveSession getTestSession( string username, string password );
++        OneDriveSessionPtr getTestSession( string username, string password );
+ };
+ 
+-OneDriveSession OneDriveTest::getTestSession( string username, string 
password )
++OneDriveSessionPtr OneDriveTest::getTestSession( string username, string 
password )
+ {
+     libcmis::OAuth2DataPtr oauth2(
+         new libcmis::OAuth2Data( AUTH_URL, TOKEN_URL, SCOPE,
+@@ -154,12 +156,12 @@ OneDriveSession OneDriveTest::getTestSession( string 
username, string password )
+     curl_mockup_addResponse ( TOKEN_URL.c_str( ), empty.c_str( ), "POST",
+                               DATA_DIR "/onedrive/token-response.json", 200, 
true );
+ 
+-    return OneDriveSession( BASE_URL, username, password, oauth2, false );
++    return OneDriveSessionPtr( new OneDriveSession( BASE_URL, username, 
password, oauth2, false ) );
+ }
+ 
+ void OneDriveTest::sessionAuthenticationTest( )
+ {
+-    OneDriveSession session = getTestSession( USERNAME, PASSWORD );
++    OneDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+     string empty;
+ 
+     // Check token request
+@@ -179,11 +181,11 @@ void OneDriveTest::sessionAuthenticationTest( )
+     CPPUNIT_ASSERT_EQUAL_MESSAGE(
+         "Wrong access token",
+          string ( "mock-access-token" ),
+-         session.m_oauth2Handler->getAccessToken( ));
++         session->m_oauth2Handler->getAccessToken( ));
+     CPPUNIT_ASSERT_EQUAL_MESSAGE(
+         "Wrong refresh token",
+         string ("mock-refresh-token"),
+-        session.m_oauth2Handler->getRefreshToken( ));
++        session->m_oauth2Handler->getRefreshToken( ));
+ }
+ 
+ void OneDriveTest::sessionExpiryTokenGetTest( )
+@@ -192,7 +194,7 @@ void OneDriveTest::sessionExpiryTokenGetTest( )
+     // We need to use the refresh key to get a new one.
+ 
+     curl_mockup_reset( );
+-    OneDriveSession session = getTestSession( USERNAME, PASSWORD );
++    OneDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+ 
+     curl_mockup_reset( );
+     static const string objectId("aFileId");
+@@ -206,17 +208,17 @@ void OneDriveTest::sessionExpiryTokenGetTest( )
+     try
+     {
+         // GET expires, need to refresh then GET again
+-        libcmis::ObjectPtr obj = session.getObject( objectId );
++        libcmis::ObjectPtr obj = session->getObject( objectId );
+     }
+     catch ( ... )
+     {
+-        if ( session.getHttpStatus( ) == 401 )
++        if ( session->getHttpStatus( ) == 401 )
+         {
+             // Check if access token is refreshed
+             CPPUNIT_ASSERT_EQUAL_MESSAGE(
+                    "wrong access token",
+                    string ( "new-access-token" ),
+-                   session.m_oauth2Handler->getAccessToken( ) );
++                   session->m_oauth2Handler->getAccessToken( ) );
+         }
+     }
+ }
+@@ -225,8 +227,8 @@ void OneDriveTest::getRepositoriesTest( )
+ {
+      curl_mockup_reset( );
+ 
+-     OneDriveSession session = getTestSession( USERNAME, PASSWORD );
+-     vector< libcmis::RepositoryPtr > actual = session.getRepositories( );
++     OneDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
++     vector< libcmis::RepositoryPtr > actual = session->getRepositories( );
+ 
+      CPPUNIT_ASSERT_EQUAL_MESSAGE( "Wrong number of repositories", size_t( 1 
),
+                                    actual.size( ) );
+@@ -239,9 +241,9 @@ void OneDriveTest::getObjectTypeDocumentTest()
+ {
+      curl_mockup_reset( );
+ 
+-     OneDriveSession session = getTestSession( USERNAME, PASSWORD );
++     OneDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+ 
+-     libcmis::ObjectTypePtr actual = session.getType("cmis:document");
++     libcmis::ObjectTypePtr actual = session->getType("cmis:document");
+ 
+      CPPUNIT_ASSERT_EQUAL_MESSAGE( "Wrong type ID", string("cmis:document"),
+                                    actual->getId() );
+@@ -282,9 +284,9 @@ void OneDriveTest::getObjectTypeFolderTest()
+ {
+      curl_mockup_reset( );
+ 
+-     OneDriveSession session = getTestSession( USERNAME, PASSWORD );
++     OneDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+ 
+-     libcmis::ObjectTypePtr actual = session.getType("cmis:folder");
++     libcmis::ObjectTypePtr actual = session->getType("cmis:folder");
+ 
+      CPPUNIT_ASSERT_EQUAL_MESSAGE( "Wrong type ID", string("cmis:folder"),
+                                    actual->getId() );
+@@ -322,11 +324,11 @@ void OneDriveTest::getObjectTest()
+ {
+     static const string objectId ("aFileId");
+ 
+-    OneDriveSession session = getTestSession( USERNAME, PASSWORD );
++    OneDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+     string url = BASE_URL + "/" + objectId;
+     curl_mockup_addResponse ( url.c_str( ), "",
+                               "GET", DATA_DIR "/onedrive/file.json", 200, 
true);
+-    libcmis::ObjectPtr object = session.getObject( objectId );
++    libcmis::ObjectPtr object = session->getObject( objectId );
+     boost::shared_ptr<OneDriveObject> obj = boost::dynamic_pointer_cast
+                                             <OneDriveObject>( object );
+     CPPUNIT_ASSERT_EQUAL_MESSAGE( "Wrong Object Id", objectId,
+@@ -338,12 +340,12 @@ void OneDriveTest::filePropertyTest( )
+     curl_mockup_reset( );
+     static const string objectId ("aFileId");
+ 
+-    OneDriveSession session = getTestSession( USERNAME, PASSWORD );
++    OneDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+     string url = BASE_URL + "/" + objectId;
+     curl_mockup_addResponse( url.c_str( ), "",
+                              "GET", DATA_DIR "/onedrive/file.json", 200, 
true);
+ 
+-    libcmis::ObjectPtr obj = session.getObject( objectId );
++    libcmis::ObjectPtr obj = session->getObject( objectId );
+ 
+     CPPUNIT_ASSERT_EQUAL_MESSAGE( "Wrong creation date",
+                                    string ( "2014-06-09T08:24:04+0000" ),
+@@ -365,7 +367,7 @@ void OneDriveTest::filePropertyTest( )
+ void OneDriveTest::deleteTest( )
+ {
+     curl_mockup_reset( );
+-    OneDriveSession session = getTestSession( USERNAME, PASSWORD );
++    OneDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+ 
+     const string objectId( "aFileId" );
+ 
+@@ -374,7 +376,7 @@ void OneDriveTest::deleteTest( )
+                                "GET", DATA_DIR "/onedrive/file.json", 200, 
true);
+     curl_mockup_addResponse( url.c_str( ),"", "DELETE", "", 204, false);
+ 
+-    libcmis::ObjectPtr object = session.getObject( objectId );
++    libcmis::ObjectPtr object = session->getObject( objectId );
+ 
+     object->remove( );
+     const struct HttpRequest* deleteRequest = curl_mockup_getRequest( 
url.c_str( ), "", "DELETE" );
+@@ -385,7 +387,7 @@ void OneDriveTest::deleteTest( )
+ void OneDriveTest::updatePropertiesTest( )
+ {
+     curl_mockup_reset( );
+-    OneDriveSession session = getTestSession( USERNAME, PASSWORD );
++    OneDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+     const string objectId( "aFileId" );
+     const string newObjectId( "aNewFileId" );
+ 
+@@ -399,8 +401,8 @@ void OneDriveTest::updatePropertiesTest( )
+     curl_mockup_addResponse( objectUrl.c_str( ), "",
+                                "PUT", DATA_DIR "/onedrive/updated-file.json", 
200, true );
+ 
+-    libcmis::ObjectPtr object = session.getObject( objectId );
+-    libcmis::ObjectPtr newObject = session.getObject( newObjectId );
++    libcmis::ObjectPtr object = session->getObject( objectId );
++    libcmis::ObjectPtr newObject = session->getObject( newObjectId );
+ 
+     object->updateProperties( newObject->getProperties( ) );
+ 
+@@ -424,12 +426,12 @@ void OneDriveTest::getFileAllowableActionsTest( )
+     curl_mockup_reset( );
+     static const string objectId ("aFileId");
+ 
+-    OneDriveSession session = getTestSession( USERNAME, PASSWORD );
++    OneDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+     string url = BASE_URL + "/" + objectId;
+     curl_mockup_addResponse( url.c_str( ), "",
+                              "GET", DATA_DIR "/onedrive/file.json", 200, 
true);
+ 
+-    libcmis::ObjectPtr object = session.getObject( objectId );
++    libcmis::ObjectPtr object = session->getObject( objectId );
+ 
+     boost::shared_ptr< libcmis::AllowableActions > actions = 
object->getAllowableActions( );
+ 
+@@ -446,12 +448,12 @@ void OneDriveTest::getFolderAllowableActionsTest( )
+     curl_mockup_reset( );
+     static const string objectId ("aFolderId");
+ 
+-    OneDriveSession session = getTestSession( USERNAME, PASSWORD );
++    OneDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+     string url = BASE_URL + "/" + objectId;
+     curl_mockup_addResponse( url.c_str( ), "",
+                              "GET", DATA_DIR "/onedrive/folder.json", 200, 
true);
+ 
+-    libcmis::ObjectPtr object = session.getObject( objectId );
++    libcmis::ObjectPtr object = session->getObject( objectId );
+ 
+     boost::shared_ptr< libcmis::AllowableActions > actions = 
object->getAllowableActions( );
+ 
+@@ -468,7 +470,7 @@ void OneDriveTest::getFolderTest( )
+ {
+     curl_mockup_reset( );
+ 
+-    OneDriveSession session = getTestSession( USERNAME, PASSWORD );
++    OneDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+     static const string folderId( "aFolderId" );
+     static const string parentId( "aParentId" );
+     string url = BASE_URL + "/" + folderId;
+@@ -480,7 +482,7 @@ void OneDriveTest::getFolderTest( )
+     curl_mockup_addResponse( parentUrl.c_str( ), "",
+                              "GET", DATA_DIR "/onedrive/parent-folder.json", 
200, true);
+ 
+-    libcmis::FolderPtr folder = session.getFolder( folderId );
++    libcmis::FolderPtr folder = session->getFolder( folderId );
+     CPPUNIT_ASSERT_MESSAGE( "Fetched object should be an instance of 
libcmis::FolderPtr",
+             NULL != folder );
+ 
+@@ -499,15 +501,15 @@ void OneDriveTest::getChildrenTest( )
+ {
+     curl_mockup_reset( );
+ 
+-    OneDriveSession session = getTestSession( USERNAME, PASSWORD );
++    OneDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+     static const string folderId ("aFolderId");
+     string url = BASE_URL + "/" + folderId;
+     curl_mockup_addResponse( url.c_str( ), "",
+                              "GET", DATA_DIR "/onedrive/folder.json", 200, 
true);
+ 
+-    libcmis::ObjectPtr obj = session.getObject( folderId );
++    libcmis::ObjectPtr obj = session->getObject( folderId );
+ 
+-    libcmis::FolderPtr folder = session.getFolder( folderId );
++    libcmis::FolderPtr folder = session->getFolder( folderId );
+     CPPUNIT_ASSERT_MESSAGE( "Fetched object should be an instance of 
libcmis::FolderPtr",
+             NULL != folder );
+ 
+@@ -536,7 +538,7 @@ void OneDriveTest::getChildrenTest( )
+ void OneDriveTest::moveTest( )
+ {
+     curl_mockup_reset( );
+-    OneDriveSession session = getTestSession( USERNAME, PASSWORD );
++    OneDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+     const string objectId( "aFileId" );
+     const string sourceId( "aFolderId" );
+     const string desId( "aParentId" );
+@@ -554,9 +556,9 @@ void OneDriveTest::moveTest( )
+     curl_mockup_addResponse( sourceUrl.c_str( ), "",
+                                "GET", DATA_DIR "/onedrive/folder.json", 200, 
true );
+ 
+-    libcmis::ObjectPtr object = session.getObject( objectId );
+-    libcmis::FolderPtr source = session.getFolder( sourceId );
+-    libcmis::FolderPtr destination = session.getFolder( desId );
++    libcmis::ObjectPtr object = session->getObject( objectId );
++    libcmis::FolderPtr source = session->getFolder( sourceId );
++    libcmis::FolderPtr destination = session->getFolder( desId );
+ 
+     object->move( source, destination );
+     const char* moveRequest = curl_mockup_getRequestBody( url.c_str( ), 
"method=MOVE", "POST" );
+@@ -570,12 +572,12 @@ void OneDriveTest::getDocumentTest( )
+     curl_mockup_reset( );
+     static const string objectId ("aFileId");
+ 
+-    OneDriveSession session = getTestSession( USERNAME, PASSWORD );
++    OneDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+     string url = BASE_URL + "/" + objectId;
+     curl_mockup_addResponse( url.c_str( ), "",
+                              "GET", DATA_DIR "/onedrive/file.json", 200, 
true);
+ 
+-    libcmis::ObjectPtr obj = session.getObject( objectId );
++    libcmis::ObjectPtr obj = session->getObject( objectId );
+ 
+     // Check if we got the document object.
+     libcmis::DocumentPtr document = boost::dynamic_pointer_cast< 
libcmis::Document >( obj );
+@@ -599,7 +601,7 @@ void OneDriveTest::getDocumentTest( )
+ void OneDriveTest::getDocumentParentTest( )
+ {
+     curl_mockup_reset( );
+-    OneDriveSession session = getTestSession( USERNAME, PASSWORD );
++    OneDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+ 
+     static const string documentId( "aFileId" );
+     static const string parentId( "aParentId" );
+@@ -611,7 +613,7 @@ void OneDriveTest::getDocumentParentTest( )
+     curl_mockup_addResponse( parentUrl.c_str( ), "",
+                              "GET", DATA_DIR "/onedrive/parent-folder.json", 
200, true);
+ 
+-    libcmis::ObjectPtr object = session.getObject( "aFileId" );
++    libcmis::ObjectPtr object = session->getObject( "aFileId" );
+     libcmis::DocumentPtr document = boost::dynamic_pointer_cast< 
libcmis::Document >( object );
+ 
+     CPPUNIT_ASSERT_MESSAGE( "Document expected", document != NULL );
+@@ -626,7 +628,7 @@ void OneDriveTest::getDocumentParentTest( )
+ void OneDriveTest::getContentStreamTest( )
+ {
+     curl_mockup_reset( );
+-    OneDriveSession session = getTestSession( USERNAME, PASSWORD );
++    OneDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+ 
+     static const string documentId( "aFileId" );
+     string url = BASE_URL + "/" + documentId;
+@@ -636,7 +638,7 @@ void OneDriveTest::getContentStreamTest( )
+     string downloadUrl = "sourceUrl";
+     curl_mockup_addResponse( downloadUrl.c_str( ), "", "GET", 
expectedContent.c_str( ), 0, false );
+ 
+-    libcmis::ObjectPtr object = session.getObject( documentId );
++    libcmis::ObjectPtr object = session->getObject( documentId );
+     libcmis::DocumentPtr document = boost::dynamic_pointer_cast< 
libcmis::Document >( object );
+ 
+     try
+@@ -658,7 +660,7 @@ void OneDriveTest::getContentStreamTest( )
+ void OneDriveTest::setContentStreamTest( )
+ {
+     curl_mockup_reset( );
+-    OneDriveSession session = getTestSession( USERNAME, PASSWORD );
++    OneDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+ 
+     const string documentId( "aFileId" );
+ 
+@@ -667,7 +669,7 @@ void OneDriveTest::setContentStreamTest( )
+     curl_mockup_addResponse( url.c_str( ), "",
+                                "GET", DATA_DIR "/onedrive/file.json", 200, 
true);
+ 
+-    libcmis::ObjectPtr object = session.getObject( documentId );
++    libcmis::ObjectPtr object = session->getObject( documentId );
+     libcmis::DocumentPtr document = boost::dynamic_pointer_cast< 
libcmis::Document >( object );
+ 
+     curl_mockup_addResponse( url.c_str( ), "",
+@@ -701,7 +703,7 @@ void OneDriveTest::setContentStreamTest( )
+ void OneDriveTest::createDocumentTest( )
+ {
+     curl_mockup_reset( );
+-    OneDriveSession session = getTestSession( USERNAME, PASSWORD );
++    OneDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+     const string documentId( "aFileId" );
+     const string folderId( "aParentId" );
+     const string filename( "aFileName" );
+@@ -719,7 +721,7 @@ void OneDriveTest::createDocumentTest( )
+     curl_mockup_addResponse( documentUrl.c_str( ), "",
+                                "GET", DATA_DIR "/onedrive/file.json", 200, 
true );
+ 
+-    libcmis::FolderPtr parent = session.getFolder( folderId );
++    libcmis::FolderPtr parent = session->getFolder( folderId );
+     try
+     {
+         string expectedContent( "Test set content stream" );
+@@ -744,7 +746,7 @@ void OneDriveTest::createDocumentTest( )
+ void OneDriveTest::getObjectByPathTest( )
+ {
+     curl_mockup_reset( );
+-    OneDriveSession session = getTestSession( USERNAME, PASSWORD );
++    OneDriveSessionPtr session = getTestSession( USERNAME, PASSWORD );
+     const string documentId( "rightFile" );
+     const string wrongDocumentId( "wrongFile" );
+     const string folderAId( "folderA" ); // root
+@@ -772,7 +774,7 @@ void OneDriveTest::getObjectByPathTest( )
+     curl_mockup_addResponse( folderCUrl.c_str( ), "",
+                                "GET", DATA_DIR "/onedrive/folderC.json", 200, 
true );
+ 
+-    libcmis::ObjectPtr object = session.getObjectByPath( path );
++    libcmis::ObjectPtr object = session->getObjectByPath( path );
+     CPPUNIT_ASSERT_EQUAL_MESSAGE( "Wrong objectFetched", documentId, 
object->getId( ) );
+ }
+ 
+diff --git a/src/libcmis/onedrive-session.cxx 
b/src/libcmis/onedrive-session.cxx
+index c6f4270..a6652b4 100644
+--- a/src/libcmis/onedrive-session.cxx
++++ b/src/libcmis/onedrive-session.cxx
+@@ -54,11 +54,6 @@ OneDriveSession::OneDriveSession ( string baseUrl,
+     }
+ }
+ 
+-OneDriveSession::OneDriveSession( const OneDriveSession& copy ) :
+-    BaseSession( copy )
+-{
+-}
+-
+ OneDriveSession::OneDriveSession() :
+     BaseSession()
+ {
+diff --git a/src/libcmis/onedrive-session.hxx 
b/src/libcmis/onedrive-session.hxx
+index 441e110..f11fbaf 100644
+--- a/src/libcmis/onedrive-session.hxx
++++ b/src/libcmis/onedrive-session.hxx
+@@ -42,8 +42,6 @@ class OneDriveSession : public BaseSession
+                        libcmis::OAuth2DataPtr oauth2,
+                        bool verbose = false );
+ 
+-        OneDriveSession( const OneDriveSession& copy );
+-
+         ~OneDriveSession ( );
+ 
+         virtual libcmis::RepositoryPtr getRepository( );
+@@ -64,6 +62,8 @@ class OneDriveSession : public BaseSession
+ 
+     private:
+         OneDriveSession( );
++        OneDriveSession( const OneDriveSession& copy ) = delete;
++        OneDriveSession& operator=( const OneDriveSession& copy ) = delete;
+ };
+ 
+ #endif /* _ONEDRIVE_SESSION_HXX_ */

diff --git a/dev-cpp/libcmis/libcmis-0.5.2-r2.ebuild 
b/dev-cpp/libcmis/libcmis-0.5.2-r2.ebuild
new file mode 100644
index 000000000000..d90cb7574671
--- /dev/null
+++ b/dev-cpp/libcmis/libcmis-0.5.2-r2.ebuild
@@ -0,0 +1,69 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+if [[ ${PV} == *9999* ]]; then
+       EGIT_REPO_URI="https://github.com/tdf/libcmis.git";
+       inherit git-r3
+else
+       SRC_URI="https://github.com/tdf/${PN}/archive/v${PV}.tar.gz -> 
${P}.tar.gz"
+       KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc64 ~x86 ~amd64-linux ~x86-linux"
+fi
+inherit autotools
+
+DESCRIPTION="C++ client library for the CMIS interface"
+HOMEPAGE="https://github.com/tdf/libcmis";
+
+LICENSE="|| ( GPL-2 LGPL-2 MPL-1.1 )"
+SLOT="0.5"
+IUSE="man test tools"
+
+RESTRICT="test"
+
+DEPEND="
+       dev-libs/boost:=
+       dev-libs/libxml2
+       net-misc/curl
+"
+RDEPEND="${DEPEND}"
+BDEPEND="
+       virtual/pkgconfig
+       man? (
+               app-text/docbook2X
+               dev-libs/libxslt
+       )
+       test? (
+               dev-util/cppcheck
+               dev-util/cppunit
+       )
+"
+
+PATCHES=(
+       "${FILESDIR}/${P}-icu-64.2.patch" # bug 674414
+       "${FILESDIR}/${P}-fix-onedrive.patch"
+       "${FILESDIR}/${P}-gdrive-do-not-allow-copying.patch"
+       "${FILESDIR}/${P}-onedrive-do-not-allow-copying.patch"
+       "${FILESDIR}/${P}-fix-gdrive-onedrive.patch"
+)
+
+src_prepare() {
+       default
+       eautoreconf
+}
+
+src_configure() {
+       local myeconfargs=(
+               --program-suffix=-$(ver_cut 1-2)
+               --disable-werror
+               $(use_with man)
+               $(use_enable test tests)
+               $(use_enable tools client)
+       )
+       econf "${myeconfargs[@]}"
+}
+
+src_install() {
+       default
+       find "${D}" -name '*.la' -delete || die
+}

Reply via email to