You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sa...@apache.org on 2004/12/15 12:55:48 UTC
cvs commit: ws-axis/c/vc/transport/Axis2/Axis2SSLChannel Axis2SSLChannel.dsp Axis2SSLChannel.dsw
sanjaya 2004/12/15 03:55:48
Modified: c/src/engine/client Tag: release1-4-final-branch Call.cpp
c/src/platforms/windows Tag: release1-4-final-branch
PlatformSpecificWindows.hpp
c/src/transport/axis2 Tag: release1-4-final-branch
Axis2Transport.cpp ChannelFactory.cpp
ChannelFactory.hpp SecureChannel.cpp
SecureChannel.hpp
c/src/transport/axis2/ssl Tag: release1-4-final-branch
OpenSSLChannel.cpp OpenSSLChannel.hpp
SSLChannelLoader.cpp
Added: c/src/transport Tag: release1-4-final-branch SSLChannel.hpp
c/vc/transport/Axis2/Axis2SSLChannel Tag:
release1-4-final-branch Axis2SSLChannel.dsp
Axis2SSLChannel.dsw
Log:
reverting ssl implementation back to the working version of 1.4 alpha for the
1.4 final relase
Revision Changes Path
No revision
No revision
1.79.2.1 +3 -1 ws-axis/c/src/engine/client/Call.cpp
Index: Call.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/engine/client/Call.cpp,v
retrieving revision 1.79
retrieving revision 1.79.2.1
diff -u -r1.79 -r1.79.2.1
--- Call.cpp 30 Nov 2004 11:49:03 -0000 1.79
+++ Call.cpp 15 Dec 2004 11:55:47 -0000 1.79.2.1
@@ -310,11 +310,13 @@
if (!m_pTransport)
m_pTransport = SOAPTransportFactory::getTransportObject(m_nTransportType);
if (!m_pTransport) return AXIS_FAIL;
-
+ //printf("m_pcEndPointUri:%s\n", m_pcEndPointUri);
m_pTransport->setEndpointUri(m_pcEndPointUri);
/* damitha:SSLChannelFactory needs the ssl channel library name to load the
optional ssl channel library*/
char* pcLibraryPath = g_pConfig->getAxisConfProperty(AXCONF_SSLCHANNEL);
+ //printf("pcLibraryPath:%s\n", pcLibraryPath);
+ if(pcLibraryPath)
m_pTransport->setTransportProperty(DLL_NAME, pcLibraryPath);
//if use proxy then set proxy
No revision
No revision
1.5.2.1 +1 -1 ws-axis/c/src/platforms/windows/PlatformSpecificWindows.hpp
Index: PlatformSpecificWindows.hpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/platforms/windows/PlatformSpecificWindows.hpp,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -u -r1.5 -r1.5.2.1
--- PlatformSpecificWindows.hpp 1 Dec 2004 09:13:05 -0000 1.5
+++ PlatformSpecificWindows.hpp 15 Dec 2004 11:55:47 -0000 1.5.2.1
@@ -32,7 +32,7 @@
#define PLATFORM_XMLPARSER_PATH "AxisXMLParser.dll"
#define PLATFORM_TRANSPORTHTTP_PATH "AxisTransport.dll"
#endif
-#define PLATFORM_SSLCHANNEL_PATH "????"
+#define PLATFORM_SSLCHANNEL_PATH "Axis2SSLChannel.dll"
#define PLATFORM_LOG_PATH ""
#define PLATFORM_CLIENTLOG_PATH ""
No revision
No revision
1.3.2.1 +73 -2 ws-axis/c/src/transport/Attic/SSLChannel.hpp
No revision
No revision
1.29.2.1 +4 -4 ws-axis/c/src/transport/axis2/Axis2Transport.cpp
Index: Axis2Transport.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/transport/axis2/Axis2Transport.cpp,v
retrieving revision 1.29
retrieving revision 1.29.2.1
diff -u -r1.29 -r1.29.2.1
--- Axis2Transport.cpp 6 Dec 2004 10:13:06 -0000 1.29
+++ Axis2Transport.cpp 15 Dec 2004 11:55:47 -0000 1.29.2.1
@@ -117,8 +117,8 @@
// (as it may not be secure) and create a new secure channel.
delete m_pChannel;
- //m_pChannel = (Channel *) new SecureChannel ();
- m_pChannel = m_pFactory->getSecureChannelObject();
+ m_pChannel = (Channel *) new SecureChannel ();
+ //m_pChannel = m_pFactory->getSecureChannelObject();
m_pChannel->setURL (pcEndpointUri);
@@ -734,8 +734,8 @@
{
if (m_bChannelSecure)
{
- //((SecureChannel *) m_pChannel)->setTransportProperty (type, value);
- m_pFactory->initialize(value);
+ ((SecureChannel *) m_pChannel)->setTransportProperty (type, value);
+ //m_pFactory->initialize(value);
}
break;
}
1.1.2.1 +3 -3 ws-axis/c/src/transport/axis2/ChannelFactory.cpp
Index: ChannelFactory.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/transport/axis2/ChannelFactory.cpp,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- ChannelFactory.cpp 6 Dec 2004 10:45:37 -0000 1.1
+++ ChannelFactory.cpp 15 Dec 2004 11:55:47 -0000 1.1.2.1
@@ -84,14 +84,14 @@
/**
* Should create an instance of Secure Channel
*/
-SecureChannel* ChannelFactory::getSecureChannelObject()
+SSLChannel* ChannelFactory::getSSLChannelObject()
{
- SecureChannel* pSecure = 0;
+ SSLChannel* pSecure = 0;
if (m_Create) m_Create(&pSecure);
return pSecure;
}
-void ChannelFactory::destroySecureChannelObject(SecureChannel* pObject)
+void ChannelFactory::destroySSLChannelObject(SSLChannel* pObject)
{
m_Delete(pObject);
}
1.1.2.1 +6 -6 ws-axis/c/src/transport/axis2/ChannelFactory.hpp
Index: ChannelFactory.hpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/transport/axis2/ChannelFactory.hpp,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- ChannelFactory.hpp 6 Dec 2004 10:45:37 -0000 1.1
+++ ChannelFactory.hpp 15 Dec 2004 11:55:47 -0000 1.1.2.1
@@ -29,14 +29,14 @@
#include "../../platforms/PlatformAutoSense.hpp"
#include <axis/GDefine.hpp>
-//#include "../SSLChannel.hpp"
-#include "SecureChannel.hpp"
+#include "../SSLChannel.hpp"
+//#include "SecureChannel.hpp"
#define CREATE_FUNCTION3 "CreateInstance"
#define DELETE_FUNCTION3 "DestroyInstance"
-typedef int (* CREATE_OBJECT3) (SecureChannel** inst);
-typedef int (* DELETE_OBJECT3) (SecureChannel* inst);
+typedef int (* CREATE_OBJECT3) (SSLChannel** inst);
+typedef int (* DELETE_OBJECT3) (SSLChannel* inst);
AXIS_CPP_NAMESPACE_START
class ChannelFactory
{
@@ -59,11 +59,11 @@
/**
* Used to create a parser object
*/
- static SecureChannel* getSecureChannelObject();
+ static SSLChannel* getSSLChannelObject();
/**
* Destroys the parser object
*/
- static void destroySecureChannelObject(SecureChannel* pObject);
+ static void destroySSLChannelObject(SSLChannel* pObject);
static int loadLib();
static int unloadLib();
1.5.2.1 +10 -9 ws-axis/c/src/transport/axis2/SecureChannel.cpp
Index: SecureChannel.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/transport/axis2/SecureChannel.cpp,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -u -r1.5 -r1.5.2.1
--- SecureChannel.cpp 6 Dec 2004 10:13:06 -0000 1.5
+++ SecureChannel.cpp 15 Dec 2004 11:55:47 -0000 1.5.2.1
@@ -1,8 +1,9 @@
#include "SecureChannel.hpp"
+#include "ChannelFactory.hpp"
SecureChannel::SecureChannel()
{
- //m_pFactory = new SSLChannelFactory();
+ m_pFactory = new ChannelFactory();
//m_pFactory->initialize();
//m_pSSLChannel = m_pFactory->getSSLChannelObject();
//m_pSSLChannel->SSLInit();
@@ -14,10 +15,10 @@
bool SecureChannel::open() throw (AxisTransportException&)
{
- //m_pSSLChannel = m_pFactory->getSSLChannelObject();
- //m_pSSLChannel->SSLInit();
- //Channel::open();
- //m_pSSLChannel->openSSLConnection(&m_Sock);
+ m_pSSLChannel = m_pFactory->getSSLChannelObject();
+ m_pSSLChannel->SSLInit();
+ Channel::open();
+ m_pSSLChannel->openSSLConnection(&m_Sock);
return true;
}
@@ -27,13 +28,13 @@
const Channel & SecureChannel::operator << (const char * msg) throw (AxisTransportException)
{
- //m_pSSLChannel->SSLWrite(msg, &m_Sock);
+ m_pSSLChannel->SSLWrite(msg, &m_Sock);
return *this;
}
const Channel &SecureChannel::operator >> (std::string & msg) throw (AxisTransportException)
{
- //m_pSSLChannel->SSLRead(msg);
+ m_pSSLChannel->SSLRead(msg);
return *this;
}
@@ -52,8 +53,8 @@
int SecureChannel::setTransportProperty (AXIS_TRANSPORT_INFORMATION_TYPE type,
const char* value)
{
- //if(DLL_NAME == type)
- // m_pFactory->initialize(value);
+ if(DLL_NAME == type)
+ m_pFactory->initialize(value);
//m_pFactory->setTransportProperty(type, value);
return AXIS_SUCCESS;
}
1.1.2.1 +17 -15 ws-axis/c/src/transport/axis2/SecureChannel.hpp
Index: SecureChannel.hpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/transport/axis2/SecureChannel.hpp,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- SecureChannel.hpp 6 Dec 2004 10:43:13 -0000 1.1
+++ SecureChannel.hpp 15 Dec 2004 11:55:47 -0000 1.1.2.1
@@ -1,8 +1,8 @@
#if !defined(_AXIS_SECURECHANNEL_H)
#define _AXIS_SECURECHANNEL_H
#include "ISecureChannel.hpp"
-//#include "ChannelFactory.hpp"
-//#include "../SSLChannel.hpp"
+#include "ChannelFactory.hpp"
+#include "../SSLChannel.hpp"
#include "Channel.h"
#include <iostream>
using namespace std;
@@ -13,36 +13,38 @@
SecureChannel();
virtual ~SecureChannel();
- virtual bool open() throw (AxisTransportException&);
- virtual void close();
+ bool open() throw (AxisTransportException&);
+ void close();
- virtual const Channel& operator >> (std::string&) throw (AxisTransportException);
- virtual const Channel& operator << (const char *) throw (AxisTransportException);
+ const Channel& operator >> (std::string&) throw (AxisTransportException);
+ const Channel& operator << (const char *) throw (AxisTransportException);
bool setServerName( std::string);
string getServerName();
- virtual void setSecureProperties( const char *);
- virtual const char * getSecureProperties();
- virtual int setTransportProperty(AXIS_TRANSPORT_INFORMATION_TYPE
+ void setSecureProperties( const char *);
+ const char * getSecureProperties();
+ int setTransportProperty(AXIS_TRANSPORT_INFORMATION_TYPE
type, const char* value);
private:
bool openConnection();
bool closeConnection();
- virtual int openSecureSocket(){ return 0;};
- virtual int closeSecureSocket(){ return 0;};
+ int openSecureSocket();
+ int closeSecureSocket();
- virtual bool writeSecureSocket(const char *){return true;};
- virtual bool readSecureSocket( char *, int){return true;};
+ bool writeSecureSocket(const char *);
+ bool readSecureSocket( char *, int);
- virtual void setSecureError(int iError){};
- virtual char* getSecureError(){ return NULL;};
+ //void setSecureError(int iError){};
+ //char* getSecureError(){ return NULL;};
protected:
string sServerName;
//SecureChannel* m_pSecureChannel;
+ ChannelFactory* m_pFactory;
+ SSLChannel* m_pSSLChannel;
};
#endif
No revision
No revision
1.2.2.1 +28 -46 ws-axis/c/src/transport/axis2/ssl/OpenSSLChannel.cpp
Index: OpenSSLChannel.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/transport/axis2/ssl/OpenSSLChannel.cpp,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -r1.2 -r1.2.2.1
--- OpenSSLChannel.cpp 6 Dec 2004 10:13:06 -0000 1.2
+++ OpenSSLChannel.cpp 15 Dec 2004 11:55:47 -0000 1.2.2.1
@@ -20,12 +20,6 @@
*/
#include "OpenSSLChannel.hpp"
-#include <openssl/ssl.h>
-#include <openssl/err.h>
-
-char* m_pcError;
-SSL_CTX* m_sslContext;
-SSL* m_sslHandle;
/* "global" init done? */
static bool g_InitSSL = false;
@@ -65,14 +59,12 @@
{
}
-bool OpenSSLChannel::open() throw (AxisTransportException&)
+bool OpenSSLChannel::SSLInit()
{
- Channel::open();
- openSecureSocket();
return true;
}
-int OpenSSLChannel::openSecureSocket()
+bool OpenSSLChannel::openSSLConnection(unsigned int* pSock)
{
SSL_METHOD* req_method = SSLv23_client_method();
SSL_SESSION* ssl_sessionid = NULL;
@@ -86,7 +78,7 @@
/* OpenSSL documents that this must be at least 120 bytes long. */
char error_buffer[120];
ERR_error_string(sslerror, error_buffer);
- closeSecureSocket();
+ closeSSLChannel();
throw AxisSSLChannelException(CLIENT_SSLCHANNEL_CONTEXT_CREATE_ERROR, error_buffer);
}
@@ -100,7 +92,7 @@
SSL_set_connect_state(m_sslHandle);
/* pass the raw socket into the SSL layers */
- SSL_set_fd(m_sslHandle, m_Sock);
+ SSL_set_fd(m_sslHandle, *pSock);
int iError = SSL_connect(m_sslHandle);
/*
@@ -109,30 +101,15 @@
* <0 is "handshake was not successful, because a fatal error occurred"
*/
if(iError <= 0)
- setSecureError(iError);
-
- return 0;
-}
-
-const Channel & SecureChannel::operator << (const char * msg) throw (AxisTransportException)
-{
- writeSecureSocket(msg);
- return *this;
-}
+ setSSLError(iError);
-const Channel &SecureChannel::operator >> (std::string & msg) throw (AxisTransportException)
-{
- int iBuffSize = 4096;
- char buff[iBuffSize];
- readSecureSocket(buff, iBuffSize);
- msg = buff;
- return *this;
+ return true;
}
-bool OpenSSLChannel::readSecureSocket(char* pcMsg, int piSize)
+int OpenSSLChannel::SSLRead(std::string& msg)
{
int nByteRecv = 0;
- //const int BUF_SIZE = 4096;
+ const int BUF_SIZE = 4096;
char buf[BUF_SIZE];
nByteRecv = SSL_read(m_sslHandle, buf, BUF_SIZE - 1);
if(nByteRecv < 0)
@@ -140,42 +117,47 @@
char error_string[256];
/* failed SSL_read */
int iError = SSL_get_error(m_sslHandle, nByteRecv);
- setSecureError(iError);
- closeSecureSocket();
+ setSSLError(iError);
+ closeSSLChannel();
}
if(nByteRecv)
{
buf[nByteRecv] = '\0';
/* got a part of the message, so add it to form */
- pcMsg = buf;
+ msg = buf;
}
else
printf("execution break\n");
return true;
}
-bool OpenSSLChannel::writeSecureSocket(const char* pcMsg)
+int OpenSSLChannel::SSLWrite(const std::string& msg, unsigned int* pSock)
{
- if(INVALID_SOCKET == m_Sock)
+ if(INVALID_SOCKET == *pSock)
{
throw AxisSSLChannelException(CLIENT_SSLCHANNEL_INVALID_SOCKET_ERROR,"");
}
- int size = strlen(pcMsg), nByteSent;
+ int size = msg.size(), nByteSent;
- nByteSent = SSL_write(m_sslHandle, (char *)pcMsg, size);
+ nByteSent = SSL_write(m_sslHandle, (char *)msg.c_str(), size);
if(nByteSent < 0)
{
char error_string[256];
int iError = SSL_get_error(m_sslHandle, nByteSent);
- setSecureError(iError);
- closeSecureSocket();
+ setSSLError(iError);
+ closeSSLChannel();
}
return true;
}
-void OpenSSLChannel::setSecureError(int iError)
+/*void OpenSSLChannel::setSSLError(char* pcError)
+{
+ strcpy(m_pcError, pcError);
+}*/
+
+void OpenSSLChannel::setSSLError(int iError)
{
switch(iError)
{
@@ -192,7 +174,7 @@
iError = errno;
#endif
- closeSecureSocket();
+ closeSSLChannel();
throw AxisSSLChannelException(CLIENT_SSLCHANNEL_ERROR, "SSL_ERROR_SYSCALL");
}
@@ -209,7 +191,7 @@
char error_buffer[120];
ERR_error_string(sslerror, error_buffer);
- closeSecureSocket();
+ closeSSLChannel();
throw AxisSSLChannelException(CLIENT_SSLCHANNEL_ERROR, error_buffer);
}
default:
@@ -226,14 +208,14 @@
char error_buffer[120];
ERR_error_string(sslerror, error_buffer);
- closeSecureSocket();
+ closeSSLChannel();
throw AxisSSLChannelException(CLIENT_SSLCHANNEL_ERROR, error_buffer);
}
}
}
-char* OpenSSLChannel::getSecureError()
+char* OpenSSLChannel::getSSLError()
{
return m_pcError;
}
@@ -244,7 +226,7 @@
*
*/
-int OpenSSLChannel::closeSecureSocket()
+void OpenSSLChannel::closeSSLChannel()
{
if(m_sslHandle)
{
1.2.2.1 +44 -37 ws-axis/c/src/transport/axis2/ssl/OpenSSLChannel.hpp
Index: OpenSSLChannel.hpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/transport/axis2/ssl/OpenSSLChannel.hpp,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -r1.2 -r1.2.2.1
--- OpenSSLChannel.hpp 6 Dec 2004 10:13:06 -0000 1.2
+++ OpenSSLChannel.hpp 15 Dec 2004 11:55:47 -0000 1.2.2.1
@@ -1,46 +1,53 @@
-#if !defined(_AXIS_OPENSSLCHANNEL_H)
-#define _AXIS_OPENSSLCHANNEL_H
-#include "../SecureChannel.hpp"
+/*
+ * Copyright 2003-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @author damitha Kumarage (damitha@hsenid.lk, damitha@opensource.lk)
+ *
+ */
+
+#if !defined(_AXIS_AXIS2_OPENSSLCHANNEL_HPP)
+#define _AXIS_AXIS2_OPENSSLCHANNEL_HPP
+#include "../../SSLChannel.hpp"
+#include "../Channel.h"
#include "AxisSSLChannelException.hpp"
-#include <iostream>
-using namespace std;
+#include <openssl/ssl.h>
+#include <openssl/err.h>
+AXIS_CPP_NAMESPACE_START
-class OpenSSLChannel: public SecureChannel
+class OpenSSLChannel: public SSLChannel
{
public:
- OpenSSLChannel();
- ~OpenSSLChannel();
-
- bool open() throw (AxisTransportException&);
- void close();
-
- const Channel& operator >> (std::string&) throw (AxisTransportException);
- const Channel& operator << (const char *) throw (AxisTransportException);
-
- bool setServerName( std::string) { return true;};
- string getServerName(){ return NULL;};
-
- void setSecureProperties( const char *){};
- const char * getSecureProperties(){ return NULL;};
- int setTransportProperty(AXIS_TRANSPORT_INFORMATION_TYPE
- type, const char* value){ return 0;};
+ OpenSSLChannel();
+ ~OpenSSLChannel();
+ bool SSLInit();
+ bool openSSLConnection(unsigned int* pSock);
+ int SSLRead(std::string& msg);
+ int SSLWrite(const std::string& msg, unsigned int* pSock);
+ void closeSSLChannel();
+ void setSSLError(int);
+ //void setSSLError(char*);
+ char* getSSLError();
private:
- bool openConnection(){ return true;};
- bool closeConnection(){ return true;};
-
- int openSecureSocket();
- int closeSecureSocket();
-
- bool writeSecureSocket(const char *);
- bool readSecureSocket( char *, int);
-
- void setSecureError(int iError);
- char* getSecureError();
-
-protected:
- string sServerName;
+ char* m_pcError;
+ SSL_CTX* m_sslContext;
+ SSL* m_sslHandle;
};
-#endif
+AXIS_CPP_NAMESPACE_END
+#endif
1.2.2.1 +4 -4 ws-axis/c/src/transport/axis2/ssl/SSLChannelLoader.cpp
Index: SSLChannelLoader.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/transport/axis2/ssl/SSLChannelLoader.cpp,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -r1.2 -r1.2.2.1
--- SSLChannelLoader.cpp 6 Dec 2004 10:13:06 -0000 1.2
+++ SSLChannelLoader.cpp 15 Dec 2004 11:55:47 -0000 1.2.2.1
@@ -20,13 +20,13 @@
*
*/
-#include "../SecureChannel.hpp"
+#include "OpenSSLChannel.hpp"
extern "C" {
STORAGE_CLASS_INFO
-int CreateInstance(SecureChannel **inst)
+int CreateInstance(SSLChannel **inst)
{
- *inst = new SecureChannel();
+ *inst = new OpenSSLChannel();
if (*inst)
{
return AXIS_SUCCESS;
@@ -34,7 +34,7 @@
return AXIS_FAIL;
}
STORAGE_CLASS_INFO
-int DestroyInstance(SecureChannel *inst)
+int DestroyInstance(SSLChannel *inst)
{
if (inst)
{
No revision
No revision
1.1.2.1 +131 -0 ws-axis/c/vc/transport/Axis2/Axis2SSLChannel/Attic/Axis2SSLChannel.dsp
1.1.2.1 +29 -0 ws-axis/c/vc/transport/Axis2/Axis2SSLChannel/Attic/Axis2SSLChannel.dsw