Author: ug Date: Mon Aug 29 13:02:11 2011 New Revision: 65414 URL: http://svn.opensuse.org/viewcvs/yast?rev=65414&view=rev Log: added support for client certifactes on HTTPS transfers. 2.16.3 Modified: branches/SuSE-Code-11-SP2-Branch/transfer/VERSION branches/SuSE-Code-11-SP2-Branch/transfer/agent-curl/src/CurlAgent.cc branches/SuSE-Code-11-SP2-Branch/transfer/agent-curl/src/CurlAgent.h branches/SuSE-Code-11-SP2-Branch/transfer/module/HTTP.ycp branches/SuSE-Code-11-SP2-Branch/transfer/package/yast2-transfer.changes Modified: branches/SuSE-Code-11-SP2-Branch/transfer/VERSION URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/transfer/VERSION?rev=65414&r1=65413&r2=65414&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/transfer/VERSION (original) +++ branches/SuSE-Code-11-SP2-Branch/transfer/VERSION Mon Aug 29 13:02:11 2011 @@ -1 +1 @@ -2.16.2 +2.16.3 Modified: branches/SuSE-Code-11-SP2-Branch/transfer/agent-curl/src/CurlAgent.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/transfer/agent-curl/src/CurlAgent.cc?rev=65414&r1=65413&r2=65414&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/transfer/agent-curl/src/CurlAgent.cc (original) +++ branches/SuSE-Code-11-SP2-Branch/transfer/agent-curl/src/CurlAgent.cc Mon Aug 29 13:02:11 2011 @@ -22,6 +22,8 @@ CurlAgent::CurlAgent() : SCRAgent() { easySSL_val = false; + clientKeyPath_val = NULL; + clientCertPath_val = NULL; } /** @@ -37,6 +39,30 @@ return; } +void CurlAgent::clientCertSSL( const char *path ) +{ + if( clientCertPath_val != NULL ) + free(clientCertPath_val); + if( path != NULL ) { + clientCertPath_val = new char [strlen (path) + 1]; + if( clientCertPath_val != NULL ) + strcpy( clientCertPath_val, path ); + } + return; +} + +void CurlAgent::clientKeySSL( const char *path ) +{ + if( clientKeyPath_val != NULL ) + free(clientKeyPath_val); + if( path != NULL ) { + clientKeyPath_val = new char [strlen (path) + 1]; + if( clientKeyPath_val != NULL ) + strcpy( clientKeyPath_val, path ); + } + return; +} + YCPValue CurlAgent::Get( const char *url, const char *target) { @@ -64,6 +90,10 @@ curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); if( easySSL_val ) curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); + if( clientCertPath_val != NULL ) + curl_easy_setopt(curl, CURLOPT_SSLCERT, clientCertPath_val); + if( clientKeyPath_val != NULL ) + curl_easy_setopt(curl, CURLOPT_SSLKEY, clientKeyPath_val); res = curl_easy_setopt(curl, CURLOPT_WRITEDATA, outfile); if ( res != 0 ) { fclose( outfile ); @@ -235,6 +265,18 @@ easySSL( (bool)(value->asBoolean()->value()) ); } } + else if (path_name == "clientKeySSL") + { + if ( !value.isNull() ) { + clientKeySSL( (const char *)(value->asString()->value().c_str()) ); + } + } + else if (path_name == "clientCertSSL") + { + if ( !value.isNull() ) { + clientCertSSL( (const char *)(value->asString()->value().c_str()) ); + } + } /* else if (path_name == "post") { Modified: branches/SuSE-Code-11-SP2-Branch/transfer/agent-curl/src/CurlAgent.h URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/transfer/agent-curl/src/CurlAgent.h?rev=65414&r1=65413&r2=65414&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/transfer/agent-curl/src/CurlAgent.h (original) +++ branches/SuSE-Code-11-SP2-Branch/transfer/agent-curl/src/CurlAgent.h Mon Aug 29 13:02:11 2011 @@ -27,6 +27,8 @@ * Agent private variables */ bool easySSL_val; + char* clientKeyPath_val; + char* clientCertPath_val; public: /** @@ -76,6 +78,8 @@ // virtual YCPValue Post( const char *url, const char *post, const char *target); virtual string getMapValue ( const YCPMap map, const string key, const string defaultValue); virtual void easySSL( bool easy ); + virtual void clientCertSSL( const char *path ); + virtual void clientKeySSL( const char *path ); private: Modified: branches/SuSE-Code-11-SP2-Branch/transfer/module/HTTP.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/transfer/module/HTTP.ycp?rev=65414&r1=65413&r2=65414&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/transfer/module/HTTP.ycp (original) +++ branches/SuSE-Code-11-SP2-Branch/transfer/module/HTTP.ycp Mon Aug 29 13:02:11 2011 @@ -58,5 +58,18 @@ return; } +global define void clientCertSSL( string cert_path ) ``{ + y2debug("setting clientCertSSL to %1",cert_path); + SCR::Execute(.curl.clientCertSSL, cert_path, $[]); + return; +} + +global define void clientKeySSL( string key_path ) ``{ + y2debug("setting clientKeySSL to %1",key_path); + SCR::Execute(.curl.clientKeySSL, key_path, $[]); + return; +} + + /* EOF */ } Modified: branches/SuSE-Code-11-SP2-Branch/transfer/package/yast2-transfer.changes URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/transfer/package/yast2-transfer.changes?rev=65414&r1=65413&r2=65414&view=diff ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/transfer/package/yast2-transfer.changes (original) +++ branches/SuSE-Code-11-SP2-Branch/transfer/package/yast2-transfer.changes Mon Aug 29 13:02:11 2011 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Mon Aug 29 12:57:30 CEST 2011 - ug@suse.de + +- added support for client certifactes on HTTPS transfers +- 2.16.3 + +------------------------------------------------------------------- Tue May 26 16:09:53 CEST 2009 - ug@suse.de - send ACK package for the last DATA package that was received via -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org