From 16b49fa63ad28aab44cde5096a706e6cc7520b1f Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Sat, 18 Jan 2020 17:46:14 -0700 Subject: * Adding pith_ssl_encryption function to linkage.h. --- imap/src/osdep/nt/proc.c | 2 ++ imap/src/osdep/nt/ssl_libressl.c | 10 ++++------ imap/src/osdep/nt/ssl_win.c | 7 +++++++ imap/src/osdep/unix/Makefile | 1 + imap/src/osdep/unix/ssl_unix.c | 8 +++----- pith/pine.hlp | 2 +- 6 files changed, 18 insertions(+), 12 deletions(-) diff --git a/imap/src/osdep/nt/proc.c b/imap/src/osdep/nt/proc.c index 8fc3c4e..0c13712 100644 --- a/imap/src/osdep/nt/proc.c +++ b/imap/src/osdep/nt/proc.c @@ -64,6 +64,8 @@ main(int argc, char *argv[]) else if(!strcmp(opt, "sslinit")){ fpc = fopen("linkage.c", "a"); fprintf(fpc, "%s\n", "ssl_onceonlyinit();"); + fph = fopen("linkage.h", "a"); + fprintf(fph, "%s\n", "int pith_ssl_encryption_version(char *);"); } else if(!strcmp(opt, "version")){ fpc = fopen("linkage.c", "a"); diff --git a/imap/src/osdep/nt/ssl_libressl.c b/imap/src/osdep/nt/ssl_libressl.c index a70a4ab..81f3f0d 100644 --- a/imap/src/osdep/nt/ssl_libressl.c +++ b/imap/src/osdep/nt/ssl_libressl.c @@ -100,7 +100,7 @@ int pith_ssl_encryption_version(char *s) { SSL_VERSIONS_S ssl_versions[] = { - { "no_min", 0 }, + { "no_min", 0 }, { "ssl3", SSL3_VERSION }, { "tls1", TLS1_VERSION }, { "tls1_1", TLS1_1_VERSION }, @@ -890,20 +890,18 @@ char *ssl_getsize (SSLSTREAM *stream, unsigned long size) { char *ret = NIL; unsigned long got = 0L, need = size, n; - int done = 0; - while(!done){ + do { if(!ssl_getdata (stream)) return ret; /* return what we have */ n = stream->ictr < need ? stream->ictr : need; - fs_resize((void **) &ret, got + n + 1); + fs_resize((void **) &ret, (got + n + 1)*sizeof(char)); memcpy(ret + got, stream->iptr, n); ret[got+n] = '\0'; got += n; need -= n; stream->iptr += n; stream->ictr -= n; - if(need == 0L) done++; - } + } while (need > 0); return ret; } diff --git a/imap/src/osdep/nt/ssl_win.c b/imap/src/osdep/nt/ssl_win.c index 0e77ee3..5b8606a 100644 --- a/imap/src/osdep/nt/ssl_win.c +++ b/imap/src/osdep/nt/ssl_win.c @@ -497,6 +497,13 @@ static char *ssl_getline_work (SSLSTREAM *stream,unsigned long *size, return ret; } +/* not implemented yet */ +int pith_ssl_encryption_version(char *s) +{ +return 0; +} + + char *ssl_getsize(SSLSTREAM* stream, unsigned long size) { char *ret = NIL; diff --git a/imap/src/osdep/unix/Makefile b/imap/src/osdep/unix/Makefile index 7b1bff3..a30e8d5 100644 --- a/imap/src/osdep/unix/Makefile +++ b/imap/src/osdep/unix/Makefile @@ -1003,6 +1003,7 @@ onceenv: ./drivers $(EXTRADRIVERS) $(DEFAULTDRIVERS) dummy ./mkauths $(EXTRAAUTHENTICATORS) $(DEFAULTAUTHENTICATORS) echo " mail_versioncheck (CCLIENTVERSION);" >> linkage.c + sh -c '(test $(SSLTYPE) != none) && echo "int pith_ssl_encryption_version(char *);" >> linkage.h || true' $(LN) os_$(OS).h osdep.h $(LN) os_$(OS).c osdepbas.c $(LN) log_$(LOGINPW).c osdeplog.c diff --git a/imap/src/osdep/unix/ssl_unix.c b/imap/src/osdep/unix/ssl_unix.c index 020cfd7..93fb1a9 100644 --- a/imap/src/osdep/unix/ssl_unix.c +++ b/imap/src/osdep/unix/ssl_unix.c @@ -636,20 +636,18 @@ char *ssl_getsize (SSLSTREAM *stream, unsigned long size) { char *ret = NIL; unsigned long got = 0L, need = size, n; - int done = 0; - while(!done){ + do { if(!ssl_getdata (stream)) return ret; /* return what we have */ n = stream->ictr < need ? stream->ictr : need; - fs_resize((void **) &ret, got + n + 1); + fs_resize((void **) &ret, (got + n + 1)*sizeof(char)); memcpy(ret + got, stream->iptr, n); ret[got+n] = '\0'; got += n; need -= n; stream->iptr += n; stream->ictr -= n; - if(need == 0L) done++; - } + } while (need > 0); return ret; } diff --git a/pith/pine.hlp b/pith/pine.hlp index 8618aea..1256704 100644 --- a/pith/pine.hlp +++ b/pith/pine.hlp @@ -140,7 +140,7 @@ with help text for the config screen and the composer that didn't have any reasonable place to be called from. Dummy change to get revision in pine.hlp ============= h_revision ================= -Alpine Commit 392 2020-01-18 13:08:29 +Alpine Commit 393 2020-01-18 17:46:09 ============= h_news ================= -- cgit v1.2.3-54-g00ecf