Commit ded9d88dc0d6a1b6f80a72f55642d35963db9446

Authored by Perry Werneck
1 parent 7fe37ca6

Fixing small bugs in the API.

src/selection/selection.c
... ... @@ -288,7 +288,7 @@ LIB3270_EXPORT char * lib3270_get_string_at_address(H3270 *h, int offset, int le
288 288 return NULL;
289 289 }
290 290  
291   - maxlen = (h->rows * (h->cols+1)) - offset;
  291 + maxlen = (h->rows * (h->cols+ (lf ? 1 : 0) )) - offset;
292 292 if(maxlen <= 0 || offset < 0)
293 293 {
294 294 errno = EINVAL;
... ... @@ -301,7 +301,9 @@ LIB3270_EXPORT char * lib3270_get_string_at_address(H3270 *h, int offset, int le
301 301 buffer = lib3270_malloc(len+1);
302 302 ptr = buffer;
303 303  
304   -// trace("len=%d buffer=%p",len,buffer);
  304 + memset(buffer,0,len+1);
  305 +
  306 + trace("len=%d buffer=%p",len,buffer);
305 307  
306 308 while(len > 0)
307 309 {
... ...
src/ssl/linux/ldap.c
... ... @@ -34,9 +34,18 @@
34 34 */
35 35  
36 36 #include <config.h>
  37 +#include <lib3270-internals.h>
  38 +#include <lib3270/log.h>
  39 +#include <lib3270/trace.h>
  40 +#include <lib3270/toggle.h>
37 41  
38 42 #if defined(HAVE_LIBSSL) && defined(SSL_ENABLE_CRL_CHECK) && defined(HAVE_LDAP)
39 43  
  44 +#include <openssl/ssl.h>
  45 +#include <openssl/err.h>
  46 +#include <openssl/x509_vfy.h>
  47 +#include <openssl/x509.h>
  48 +
40 49 #define LDAP_DEPRECATED 1
41 50 #include <ldap.h>
42 51  
... ... @@ -124,7 +133,7 @@ LIB3270_INTERNAL X509_CRL * get_crl_using_ldap(H3270 *hSession, SSL_ERROR_MESSAG
124 133 message->text = _( "Can't initialize LDAP" );
125 134 message->description = ldap_err2string(rc);
126 135 lib3270_write_log(hSession,"ssl","%s: %s",url, message->description);
127   - return -1;
  136 + return NULL;
128 137 }
129 138  
130 139 unsigned long version = LDAP_VERSION3;
... ... @@ -146,7 +155,7 @@ LIB3270_INTERNAL X509_CRL * get_crl_using_ldap(H3270 *hSession, SSL_ERROR_MESSAG
146 155 message->text = _( "Can't bind to LDAP server" );
147 156 message->description = ldap_err2string(rc);
148 157 lib3270_write_log(hSession,"ssl","%s: %s",url, message->description);
149   - return -1;
  158 + return NULL;
150 159 }
151 160  
152 161 lib3270_autoptr(LDAPMessage) results = NULL;
... ...
src/testprogram/testprogram.c
... ... @@ -89,6 +89,11 @@ int main(int argc, char *argv[])
89 89 if(!rc)
90 90 {
91 91 lib3270_wait_for_ready(h,10);
  92 +
  93 + lib3270_autoptr(char) text = lib3270_get_string_at_address(h,0,-1,0);
  94 + if(text)
  95 + printf("Screen:\n[%s]\n",text);
  96 +
92 97 lib3270_enter(h);
93 98 lib3270_wait_for_ready(h,10);
94 99 }
... ...