libcmis: upgrade to 0.6.3

Change-Id: I835c68a209386d051d059b5b7d3a23ad8b2356f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205865
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
This commit is contained in:
Xisco Fauli
2026-06-01 13:56:42 +02:00
parent 750af72a83
commit 7281f570cc
12 changed files with 2 additions and 835 deletions
+2 -2
View File
@@ -65,8 +65,8 @@ FAST_FLOAT_TARBALL := fast_float-8.2.5.tar.gz
# three static lines
# so that git cherry-pick
# will not run into conflicts
LIBCMIS_SHA256SUM := 1b5c2d7258ff93eb5f9958ff0e4dfd7332dc75a071bb717dde2217a26602a644
LIBCMIS_TARBALL := libcmis-0.6.2.tar.xz
LIBCMIS_SHA256SUM := 5adb3781f374adf491103b2cb2dc290085150c9b7d097baf56d8ac35df84e792
LIBCMIS_TARBALL := libcmis-0.6.3.tar.xz
# three static lines
# so that git cherry-pick
# will not run into conflicts
-47
View File
@@ -1,47 +0,0 @@
From dfcb642a491f7ec2ae52e3e83d31bb6cdf3670c2 Mon Sep 17 00:00:00 2001
From: David Seifert <soap@gentoo.org>
Date: Sat, 31 Aug 2024 12:39:39 +0200
Subject: [PATCH] Fix boost 1.86 breakage
The fix does not break building against <1.86 since we're now accessing the
object representation of the return value.
Fixes #67
---
src/libcmis/xml-utils.cxx | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/libcmis/xml-utils.cxx b/src/libcmis/xml-utils.cxx
index e487d17..cdf088f 100644
--- a/src/libcmis/xml-utils.cxx
+++ b/src/libcmis/xml-utils.cxx
@@ -531,16 +531,22 @@ namespace libcmis
boost::uuids::detail::sha1 sha1;
sha1.process_bytes( str.c_str(), str.size() );
- unsigned int digest[5];
+ // on boost < 1.86.0, digest_type is typedef'd as unsigned int[5]
+ // on boost >= 1.86.0, digest_type is typedef'd as unsigned char[20]
+ boost::uuids::detail::sha1::digest_type digest;
sha1.get_digest( digest );
+ // by using a pointer to unsigned char, we can read the
+ // object representation of either typedef.
+ const unsigned char* ptr = reinterpret_cast<const unsigned char*>( digest );
+
stringstream out;
- // Setup writing mode. Every number must produce eight
+ // Setup writing mode. Every number must produce two
// hexadecimal digits, including possible leading 0s, or we get
// less than 40 digits as result.
out << hex << setfill('0') << right;
- for ( int i = 0; i < 5; ++i )
- out << setw(8) << digest[i];
+ for ( int i = 0; i < sizeof( digest ); ++ptr, ++i )
+ out << setw(2) << static_cast<int>( *ptr );
return out.str();
}
--
2.45.1
@@ -1,222 +0,0 @@
From c86638560b3cb39b847d4e84ae9b8492f0c5fa22 Mon Sep 17 00:00:00 2001
From: Mike Kaganski <mikekaganski@hotmail.com>
Date: Thu, 22 Feb 2024 20:47:48 +0600
Subject: [PATCH] Fix warning C4589 when building with MSVC
C:\libcmis\inc\libcmis/document.hxx(51): warning C4589: Constructor of abstract class 'libcmis::Document' ignores initializer for virtual base class 'libcmis::Object'
C:\libcmis\inc\libcmis/document.hxx(51): note: virtual base classes are only initialized by the most-derived type
C:\libcmis\inc\libcmis/folder.hxx(58): warning C4589: Constructor of abstract class 'libcmis::Folder' ignores initializer for virtual base class 'libcmis::Object'
C:\libcmis\inc\libcmis/folder.hxx(58): note: virtual base classes are only initialized by the most-derived type
---
inc/libcmis/document.hxx | 1 -
inc/libcmis/folder.hxx | 1 -
src/libcmis/atom-document.cxx | 2 --
src/libcmis/atom-folder.cxx | 1 -
src/libcmis/gdrive-document.cxx | 2 --
src/libcmis/gdrive-folder.cxx | 2 --
src/libcmis/onedrive-document.cxx | 2 --
src/libcmis/onedrive-folder.cxx | 2 --
src/libcmis/sharepoint-document.cxx | 2 --
src/libcmis/sharepoint-folder.cxx | 2 --
src/libcmis/ws-document.cxx | 1 -
src/libcmis/ws-folder.cxx | 1 -
12 files changed, 19 deletions(-)
diff --git a/inc/libcmis/document.hxx b/inc/libcmis/document.hxx
index 8f44313..ca18a84 100644
--- a/inc/libcmis/document.hxx
+++ b/inc/libcmis/document.hxx
@@ -48,7 +48,6 @@ namespace libcmis
class LIBCMIS_API Document : public virtual Object
{
public:
- Document( Session* session ) : Object( session ) { }
virtual ~Document( ) { }
/** Get the folder parents for the document.
diff --git a/inc/libcmis/folder.hxx b/inc/libcmis/folder.hxx
index 0010dbd..24f4ac4 100644
--- a/inc/libcmis/folder.hxx
+++ b/inc/libcmis/folder.hxx
@@ -55,7 +55,6 @@ namespace libcmis
class LIBCMIS_API Folder : public virtual Object
{
public:
- Folder( Session* session ) : Object( session ) { }
virtual ~Folder() { }
virtual std::vector< std::string > getPaths( );
diff --git a/src/libcmis/atom-document.cxx b/src/libcmis/atom-document.cxx
index e0400b1..8871dbc 100644
--- a/src/libcmis/atom-document.cxx
+++ b/src/libcmis/atom-document.cxx
@@ -43,7 +43,6 @@ using namespace libcmis;
AtomDocument::AtomDocument( AtomPubSession* session ) :
libcmis::Object( session ),
- libcmis::Document( session ),
AtomObject( session ),
m_contentUrl( )
{
@@ -52,7 +51,6 @@ AtomDocument::AtomDocument( AtomPubSession* session ) :
AtomDocument::AtomDocument( AtomPubSession* session, xmlNodePtr entryNd ) :
libcmis::Object( session ),
- libcmis::Document( session ),
AtomObject( session ),
m_contentUrl( )
{
diff --git a/src/libcmis/atom-folder.cxx b/src/libcmis/atom-folder.cxx
index 5e41194..25276a1 100644
--- a/src/libcmis/atom-folder.cxx
+++ b/src/libcmis/atom-folder.cxx
@@ -46,7 +46,6 @@ namespace
AtomFolder::AtomFolder( AtomPubSession* session, xmlNodePtr entryNd ) :
libcmis::Object( session ),
- libcmis::Folder( session ),
AtomObject( session )
{
xmlDocPtr doc = libcmis::wrapInDoc( entryNd );
diff --git a/src/libcmis/gdrive-document.cxx b/src/libcmis/gdrive-document.cxx
index ecb13d6..a826cf7 100644
--- a/src/libcmis/gdrive-document.cxx
+++ b/src/libcmis/gdrive-document.cxx
@@ -40,7 +40,6 @@ using namespace libcmis;
GDriveDocument::GDriveDocument( GDriveSession* session ) :
libcmis::Object( session),
- libcmis::Document( session ),
GDriveObject( session ),
m_isGoogleDoc( false )
{
@@ -48,7 +47,6 @@ GDriveDocument::GDriveDocument( GDriveSession* session ) :
GDriveDocument::GDriveDocument( GDriveSession* session, Json json, string id, string name ) :
libcmis::Object( session),
- libcmis::Document( session ),
GDriveObject( session, json, id, name ),
m_isGoogleDoc( false )
{
diff --git a/src/libcmis/gdrive-folder.cxx b/src/libcmis/gdrive-folder.cxx
index 26de89b..3aa5faf 100644
--- a/src/libcmis/gdrive-folder.cxx
+++ b/src/libcmis/gdrive-folder.cxx
@@ -38,14 +38,12 @@ using namespace libcmis;
GDriveFolder::GDriveFolder( GDriveSession* session ):
libcmis::Object( session ),
- libcmis::Folder( session ),
GDriveObject( session )
{
}
GDriveFolder::GDriveFolder( GDriveSession* session, Json json ):
libcmis::Object( session ),
- libcmis::Folder( session ),
GDriveObject( session, json )
{
}
diff --git a/src/libcmis/onedrive-document.cxx b/src/libcmis/onedrive-document.cxx
index 863a92f..ced64e0 100644
--- a/src/libcmis/onedrive-document.cxx
+++ b/src/libcmis/onedrive-document.cxx
@@ -40,14 +40,12 @@ using namespace libcmis;
OneDriveDocument::OneDriveDocument( OneDriveSession* session ) :
libcmis::Object( session),
- libcmis::Document( session ),
OneDriveObject( session )
{
}
OneDriveDocument::OneDriveDocument( OneDriveSession* session, Json json, string id, string name ) :
libcmis::Object( session),
- libcmis::Document( session ),
OneDriveObject( session, json, id, name )
{
}
diff --git a/src/libcmis/onedrive-folder.cxx b/src/libcmis/onedrive-folder.cxx
index c1980c8..3fa455a 100644
--- a/src/libcmis/onedrive-folder.cxx
+++ b/src/libcmis/onedrive-folder.cxx
@@ -38,14 +38,12 @@ using namespace libcmis;
OneDriveFolder::OneDriveFolder( OneDriveSession* session ):
libcmis::Object( session ),
- libcmis::Folder( session ),
OneDriveObject( session )
{
}
OneDriveFolder::OneDriveFolder( OneDriveSession* session, Json json ):
libcmis::Object( session ),
- libcmis::Folder( session ),
OneDriveObject( session, json )
{
}
diff --git a/src/libcmis/sharepoint-document.cxx b/src/libcmis/sharepoint-document.cxx
index dec5527..61b4431 100644
--- a/src/libcmis/sharepoint-document.cxx
+++ b/src/libcmis/sharepoint-document.cxx
@@ -37,14 +37,12 @@ using namespace libcmis;
SharePointDocument::SharePointDocument( SharePointSession* session ) :
libcmis::Object( session),
- libcmis::Document( session ),
SharePointObject( session )
{
}
SharePointDocument::SharePointDocument( SharePointSession* session, Json json, string parentId, string name ) :
libcmis::Object( session),
- libcmis::Document( session ),
SharePointObject( session, json, parentId, name )
{
}
diff --git a/src/libcmis/sharepoint-folder.cxx b/src/libcmis/sharepoint-folder.cxx
index e4da4a3..8bcb2db 100644
--- a/src/libcmis/sharepoint-folder.cxx
+++ b/src/libcmis/sharepoint-folder.cxx
@@ -38,14 +38,12 @@ using namespace libcmis;
SharePointFolder::SharePointFolder( SharePointSession* session ):
libcmis::Object( session ),
- libcmis::Folder( session ),
SharePointObject( session )
{
}
SharePointFolder::SharePointFolder( SharePointSession* session, Json json, string parentId ):
libcmis::Object( session ),
- libcmis::Folder( session ),
SharePointObject( session, json, parentId )
{
}
diff --git a/src/libcmis/ws-document.cxx b/src/libcmis/ws-document.cxx
index ba2f2bc..c085d5b 100644
--- a/src/libcmis/ws-document.cxx
+++ b/src/libcmis/ws-document.cxx
@@ -33,7 +33,6 @@ using libcmis::PropertyPtrMap;
WSDocument::WSDocument( const WSObject& object ) :
libcmis::Object( object ),
- libcmis::Document( const_cast< WSObject& >( object ).getSession( ) ),
WSObject( object )
{
}
diff --git a/src/libcmis/ws-folder.cxx b/src/libcmis/ws-folder.cxx
index 4e82ac2..aca0543 100644
--- a/src/libcmis/ws-folder.cxx
+++ b/src/libcmis/ws-folder.cxx
@@ -33,7 +33,6 @@ using libcmis::PropertyPtrMap;
WSFolder::WSFolder( const WSObject& object ) :
libcmis::Object( object ),
- libcmis::Folder( const_cast< WSObject& >( object ).getSession( ) ),
WSObject( object )
{
}
--
2.43.0.windows.1
@@ -1,25 +0,0 @@
From 98e7e9f15449e0c8eaa12776c6c126ea0411002e Mon Sep 17 00:00:00 2001
From: Julien Nabet <serval2412@yahoo.fr>
Date: Fri, 23 Feb 2024 21:59:12 +0100
Subject: [PATCH] Take into account m_CurlInitProtocolsFunction in copy
constructor HttpSession
---
src/libcmis/http-session.cxx | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/libcmis/http-session.cxx b/src/libcmis/http-session.cxx
index 8d427a4..79bcc08 100644
--- a/src/libcmis/http-session.cxx
+++ b/src/libcmis/http-session.cxx
@@ -183,6 +183,7 @@ HttpSession::HttpSession( string username, string password, bool noSslCheck,
HttpSession::HttpSession( const HttpSession& copy ) :
m_curlHandle( NULL ),
+ m_CurlInitProtocolsFunction( copy.m_CurlInitProtocolsFunction ),
m_no100Continue( copy.m_no100Continue ),
m_oauth2Handler( copy.m_oauth2Handler ),
m_username( copy.m_username ),
--
2.45.1
@@ -1,69 +0,0 @@
From ca078137dfa94664275f021c5fbf08a34f3fbc10 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolan.mcnamara@collabora.com>
Date: Sun, 14 Jan 2024 20:41:06 +0000
Subject: [PATCH] cid#1545775 COPY_INSTEAD_OF_MOVE
and
cid#1546321 COPY_INSTEAD_OF_MOVE
cid#1546272 COPY_INSTEAD_OF_MOVE
cid#1546287 COPY_INSTEAD_OF_MOVE
cid#1545443 COPY_INSTEAD_OF_MOVE
---
inc/libcmis/exception.hxx | 4 ++--
inc/libcmis/property-type.hxx | 10 +++++-----
inc/libcmis/session-factory.hxx | 2 +-
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/inc/libcmis/exception.hxx b/inc/libcmis/exception.hxx
index aa42ae7..565bff0 100644
--- a/inc/libcmis/exception.hxx
+++ b/inc/libcmis/exception.hxx
@@ -44,8 +44,8 @@ namespace libcmis
public:
Exception( std::string message, std::string type = "runtime" ) :
exception( ),
- m_message( message ),
- m_type( type )
+ m_message( std::move(message) ),
+ m_type( std::move(type) )
{
}
diff --git a/inc/libcmis/property-type.hxx b/inc/libcmis/property-type.hxx
index 350a7b2..e6b3779 100644
--- a/inc/libcmis/property-type.hxx
+++ b/inc/libcmis/property-type.hxx
@@ -102,11 +102,11 @@ namespace libcmis
bool isOrderable( ) { return m_orderable; }
bool isOpenChoice( ) { return m_openChoice; }
- void setId( std::string id ) { m_id = id; }
- void setLocalName( std::string localName ) { m_localName = localName; }
- void setLocalNamespace( std::string localNamespace ) { m_localNamespace = localNamespace; }
- void setDisplayName( std::string displayName ) { m_displayName = displayName; }
- void setQueryName( std::string queryName ) { m_queryName = queryName; }
+ void setId( const std::string& id ) { m_id = id; }
+ void setLocalName( const std::string& localName ) { m_localName = localName; }
+ void setLocalNamespace( const std::string& localNamespace ) { m_localNamespace = localNamespace; }
+ void setDisplayName( const std::string& displayName ) { m_displayName = displayName; }
+ void setQueryName( const std::string& queryName ) { m_queryName = queryName; }
void setType( Type type ) { m_type = type; }
void setMultiValued( bool multivalued ) { m_multiValued = multivalued; }
void setUpdatable( bool updatable ) { m_updatable = updatable; }
diff --git a/inc/libcmis/session-factory.hxx b/inc/libcmis/session-factory.hxx
index 227ac4d..1887254 100644
--- a/inc/libcmis/session-factory.hxx
+++ b/inc/libcmis/session-factory.hxx
@@ -111,7 +111,7 @@ namespace libcmis
/** Set the handler to ask the user what to do with invalid SSL certificates. If not set,
every invalid certificate will raise an exception.
*/
- static void setCertificateValidationHandler( CertValidationHandlerPtr handler ) { s_certValidationHandler = handler; }
+ static void setCertificateValidationHandler(const CertValidationHandlerPtr& handler ) { s_certValidationHandler = handler; }
static CertValidationHandlerPtr getCertificateValidationHandler( ) { return s_certValidationHandler; }
static void setCurlInitProtocolsFunction(CurlInitProtocolsFunction);
--
2.43.0
@@ -1,24 +0,0 @@
From 308a5352bab44157ba13962b9aa4becefb6e3817 Mon Sep 17 00:00:00 2001
From: Julien Nabet <serval2412@yahoo.fr>
Date: Fri, 23 Feb 2024 17:56:17 +0100
Subject: [PATCH] cppcheck: operatorEqVarError in src/libcmis/http-session.cxx
---
src/libcmis/http-session.cxx | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/libcmis/http-session.cxx b/src/libcmis/http-session.cxx
index f690914..8d427a4 100644
--- a/src/libcmis/http-session.cxx
+++ b/src/libcmis/http-session.cxx
@@ -224,6 +224,7 @@ HttpSession& HttpSession::operator=( const HttpSession& copy )
{
curl_easy_cleanup( m_curlHandle );
m_curlHandle = NULL;
+ m_CurlInitProtocolsFunction = copy.m_CurlInitProtocolsFunction;
m_no100Continue = copy.m_no100Continue;
m_oauth2Handler = copy.m_oauth2Handler;
m_username = copy.m_username;
--
2.45.1
-15
View File
@@ -11,19 +11,4 @@ $(eval $(call gb_UnpackedTarball_UnpackedTarball,libcmis))
$(eval $(call gb_UnpackedTarball_set_tarball,libcmis,$(LIBCMIS_TARBALL)))
# 0001-cid-1545775-COPY_INSTEAD_OF_MOVE.patch is upstreamed
$(eval $(call gb_UnpackedTarball_add_patches,libcmis,\
external/libcmis/0001-cid-1545775-COPY_INSTEAD_OF_MOVE.patch \
external/libcmis/0001-Fix-warning-C4589-when-building-with-MSVC.patch \
external/libcmis/http-session-cleanup.patch.1 \
external/libcmis/factory-no-retry-ssl.patch.1 \
external/libcmis/sharepoint-auth.patch.1 \
external/libcmis/exceptions.patch.1 \
external/libcmis/0001-cppcheck-operatorEqVarError-in-src-libcmis-http-sess.patch \
external/libcmis/0001-Take-into-account-m_CurlInitProtocolsFunction-in-cop.patch \
external/libcmis/initprotocols.patch.1 \
external/libcmis/0001-Fix-boost-1.86-breakage.patch \
))
# vim: set noet sw=4 ts=4:
-172
View File
@@ -1,172 +0,0 @@
--- libcmis/src/libcmis/http-session.cxx.orig 2024-06-21 12:22:36.083125022 +0200
+++ libcmis/src/libcmis/http-session.cxx 2024-06-21 13:08:37.403016695 +0200
@@ -653,7 +653,7 @@
m_authProvided = authProvider->authenticationQuery( m_username, m_password );
if ( !m_authProvided )
{
- throw CurlException( "User cancelled authentication request" );
+ throw CurlException("User cancelled authentication request", CURLE_OK);
}
}
}
@@ -762,6 +762,7 @@
if ( CURLE_SSL_CACERT == errCode )
{
vector< string > certificates;
+ string err(errBuff);
// We somehow need to rerun the request to get the certificate
curl_easy_setopt(m_curlHandle, CURLOPT_SSL_VERIFYHOST, 0);
@@ -814,7 +815,7 @@
}
else
{
- throw CurlException( "Invalid SSL certificate" );
+ throw CurlException(err, CURLE_SSL_CACERT);
}
}
}
@@ -827,7 +828,6 @@
void HttpSession::checkOAuth2( string url )
-try
{
if ( m_oauth2Handler )
{
@@ -836,10 +836,6 @@
oauth2Authenticate( );
}
}
-catch ( const libcmis::Exception& e )
-{
- throw CurlException( e.what( ) );
-}
long HttpSession::getHttpStatus( )
{
@@ -906,15 +902,10 @@
}
void HttpSession::oauth2Refresh( )
-try
{
const ScopeGuard<bool> inOauth2Guard(m_inOAuth2Authentication, true);
m_oauth2Handler->refresh( );
}
-catch ( const libcmis::Exception& e )
-{
- throw CurlException( e.what() );
-}
void HttpSession::initProtocols( )
{
@@ -981,11 +972,45 @@
break;
default:
msg = what();
- if ( !isCancelled( ) )
- msg += ": " + m_url;
- else
- type = "permissionDenied";
- break;
+ switch (m_code)
+ {
+ case CURLE_COULDNT_RESOLVE_PROXY:
+ case CURLE_COULDNT_RESOLVE_HOST:
+ type = "dnsFailed";
+ break;
+ case CURLE_COULDNT_CONNECT:
+ case CURLE_SSL_CONNECT_ERROR:
+ case CURLE_SSL_CERTPROBLEM:
+ case CURLE_SSL_CIPHER:
+ case CURLE_PEER_FAILED_VERIFICATION:
+#if CURL_AT_LEAST_VERSION(7, 19, 0)
+ case CURLE_SSL_ISSUER_ERROR:
+#endif
+ case CURLE_SSL_PINNEDPUBKEYNOTMATCH:
+ case CURLE_SSL_INVALIDCERTSTATUS:
+ case CURLE_FAILED_INIT:
+#if CURL_AT_LEAST_VERSION(7, 69, 0)
+ case CURLE_QUIC_CONNECT_ERROR:
+#endif
+ type = "connectFailed";
+ break;
+ case CURLE_OPERATION_TIMEDOUT:
+ type = "connectTimeout";
+ break;
+ case CURLE_WRITE_ERROR:
+ case CURLE_READ_ERROR: // error returned from our callbacks
+ case CURLE_ABORTED_BY_CALLBACK:
+ case CURLE_SEND_ERROR:
+ case CURLE_RECV_ERROR:
+ type = "transferFailed";
+ break;
+ default:
+ if ( !isCancelled( ) )
+ msg += ": " + m_url;
+ else if (msg == "User cancelled authentication request")
+ type = "permissionDenied";
+ break;
+ }
}
return libcmis::Exception( msg, type );
--- libcmis/src/libcmis/http-session.hxx.orig 2024-06-21 12:36:22.785868998 +0200
+++ libcmis/src/libcmis/http-session.hxx 2024-06-21 12:36:44.272966309 +0200
@@ -71,10 +71,10 @@
{
}
- CurlException( std::string message ) :
+ CurlException(std::string message, CURLcode const code) :
exception( ),
m_message( message ),
- m_code( CURLE_OK ),
+ m_code(code),
m_url( ),
m_httpStatus( 0 ),
m_cancelled( true ),
--- libcmis/src/libcmis/sharepoint-session.cxx.orig 2024-06-21 12:23:07.164265783 +0200
+++ libcmis/src/libcmis/sharepoint-session.cxx 2024-06-21 12:37:45.528243723 +0200
@@ -289,6 +291,7 @@
if ( CURLE_SSL_CACERT == errCode )
{
vector< string > certificates;
+ string err(errBuff);
// We somehow need to rerun the request to get the certificate
curl_easy_setopt(m_curlHandle, CURLOPT_SSL_VERIFYHOST, 0);
@@ -344,7 +344,7 @@
}
else
{
- throw CurlException( "Invalid SSL certificate" );
+ throw CurlException(err, CURLE_SSL_CACERT);
}
}
}
--- libcmis/src/libcmis/session-factory.cxx.orig 2024-06-21 15:37:55.132824666 +0200
+++ libcmis/src/libcmis/session-factory.cxx 2024-06-21 15:36:17.558408868 +0200
@@ -96,7 +96,7 @@
}
catch (const CurlException& e)
{
- if (strcmp(e.what(), "Invalid SSL certificate") == 0)
+ if (e.getErrorCode() == CURLE_SSL_CACERT)
{
// no point in trying other protocols
throw e.getCmisException();
--- libcmis/qa/libcmis/test-atom.cxx.orig 2024-06-21 15:39:49.130310447 +0200
+++ libcmis/qa/libcmis/test-atom.cxx 2024-06-21 15:39:51.541320721 +0200
@@ -323,8 +323,8 @@
}
catch ( const libcmis::Exception& e )
{
- CPPUNIT_ASSERT_EQUAL_MESSAGE( "Wrong exception message",
- string( "Invalid SSL certificate" ), string( e.what() ) );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE( "Wrong exception type",
+ string("connectFailed"), string(e.getType()) );
}
}
}
-17
View File
@@ -1,17 +0,0 @@
--- libcmis/src/libcmis/session-factory.cxx.orig 2024-06-19 18:43:56.244832053 +0200
+++ libcmis/src/libcmis/session-factory.cxx 2024-06-20 11:46:26.518263605 +0200
@@ -94,8 +94,13 @@
{
response = httpSession->httpGetRequest( bindingUrl );
}
- catch ( const CurlException& )
+ catch (const CurlException& e)
{
+ if (strcmp(e.what(), "Invalid SSL certificate") == 0)
+ {
+ // no point in trying other protocols
+ throw e.getCmisException();
+ }
// Could be SharePoint - needs NTLM authentication
session = new SharePointSession( bindingUrl, username,
password, verbose );
-82
View File
@@ -1,82 +0,0 @@
--- libcmis/src/libcmis/http-session.cxx.orig 2024-06-19 18:04:14.198691623 +0200
+++ libcmis/src/libcmis/http-session.cxx 2024-06-19 18:09:08.853234764 +0200
@@ -670,16 +670,17 @@
curl_easy_setopt( m_curlHandle, CURLOPT_URL, url.c_str() );
// Set the headers
- struct curl_slist *headers_slist = NULL;
+ struct deleter { void operator()(curl_slist* p) const { curl_slist_free_all(p); } };
+ unique_ptr<struct curl_slist, deleter> headers_slist;
for ( vector< string >::iterator it = headers.begin( ); it != headers.end( ); ++it )
- headers_slist = curl_slist_append( headers_slist, it->c_str( ) );
+ headers_slist.reset(curl_slist_append(headers_slist.release(), it->c_str()));
// If we are using OAuth2, then add the proper header with token to authenticate
// Otherwise, just set the credentials normally using in libcurl options
if ( m_oauth2Handler != NULL && !m_oauth2Handler->getHttpHeader( ).empty() )
{
- headers_slist = curl_slist_append( headers_slist,
- m_oauth2Handler->getHttpHeader( ).c_str( ) );
+ headers_slist.reset(curl_slist_append(headers_slist.release(),
+ m_oauth2Handler->getHttpHeader().c_str()));
}
else if ( !getUsername().empty() )
{
@@ -693,7 +693,7 @@
#endif
}
- curl_easy_setopt( m_curlHandle, CURLOPT_HTTPHEADER, headers_slist );
+ curl_easy_setopt(m_curlHandle, CURLOPT_HTTPHEADER, headers_slist.get());
// Set the proxy configuration if any
if ( !libcmis::SessionFactory::getProxy( ).empty() )
@@ -747,9 +747,6 @@
// Perform the query
CURLcode errCode = curl_easy_perform( m_curlHandle );
- // Free the headers list
- curl_slist_free_all( headers_slist );
-
// Process the response
bool isHttpError = errCode == CURLE_HTTP_RETURNED_ERROR;
if ( CURLE_OK != errCode && !( m_noHttpErrors && isHttpError ) )
--- libcmis/src/libcmis/sharepoint-session.cxx.orig 2024-06-19 18:04:35.761804551 +0200
+++ libcmis/src/libcmis/sharepoint-session.cxx 2024-06-19 18:08:44.563107553 +0200
@@ -200,12 +200,13 @@
curl_easy_setopt( m_curlHandle, CURLOPT_URL, url.c_str() );
// Set the headers
- struct curl_slist *headers_slist = NULL;
+ struct deleter { void operator()(curl_slist* p) const { curl_slist_free_all(p); } };
+ unique_ptr<struct curl_slist, deleter> headers_slist;
for ( vector< string >::iterator it = headers.begin( ); it != headers.end( ); ++it )
- headers_slist = curl_slist_append( headers_slist, it->c_str( ) );
+ headers_slist.reset(curl_slist_append(headers_slist.release(), it->c_str()));
- headers_slist = curl_slist_append( headers_slist, "accept:application/json; odata=verbose" );
- headers_slist = curl_slist_append( headers_slist, ( "x-requestdigest:" + m_digestCode ).c_str( ) );
+ headers_slist.reset(curl_slist_append(headers_slist.release(), "accept:application/json; odata=verbose"));
+ headers_slist.reset(curl_slist_append(headers_slist.release(), ("x-requestdigest:" + m_digestCode).c_str()));
if ( !getUsername().empty() && !getPassword().empty() )
{
@@ -220,7 +219,7 @@
#endif
}
- curl_easy_setopt( m_curlHandle, CURLOPT_HTTPHEADER, headers_slist );
+ curl_easy_setopt(m_curlHandle, CURLOPT_HTTPHEADER, headers_slist.get());
// Set the proxy configuration if any
if ( !libcmis::SessionFactory::getProxy( ).empty() )
@@ -274,9 +273,6 @@
// Perform the query
CURLcode errCode = curl_easy_perform( m_curlHandle );
- // Free the headers list
- curl_slist_free_all( headers_slist );
-
// Process the response
bool isHttpError = errCode == CURLE_HTTP_RETURNED_ERROR;
if ( CURLE_OK != errCode && !( m_noHttpErrors && isHttpError ) )
-147
View File
@@ -1,147 +0,0 @@
--- libcmis/src/libcmis/session-factory.cxx.orig 2024-06-21 17:40:02.696092806 +0200
+++ libcmis/src/libcmis/session-factory.cxx 2024-06-21 17:32:21.759833389 +0200
@@ -75,12 +75,15 @@
if ( bindingUrl == "https://www.googleapis.com/drive/v3" )
{
session = new GDriveSession( bindingUrl, username, password,
- oauth2, verbose );
+ oauth2, verbose,
+ g_CurlInitProtocolsFunction);
+
}
else if ( bindingUrl == "https://graph.microsoft.com/v1.0" )
{
session = new OneDriveSession( bindingUrl, username, password,
- oauth2, verbose);
+ oauth2, verbose,
+ g_CurlInitProtocolsFunction);
}
else
{
@@ -103,7 +106,7 @@
}
// Could be SharePoint - needs NTLM authentication
session = new SharePointSession( bindingUrl, username,
- password, verbose );
+ password, verbose, g_CurlInitProtocolsFunction);
}
// Try the CMIS cases: we need to autodetect the binding type
--- libcmis/src/libcmis/base-session.hxx.orig 2024-06-21 17:41:56.737651815 +0200
+++ libcmis/src/libcmis/base-session.hxx 2024-06-21 17:42:08.466709308 +0200
@@ -59,7 +59,8 @@
BaseSession( std::string sBindingUrl, std::string repository,
std::string username, std::string password,
bool noSslCheck = false,
- libcmis::OAuth2DataPtr oauth2 = libcmis::OAuth2DataPtr(), bool verbose = false );
+ libcmis::OAuth2DataPtr oauth2 = libcmis::OAuth2DataPtr(), bool verbose = false,
+ libcmis::CurlInitProtocolsFunction = nullptr);
/** This constructor copies an existing http session.
This has been mostly designed for SessionFactory to save
--- libcmis/src/libcmis/base-session.cxx.orig 2024-06-21 17:42:28.593807967 +0200
+++ libcmis/src/libcmis/base-session.cxx 2024-06-21 17:43:37.051143529 +0200
@@ -43,9 +43,10 @@
using namespace std;
BaseSession::BaseSession( string bindingUrl, string repositoryId, string username,
- string password, bool noSslCheck, libcmis::OAuth2DataPtr oauth2, bool verbose ) :
+ string password, bool noSslCheck, libcmis::OAuth2DataPtr oauth2, bool verbose,
+ libcmis::CurlInitProtocolsFunction initProtocolsFunction) :
Session( ),
- HttpSession( username, password, noSslCheck, oauth2, verbose ),
+ HttpSession( username, password, noSslCheck, oauth2, verbose, initProtocolsFunction ),
m_bindingUrl( bindingUrl ),
m_repositoryId( repositoryId ),
m_repositories( )
--- libcmis/src/libcmis/gdrive-session.hxx.orig 2024-06-21 17:44:32.721416413 +0200
+++ libcmis/src/libcmis/gdrive-session.hxx 2024-06-21 17:39:01.143791090 +0200
@@ -39,7 +39,8 @@
std::string username,
std::string password,
libcmis::OAuth2DataPtr oauth2,
- bool verbose = false );
+ bool verbose = false,
+ libcmis::CurlInitProtocolsFunction = nullptr);
~GDriveSession ( );
--- libcmis/src/libcmis/gdrive-session.cxx.orig 2024-06-21 17:44:59.947549870 +0200
+++ libcmis/src/libcmis/gdrive-session.cxx 2024-06-21 17:45:26.666680841 +0200
@@ -43,9 +43,10 @@
string username,
string password,
libcmis::OAuth2DataPtr oauth2,
- bool verbose ) :
+ bool verbose,
+ libcmis::CurlInitProtocolsFunction initProtocolsFunction) :
BaseSession( baseUrl, string(), username, password, false,
- libcmis::OAuth2DataPtr(), verbose )
+ libcmis::OAuth2DataPtr(), verbose, initProtocolsFunction )
{
// Add the dummy repository, even if we don't have OAuth2
--- libcmis/src/libcmis/onedrive-session.hxx.orig 2024-06-21 17:46:39.857039605 +0200
+++ libcmis/src/libcmis/onedrive-session.hxx 2024-06-21 17:46:59.045133662 +0200
@@ -40,7 +40,8 @@
std::string username,
std::string password,
libcmis::OAuth2DataPtr oauth2,
- bool verbose = false );
+ bool verbose = false,
+ libcmis::CurlInitProtocolsFunction = nullptr);
~OneDriveSession ( );
--- libcmis/src/libcmis/onedrive-session.cxx.orig 2024-06-21 17:47:35.187310824 +0200
+++ libcmis/src/libcmis/onedrive-session.cxx 2024-06-21 17:48:02.068442589 +0200
@@ -41,9 +41,10 @@
string username,
string password,
libcmis::OAuth2DataPtr oauth2,
- bool verbose ) :
+ bool verbose,
+ libcmis::CurlInitProtocolsFunction initProtocolsFunction) :
BaseSession( baseUrl, string(), username, password, false,
- libcmis::OAuth2DataPtr(), verbose )
+ libcmis::OAuth2DataPtr(), verbose, initProtocolsFunction)
{
// Add the dummy repository
--- libcmis/src/libcmis/sharepoint-session.hxx.orig 2024-06-21 18:02:35.120719197 +0200
+++ libcmis/src/libcmis/sharepoint-session.hxx 2024-06-21 18:02:54.288813088 +0200
@@ -39,7 +39,8 @@
SharePointSession( std::string baseUrl,
std::string username,
std::string password,
- bool verbose = false );
+ bool verbose = false,
+ libcmis::CurlInitProtocolsFunction = nullptr);
SharePointSession( std::string baseUrl,
const HttpSession& httpSession,
--- libcmis/src/libcmis/sharepoint-session.cxx.orig 2024-06-21 16:02:24.597237776 +0200
+++ libcmis/src/libcmis/sharepoint-session.cxx 2024-06-21 18:03:48.109076715 +0200
@@ -42,9 +42,10 @@
SharePointSession::SharePointSession ( string baseUrl,
string username,
string password,
- bool verbose ) :
+ bool verbose,
+ libcmis::CurlInitProtocolsFunction initProtocolsFunction) :
BaseSession( baseUrl, string(), username, password, false,
- libcmis::OAuth2DataPtr(), verbose ),
+ libcmis::OAuth2DataPtr(), verbose, initProtocolsFunction ),
m_digestCode( string( ) )
{
--- libcmis/src/libcmis/http-session.cxx.orig 2024-06-21 18:24:44.192002619 +0200
+++ libcmis/src/libcmis/http-session.cxx 2024-06-21 18:24:46.329012530 +0200
@@ -981,6 +981,7 @@
case CURLE_COULDNT_RESOLVE_HOST:
type = "dnsFailed";
break;
+ case CURLE_UNSUPPORTED_PROTOCOL:
case CURLE_COULDNT_CONNECT:
case CURLE_SSL_CONNECT_ERROR:
case CURLE_SSL_CERTPROBLEM:
-13
View File
@@ -1,13 +0,0 @@
--- libcmis/src/libcmis/sharepoint-session.cxx.orig 2024-06-20 18:02:12.751118095 +0200
+++ libcmis/src/libcmis/sharepoint-session.cxx 2024-06-20 18:04:36.467083223 +0200
@@ -207,6 +207,10 @@
headers_slist.reset(curl_slist_append(headers_slist.release(), "accept:application/json; odata=verbose"));
headers_slist.reset(curl_slist_append(headers_slist.release(), ("x-requestdigest:" + m_digestCode).c_str()));
+ // newer Sharepoint requires this; this can be detected based on header
+ // "x-msdavext_error" starting with "917656;" typically with a 403 status
+ // but since this class is specifically for SharePoint just add it always
+ headers_slist.reset(curl_slist_append(headers_slist.release(), "X-FORMS_BASED_AUTH_ACCEPTED: f"));
if ( !getUsername().empty() && !getPassword().empty() )
{