Finished changes to the linux client so that it can communicate
with the ATS via SSL.
This commit is contained in:
		| @@ -13,4 +13,5 @@ details outstanding items at the project level. | |||||||
|  |  | ||||||
| OUTSTANDING ITEMS | OUTSTANDING ITEMS | ||||||
|  |  | ||||||
| - Allow the Windows client to be built under Cygwin. | - Add mechanism to try communicating with ATS over port 443 if communications | ||||||
|  |   over port 2645 fail. | ||||||
|   | |||||||
| @@ -83,4 +83,6 @@ AllowInvalidCerts	true | |||||||
| #              Note: This parameter has no effect if the setting AllowInvalidCerts | #              Note: This parameter has no effect if the setting AllowInvalidCerts | ||||||
| #              is set to true. | #              is set to true. | ||||||
| # | # | ||||||
|  | #              THIS FUNCTIONALITY HAS NOT BEEN IMPLEMENTED | ||||||
|  | # | ||||||
| #UsersCannotAllowInvalidCerts	true | #UsersCannotAllowInvalidCerts	true | ||||||
|   | |||||||
| @@ -55,6 +55,7 @@ CFILES = ../authmech.c \ | |||||||
| 	 ../getpolicymsg.c \ | 	 ../getpolicymsg.c \ | ||||||
| 	 ../gettokenmsg.c \ | 	 ../gettokenmsg.c \ | ||||||
| 	 ../util.c \ | 	 ../util.c \ | ||||||
|  | 	 ../invalidcert.c \ | ||||||
| 	 rpc.c \ | 	 rpc.c \ | ||||||
| 	 platform.c | 	 platform.c | ||||||
|  |  | ||||||
|   | |||||||
| @@ -29,9 +29,6 @@ | |||||||
|  |  | ||||||
| //===[ Type definitions ]================================================== | //===[ Type definitions ]================================================== | ||||||
|  |  | ||||||
| #define INITIAL_RESPONSE_DATA_BUF_SIZE 1028 |  | ||||||
| #define INCREMENT_RESPONSE_DATA_BUF_SIZE 256 |  | ||||||
|  |  | ||||||
| #define MAX_RPC_RETRIES 3 | #define MAX_RPC_RETRIES 3 | ||||||
|  |  | ||||||
| //===[ Function prototypes ]=============================================== | //===[ Function prototypes ]=============================================== | ||||||
| @@ -310,13 +307,14 @@ InternalRpc( | |||||||
| // L2 | // L2 | ||||||
| //=======================================================================-- | //=======================================================================-- | ||||||
| { | { | ||||||
|  | #define CASA_STATUS_INVALID_SERVER_CERTIFICATE CASA_STATUS_UNSUCCESSFUL // temporary until casa_status.h is updated | ||||||
|  |  | ||||||
|    CasaStatus  retStatus; |    CasaStatus  retStatus; | ||||||
|    char        *pPartialUrl; |    char        *pPartialUrl; | ||||||
|    int         partialUrlLen; |    int         partialUrlLen; | ||||||
|    char        *pUrl; |    char        *pUrl; | ||||||
|    CURLcode    curlResult; |    CURLcode    curlResult; | ||||||
|  |  | ||||||
|  |  | ||||||
|    DbgTrace(1, "-InternalRpc- Start\n", 0); |    DbgTrace(1, "-InternalRpc- Start\n", 0); | ||||||
|  |  | ||||||
|    // Initialize output parameters |    // Initialize output parameters | ||||||
| @@ -328,13 +326,42 @@ InternalRpc( | |||||||
|    { |    { | ||||||
|       pPartialUrl = pSession->pPartialHttpsUrl; |       pPartialUrl = pSession->pPartialHttpsUrl; | ||||||
|       partialUrlLen = pSession->partialHttpsUrlLen; |       partialUrlLen = pSession->partialHttpsUrlLen; | ||||||
|  |  | ||||||
|  |       // Check if we need to ignore invalid CERTS | ||||||
|  |       if (flags & ALLOW_INVALID_CERTS_RPC_FLAG) | ||||||
|  |       { | ||||||
|  |          if ((curlResult = curl_easy_setopt(pSession->hCurl, CURLOPT_SSL_VERIFYPEER, 0)) != CURLE_OK) | ||||||
|  |          { | ||||||
|  |             DbgTrace(0, "-InternalRpc- Error setting CURLOPT_SSL_VERIFYPEER, code = %d\n", curlResult); | ||||||
|  |          } | ||||||
|  |  | ||||||
|  |          if ((curlResult = curl_easy_setopt(pSession->hCurl, CURLOPT_SSL_VERIFYHOST, 0)) != CURLE_OK) | ||||||
|  |          { | ||||||
|  |             DbgTrace(0, "-InternalRpc- Error setting CURLOPT_SSL_VERIFYHOST, code = %d\n", curlResult); | ||||||
|  |          } | ||||||
|  |       } | ||||||
|  |       else | ||||||
|  |       { | ||||||
|  |          if ((curlResult = curl_easy_setopt(pSession->hCurl, CURLOPT_SSL_VERIFYPEER, 1)) != CURLE_OK) | ||||||
|  |          { | ||||||
|  |             DbgTrace(0, "-InternalRpc- Error setting CURLOPT_SSL_VERIFYPEER, code = %d\n", curlResult); | ||||||
|  |          } | ||||||
|  |  | ||||||
|  |          if ((curlResult = curl_easy_setopt(pSession->hCurl, CURLOPT_SSL_VERIFYHOST, 2)) != CURLE_OK) | ||||||
|  |          { | ||||||
|  |             DbgTrace(0, "-InternalRpc- Error setting CURLOPT_SSL_VERIFYHOST, code = %d\n", curlResult); | ||||||
|  |          } | ||||||
|  |       } | ||||||
|  |  | ||||||
|    } |    } | ||||||
|    else |    else | ||||||
|    { |    { | ||||||
|       pPartialUrl = pSession->pPartialHttpUrl; |       pPartialUrl = pSession->pPartialHttpUrl; | ||||||
|       partialUrlLen = pSession->partialHttpUrlLen; |       partialUrlLen = pSession->partialHttpUrlLen; | ||||||
|    } |    } | ||||||
|  |  | ||||||
|    pUrl = (char*) malloc(partialUrlLen + strlen(pMethod) + 1); |    pUrl = (char*) malloc(partialUrlLen + strlen(pMethod) + 1); | ||||||
|  |  | ||||||
|    if (pUrl) |    if (pUrl) | ||||||
|    { |    { | ||||||
|       strcpy(pUrl, pPartialUrl); |       strcpy(pUrl, pPartialUrl); | ||||||
|   | |||||||
| @@ -636,6 +636,10 @@ InternalRpc( | |||||||
|                               { |                               { | ||||||
|                                  DbgTrace(1, "-InternalRpc- User approved invalid certificate from %s\n", pSession->pHostName); |                                  DbgTrace(1, "-InternalRpc- User approved invalid certificate from %s\n", pSession->pHostName); | ||||||
|  |  | ||||||
|  |                                  // tbd - Investigate if there is a way to set the accepted certificate in a store so that | ||||||
|  |                                  // it can be utilized by the SSL stack directly. This would be a better method for dealing with | ||||||
|  |                                  // this issue. | ||||||
|  |  | ||||||
|                                  AllowInvalidCertsFromHost(pSession->pHostName); |                                  AllowInvalidCertsFromHost(pSession->pHostName); | ||||||
|  |  | ||||||
|                                  // Try to retry the request |                                  // Try to retry the request | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user