summaryrefslogtreecommitdiff
path: root/imap/src/osdep
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2020-01-18 17:46:14 -0700
committerEduardo Chappa <chappa@washington.edu>2020-01-18 17:46:14 -0700
commit16b49fa63ad28aab44cde5096a706e6cc7520b1f (patch)
tree7ba6d75f6d8d2a3d52252d1732f52a39b670db92 /imap/src/osdep
parente328ab4a9dd90b53a4ae71cd97b699b1dd13e9a2 (diff)
downloadalpine-16b49fa63ad28aab44cde5096a706e6cc7520b1f.tar.xz
* Adding pith_ssl_encryption function to linkage.h.
Diffstat (limited to 'imap/src/osdep')
-rw-r--r--imap/src/osdep/nt/proc.c2
-rw-r--r--imap/src/osdep/nt/ssl_libressl.c10
-rw-r--r--imap/src/osdep/nt/ssl_win.c7
-rw-r--r--imap/src/osdep/unix/Makefile1
-rw-r--r--imap/src/osdep/unix/ssl_unix.c8
5 files changed, 17 insertions, 11 deletions
diff --git a/imap/src/osdep/nt/proc.c b/imap/src/osdep/nt/proc.c
index 8fc3c4ee..0c137122 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 a70a4ab8..81f3f0df 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 0e77ee3c..5b8606a1 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 7b1bff38..a30e8d51 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 020cfd77..93fb1a9a 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;
}