diff options
author | Eduardo Chappa <chappa@washington.edu> | 2019-05-04 12:41:11 -0600 |
---|---|---|
committer | Eduardo Chappa <chappa@washington.edu> | 2019-05-04 12:41:11 -0600 |
commit | c024a78dbaa9b42db7f18b0fea1894c41e2b0d67 (patch) | |
tree | 441e7308e4577ac8766c44edda682704aa432262 /imap/src/osdep/unix | |
parent | 19cde66486e27063a9af8cfd79c6eb7f106b9111 (diff) | |
download | alpine-c024a78dbaa9b42db7f18b0fea1894c41e2b0d67.tar.xz |
* Initial release of XOAUTH2 authentication support in Alpine for
Gmail.
Diffstat (limited to 'imap/src/osdep/unix')
-rw-r--r-- | imap/src/osdep/unix/Makefile | 12 | ||||
-rw-r--r-- | imap/src/osdep/unix/ssl_unix.c | 26 | ||||
-rw-r--r-- | imap/src/osdep/unix/tcp_unix.c | 22 |
3 files changed, 53 insertions, 7 deletions
diff --git a/imap/src/osdep/unix/Makefile b/imap/src/osdep/unix/Makefile index 8d740bb4..a94040c8 100644 --- a/imap/src/osdep/unix/Makefile +++ b/imap/src/osdep/unix/Makefile @@ -140,7 +140,7 @@ RANLIB=ranlib # Standard distribution build parameters -DEFAULTAUTHENTICATORS=ext md5 pla log +DEFAULTAUTHENTICATORS=ext md5 pla oa2 log # # mh needs to be after any other directory format drivers (such as mx or mix) # since otherwise mh will seize any directory that is under the mh path. @@ -155,7 +155,7 @@ CHUNKSIZE=65536 ARCHIVE=c-client.a BINARIES=osdep.o mail.o misc.o newsrc.o smanager.o utf8.o utf8aux.o siglocal.o \ dummy.o pseudo.o netmsg.o flstring.o fdstring.o \ - rfc822.o nntp.o smtp.o imap4r1.o pop3.o \ + rfc822.o nntp.o smtp.o imap4r1.o http.o json.o pop3.o \ unix.o mbx.o mmdf.o tenex.o mtx.o news.o phile.o mh.o mx.o mix.o CFLAGS=-g @@ -889,7 +889,7 @@ dummy.o: mail.h misc.h osdep.h dummy.h fdstring.o: mail.h misc.h osdep.h fdstring.h flstring.o: mail.h misc.h osdep.h flstring.h imap4r1.o: mail.h misc.h osdep.h imap4r1.h rfc822.h -mail.o: mail.h misc.h osdep.h rfc822.h linkage.h +mail.o: mail.h misc.h osdep.h rfc822.h linkage.h json.h mbx.o: mail.h misc.h osdep.h dummy.h mh.o: mail.h misc.h osdep.h dummy.h mix.o: mail.h misc.h osdep.h dummy.h @@ -911,7 +911,8 @@ tenex.o: mail.h misc.h osdep.h dummy.h unix.o: mail.h misc.h osdep.h unix.h pseudo.h dummy.h utf8.o: mail.h misc.h osdep.h utf8.h tmap.c widths.c utf8aux.o: mail.h misc.h osdep.h utf8.h - +json.o: mail.h misc.h osdep.h utf8.h json.h +http.o: mail.h misc.h osdep.h utf8.h http.h json.h # OS-dependent @@ -922,7 +923,8 @@ osdep.o:mail.h misc.h env.h fs.h ftl.h nl.h tcp.h \ gethstid.c getspnam.c \ gr_wait.c gr_wait4.c gr_waitp.c \ kerb_mit.c \ - auth_ext.c auth_gss.c auth_log.c auth_md5.c auth_ntl.c auth_pla.c \ + auth_ext.c auth_gss.c auth_log.c auth_md5.c auth_ntl.c \ + auth_oa2.c auth_pla.c \ pmatch.c scandir.c setpgrp.c strerror.c truncate.c write.c \ memmove.c memmove2.c memset.c \ tz_bsd.c tz_nul.c tz_sv4.c \ diff --git a/imap/src/osdep/unix/ssl_unix.c b/imap/src/osdep/unix/ssl_unix.c index 53c5d05a..21bf55ee 100644 --- a/imap/src/osdep/unix/ssl_unix.c +++ b/imap/src/osdep/unix/ssl_unix.c @@ -107,7 +107,8 @@ static struct ssl_driver ssldriver = { ssl_host, /* return host name */ ssl_remotehost, /* return remote host name */ ssl_port, /* return port number */ - ssl_localhost /* return local host name */ + ssl_localhost, /* return local host name */ + ssl_getsize /* return needed number of bytes */ }; /* non-NIL if doing SSL primary I/O */ static SSLSTDIOSTREAM *sslstdio = NIL; @@ -546,7 +547,28 @@ char *ssl_getline (SSLSTREAM *stream) } return ret; } - + +char *ssl_getsize (SSLSTREAM *stream, unsigned long size) +{ + char *ret = NIL; + unsigned long got = 0L, need = size, n; + int done = 0; + + while(!done){ + if(!ssl_getdata (stream)) return ret; /* return what we have */ + n = stream->ictr < need ? stream->ictr : need; + fs_resize((void **) &ret, got + n + 1); + memcpy(ret + got, stream->iptr, n); + ret[got+n] = '\0'; + got += n; + need -= n; + stream->iptr += n; + stream->ictr -= n; + if(need == 0L) done++; + } + + return ret; +} /* SSL receive line or partial line * Accepts: SSL stream * pointer to return size diff --git a/imap/src/osdep/unix/tcp_unix.c b/imap/src/osdep/unix/tcp_unix.c index b076ce44..73791f60 100644 --- a/imap/src/osdep/unix/tcp_unix.c +++ b/imap/src/osdep/unix/tcp_unix.c @@ -1063,6 +1063,28 @@ long tcp_isclienthost (char *host) return ret; } +char *tcp_getsize (TCPSTREAM *stream, unsigned long size) +{ + char *ret = NIL; + unsigned long got = 0L, need = size, n; + int done = 0; + + while(!done){ + if(!tcp_getdata (stream)) return ret; /* return what we have */ + n = stream->ictr < need ? stream->ictr : need; + fs_resize((void **) &ret, got + n + 1); + memcpy(ret + got, stream->iptr, n); + ret[got+n] = '\0'; + got += n; + need -= n; + stream->iptr += n; + stream->ictr -= n; + if(need == 0L) done++; + } + + return ret; +} + /* Following statement must be at end of this module */ #undef fork /* undo any use of vfork() */ |