Commit ded9d88dc0d6a1b6f80a72f55642d35963db9446
1 parent
7fe37ca6
Exists in
master
and in
3 other branches
Fixing small bugs in the API.
Showing
3 changed files
with
20 additions
and
4 deletions
Show diff stats
src/selection/selection.c
@@ -288,7 +288,7 @@ LIB3270_EXPORT char * lib3270_get_string_at_address(H3270 *h, int offset, int le | @@ -288,7 +288,7 @@ LIB3270_EXPORT char * lib3270_get_string_at_address(H3270 *h, int offset, int le | ||
288 | return NULL; | 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 | if(maxlen <= 0 || offset < 0) | 292 | if(maxlen <= 0 || offset < 0) |
293 | { | 293 | { |
294 | errno = EINVAL; | 294 | errno = EINVAL; |
@@ -301,7 +301,9 @@ LIB3270_EXPORT char * lib3270_get_string_at_address(H3270 *h, int offset, int le | @@ -301,7 +301,9 @@ LIB3270_EXPORT char * lib3270_get_string_at_address(H3270 *h, int offset, int le | ||
301 | buffer = lib3270_malloc(len+1); | 301 | buffer = lib3270_malloc(len+1); |
302 | ptr = buffer; | 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 | while(len > 0) | 308 | while(len > 0) |
307 | { | 309 | { |
src/ssl/linux/ldap.c
@@ -34,9 +34,18 @@ | @@ -34,9 +34,18 @@ | ||
34 | */ | 34 | */ |
35 | 35 | ||
36 | #include <config.h> | 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 | #if defined(HAVE_LIBSSL) && defined(SSL_ENABLE_CRL_CHECK) && defined(HAVE_LDAP) | 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 | #define LDAP_DEPRECATED 1 | 49 | #define LDAP_DEPRECATED 1 |
41 | #include <ldap.h> | 50 | #include <ldap.h> |
42 | 51 | ||
@@ -124,7 +133,7 @@ LIB3270_INTERNAL X509_CRL * get_crl_using_ldap(H3270 *hSession, SSL_ERROR_MESSAG | @@ -124,7 +133,7 @@ LIB3270_INTERNAL X509_CRL * get_crl_using_ldap(H3270 *hSession, SSL_ERROR_MESSAG | ||
124 | message->text = _( "Can't initialize LDAP" ); | 133 | message->text = _( "Can't initialize LDAP" ); |
125 | message->description = ldap_err2string(rc); | 134 | message->description = ldap_err2string(rc); |
126 | lib3270_write_log(hSession,"ssl","%s: %s",url, message->description); | 135 | lib3270_write_log(hSession,"ssl","%s: %s",url, message->description); |
127 | - return -1; | 136 | + return NULL; |
128 | } | 137 | } |
129 | 138 | ||
130 | unsigned long version = LDAP_VERSION3; | 139 | unsigned long version = LDAP_VERSION3; |
@@ -146,7 +155,7 @@ LIB3270_INTERNAL X509_CRL * get_crl_using_ldap(H3270 *hSession, SSL_ERROR_MESSAG | @@ -146,7 +155,7 @@ LIB3270_INTERNAL X509_CRL * get_crl_using_ldap(H3270 *hSession, SSL_ERROR_MESSAG | ||
146 | message->text = _( "Can't bind to LDAP server" ); | 155 | message->text = _( "Can't bind to LDAP server" ); |
147 | message->description = ldap_err2string(rc); | 156 | message->description = ldap_err2string(rc); |
148 | lib3270_write_log(hSession,"ssl","%s: %s",url, message->description); | 157 | lib3270_write_log(hSession,"ssl","%s: %s",url, message->description); |
149 | - return -1; | 158 | + return NULL; |
150 | } | 159 | } |
151 | 160 | ||
152 | lib3270_autoptr(LDAPMessage) results = NULL; | 161 | lib3270_autoptr(LDAPMessage) results = NULL; |
src/testprogram/testprogram.c
@@ -89,6 +89,11 @@ int main(int argc, char *argv[]) | @@ -89,6 +89,11 @@ int main(int argc, char *argv[]) | ||
89 | if(!rc) | 89 | if(!rc) |
90 | { | 90 | { |
91 | lib3270_wait_for_ready(h,10); | 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 | lib3270_enter(h); | 97 | lib3270_enter(h); |
93 | lib3270_wait_for_ready(h,10); | 98 | lib3270_wait_for_ready(h,10); |
94 | } | 99 | } |