Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 84612 Details for
Bug 195644
Add security support to New Agent Controller
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Pluggable layer implementation
ac.txt (text/plain), 41.72 KB, created by
Igor Alelekov
on 2007-12-06 04:09:57 EST
(
hide
)
Description:
Pluggable layer implementation
Filename:
MIME Type:
Creator:
Igor Alelekov
Created:
2007-12-06 04:09:57 EST
Size:
41.72 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.tptp.platform.agentcontroller >Index: src-native-new/src/transport/transportSupport/TransportSupportSocket.c >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.agentcontroller/src-native-new/src/transport/transportSupport/TransportSupportSocket.c,v >retrieving revision 1.23 >diff -u -r1.23 TransportSupportSocket.c >--- src-native-new/src/transport/transportSupport/TransportSupportSocket.c 21 Nov 2007 15:24:32 -0000 1.23 >+++ src-native-new/src/transport/transportSupport/TransportSupportSocket.c 6 Dec 2007 08:22:10 -0000 >@@ -470,5 +470,23 @@ > return ( send(sock, buffer, byteCount, 0) ) ; > } > >+#ifdef __linux__ >+int closeSocket (int socket) { >+ struct linger linger; >+ int rc; > >+ linger.l_onoff = 1; >+ linger.l_linger = 0; > >+ rc = setsockopt(socket, SOL_SOCKET, SO_LINGER, (const char*) &linger, >+ sizeof(linger)); >+ >+ close (socket); >+ >+ return rc; >+} >+#else >+int closeSocket (int socket) { >+ return closeThisSocket(socket); >+} >+#endif >Index: src-native-new/src/transport/transportSupport/TransportSupport.def >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.agentcontroller/src-native-new/src/transport/transportSupport/TransportSupport.def,v >retrieving revision 1.18 >diff -u -r1.18 TransportSupport.def >--- src-native-new/src/transport/transportSupport/TransportSupport.def 9 Apr 2007 17:01:24 -0000 1.18 >+++ src-native-new/src/transport/transportSupport/TransportSupport.def 6 Dec 2007 08:22:10 -0000 >@@ -52,4 +52,5 @@ > ipcCloseMem @49 > isMemOpen @50 > ipcMemDetach @51 >+ closeSocket @52 > >\ No newline at end of file >Index: src-native-new/src/shared/TPTPUtil/TPTUtil.def >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.agentcontroller/src-native-new/src/shared/TPTPUtil/TPTUtil.def,v >retrieving revision 1.29 >diff -u -r1.29 TPTUtil.def >--- src-native-new/src/shared/TPTPUtil/TPTUtil.def 29 Aug 2007 19:53:12 -0000 1.29 >+++ src-native-new/src/shared/TPTPUtil/TPTUtil.def 6 Dec 2007 08:22:10 -0000 >@@ -99,4 +99,6 @@ > terminateXMLPlatformUtils > parseHostList > getExecutableName >- readStringFromBuffer >\ No newline at end of file >+ readStringFromBuffer >+ vrfusrpwd >+ >\ No newline at end of file >Index: src-native-new/src/shared/TPTPUtil/TPTPUtil.cpp >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.agentcontroller/src-native-new/src/shared/TPTPUtil/TPTPUtil.cpp,v >retrieving revision 1.37 >diff -u -r1.37 TPTPUtil.cpp >--- src-native-new/src/shared/TPTPUtil/TPTPUtil.cpp 21 Nov 2007 15:24:35 -0000 1.37 >+++ src-native-new/src/shared/TPTPUtil/TPTPUtil.cpp 6 Dec 2007 08:22:10 -0000 >@@ -27,6 +27,7 @@ > #include <malloc.h> > > #include "tptp/TPTPUtils.h" >+#include "tptp/TPTPConfig.h" > > #ifdef _WIN32 > #include <sys/types.h> >@@ -44,6 +45,8 @@ > #include <sys/types.h> > #include <linux/stat.h> //for mode S_IXUSR > #define STAT stat >+ #include <signal.h> >+ #include <sys/wait.h> > #include <ctype.h> > #endif > >@@ -103,8 +106,6 @@ > tptp_list_t** paramList ) > { > try { >- char *tempnodename = 0; >- > //Initialize the XML parser > DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(&chNull); > DOMBuilder *parser = ((DOMImplementationLS*)impl)->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, 0); >@@ -949,72 +950,38 @@ > return ++endIdx; //Move past the closing delim for the value > } > >-int getSocketConfigInfo( const char* config, SocketConfigInfo *socketInfo ) >-{ >- char* tagName=NULL; >- char* elementName=NULL; >- char* elementValue=NULL; >- int mstrIdx=0; >- int nextIdx=0; >- int endIdx = strlen(config); >- >- nextIdx = getTagName(config, &tagName); >- if ((nextIdx == -1) || (tagName == NULL)) goto errorReturn; //Error: badly formed cmd >- >- if (!isEqualString(tagName, "Configuration") ) goto errorReturn; //Error: Don't have a "Cmd" >- mstrIdx += nextIdx; >- mstrIdx++; >- tptp_free(tagName); tagName=NULL; >+int getSocketConfigInfo(const char* config, SocketConfigInfo *socketInfo) { >+ tptp_param_t* param; >+ tptp_node_t* node; > > socketInfo->securityEnabled = 0; // default >+ socketInfo->sslProviderLib = NULL; >+ socketInfo->params = NULL; > >- while (1) >- { >- nextIdx = getConfigElementName(&(config[mstrIdx]), &elementName); >- if (isEqualString(elementName, "/Configuration")) break; >- >- if ((nextIdx == -1) || (elementName == NULL)) goto errorReturn; //Error: badly formed cmd >- mstrIdx += nextIdx; >- >- nextIdx = getConfigElementValue(&(config[mstrIdx]), &elementValue); >- if ((nextIdx == -1) || (elementValue == NULL)) goto errorReturn; //Error: badly formed cmd >- mstrIdx += nextIdx; >- >- nextIdx = skipConfigElementClose(&(config[mstrIdx])); >- if (nextIdx == -1) goto errorReturn; //Error: badly formed cmd >- mstrIdx += nextIdx; >- >- if (isEqualString(elementName, "Port")) >- { >- socketInfo->portNumber = atoi(elementValue); >- } >- else if (isEqualString(elementName, "SecurityEnabled")) >- { >- socketInfo->securityEnabled = isEqualString(elementValue, "true"); >- } >- else if (isEqualString(elementName, "Hosts Configuration")) >- { >- socketInfo->hostConfig = elementValue; >- } >- else if (isEqualString(elementName, "Allow host")) >- { >- socketInfo->allowHosts = elementValue; >- } >+ if (getXMLElements(config, &socketInfo->params) < 0) return -1; > >- tptp_free(elementName); elementName=NULL; >- tptp_free(elementValue); elementValue=NULL; >+ for (node = socketInfo->params->head; node != 0; node = node->next) { >+ param = (tptp_param_t*) node->data; >+ if (param == NULL) continue; >+ >+ if (isEqualString(param->name, "Port")) { >+ socketInfo->portNumber = atoi(param->value); >+ } >+ else if (isEqualString(param->name, "SecurityEnabled")) { >+ socketInfo->securityEnabled = isEqualString(param->value, "true"); >+ } >+ else if (isEqualString(param->name, "Hosts Configuration")) { >+ socketInfo->hostConfig = param->value; >+ } >+ else if (isEqualString(param->name, "Allow host")) { >+ socketInfo->allowHosts = param->value; >+ } >+ else if (isEqualString(param->name, "SSLproviderLib")) { >+ socketInfo->sslProviderLib = param->value; >+ } > } > >- if (elementName) {tptp_free(elementName); elementName=NULL;} >- if (elementValue) {tptp_free(elementValue); elementValue=NULL;} >- > return 0; >- >-errorReturn: >- if (tagName != NULL) tptp_free(tagName); >- if (elementName != NULL) tptp_free(elementName); >- if (elementValue != NULL) tptp_free(elementValue); >- return -1; //TODO: replace with real error codes > } > > int getNamedPipeConfigInfo( const char* config, char **pipeName ) >@@ -1263,7 +1230,6 @@ > tptp_list_setNodeDestructor(*paramList, destroyParamNode); > tptp_list_setNodeCopier(*paramList, copyParamNode); > >- bool isCmdRoot = false; > DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(&chNull); > DOMBuilder *parser = ((DOMImplementationLS*)impl)->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, 0); > >@@ -1281,23 +1247,13 @@ > XERCES_CPP_NAMESPACE::DOMDocument *doc = parser->parse(*domBufIS); > DOMTreeWalker* iter = doc->createTreeWalker(doc->getDocumentElement(),DOMNodeFilter::SHOW_ELEMENT,NULL,true); > >- //Got the Node after the Root - The assumption here is that there is an encapsulating element around the >- //<Cmd></Cmd> tags >- char *roottag = XMLString::transcode(iter->getCurrentNode()->getNodeName()); >- if(strcmp(roottag, "Cmd")==0) >- { >- isCmdRoot = true; >- } >- XMLString::release(&roottag); >- DOMNode *node; >- if(!isCmdRoot){node = iter->firstChild();} >- > DOMNode *curr = iter->getCurrentNode(); > if(curr != NULL) > { > char *tempparmval = "\0"; > tptp_param_t* newParam; >- char *tempparmname = XMLString::transcode(curr->getNodeName()); >+ char *tempparmname = XMLString::transcode(curr->getNodeName()); >+ > newParam = initParamT(tempparmname, tempparmval); > tptp_list_add(*paramList, (void*)newParam); > addElementAttrs(curr, *paramList); >@@ -1727,10 +1683,6 @@ > TPTPParserErrorHandler* tptp_dom_err = new TPTPParserErrorHandler(); > parser->setErrorHandler(tptp_dom_err); > >- char* executable=NULL; >- char* path=NULL; >- char* location=NULL; >- > XERCES_CPP_NAMESPACE::DOMDocument *doc = parser->parse(*domBufIS); > > //Initialize the list to NULL... just so that we can check it later. >@@ -1914,3 +1866,123 @@ > return -1; > } > } >+ >+/* >+ * -------------------------------------------------------------------------------- >+ * All the platform-dependent vrfusrpwd() functions below >+ * -------------------------------------------------------------------------------- >+ */ >+ >+#if defined(_WIN32) >+/* >+ * Windows/IA32 section, in-process authentication >+ */ >+int vrfusrpwd(tptp_string *userid, tptp_string *password) { >+ HANDLE handle; >+ return LogonUser(userid, NULL, password, LOGON32_LOGON_NETWORK, LOGON32_PROVIDER_DEFAULT, &handle) ? 1 : 0; >+} >+#elif defined(__MVS__) >+/* >+ * OS/390 section, in-process authentication. BPX.DAEMON is needed. >+ */ >+int vrfusrpwd(tptp_string *userid, tptp_string *password) { >+ return __passwd(userid, password, NULL) ? 0 : 1; >+} >+#elif defined(__OS400__) >+/* >+ * OS/400 section, in-process authentication >+ */ >+int vrfusrpwd(tptp_string *userid, tptp_string *password) { >+ struct error_code_t errorCode; >+ char profileHandle[12]; /* profile handle, required by QSYGETPH API */ >+ char useridBuf[10] = " "; >+ >+ /* In descrypted case, the password is in code page of 437 */ >+ errorCode.bytesProvided = 64; >+ errorCode.bytesAvailable = 0; >+ >+ if(userid[0] == '*') { >+ return 0; >+ } >+ else if(strlen(userid) > 10) { >+ return 0; >+ } >+ else { >+ int i; >+ for(i = 0; i < strlen(userid); i++) { >+ useridBuf[i] = toupper(userid[i]); /* change it all to upper case */ >+ } >+ } >+ >+ QSYGETPH(useridBuf, password, profileHandle, &errorCode, strlen(password), 37); /* CCSID of password is 37 (EBCDIC) */ >+ >+ if(errorCode.bytesAvailable > 0) { >+ char *exc = (char*)ra_malloc(sizeof(char) * 8); >+ BZERO(exc, 8); >+ strncpy(exc, errorCode.exceptionID, 7); >+ ra_free(exc); >+ >+ return 0; >+ } >+ else { >+ return 1; /* authentication successful */ >+ } >+} >+#else /* non-Windows, non-OS/400 */ >+/* >+ * Launch a separate process to authenticate user name and password >+ */ >+int vrfusrpwd(tptp_string *userid, tptp_string *password) { >+ FILE *fp; >+ int success = 0; // FALSE >+ char *serverHome; >+ char *authCmd; >+ int authLen; >+ int status; >+ int rc=0; >+ >+ struct sigaction ignoreHandler; /* Use this handler for bypassing pre-configured signal handler */ >+ struct sigaction oldHandler; /* Used to temporary storing the configured signal handler */ >+ >+ serverHome = getCacheEnv("default", "RASERVER_HOME"); >+ /* Do not pass user ID and password since they will be shown by running 'ps' */ >+ authLen = strlen(serverHome) + 1 + strlen("bin") + 1 + strlen("ChkPass") + 1; /* Bug 168705 : need a null at the end for strcat() */ >+ authCmd = (char*)malloc(sizeof(char) * authLen); >+ BZERO(authCmd, authLen); >+ strcpy(authCmd, serverHome); >+ strcat(authCmd, "/"); >+ strcat(authCmd, "bin"); >+ strcat(authCmd, "/"); >+ strcat(authCmd, "ChkPass"); >+ >+ /* Disable default SIGCHLD handler since system() call doesn't work with user-supplied signal handlers */ >+ BZERO(&ignoreHandler, sizeof(struct sigaction)); >+ BZERO(&oldHandler, sizeof(struct sigaction)); >+ >+ ignoreHandler.sa_handler = SIG_DFL; /* Reset to default SIGCHLD handler */ >+ sigaction(SIGCHLD, &ignoreHandler, &oldHandler); /* Store the previous signal handler */ >+ >+ fp = popen(authCmd, "w"); >+ fprintf(fp, "%s\n", userid); >+ fprintf(fp, "%s\n", password); >+ status = pclose(fp); >+ if(WIFEXITED(status)) { >+ rc = WEXITSTATUS(status); >+ } >+ >+ if(rc == 100) { /* 100 indicates success */ >+ success = 1; >+ } >+ else { >+ success = 0; >+ } >+ >+ /* Re-enable the user-specified SIGCHLD handler */ >+ sigaction(SIGCHLD, &oldHandler, NULL); >+ >+ free(authCmd); >+ >+ return success; >+} >+ >+#endif >Index: src-native-new/src/shared/TPTPUtil/TPTPSupportUtils.c >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.agentcontroller/src-native-new/src/shared/TPTPUtil/TPTPSupportUtils.c,v >retrieving revision 1.4 >diff -u -r1.4 TPTPSupportUtils.c >--- src-native-new/src/shared/TPTPUtil/TPTPSupportUtils.c 4 Sep 2007 22:37:46 -0000 1.4 >+++ src-native-new/src/shared/TPTPUtil/TPTPSupportUtils.c 6 Dec 2007 08:22:10 -0000 >@@ -75,9 +75,10 @@ > } > > unsigned char* readStringFromBuffer(unsigned char *buffer, char** str) { >- int len; >+ int len, padding; > > buffer = readUINTFromBuffer(buffer, &len); >+ > if (len == 0) > *str = NULL; > else { >@@ -87,5 +88,8 @@ > buffer += len; > } > >- return buffer; >+ padding = 4 - len%4; >+ if (padding == 4) padding = 0; >+ >+ return buffer + padding; > } >Index: src-native-new/include/tptp/TransportSupportSocket.h >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.agentcontroller/src-native-new/include/tptp/TransportSupportSocket.h,v >retrieving revision 1.8 >diff -u -r1.8 TransportSupportSocket.h >--- src-native-new/include/tptp/TransportSupportSocket.h 1 Nov 2006 22:47:16 -0000 1.8 >+++ src-native-new/include/tptp/TransportSupportSocket.h 6 Dec 2007 08:22:10 -0000 >@@ -196,8 +196,7 @@ > > int getPeerName(SOCKET sock, unsigned char *pAddr); > >- >- >+int closeSocket(int socket); > > #ifdef __cplusplus > } >Index: src-native-new/include/tptp/TPTPUtils.h >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.agentcontroller/src-native-new/include/tptp/TPTPUtils.h,v >retrieving revision 1.22 >diff -u -r1.22 TPTPUtils.h >--- src-native-new/include/tptp/TPTPUtils.h 29 Aug 2007 19:53:13 -0000 1.22 >+++ src-native-new/include/tptp/TPTPUtils.h 6 Dec 2007 08:22:10 -0000 >@@ -80,6 +80,8 @@ > char *hostConfig; > char *allowHosts; > int securityEnabled; >+ char *sslProviderLib; >+ tptp_list_t* params; > } SocketConfigInfo; > > /* Define the various types of host addressing wildcards and types */ >@@ -268,6 +270,8 @@ > > int parseHostList(const char *initString, network_list_t **nList); > >+int vrfusrpwd(tptp_string *userid, tptp_string *password); >+ > #ifdef __cplusplus > } /* Ends extern C */ > #endif >Index: src-native-new/src/transport/socketTL/SocketListener.h >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.agentcontroller/src-native-new/src/transport/socketTL/SocketListener.h,v >retrieving revision 1.14 >diff -u -r1.14 SocketListener.h >--- src-native-new/src/transport/socketTL/SocketListener.h 31 Oct 2007 15:43:07 -0000 1.14 >+++ src-native-new/src/transport/socketTL/SocketListener.h 6 Dec 2007 08:22:10 -0000 >@@ -22,6 +22,8 @@ > #include "tptp/TPTPMessageHeader.h" > #include "tptp/hashtable.h" > >+#include "SSLTypes.h" >+ > #define SOCKET_LISTENER_OBJECT_ID 20001 > > /** instance-specific data block */ >@@ -32,7 +34,10 @@ > tptp_object* cmo ; > transport_layer_data_t agentControllerDataBlk ; > processMessage_ptr_t processMessage; >+ int securityEnabled; >+ char* sslProviderLib; > tptp_object* nexto; >+ tptp_list_t* params; > > /* hash table of connections for easy and fast search */ > HashTable * connectionTable ; >@@ -197,6 +202,10 @@ > sendData_ptr_t pSendFunc ; > tptp_object* partner; > int connectionPartnerID ; >+ >+ ssl_socket_t ssl_socket; >+ BOOL secured; >+ BOOL authenticated; > > BOOL isForConsole ; > >Index: src-native-new/src/transport/socketTL/SocketListener.c >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.agentcontroller/src-native-new/src/transport/socketTL/SocketListener.c,v >retrieving revision 1.42 >diff -u -r1.42 SocketListener.c >--- src-native-new/src/transport/socketTL/SocketListener.c 31 Oct 2007 15:43:07 -0000 1.42 >+++ src-native-new/src/transport/socketTL/SocketListener.c 6 Dec 2007 08:22:10 -0000 >@@ -71,6 +71,7 @@ > #endif > > #include "SocketListener.h" >+#include "SSLSupport.h" > > #include "tptp/TransportSupport.h" > #include "tptp/TPTPSupportUtils.h" >@@ -82,11 +83,6 @@ > #define DEFAULT_PORT_NUM 10002 > #define PROTO_VERSION 1 > >-#define CONFIGURATION_HOME "TPTP_AC_HOME" >- >-#define CERTF "cert.pem" >-#define KEYF "key.pem" >- > /** thread status */ > enum ThreadStatus { IDLE, RUNNING } ; > >@@ -95,7 +91,9 @@ > /*====================================================================*/ > THREAD_USER_FUNC_RET_TYPE processClientRequest(LPVOID args) ; > THREAD_USER_FUNC_RET_TYPE doListening(LPVOID args) ; >+THREAD_USER_FUNC_RET_TYPE doSecureListening(LPVOID args) ; > int serveRequest(SOCKET serverSock, server_block_ptr_t pServerData) ; >+int serveSecureRequest(server_block_ptr_t pServerData) ; > int sendThisMessage(server_block_t* pServerData, tptp_uint32 connectionID, tptp_uint32 cmdSize, tptp_string* pCmdBlock, BOOL shouldAddHeader) ; > int addMessageHeader(char * pCmdBlock, int cmdSize, char * buffer, int *pBufferLength, unsigned int flags) ; > int processCONNECTCall(request_block_ptr_t pBlk, char *pMsg, int flags) ; >@@ -111,8 +109,11 @@ > int handleCONNECT(request_block_ptr_t pBlk, char *pMsg) ; > > int handleCONNECT_DATA(request_block_ptr_t pBlk, char *pMsg) ; >-tptp_int32 closeConnection(request_block_ptr_t pBlock); >-int closeSocket (int socket); >+int closeConnection(request_block_ptr_t pBlock); >+int recvData(request_block_ptr_t pRdb, char *buffer, int length, int *bytesRead); >+int writeData(request_block_ptr_t pBlock, char* buffer, int length); >+int setSSL(request_block_ptr_t pBlk); >+int handleAUTHENTICATE(request_block_ptr_t pBlk, char *pMsg); > > /** > ********************************************************* >@@ -162,7 +163,7 @@ > > addBasicMsgHeader(cmd, cmdLength, &buffer, &bufferLength, flags) ; > /* send the response */ >- writeToSocket(pBlk->clientSock, buffer, bufferLength); >+ writeData(pBlk, buffer, bufferLength); > > if (cmd) tptp_free(cmd); > if (buffer) tptp_free(buffer); >@@ -187,11 +188,16 @@ > TPTP_LOG_DEBUG_MSG(pBlk->pServerData, "Socket: handle CONNECT request (Control channel)."); > pBlk->connectionType = CONTROL_CHANNEL ; > >+ if (pBlk->pServerData->securityEnabled && !pBlk->secured) { >+ processCONNECTCall(pBlk, pMsg, CONNECTION_REFUSED | SECURITY_REQUIRED); >+ return setSSL(pBlk); >+ } >+ > /* tell the agent controller about the new connection */ > /* and receive the assigned connection id */ > pFunc = pBlk->pServerData->agentControllerDataBlk.addConnectionEntry ; > pFunc(pBlk->pServerData->cmo, pBlk->pServerData->agentControllerDataBlk.transportID, >- &(pBlk->connectionId)) ; >+ &(pBlk->connectionId)); > > > /* save the socket and the control block away */ >@@ -203,7 +209,13 @@ > pTab = pBlk->pServerData->connectionTable ; > tablePut(pTab, connId, (Entry_value_ptr_t) pBlk) ; > >- processCONNECTCall(pBlk, pMsg, CONNECTION_COMPLETE); >+ if (pBlk->pServerData->securityEnabled && !pBlk->authenticated) { >+ processCONNECTCall(pBlk, pMsg, CONNECTION_COMPLETE | AUTHENTICATION_FAILED); >+ } >+ else { >+ processCONNECTCall(pBlk, pMsg, CONNECTION_COMPLETE); >+ pBlk->authenticated = TRUE; >+ } > > return 0 ; > } >@@ -224,6 +236,11 @@ > > TPTP_LOG_DEBUG_MSG(pBlk->pServerData, "Socket: handle CONNECT_DATA/CONNECT_CONSOLE request (Data channel)."); > >+ if (pBlk->pServerData->securityEnabled && !pBlk->secured) { >+ processCONNECTCall(pBlk, pMsg, CONNECTION_REFUSED | SECURITY_REQUIRED); >+ return setSSL(pBlk); >+ } >+ > pBlk->connectionType = DATA_CHANNEL ; > > /* tell the agent controller about the new connection */ >@@ -234,8 +251,7 @@ > > pFunc = pBlk->pServerData->agentControllerDataBlk.addDataConnectionEntry ; > pFunc(pBlk->pServerData->cmo, pBlk->pServerData->agentControllerDataBlk.transportID, >- pBlk->flags, >- &(pBlk->connectionId)) ; >+ pBlk->flags, &(pBlk->connectionId)) ; > > /* save the socket and the control block away */ > /* use the connection id as the index into the array for fast lookup */ >@@ -261,22 +277,23 @@ > *********************************************************/ > int handleDISCONNECT(request_block_ptr_t pBlk, char *pMsg) > { >+ > TPTP_LOG_DEBUG_MSG(pBlk->pServerData, "Socket: handle DISCONNECT request."); > if (pBlk->connectionType == DATA_CHANNEL) > { > /* pass the command to the agent controller to be processed */ > removeConnectionEntry_ptr_t pRemoveFunc = >- pBlk->pServerData->agentControllerDataBlk.removeConnectionEntry ; >+ pBlk->pServerData->agentControllerDataBlk.removeDataConnectionEntry; > >- pRemoveFunc(pBlk->pServerData->cmo, pBlk->connectionId) ; >+ pRemoveFunc(pBlk->pServerData->cmo, pBlk->connectionId); > } > else > { > /* pass the command to the agent controller to be processed */ > removeDataConnectionEntry_ptr_t pDataRemoveFunc = >- pBlk->pServerData->agentControllerDataBlk.removeDataConnectionEntry ; >+ pBlk->pServerData->agentControllerDataBlk.removeConnectionEntry; > >- pDataRemoveFunc(pBlk->pServerData->cmo, pBlk->connectionId) ; >+ pDataRemoveFunc(pBlk->pServerData->cmo, pBlk->connectionId); > } > > return 0 ; >@@ -309,15 +326,13 @@ > /* read in the payload length */ > pMsg = readUINTFromBuffer(pMsg, pPayLoadLength) ; > >- if ((flags & CONNECT) != 0) >- { >+ if ((flags & CONNECT) != 0) { > handleCONNECT(pBlk, pMsg) ; > > /* prevent it from forwarding to the AC */ > pMsg = NULL ; > } >- else if (((flags & CONNECT_DATA) != 0) || >- ((flags & CONNECT_CONSOLE) != 0)) >+ else if (((flags & CONNECT_DATA) != 0) || ((flags & CONNECT_CONSOLE) != 0)) > { > if ((flags & CONNECT_CONSOLE) != 0) > pBlk->isForConsole = TRUE; >@@ -334,6 +349,17 @@ > /* prevent it from forwarding to the AC */ > pMsg = NULL ; > } >+ else if (pBlk->pServerData->securityEnabled && !pBlk->secured) { >+ pMsg = NULL ; >+ } >+ else if ((flags & AUTHENTICATE) != 0) { >+ handleAUTHENTICATE(pBlk, pMsg) ; >+ pMsg = NULL ; >+ } >+ else if (pBlk->pServerData->securityEnabled && !pBlk->authenticated) { >+ processCONNECTCall(pBlk, pMsg, AUTHENTICATION_FAILED); >+ pMsg = NULL ; >+ } > else > { > if (flags != 0) >@@ -560,7 +586,7 @@ > > /* Another message might come in while we're processing > * so we read until the pipe is empty */ >- while ( (rc = readFromSocket(pRdb->clientSock, buffer, bufferLength, &bytesRead)) > 0) >+ while ( (rc = recvData(pRdb, buffer, bufferLength, &bytesRead)) > 0) > { > TPTP_LOG_DEBUG_MSG1(pRdb->pServerData, "Socket processClientRequest: Read %d bytes.", bytesRead) ; > >@@ -616,6 +642,10 @@ > pRequestDataBlock->pServerData = pServerData ; > pRequestDataBlock->connectionId = 0 ; > pRequestDataBlock->connectionType = 0 ; >+ >+ pRequestDataBlock->ssl_socket = NULL; >+ pRequestDataBlock->authenticated = FALSE; >+ pRequestDataBlock->secured = FALSE; > > pRequestDataBlock->isForConsole = FALSE ; > >@@ -677,6 +707,42 @@ > return ( rc ) ; > } > >+/** >+ ********************************************************* >+ * >+ * @brief >+ * main running thread that accepts connection, >+ * set up the environment and process it in a new separate thread >+ * >+ * @return >+ * 0 - Success >+ * nonzero - Error. >+ *********************************************************/ >+int serveSecureRequest(server_block_ptr_t pServerData) { >+ int rc = 0 ; >+ request_block_ptr_t pRequestDataBlock = NULL; >+ TID threadId; >+ HANDLE threadHandle; >+ ssl_socket_t ssl_socket; >+ >+ /* initial status before the thread is running */ >+ pServerData->threadStatus = RUNNING ; >+ >+ /* accept and process one connection at a time */ >+ while (pServerData->threadStatus == RUNNING) { >+ ssl_socket = ssl_accept(); >+ if (ssl_socket == NULL) break; >+ >+ /* set up the data block for each request */ >+ pRequestDataBlock = getInitRequestDataBlock(0, pServerData); >+ pRequestDataBlock->ssl_socket = ssl_socket; >+ >+ /* go create a new thread to process each incoming connection request */ >+ rc = tptpStartThread(processClientRequest, (LPVOID) pRequestDataBlock, &threadId, &threadHandle); >+ } >+ >+ return rc; >+} > > /** > ********************************************************* >@@ -723,6 +789,25 @@ > ********************************************************* > * > * @brief >+ * place to set up listening incoming secure requests >+ * >+ * @return >+ * 0 - Success >+ * nonzero - Error. >+ *********************************************************/ >+THREAD_USER_FUNC_RET_TYPE doSecureListening(LPVOID args) { >+ server_block_ptr_t pServerData = (server_block_ptr_t) args; >+ >+ /* ready to accept incoming connection requests */ >+ serveSecureRequest(pServerData); >+ >+ return 0; >+} >+ >+/** >+ ********************************************************* >+ * >+ * @brief > * create a socket listener instance > * > * @return >@@ -731,48 +816,49 @@ > *********************************************************/ > tptp_int32 createSocketListener(tptp_object* cmo, transport_layer_data_t * pTransportData, tptp_object* tlo) > { >- int rc = 0 ; >+ server_block_t* pServerData; >+ SocketConfigInfo socketInfo; >+ int rc; > > rc = initForSocketCalls() ; >+ if (rc != 0) { >+ if (pTransportData->logEventEntry) >+ pTransportData->logEventEntry(cmo, "Socket TL", pTransportData->transportID, __FILE__, __LINE__, TPTP_FATAL, "Unable to initialize socket library."); >+ >+ return rc; >+ } > >- if (rc == 0) >- { >- server_block_t* pServerData; >- SocketConfigInfo socketInfo; >- >- /* prepare the globally available server data block */ >- pServerData = (server_block_ptr_t) malloc(sizeof(server_block_t)) ; >- pServerData->cmo = cmo; >- pServerData->threadStatus = 0 ; >- pServerData->agentControllerDataBlk = *pTransportData ; >- >- /* allocate connection table */ >- pServerData->connectionTable = tableCreate(); >- >- rc = getSocketConfigInfo(pTransportData->configurationData, &socketInfo); >- if (rc != -1) >- { >- pServerData->port = socketInfo.portNumber; >- } >- else >- { >- pServerData->port = DEFAULT_PORT_NUM; >- } >+ /* prepare the globally available server data block */ >+ pServerData = (server_block_ptr_t) malloc(sizeof(server_block_t)) ; >+ pServerData->cmo = cmo; >+ pServerData->threadStatus = 0 ; >+ pServerData->agentControllerDataBlk = *pTransportData ; >+ >+ /* allocate connection table */ >+ pServerData->connectionTable = tableCreate(); >+ >+ rc = getSocketConfigInfo(pTransportData->configurationData, &socketInfo); >+ if (rc != -1) >+ { >+ pServerData->port = socketInfo.portNumber; >+ pServerData->securityEnabled = socketInfo.securityEnabled; >+ pServerData->sslProviderLib = socketInfo.sslProviderLib; >+ pServerData->params = socketInfo.params; >+ } >+ else >+ { >+ pServerData->port = DEFAULT_PORT_NUM; >+ pServerData->securityEnabled = FALSE; >+ pServerData->sslProviderLib = NULL; >+ pServerData->params = NULL; >+ } > >- tlo->data = pServerData; >- tlo->objectID = SOCKET_LISTENER_OBJECT_ID; >+ tlo->data = pServerData; >+ tlo->objectID = SOCKET_LISTENER_OBJECT_ID; > >- TPTP_LOG_DEBUG_MSG(pServerData, "createTransportListener (socket)") ; >- } >- else >- { >- if ( pTransportData->logEventEntry ) >- { >- pTransportData->logEventEntry( cmo, "Socket TL", pTransportData->transportID, __FILE__, __LINE__, TPTP_FATAL, "Unable to initialize socket library." ); >- } >- } >+ TPTP_LOG_DEBUG_MSG(pServerData, "createTransportListener (socket)") ; > >- return ( rc ) ; >+ return rc; > } > > /** >@@ -800,8 +886,12 @@ > pServerData->threadStatus = IDLE ; > > /* stop accepting connection */ >- sock = pServerData->serverSock ; >- rc = closeSocket(sock) ; >+ if (pServerData->securityEnabled) { >+ ssl_reset(); >+ } else { >+ sock = pServerData->serverSock ; >+ rc = closeSocket(sock) ; >+ } > > /* free the connection table */ > tableDelete( pServerData->connectionTable ); >@@ -849,16 +939,33 @@ > TPTP_LOG_DEBUG_MSG(pServerData, "startTransportListener (socket)") ; > > /* create new thread to listen for incoming connection requests */ >- rc = tptpStartThread(doListening, >- (LPVOID) pServerData, &threadId, &threadHandle) ; >+ if (pServerData->securityEnabled) { >+ if (ssl_init(pServerData)) return -1; >+ rc = tptpStartThread(doSecureListening,(LPVOID) pServerData, &threadId, &threadHandle); >+ } >+ else { >+ rc = tptpStartThread(doListening,(LPVOID) pServerData, &threadId, &threadHandle); >+ } > >- return ( rc ) ; >+ return rc; > } > >-tptp_int32 closeConnection(request_block_ptr_t pBlock) { >+int closeConnection(request_block_ptr_t pBlock) { >+ int rc=0; > if (pBlock == NULL) return -1; > >- return closeSocket(pBlock->clientSock); >+ if (pBlock->ssl_socket != NULL) { >+ rc = ssl_close(pBlock->ssl_socket); >+ pBlock->ssl_socket = NULL; >+ } >+ else { >+ rc = closeSocket(pBlock->clientSock); >+ } >+ >+ pBlock->secured = FALSE; >+ pBlock->authenticated = FALSE; >+ >+ return rc; > } > > /** >@@ -951,7 +1058,7 @@ > tptp_getWriteLock( & pBlock->locker ); > > /* go send the message */ >- bytesSent = writeToSocket(pBlock->clientSock, pSendBuffer, bufferLength); >+ bytesSent = writeData(pBlock, pSendBuffer, bufferLength); > if (bytesSent < 0) > { > TPTP_LOG_ERROR_MSG1(pServerData, "Socket: Failed to send data on connection ID %d", connectionID); >@@ -1195,7 +1302,7 @@ > if (pBlock == NULL) return -1; > > /* go send the message */ >- bytesSent = writeToSocket(pBlock->clientSock, pDataBlock, dataSize); >+ bytesSent = writeData(pBlock, pDataBlock, dataSize); > if (bytesSent < 0) > { > TPTP_LOG_ERROR_MSG1(pServerData,"Socket: Failed to send data on connection ID %d", connectionID); >@@ -1261,23 +1368,84 @@ > return (forwardDataToPartner(pBlk, dataLen, pBuffer)) ; > } > >-#ifdef __linux__ >-int closeSocket (int socket) { >- struct linger linger; >- int rc; >+/** >+ ********************************************************* >+ * >+ * @brief >+ * handle the AUTHENTICATE request >+ * >+ *********************************************************/ >+int handleAUTHENTICATE(request_block_ptr_t pBlk, char *pMsg) { >+ char *name=NULL, *psw=NULL; >+ BOOL success; >+ >+ pMsg = readStringFromBuffer(pMsg, &name); >+ pMsg = readStringFromBuffer(pMsg, &psw); >+ >+ if (name != NULL && psw != NULL) { >+ success = vrfusrpwd(name, psw) > 0; >+ } >+ else{ >+ success = FALSE; >+ } >+ >+ if (success) { >+ TPTP_LOG_DEBUG_MSG1(pBlk->pServerData, "User %s is authenticated", name); >+ } >+ else if (name != NULL) { >+ TPTP_LOG_DEBUG_MSG1(pBlk->pServerData, "User %s is not authenticated", name); >+ } >+ else { >+ TPTP_LOG_DEBUG_MSG(pBlk->pServerData, "User <null> is not authenticated"); >+ } >+ >+ pBlk->authenticated = success; >+ if (success) { >+ processCONNECTCall(pBlk, pMsg, AUTHENTICATION_SUCCESSFUL); >+ } >+ else { >+ processCONNECTCall(pBlk, pMsg, AUTHENTICATION_FAILED); >+ } >+ >+ if (name != NULL) tptp_free(name); >+ if (psw != NULL) tptp_free(psw); >+ >+ return 0 ; >+} > >- linger.l_onoff = 1; >- linger.l_linger = 0; >+int setSSL(request_block_ptr_t pBlk) { >+ int err = ssl_handshake(pBlk->ssl_socket); >+ if (err) { >+ TPTP_LOG_DEBUG_MSG(pBlk->pServerData, "SSL: ssl_handshake error"); >+ ssl_close(pBlk->ssl_socket); >+ pBlk->ssl_socket = NULL; >+ } >+ else { >+ pBlk->secured = TRUE; >+ } > >- rc = setsockopt(socket, SOL_SOCKET, SO_LINGER, (const char*) &linger, >- sizeof(linger)); >+ return err; >+} > >- close (socket); >- >- return rc; >+int recvData(request_block_ptr_t pRdb, char *buffer, int length, int *bytesRead) { >+ int result; >+ >+ if (pRdb->pServerData->securityEnabled) { >+ result = ssl_read(pRdb->ssl_socket, buffer, length); >+ *bytesRead = result; >+ } >+ else { >+ result = readFromSocket(pRdb->clientSock, buffer, length, bytesRead); >+ } >+ >+ return result; > } >-#else >-int closeSocket (int socket) { >- return closeThisSocket(socket); >+ >+int writeData(request_block_ptr_t pBlock, char* buffer, int length) { >+ if (pBlock->pServerData->securityEnabled) { >+ return ssl_write(pBlock->ssl_socket, buffer, length); >+ } >+ else { >+ return writeToSocket(pBlock->clientSock, buffer, length); >+ } > } >-#endif >Index: src-native-new/src/transport/socketTL/SocketTL.dsp >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.agentcontroller/src-native-new/src/transport/socketTL/SocketTL.dsp,v >retrieving revision 1.5 >diff -u -r1.5 SocketTL.dsp >--- src-native-new/src/transport/socketTL/SocketTL.dsp 12 Sep 2005 18:05:17 -0000 1.5 >+++ src-native-new/src/transport/socketTL/SocketTL.dsp 6 Dec 2007 08:22:10 -0000 >@@ -105,6 +105,10 @@ > SOURCE=.\socketTL.def > # PROP Exclude_From_Build 1 > # End Source File >+# Begin Source File >+ >+SOURCE=.\SSLSupport.c >+# End Source File > # End Group > # Begin Group "Header Files" > >@@ -121,6 +125,10 @@ > > SOURCE=.\SocketTLLog.h > # End Source File >+# Begin Source File >+ >+SOURCE=.\SSLSupport.h >+# End Source File > # End Group > # Begin Group "Resource Files" > >Index: src-native-new/src/transport/socketTL/SSLSupport.c >=================================================================== >RCS file: src-native-new/src/transport/socketTL/SSLSupport.c >diff -N src-native-new/src/transport/socketTL/SSLSupport.c >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src-native-new/src/transport/socketTL/SSLSupport.c 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,128 @@ >+#include <stdio.h> >+#include <stdlib.h> >+#include <string.h> >+ >+#include "SSLTypes.h" >+#include "SSLSupport.h" >+#include "SocketTLLog.h" >+#include "tptp/TPTPUtils.h" >+#include "tptp/tptpSSLProvider.h" >+ >+/* Resolved SSL functions */ >+static ssl_provider_accept_t ssl_provider_accept; >+static ssl_provider_handshake_t ssl_provider_handshake; >+static ssl_provider_read_t ssl_provider_read; >+static ssl_provider_write_t ssl_provider_write; >+static ssl_provider_close_t ssl_provider_close; >+static ssl_provider_reset_t ssl_provider_reset; >+static ssl_provider_reset_t ssl_provider_reset; >+static ssl_provider_getValue_t ssl_provider_getValue; >+static ssl_provider_setValue_t ssl_provider_setValue; >+static ssl_provider_getName_t ssl_provider_getName; >+ >+int ssl_init(server_block_ptr_t pServerData) { >+ tptp_param_t* param; >+ tptp_node_t* node; >+ log_service_t* logService; >+ >+ DLL_REFERENCE sslLibrary; >+ ssl_provider_init_t ssl_provider_init; >+ int rc; >+ >+ if (!pServerData->securityEnabled) return 0; >+ >+ if (pServerData->sslProviderLib == NULL) { >+ TPTP_LOG_ERROR_MSG(pServerData, "No ssl provider library supplied"); >+ return -1; >+ } >+ >+ sslLibrary = LOAD_LIBRARY(pServerData->sslProviderLib); >+ if (sslLibrary == NULL) { >+ TPTP_LOG_ERROR_MSG1(pServerData, "Unable to find ssl provider library %s", pServerData->sslProviderLib); >+ return -1; >+ } >+ >+ ssl_provider_init = (ssl_provider_init_t) RESOLVE_ENTRY_POINT(sslLibrary, SSL_INIT); >+ ssl_provider_accept = (ssl_provider_accept_t) RESOLVE_ENTRY_POINT(sslLibrary, SSL_ACCEPT); >+ ssl_provider_handshake = (ssl_provider_handshake_t) RESOLVE_ENTRY_POINT(sslLibrary, SSL_HANDSHAKE); >+ ssl_provider_read = (ssl_provider_read_t) RESOLVE_ENTRY_POINT(sslLibrary, SSL_READ); >+ ssl_provider_write = (ssl_provider_write_t) RESOLVE_ENTRY_POINT(sslLibrary, SSL_WRITE); >+ ssl_provider_close = (ssl_provider_close_t) RESOLVE_ENTRY_POINT(sslLibrary, SSL_CLOSE); >+ ssl_provider_reset = (ssl_provider_reset_t) RESOLVE_ENTRY_POINT(sslLibrary, SSL_RESET); >+ ssl_provider_getValue = (ssl_provider_getValue_t) RESOLVE_ENTRY_POINT(sslLibrary, SSL_GET_VALUE); >+ ssl_provider_setValue = (ssl_provider_setValue_t) RESOLVE_ENTRY_POINT(sslLibrary, SSL_SET_VALUE); >+ ssl_provider_getName = (ssl_provider_getName_t) RESOLVE_ENTRY_POINT(sslLibrary, SSL_GET_PROVIDER_NAME); >+ >+ /* Check to make sure we found everything */ >+ if (ssl_provider_init && >+ ssl_provider_accept && >+ ssl_provider_handshake && >+ ssl_provider_read && >+ ssl_provider_write && >+ ssl_provider_close && >+ ssl_provider_reset && >+ ssl_provider_getValue && >+ ssl_provider_setValue && >+ ssl_provider_getName) { >+ >+ for (node = pServerData->params->head; node != 0; node = node->next) { >+ param = (tptp_param_t*) node->data; >+ if (param != NULL && param->name != NULL && param->value != NULL) { >+ ssl_setValue(param->name, param->value); >+ } >+ } >+ >+ logService = (log_service_t*) tptp_malloc(sizeof(log_service_t)); >+ logService->cmo = pServerData->cmo; >+ logService->logEventEntry = pServerData->agentControllerDataBlk.logEventEntry; >+ >+ rc = (*ssl_provider_init)(logService, pServerData->port); >+ if (rc) { >+ TPTP_LOG_ERROR_MSG1(pServerData, "Unable to initialize ssl provider %s", pServerData->sslProviderLib); >+ } else { >+ TPTP_LOG_DEBUG_MSG1(pServerData, "SSL provider \"%s\" successfully initialized", ssl_getProviderName()); >+ } >+ } >+ else { >+ TPTP_LOG_ERROR_MSG1(pServerData, "Unable to resolve ssl provider library %s", pServerData->sslProviderLib); >+ rc = -1; >+ } >+ >+ return rc; >+} >+ >+ssl_socket_t ssl_accept() { >+ return (ssl_provider_accept == NULL) ? NULL : (*ssl_provider_accept)(); >+} >+ >+int ssl_handshake(ssl_socket_t ssl_socket) { >+ return (ssl_socket == NULL || ssl_provider_handshake == NULL) ? -1 : (*ssl_provider_handshake)(ssl_socket); >+} >+ >+int ssl_read(ssl_socket_t ssl_socket, char* buffer, int length) { >+ return (ssl_socket == NULL || ssl_provider_read == NULL) ? -1 : (*ssl_provider_read)(ssl_socket, buffer, length); >+} >+ >+int ssl_write(ssl_socket_t ssl_socket, char* buffer, int length) { >+ return (ssl_socket == NULL || ssl_provider_write == NULL) ? -1 : (*ssl_provider_write)(ssl_socket, buffer, length); >+} >+ >+int ssl_close(ssl_socket_t ssl_socket) { >+ return (ssl_socket == NULL || ssl_provider_close == NULL) ? -1 : (*ssl_provider_close)(ssl_socket); >+} >+ >+int ssl_reset() { >+ return (ssl_provider_reset == NULL) ? -1 : (*ssl_provider_reset)(); >+} >+ >+char* ssl_getValue(const char* name) { >+ return (ssl_provider_getValue == NULL) ? NULL : (*ssl_provider_getValue)(name); >+} >+ >+void ssl_setValue(const char* name, const char* value) { >+ if (ssl_provider_setValue != NULL) (*ssl_provider_setValue)(name, value); >+} >+ >+char* ssl_getProviderName() { >+ return (ssl_provider_getName == NULL) ? NULL : (*ssl_provider_getName)(); >+} >Index: src-native-new/src/transport/socketTL/SSLSupport.h >=================================================================== >RCS file: src-native-new/src/transport/socketTL/SSLSupport.h >diff -N src-native-new/src/transport/socketTL/SSLSupport.h >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src-native-new/src/transport/socketTL/SSLSupport.h 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,18 @@ >+#ifndef SSLSUPPORT_H >+#define SSLSUPPORT_H >+ >+#include "SocketListener.h" >+#include "SSLTypes.h" >+ >+extern int ssl_init(server_block_ptr_t pServerData); >+extern ssl_socket_t ssl_accept(); >+extern int ssl_handshake(ssl_socket_t ssl_socket); >+extern int ssl_read(ssl_socket_t ssl_socket, char* buffer, int length); >+extern int ssl_write(ssl_socket_t ssl_socket, char* buffer, int length); >+extern int ssl_close(ssl_socket_t ssl_socket); >+extern int ssl_reset(); >+extern char* ssl_getValue(const char* name); >+extern void ssl_setValue(const char* name, const char* value); >+extern char* ssl_getProviderName(); >+ >+#endif >Index: src-native-new/src/transport/socketTL/SSLTypes.h >=================================================================== >RCS file: src-native-new/src/transport/socketTL/SSLTypes.h >diff -N src-native-new/src/transport/socketTL/SSLTypes.h >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src-native-new/src/transport/socketTL/SSLTypes.h 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,30 @@ >+#ifndef _SSLTypes_H >+#define _SSLTypes_H >+ >+typedef void* ssl_socket_t; >+ >+/* Function names to be imported */ >+#define SSL_INIT "sslInit" >+#define SSL_ACCEPT "sslAccept" >+#define SSL_HANDSHAKE "sslHandshake" >+#define SSL_READ "sslRead" >+#define SSL_WRITE "sslWrite" >+#define SSL_CLOSE "sslClose" >+#define SSL_RESET "sslReset" >+#define SSL_GET_VALUE "sslGetValue" >+#define SSL_SET_VALUE "sslSetValue" >+#define SSL_GET_PROVIDER_NAME "sslGetProviderName" >+ >+/* SSL function types */ >+typedef int (*ssl_provider_init_t)(); >+typedef ssl_socket_t (*ssl_provider_accept_t)(); >+typedef int (*ssl_provider_handshake_t)(); >+typedef int (*ssl_provider_read_t)(); >+typedef int (*ssl_provider_write_t)(); >+typedef int (*ssl_provider_close_t)(); >+typedef int (*ssl_provider_reset_t)(); >+typedef char* (*ssl_provider_getValue_t)(const char*); >+typedef void (*ssl_provider_setValue_t)(const char*, const char*); >+typedef char* (*ssl_provider_getName_t)(); >+ >+#endif >Index: src-native-new/include/tptp/tptpSSLProvider.h >=================================================================== >RCS file: src-native-new/include/tptp/tptpSSLProvider.h >diff -N src-native-new/include/tptp/tptpSSLProvider.h >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src-native-new/include/tptp/tptpSSLProvider.h 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,24 @@ >+#ifndef _TPTP_SSL_PROVIDER_H >+#define _TPTP_SSL_PROVIDER_H >+ >+typedef struct { >+ tptp_object* cmo; >+ logEventEntry_ptr_t logEventEntry; >+} log_service_t; >+ >+/* >+ * Interface functions for SSL provider >+ */ >+int sslInit(log_service_t *logService, int port); >+ >+void* sslAccept(); >+int sslHandshake(void* handle); >+int sslRead(void* handle, char* buffer, int length); >+int sslWrite(void* handle, char* buffer, int length); >+int sslClose(void* handle); >+int sslReset(); >+char* sslGetProviderName(); >+char* sslGetValue(const char* name); >+void sslSetValue(const char* name, const char* value); >+ >+#endif
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 195644
:
73419
|
73421
|
73422
|
73423
|
73425
|
73429
|
77241
|
77242
|
77243
|
80051
|
80132
|
80870
| 84612 |
84631