upas/fs: tls sni support for pop3/imap
This commit is contained in:
parent
cb1dc365c2
commit
3d052eb2ea
4 changed files with 6 additions and 5 deletions
|
@ -216,7 +216,7 @@ char* delmessages(int, char**);
|
||||||
char *flagmessages(int, char**);
|
char *flagmessages(int, char**);
|
||||||
void digestmessage(Mailbox*, Message*);
|
void digestmessage(Mailbox*, Message*);
|
||||||
|
|
||||||
int wraptls(int);
|
int wraptls(int, char*);
|
||||||
|
|
||||||
void eprint(char*, ...);
|
void eprint(char*, ...);
|
||||||
void iprint(char *, ...);
|
void iprint(char *, ...);
|
||||||
|
|
|
@ -802,7 +802,7 @@ imap4dial(Imap *imap)
|
||||||
port = "imap";
|
port = "imap";
|
||||||
if((imap->fd = dial(netmkaddr(imap->host, "net", port), 0, 0, 0)) < 0)
|
if((imap->fd = dial(netmkaddr(imap->host, "net", port), 0, 0, 0)) < 0)
|
||||||
return imaperrstr(imap->host, port);
|
return imaperrstr(imap->host, port);
|
||||||
if(imap->flags & Fssl && (imap->fd = wraptls(imap->fd)) < 0){
|
if(imap->flags & Fssl && (imap->fd = wraptls(imap->fd, imap->host)) < 0){
|
||||||
err = imaperrstr(imap->host, port);
|
err = imaperrstr(imap->host, port);
|
||||||
imap4disconnect(imap);
|
imap4disconnect(imap);
|
||||||
return err;
|
return err;
|
||||||
|
|
|
@ -151,7 +151,7 @@ pop3capa(Pop *pop)
|
||||||
return s;
|
return s;
|
||||||
Bterm(&pop->bin);
|
Bterm(&pop->bin);
|
||||||
Bterm(&pop->bout);
|
Bterm(&pop->bout);
|
||||||
if((pop->fd = wraptls(pop->fd)) < 0)
|
if((pop->fd = wraptls(pop->fd, pop->host)) < 0)
|
||||||
return geterrstr();
|
return geterrstr();
|
||||||
pop->encrypted = 1;
|
pop->encrypted = 1;
|
||||||
Binit(&pop->bin, pop->fd, OREAD);
|
Binit(&pop->bin, pop->fd, OREAD);
|
||||||
|
@ -237,7 +237,7 @@ pop3dial(Pop *pop)
|
||||||
|
|
||||||
if((pop->fd = dial(netmkaddr(pop->host, "net", pop->needssl ? "pop3s" : "pop3"), 0, 0, 0)) < 0)
|
if((pop->fd = dial(netmkaddr(pop->host, "net", pop->needssl ? "pop3s" : "pop3"), 0, 0, 0)) < 0)
|
||||||
return geterrstr();
|
return geterrstr();
|
||||||
if(pop->needssl && (pop->fd = wraptls(pop->fd)) < 0)
|
if(pop->needssl && (pop->fd = wraptls(pop->fd, pop->host)) < 0)
|
||||||
return geterrstr();
|
return geterrstr();
|
||||||
pop->encrypted = pop->needssl;
|
pop->encrypted = pop->needssl;
|
||||||
Binit(&pop->bin, pop->fd, OREAD);
|
Binit(&pop->bin, pop->fd, OREAD);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "dat.h"
|
#include "dat.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
wraptls(int ofd)
|
wraptls(int ofd, char *host)
|
||||||
{
|
{
|
||||||
uchar digest[SHA1dlen];
|
uchar digest[SHA1dlen];
|
||||||
Thumbprint *thumb;
|
Thumbprint *thumb;
|
||||||
|
@ -12,6 +12,7 @@ wraptls(int ofd)
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
memset(&conn, 0, sizeof conn);
|
memset(&conn, 0, sizeof conn);
|
||||||
|
conn.serverName = host;
|
||||||
fd = tlsClient(ofd, &conn);
|
fd = tlsClient(ofd, &conn);
|
||||||
if(fd < 0){
|
if(fd < 0){
|
||||||
close(ofd);
|
close(ofd);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue