Commit 23039bb895ba305f1e1c0a916134274816306239

Authored by Perry Werneck
1 parent ee5183e3

Quick and dirty fix for CRL size problem.

src/lib3270/ssl/linux/getcrl.c
@@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
33 * 33 *
34 */ 34 */
35 35
36 -#define CRL_DATA_LENGTH 4096 36 +#define CRL_DATA_LENGTH 16384
37 37
38 #include <config.h> 38 #include <config.h>
39 39
@@ -140,14 +140,20 @@ static size_t internal_curl_write_callback(void *contents, size_t size, size_t n @@ -140,14 +140,20 @@ static size_t internal_curl_write_callback(void *contents, size_t size, size_t n
140 { 140 {
141 CURLDATA * data = (CURLDATA *) userp; 141 CURLDATA * data = (CURLDATA *) userp;
142 142
  143 + debug("%s",__FUNCTION__);
  144 +
143 size_t realsize = size * nmemb; 145 size_t realsize = size * nmemb;
144 146
  147 + debug("%s size=%d data->length=%d crldatalength=%d",__FUNCTION__,(int) size, (int) data->length, CRL_DATA_LENGTH);
  148 +
145 if((size + data->length) > CRL_DATA_LENGTH) 149 if((size + data->length) > CRL_DATA_LENGTH)
146 { 150 {
147 debug("CRL Data block is bigger than allocated block (%u bytes)",(unsigned int) size); 151 debug("CRL Data block is bigger than allocated block (%u bytes)",(unsigned int) size);
148 return 0; 152 return 0;
149 } 153 }
150 154
  155 + debug("%s",__FUNCTION__);
  156 +
151 if(lib3270_get_toggle(data->hSession,LIB3270_TOGGLE_SSL_TRACE)) 157 if(lib3270_get_toggle(data->hSession,LIB3270_TOGGLE_SSL_TRACE))
152 { 158 {
153 lib3270_trace_data( 159 lib3270_trace_data(
@@ -158,9 +164,13 @@ static size_t internal_curl_write_callback(void *contents, size_t size, size_t n @@ -158,9 +164,13 @@ static size_t internal_curl_write_callback(void *contents, size_t size, size_t n
158 ); 164 );
159 } 165 }
160 166
  167 + debug("%s",__FUNCTION__);
  168 +
161 memcpy(&(data->contents[data->length]),contents,realsize); 169 memcpy(&(data->contents[data->length]),contents,realsize);
162 data->length += realsize; 170 data->length += realsize;
163 171
  172 + debug("%s",__FUNCTION__);
  173 +
164 return realsize; 174 return realsize;
165 } 175 }
166 176
@@ -404,7 +414,6 @@ int lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message) @@ -404,7 +414,6 @@ int lib3270_get_X509_CRL(H3270 *hSession, SSL_ERROR_MESSAGE * message)
404 414
405 // Use CURL to download the CRL 415 // Use CURL to download the CRL
406 lib3270_autoptr(CURLDATA) crl_data = lib3270_malloc(sizeof(CURLDATA)); 416 lib3270_autoptr(CURLDATA) crl_data = lib3270_malloc(sizeof(CURLDATA));
407 -  
408 lib3270_autoptr(CURL) hCurl = curl_easy_init(); 417 lib3270_autoptr(CURL) hCurl = curl_easy_init();
409 418
410 memset(crl_data,0,sizeof(CURLDATA)); 419 memset(crl_data,0,sizeof(CURLDATA));
src/lib3270/testprogram/testprogram.c
@@ -64,14 +64,16 @@ int main(int argc, char *argv[]) @@ -64,14 +64,16 @@ int main(int argc, char *argv[])
64 64
65 } 65 }
66 66
67 -// printf("HOST URL: %s\HOST CRL: %s\n",lib3270_get_url(h),lib3270_get_crl_url(h)); 67 + printf("HOST URL: %s\HOST CRL: %s\n",lib3270_get_url(h),lib3270_get_crl_url(h));
68 68
69 -// if(lib3270_set_url(h,NULL))  
70 -// lib3270_set_url(h,"tn3270://fandezhi.efglobe.com"); 69 + if(lib3270_set_url(h,NULL))
  70 + lib3270_set_url(h,"tn3270://fandezhi.efglobe.com");
71 71
72 //lib3270_set_toggle(h,LIB3270_TOGGLE_DS_TRACE,1); 72 //lib3270_set_toggle(h,LIB3270_TOGGLE_DS_TRACE,1);
73 lib3270_set_toggle(h,LIB3270_TOGGLE_SSL_TRACE,1); 73 lib3270_set_toggle(h,LIB3270_TOGGLE_SSL_TRACE,1);
74 74
  75 + printf("\nConnecting to %s\n",lib3270_get_url(h));
  76 +
75 rc = lib3270_reconnect(h,120); 77 rc = lib3270_reconnect(h,120);
76 printf("\nConnect exits with rc=%d\n",rc); 78 printf("\nConnect exits with rc=%d\n",rc);
77 79